package jetbrains.mps.lang.plugin.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.nodeEditor.cells.EditorCell_Collection; import jetbrains.mps.nodeEditor.cellLayout.CellLayout_Horizontal; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SPropertyOperations; import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory; import jetbrains.mps.nodeEditor.cells.EditorCell_Constant; import jetbrains.mps.openapi.editor.style.Style; import jetbrains.mps.editor.runtime.style.StyleImpl; import jetbrains.mps.baseLanguage.editor.BaseLanguageStyle_StyleSheet.LeftBraceStyleClass; import jetbrains.mps.editor.runtime.style.StyleAttributes; import jetbrains.mps.nodeEditor.cellProviders.CellProviderWithRole; import jetbrains.mps.lang.editor.cellProviders.PropertyCellProvider; import jetbrains.mps.openapi.editor.style.StyleRegistry; import jetbrains.mps.nodeEditor.MPSColors; import jetbrains.mps.nodeEditor.cellMenu.CompositeSubstituteInfo; import jetbrains.mps.nodeEditor.cellMenu.SubstituteInfoPartExt; import jetbrains.mps.nodeEditor.cellMenu.SChildSubstituteInfoPartEx; import jetbrains.mps.nodeEditor.EditorManager; import jetbrains.mps.lang.editor.generator.internal.AbstractCellMenuPart_PropertyValues; import java.util.List; import jetbrains.mps.smodel.IOperationContext; import jetbrains.mps.internal.collections.runtime.ListSequence; import java.util.ArrayList; import jetbrains.mps.nodeEditor.keymaps.AWTKeymapHandler; import jetbrains.mps.baseLanguage.editor.BaseLanguageStyle_StyleSheet.RightBraceStyleClass; import jetbrains.mps.nodeEditor.cells.EditorCell_ContextAssistantComponent; /*package*/ class KeyMapKeystroke_EditorBuilder_a extends AbstractEditorBuilder { @NotNull private SNode myNode; public KeyMapKeystroke_EditorBuilder_a(@NotNull EditorContext context, @NotNull SNode node) { super(context); myNode = node; } @NotNull @Override public SNode getNode() { return myNode; } /*package*/ EditorCell createCell() { return createCollection_paq7mh_a(); } private EditorCell createCollection_paq7mh_a() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Horizontal()); editorCell.setCellId("Collection_paq7mh_a"); editorCell.setBig(true); editorCell.setCellContext(getCellFactory().getCellContext()); editorCell.addEditorCell(createConstant_paq7mh_a0()); editorCell.addEditorCell(createProperty_paq7mh_b0()); editorCell.addEditorCell(createConstant_paq7mh_c0()); editorCell.addEditorCell(createConstant_paq7mh_d0()); editorCell.addEditorCell(createConstant_paq7mh_e0()); editorCell.addEditorCell(createProperty_paq7mh_f0()); editorCell.addEditorCell(createConstant_paq7mh_g0()); if (nodeCondition_paq7mh_a7a()) { editorCell.addEditorCell(createProperty_paq7mh_h0()); } editorCell.addEditorCell(createContextAssistant_paq7mh_i0()); return editorCell; } private boolean nodeCondition_paq7mh_a7a() { return isNotEmptyString(SPropertyOperations.getString_def(myNode, MetaAdapterFactory.getProperty(0x28f9e4973b424291L, 0xaeba0a1039153ab1L, 0x11919c665d4L, 0x5e2b603c8f03ab4dL, "change"), null)); } private EditorCell createConstant_paq7mh_a0() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "<"); editorCell.setCellId("Constant_paq7mh_a0"); Style style = new StyleImpl(); new LeftBraceStyleClass(getEditorContext(), getNode()).apply(style, editorCell); style.set(StyleAttributes.PUNCTUATION_RIGHT, true); style.set(StyleAttributes.SELECTABLE, false); style.set(StyleAttributes.MATCHING_LABEL, "mod"); editorCell.getStyle().putAll(style); editorCell.setDefaultText(""); return editorCell; } private EditorCell createProperty_paq7mh_b0() { CellProviderWithRole provider = new PropertyCellProvider(myNode, getEditorContext()); provider.setRole("modifiers"); provider.setNoTargetText("any"); provider.setAllowsEmptyTarget(true); EditorCell editorCell; editorCell = provider.createEditorCell(getEditorContext()); editorCell.setCellId("property_modifiers"); Style style = new StyleImpl(); style.set(StyleAttributes.TEXT_COLOR, StyleRegistry.getInstance().getSimpleColor(MPSColors.blue)); editorCell.getStyle().putAll(style); editorCell.setSubstituteInfo(new CompositeSubstituteInfo(getEditorContext(), provider.getCellContext(), new SubstituteInfoPartExt[]{new KeyMapKeystroke_EditorBuilder_a.KeyMapKeystroke_modifiers_cellMenu_paq7mh_a0b0(), new SChildSubstituteInfoPartEx(editorCell)})); SNode attributeConcept = provider.getRoleAttribute(); if (attributeConcept != null) { EditorManager manager = EditorManager.getInstanceFromContext(getEditorContext()); return manager.createNodeRoleAttributeCell(attributeConcept, provider.getRoleAttributeKind(), editorCell); } else return editorCell; } public static class KeyMapKeystroke_modifiers_cellMenu_paq7mh_a0b0 extends AbstractCellMenuPart_PropertyValues { public KeyMapKeystroke_modifiers_cellMenu_paq7mh_a0b0() { } public List<String> getPropertyValues(SNode node, IOperationContext operationContext, EditorContext editorContext) { List<String> result = ListSequence.fromList(new ArrayList<String>()); ListSequence.fromList(result).addSequence(ListSequence.fromList(AWTKeymapHandler.getValidModifiers())); return result; } } private EditorCell createConstant_paq7mh_c0() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, ">"); editorCell.setCellId("Constant_paq7mh_c0"); Style style = new StyleImpl(); new RightBraceStyleClass(getEditorContext(), getNode()).apply(style, editorCell); style.set(StyleAttributes.PUNCTUATION_LEFT, true); style.set(StyleAttributes.SELECTABLE, false); style.set(StyleAttributes.MATCHING_LABEL, "mod"); editorCell.getStyle().putAll(style); editorCell.setDefaultText(""); return editorCell; } private EditorCell createConstant_paq7mh_d0() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "+"); editorCell.setCellId("Constant_paq7mh_d0"); Style style = new StyleImpl(); style.set(StyleAttributes.SELECTABLE, false); style.set(StyleAttributes.PUNCTUATION_LEFT, true); style.set(StyleAttributes.PUNCTUATION_RIGHT, true); editorCell.getStyle().putAll(style); editorCell.setDefaultText(""); return editorCell; } private EditorCell createConstant_paq7mh_e0() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "<"); editorCell.setCellId("Constant_paq7mh_e0"); Style style = new StyleImpl(); new LeftBraceStyleClass(getEditorContext(), getNode()).apply(style, editorCell); style.set(StyleAttributes.PUNCTUATION_RIGHT, true); style.set(StyleAttributes.SELECTABLE, false); style.set(StyleAttributes.MATCHING_LABEL, "keycode"); editorCell.getStyle().putAll(style); editorCell.setDefaultText(""); return editorCell; } private EditorCell createProperty_paq7mh_f0() { CellProviderWithRole provider = new PropertyCellProvider(myNode, getEditorContext()); provider.setRole("keycode"); provider.setNoTargetText("<keycode>"); EditorCell editorCell; editorCell = provider.createEditorCell(getEditorContext()); editorCell.setCellId("keyCode"); Style style = new StyleImpl(); style.set(StyleAttributes.TEXT_COLOR, StyleRegistry.getInstance().getSimpleColor(MPSColors.blue)); editorCell.getStyle().putAll(style); editorCell.setSubstituteInfo(new CompositeSubstituteInfo(getEditorContext(), provider.getCellContext(), new SubstituteInfoPartExt[]{new KeyMapKeystroke_EditorBuilder_a.KeyMapKeystroke_keycode_cellMenu_paq7mh_a0f0(), new SChildSubstituteInfoPartEx(editorCell)})); SNode attributeConcept = provider.getRoleAttribute(); if (attributeConcept != null) { EditorManager manager = EditorManager.getInstanceFromContext(getEditorContext()); return manager.createNodeRoleAttributeCell(attributeConcept, provider.getRoleAttributeKind(), editorCell); } else return editorCell; } public static class KeyMapKeystroke_keycode_cellMenu_paq7mh_a0f0 extends AbstractCellMenuPart_PropertyValues { public KeyMapKeystroke_keycode_cellMenu_paq7mh_a0f0() { } public List<String> getPropertyValues(SNode node, IOperationContext operationContext, EditorContext editorContext) { List<String> result = ListSequence.fromList(new ArrayList<String>()); ListSequence.fromList(result).addSequence(ListSequence.fromList(AWTKeymapHandler.getValidKeyCodes())); return result; } } private EditorCell createConstant_paq7mh_g0() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, ">"); editorCell.setCellId("Constant_paq7mh_g0"); Style style = new StyleImpl(); new RightBraceStyleClass(getEditorContext(), getNode()).apply(style, editorCell); style.set(StyleAttributes.PUNCTUATION_LEFT, true); style.set(StyleAttributes.MATCHING_LABEL, "keycode"); editorCell.getStyle().putAll(style); editorCell.setDefaultText(""); return editorCell; } private EditorCell createProperty_paq7mh_h0() { CellProviderWithRole provider = new PropertyCellProvider(myNode, getEditorContext()); provider.setRole("change"); provider.setNoTargetText("<no change>"); EditorCell editorCell; editorCell = provider.createEditorCell(getEditorContext()); editorCell.setCellId("property_change"); KeyMapKeystroke_Change.setCellActions(editorCell, myNode, getEditorContext()); 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 createContextAssistant_paq7mh_i0() { EditorCell editorCell = new EditorCell_ContextAssistantComponent(getEditorContext(), myNode); editorCell.setCellId("ContextAssistant_paq7mh_i0"); Style style = new StyleImpl(); style.set(StyleAttributes.SELECTABLE, false); editorCell.getStyle().putAll(style); return editorCell; } private static boolean isNotEmptyString(String str) { return str != null && str.length() > 0; } }