package jetbrains.mps.build.editor; /*Generated by MPS */ import jetbrains.mps.editor.runtime.descriptor.AbstractEditorBuilder; import org.jetbrains.annotations.NotNull; import org.jetbrains.mps.openapi.model.SNode; import jetbrains.mps.openapi.editor.EditorContext; import jetbrains.mps.openapi.editor.cells.EditorCell; import jetbrains.mps.editor.runtime.cells.BigCellUtil; import jetbrains.mps.build.behavior.BuildTextStringPart__BehaviorDescriptor; import jetbrains.mps.build.behavior.BuildStringContainer__BehaviorDescriptor; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SNodeOperations; import jetbrains.mps.build.behavior.BuildStringPart__BehaviorDescriptor; import jetbrains.mps.nodeEditor.cellProviders.CellProviderWithRole; import jetbrains.mps.lang.editor.cellProviders.PropertyCellProvider; import jetbrains.mps.openapi.editor.style.Style; import jetbrains.mps.editor.runtime.style.StyleImpl; import jetbrains.mps.build.editor.buildStyles_StyleSheet.stringStyleClass; import jetbrains.mps.editor.runtime.style.StyleAttributes; import jetbrains.mps.openapi.editor.style.StyleRegistry; import jetbrains.mps.nodeEditor.EditorManager; import java.awt.Color; /*package*/ class BuildTextStringPart_EditorBuilder_a extends AbstractEditorBuilder { @NotNull private SNode myNode; public BuildTextStringPart_EditorBuilder_a(@NotNull EditorContext context, @NotNull SNode node) { super(context); myNode = node; } @NotNull @Override public SNode getNode() { return myNode; } /*package*/ EditorCell createCell() { return createAlternation_zen9g6_a(); } private EditorCell createAlternation_zen9g6_a() { boolean alternationCondition = true; alternationCondition = nodeCondition_zen9g6_a0(); EditorCell editorCell = null; if (alternationCondition) { editorCell = createAlternation_zen9g6_a0(); } else { editorCell = createAlternation_zen9g6_a0_0(); } EditorCell bigCell = BigCellUtil.findBigCell(editorCell, getNode()); if (bigCell != null) { bigCell.setBig(true); bigCell.setCellContext(getCellFactory().getCellContext()); } return editorCell; } private boolean nodeCondition_zen9g6_a0() { return (BuildTextStringPart__BehaviorDescriptor.getContainer_id5hFYqIiYHaE.invoke(myNode) != null) && BuildStringContainer__BehaviorDescriptor.getColorForTextPart_id5hFYqIiXWl$.invoke(BuildTextStringPart__BehaviorDescriptor.getContainer_id5hFYqIiYHaE.invoke(myNode), SNodeOperations.getParent(myNode).getContainmentLink()) != null; } private EditorCell createAlternation_zen9g6_a0() { boolean alternationCondition = true; alternationCondition = nodeCondition_zen9g6_a0a(); EditorCell editorCell = null; if (alternationCondition) { editorCell = createProperty_zen9g6_a0a(); } else { editorCell = createProperty_zen9g6_a0a_0(); } return editorCell; } private boolean nodeCondition_zen9g6_a0a() { return (boolean) BuildStringPart__BehaviorDescriptor.punctuationLeft_id4qU2HB9e$4N.invoke(myNode); } private EditorCell createProperty_zen9g6_a0a() { CellProviderWithRole provider = new PropertyCellProvider(myNode, getEditorContext()); provider.setRole("text"); provider.setNoTargetText("<no text>"); EditorCell editorCell; editorCell = provider.createEditorCell(getEditorContext()); editorCell.setCellId("property_text"); Style style = new StyleImpl(); new stringStyleClass(getEditorContext(), getNode()).apply(style, editorCell); style.set(StyleAttributes.PUNCTUATION_LEFT, true); style.set(StyleAttributes.TEXT_COLOR, StyleRegistry.getInstance().getSimpleColor(_StyleParameter_QueryFunction_zen9g6_a1a0a())); editorCell.getStyle().putAll(style); editorCell.addKeyMap(new BuildSimpleName_text()); editorCell.setSubstituteInfo(provider.createDefaultSubstituteInfo()); SNode attributeConcept = provider.getRoleAttribute(); if (attributeConcept != null) { EditorManager manager = EditorManager.getInstanceFromContext(getEditorContext()); return manager.createNodeRoleAttributeCell(attributeConcept, provider.getRoleAttributeKind(), editorCell); } else return editorCell; } private Color _StyleParameter_QueryFunction_zen9g6_a1a0a() { SNode container = BuildTextStringPart__BehaviorDescriptor.getContainer_id5hFYqIiYHaE.invoke(getNode()); if ((container != null)) { Color colorForTextPart = BuildStringContainer__BehaviorDescriptor.getColorForTextPart_id5hFYqIiXWl$.invoke(container, SNodeOperations.getParent(getNode()).getContainmentLink()); if (colorForTextPart != null) { return colorForTextPart; } } return null; } private EditorCell createProperty_zen9g6_a0a_0() { CellProviderWithRole provider = new PropertyCellProvider(myNode, getEditorContext()); provider.setRole("text"); provider.setNoTargetText("<no text>"); EditorCell editorCell; editorCell = provider.createEditorCell(getEditorContext()); editorCell.setCellId("property_text_1"); Style style = new StyleImpl(); new stringStyleClass(getEditorContext(), getNode()).apply(style, editorCell); style.set(StyleAttributes.TEXT_COLOR, StyleRegistry.getInstance().getSimpleColor(_StyleParameter_QueryFunction_zen9g6_a0a0a())); editorCell.getStyle().putAll(style); editorCell.addKeyMap(new BuildSimpleName_text()); editorCell.setSubstituteInfo(provider.createDefaultSubstituteInfo()); SNode attributeConcept = provider.getRoleAttribute(); if (attributeConcept != null) { EditorManager manager = EditorManager.getInstanceFromContext(getEditorContext()); return manager.createNodeRoleAttributeCell(attributeConcept, provider.getRoleAttributeKind(), editorCell); } else return editorCell; } private Color _StyleParameter_QueryFunction_zen9g6_a0a0a() { SNode container = BuildTextStringPart__BehaviorDescriptor.getContainer_id5hFYqIiYHaE.invoke(getNode()); if ((container != null)) { Color colorForTextPart = BuildStringContainer__BehaviorDescriptor.getColorForTextPart_id5hFYqIiXWl$.invoke(container, SNodeOperations.getParent(getNode()).getContainmentLink()); if (colorForTextPart != null) { return colorForTextPart; } } return null; } private EditorCell createAlternation_zen9g6_a0_0() { boolean alternationCondition = true; alternationCondition = nodeCondition_zen9g6_a0a_0(); EditorCell editorCell = null; if (alternationCondition) { editorCell = createProperty_zen9g6_a0a_1(); } else { editorCell = createProperty_zen9g6_a0a_2(); } return editorCell; } private boolean nodeCondition_zen9g6_a0a_0() { return (boolean) BuildStringPart__BehaviorDescriptor.punctuationLeft_id4qU2HB9e$4N.invoke(myNode); } private EditorCell createProperty_zen9g6_a0a_1() { CellProviderWithRole provider = new PropertyCellProvider(myNode, getEditorContext()); provider.setRole("text"); provider.setNoTargetText("<no text>"); EditorCell editorCell; editorCell = provider.createEditorCell(getEditorContext()); editorCell.setCellId("property_text_2"); Style style = new StyleImpl(); new stringStyleClass(getEditorContext(), getNode()).apply(style, editorCell); style.set(StyleAttributes.PUNCTUATION_LEFT, true); editorCell.getStyle().putAll(style); editorCell.addKeyMap(new BuildSimpleName_text()); editorCell.setSubstituteInfo(provider.createDefaultSubstituteInfo()); SNode attributeConcept = provider.getRoleAttribute(); if (attributeConcept != null) { EditorManager manager = EditorManager.getInstanceFromContext(getEditorContext()); return manager.createNodeRoleAttributeCell(attributeConcept, provider.getRoleAttributeKind(), editorCell); } else return editorCell; } private EditorCell createProperty_zen9g6_a0a_2() { CellProviderWithRole provider = new PropertyCellProvider(myNode, getEditorContext()); provider.setRole("text"); provider.setNoTargetText("<no text>"); EditorCell editorCell; editorCell = provider.createEditorCell(getEditorContext()); editorCell.setCellId("property_text_3"); Style style = new StyleImpl(); new stringStyleClass(getEditorContext(), getNode()).apply(style, editorCell); editorCell.getStyle().putAll(style); editorCell.addKeyMap(new BuildSimpleName_text()); editorCell.setSubstituteInfo(provider.createDefaultSubstituteInfo()); SNode attributeConcept = provider.getRoleAttribute(); if (attributeConcept != null) { EditorManager manager = EditorManager.getInstanceFromContext(getEditorContext()); return manager.createNodeRoleAttributeCell(attributeConcept, provider.getRoleAttributeKind(), editorCell); } else return editorCell; } }