package jetbrains.mps.debugger.java.customViewers.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_Vertical; import jetbrains.mps.nodeEditor.cellLayout.CellLayout_Horizontal; import jetbrains.mps.openapi.editor.style.Style; import jetbrains.mps.editor.runtime.style.StyleImpl; import jetbrains.mps.editor.runtime.style.StyleAttributes; import jetbrains.mps.nodeEditor.cells.EditorCell_Constant; import jetbrains.mps.nodeEditor.cellProviders.CellProviderWithRole; import jetbrains.mps.lang.editor.cellProviders.PropertyCellProvider; import jetbrains.mps.nodeEditor.EditorManager; import org.jetbrains.mps.openapi.module.SModule; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SNodeOperations; import jetbrains.mps.project.AbstractModule; import jetbrains.mps.util.MacrosFactory; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SPropertyOperations; import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory; import jetbrains.mps.vfs.FileSystem; import jetbrains.mps.baseLanguage.closures.runtime._FunctionTypes; import jetbrains.mps.nodeEditor.cells.EditorCell_Image; import jetbrains.mps.openapi.editor.style.StyleRegistry; import jetbrains.mps.nodeEditor.MPSColors; /*package*/ class CustomWatchable_EditorBuilder_a extends AbstractEditorBuilder { @NotNull private SNode myNode; public CustomWatchable_EditorBuilder_a(@NotNull EditorContext context, @NotNull SNode node) { super(context); myNode = node; } @NotNull @Override public SNode getNode() { return myNode; } /*package*/ EditorCell createCell() { return createCollection_rpujt6_a(); } private EditorCell createCollection_rpujt6_a() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Vertical()); editorCell.setCellId("Collection_rpujt6_a"); editorCell.setBig(true); editorCell.setCellContext(getCellFactory().getCellContext()); editorCell.addEditorCell(createCollection_rpujt6_a0()); editorCell.addEditorCell(createCollection_rpujt6_b0()); return editorCell; } private EditorCell createCollection_rpujt6_a0() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Horizontal()); editorCell.setCellId("Collection_rpujt6_a0"); Style style = new StyleImpl(); style.set(StyleAttributes.SELECTABLE, false); editorCell.getStyle().putAll(style); editorCell.addEditorCell(createConstant_rpujt6_a0a()); editorCell.addEditorCell(createProperty_rpujt6_b0a()); return editorCell; } private EditorCell createConstant_rpujt6_a0a() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "watchable"); editorCell.setCellId("Constant_rpujt6_a0a"); editorCell.setDefaultText(""); return editorCell; } private EditorCell createProperty_rpujt6_b0a() { CellProviderWithRole provider = new PropertyCellProvider(myNode, getEditorContext()); provider.setRole("name"); provider.setNoTargetText("<no name>"); EditorCell editorCell; editorCell = provider.createEditorCell(getEditorContext()); editorCell.setCellId("property_name"); 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 createCollection_rpujt6_b0() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Horizontal()); editorCell.setCellId("Collection_rpujt6_b0"); Style style = new StyleImpl(); style.set(StyleAttributes.SELECTABLE, false); editorCell.getStyle().putAll(style); editorCell.addEditorCell(createConstant_rpujt6_a1a()); editorCell.addEditorCell(createAlternation_rpujt6_b1a()); editorCell.addEditorCell(createConstant_rpujt6_c1a()); return editorCell; } private EditorCell createConstant_rpujt6_a1a() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "icon:"); editorCell.setCellId("Constant_rpujt6_a1a"); Style style = new StyleImpl(); style.set(StyleAttributes.SELECTABLE, false); editorCell.getStyle().putAll(style); editorCell.setDefaultText(""); return editorCell; } private EditorCell createAlternation_rpujt6_b1a() { boolean alternationCondition = true; alternationCondition = nodeCondition_rpujt6_a1b0(); EditorCell editorCell = null; if (alternationCondition) { editorCell = createCollection_rpujt6_a1b0(); } else { editorCell = createConstant_rpujt6_a1b0(); } return editorCell; } private boolean nodeCondition_rpujt6_a1b0() { String path = null; SModule module = SNodeOperations.getModel(myNode).getModule(); if (module instanceof AbstractModule) { path = MacrosFactory.forModule((AbstractModule) module).expandPath(SPropertyOperations.getString(myNode, MetaAdapterFactory.getProperty(0xfa8aeae94df94e13L, 0xbfb19b04c67ddb77L, 0x47047b7665563ef3L, 0x47047b76655643d4L, "iconPath"))); } return path != null && FileSystem.getInstance().getFileByPath(path).exists(); } private EditorCell createCollection_rpujt6_a1b0() { EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Horizontal()); editorCell.setCellId("Collection_rpujt6_a1b0"); Style style = new StyleImpl(); style.set(StyleAttributes.SELECTABLE, false); editorCell.getStyle().putAll(style); editorCell.addEditorCell(createImage_rpujt6_a0b1a()); editorCell.addEditorCell(createProperty_rpujt6_b0b1a()); return editorCell; } private EditorCell createImage_rpujt6_a0b1a() { SModule imageModule; String imagePath; imageModule = SNodeOperations.getModel(myNode).getModule(); imagePath = (new _FunctionTypes._return_P0_E0<String>() { public String invoke() { return SPropertyOperations.getString(myNode, MetaAdapterFactory.getProperty(0xfa8aeae94df94e13L, 0xbfb19b04c67ddb77L, 0x47047b7665563ef3L, 0x47047b76655643d4L, "iconPath")); } }).invoke(); EditorCell_Image editorCell = EditorCell_Image.createImageCell(getEditorContext(), myNode, imageModule, imagePath); editorCell.setCellId("Image_rpujt6_a0b1a"); editorCell.setDescent(0); return editorCell; } private EditorCell createProperty_rpujt6_b0b1a() { CellProviderWithRole provider = new PropertyCellProvider(myNode, getEditorContext()); provider.setRole("iconPath"); provider.setNoTargetText("<no iconPath>"); EditorCell editorCell; editorCell = provider.createEditorCell(getEditorContext()); editorCell.setCellId("property_iconPath"); 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 createConstant_rpujt6_a1b0() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "<no icon>"); editorCell.setCellId("Constant_rpujt6_a1b0"); Style style = new StyleImpl(); style.set(StyleAttributes.TEXT_COLOR, StyleRegistry.getInstance().getSimpleColor(MPSColors.lightGray)); editorCell.getStyle().putAll(style); editorCell.setDefaultText(""); return editorCell; } private EditorCell createConstant_rpujt6_c1a() { EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "r$swing component$"); editorCell.setCellId("Constant_rpujt6_c1a"); editorCell.setDefaultText(""); return editorCell; } }