package jetbrains.mps.lang.test.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.nodeEditor.cells.EditorCell_Constant;
import jetbrains.mps.openapi.editor.style.Style;
import jetbrains.mps.editor.runtime.style.StyleImpl;
import jetbrains.mps.lang.test.editor.transformationTest_StyleSheet.EditorOperationStyleClass;
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.smodel.structure.ExtensionPoint;
/*package*/ class BootstrapActionReference_EditorBuilder_a extends AbstractEditorBuilder {
@NotNull
private SNode myNode;
public BootstrapActionReference_EditorBuilder_a(@NotNull EditorContext context, @NotNull SNode node) {
super(context);
myNode = node;
}
@NotNull
@Override
public SNode getNode() {
return myNode;
}
/*package*/ EditorCell createCell() {
return createCollection_pdl482_a();
}
private EditorCell createCollection_pdl482_a() {
EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Horizontal());
editorCell.setCellId("Collection_pdl482_a");
editorCell.setBig(true);
editorCell.setCellContext(getCellFactory().getCellContext());
editorCell.addEditorCell(createConstant_pdl482_a0());
editorCell.addEditorCell(createProperty_pdl482_b0());
return editorCell;
}
private EditorCell createConstant_pdl482_a0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "by id:");
editorCell.setCellId("Constant_pdl482_a0");
Style style = new StyleImpl();
new EditorOperationStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
style.set(StyleAttributes.SELECTABLE, false);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createProperty_pdl482_b0() {
CellProviderWithRole provider = new PropertyCellProvider(myNode, getEditorContext());
provider.setRole("actionId");
provider.setNoTargetText("<no actionId>");
EditorCell editorCell;
editorCell = provider.createEditorCell(getEditorContext());
editorCell.setCellId("property_actionId");
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 BootstrapActionReference_EditorBuilder_a.BootstrapActionReference_actionId_cellMenu_pdl482_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 BootstrapActionReference_actionId_cellMenu_pdl482_a0b0 extends AbstractCellMenuPart_PropertyValues {
public BootstrapActionReference_actionId_cellMenu_pdl482_a0b0() {
}
public List<String> getPropertyValues(SNode node, IOperationContext operationContext, EditorContext editorContext) {
List<String> result = ListSequence.fromList(new ArrayList<String>());
for (List<String> ext : new ExtensionPoint<List<String>>("jetbrains.mps.lang.test.ActionIDs").getObjects()) {
ListSequence.fromList(result).addSequence(ListSequence.fromList(ext));
}
return result;
}
}
}