package jetbrains.mps.build.mps.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_Indent;
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.cellMenu.CompositeSubstituteInfo;
import jetbrains.mps.nodeEditor.cellMenu.BasicCellContext;
import jetbrains.mps.nodeEditor.cellMenu.SubstituteInfoPartExt;
import jetbrains.mps.nodeEditor.cellMenu.SChildSubstituteInfoPartEx;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SPropertyOperations;
import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory;
import jetbrains.mps.lang.editor.generator.internal.AbstractCellMenuPart_Generic_Group;
import java.util.List;
import jetbrains.mps.smodel.IOperationContext;
import jetbrains.mps.internal.collections.runtime.CollectionSequence;
import jetbrains.mps.lang.smodel.generator.smodelAdapter.SEnumOperations;
import org.jetbrains.mps.openapi.model.SModel;
import org.jetbrains.mps.openapi.language.SEnumerationLiteral;
import jetbrains.mps.nodeEditor.cells.EditorCell_Constant;
import jetbrains.mps.build.editor.buildStyles_StyleSheet.keywordStyleClass;
import jetbrains.mps.nodeEditor.cellProviders.CellProviderWithRole;
import jetbrains.mps.lang.editor.cellProviders.PropertyCellProvider;
import jetbrains.mps.nodeEditor.EditorManager;
/*package*/ class SourcesKindComponent_ComponentBuilder_a extends AbstractEditorBuilder {
@NotNull
private SNode myNode;
public SourcesKindComponent_ComponentBuilder_a(@NotNull EditorContext context, @NotNull SNode node) {
super(context);
myNode = node;
}
@NotNull
@Override
public SNode getNode() {
return myNode;
}
/*package*/ EditorCell createCell() {
return createCollection_qubgco_a();
}
private EditorCell createCollection_qubgco_a() {
EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Indent());
editorCell.setCellId("Collection_qubgco_a");
Style style = new StyleImpl();
style.set(StyleAttributes.SELECTABLE, false);
editorCell.getStyle().putAll(style);
delete_sourcesKind.setCellActions(editorCell, myNode, getEditorContext());
editorCell.setSubstituteInfo(new CompositeSubstituteInfo(getEditorContext(), new BasicCellContext(myNode), new SubstituteInfoPartExt[]{new SourcesKindComponent_ComponentBuilder_a.BuildMps_Solution_generic_cellMenu_qubgco_a0a(), new SChildSubstituteInfoPartEx(editorCell)}));
editorCell.addEditorCell(createConstant_qubgco_a0());
if (nodeCondition_qubgco_a1a()) {
editorCell.addEditorCell(createProperty_qubgco_b0());
}
if (nodeCondition_qubgco_a2a()) {
editorCell.addEditorCell(createConstant_qubgco_c0());
}
editorCell.addEditorCell(createConstant_qubgco_d0());
return editorCell;
}
private boolean nodeCondition_qubgco_a1a() {
return isNotEmptyString(SPropertyOperations.getString_def(myNode, MetaAdapterFactory.getProperty(0xcf935df46994e9cL, 0xa132fa109541cba3L, 0x2c446791464290f7L, 0x3be316509dccb82L, "sourcesKind"), null));
}
private boolean nodeCondition_qubgco_a2a() {
return isEmptyString(SPropertyOperations.getString_def(myNode, MetaAdapterFactory.getProperty(0xcf935df46994e9cL, 0xa132fa109541cba3L, 0x2c446791464290f7L, 0x3be316509dccb82L, "sourcesKind"), null));
}
public static class BuildMps_Solution_generic_cellMenu_qubgco_a0a extends AbstractCellMenuPart_Generic_Group {
public BuildMps_Solution_generic_cellMenu_qubgco_a0a() {
}
public List<?> createParameterObjects(SNode node, IOperationContext operationContext, EditorContext editorContext) {
return CollectionSequence.fromCollection(SEnumOperations.getMembers(0x798100da4f0a421aL, 0xb99171f8c50ce5d2L, "jetbrains.mps.build", 0x48d5d03db92974f7L, "BuildSource_JavaContentFolderKind")).toListSequence();
}
protected void handleAction(Object parameterObject, SNode node, SModel model, IOperationContext operationContext, EditorContext editorContext) {
this.handleAction_impl((SEnumerationLiteral) parameterObject, node, model, operationContext, editorContext);
}
public void handleAction_impl(SEnumerationLiteral parameterObject, SNode node, SModel model, IOperationContext operationContext, EditorContext editorContext) {
SPropertyOperations.set(node, MetaAdapterFactory.getProperty(0xcf935df46994e9cL, 0xa132fa109541cba3L, 0x2c446791464290f7L, 0x3be316509dccb82L, "sourcesKind"), "" + (parameterObject));
}
public boolean isReferentPresentation() {
return false;
}
public String getMatchingText(Object parameterObject) {
return this.getMatchingText_internal((SEnumerationLiteral) parameterObject);
}
public String getMatchingText_internal(SEnumerationLiteral parameterObject) {
return "(with " + SEnumOperations.getMemberName(parameterObject) + ")";
}
}
private EditorCell createConstant_qubgco_a0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "(with");
editorCell.setCellId("Constant_qubgco_a0");
Style style = new StyleImpl();
new keywordStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
private EditorCell createProperty_qubgco_b0() {
CellProviderWithRole provider = new PropertyCellProvider(myNode, getEditorContext());
provider.setRole("sourcesKind");
provider.setNoTargetText("<no sourcesKind>");
EditorCell editorCell;
editorCell = provider.createEditorCell(getEditorContext());
editorCell.setCellId("SKC_property_sourcesKind");
Style style = new StyleImpl();
new keywordStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
style.set(StyleAttributes.EDITABLE, false);
editorCell.getStyle().putAll(style);
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_qubgco_c0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, "sources");
editorCell.setCellId("Constant_qubgco_c0");
Style style = new StyleImpl();
new keywordStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
style.set(StyleAttributes.EDITABLE, false);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
editorCell.setSubstituteInfo(new CompositeSubstituteInfo(getEditorContext(), new BasicCellContext(myNode), new SubstituteInfoPartExt[]{new SourcesKindComponent_ComponentBuilder_a.BuildMps_Solution_generic_cellMenu_qubgco_a0c0(), new SChildSubstituteInfoPartEx(editorCell)}));
return editorCell;
}
public static class BuildMps_Solution_generic_cellMenu_qubgco_a0c0 extends AbstractCellMenuPart_Generic_Group {
public BuildMps_Solution_generic_cellMenu_qubgco_a0c0() {
}
public List<?> createParameterObjects(SNode node, IOperationContext operationContext, EditorContext editorContext) {
return CollectionSequence.fromCollection(SEnumOperations.getMembers(0xcf935df46994e9cL, 0xa132fa109541cba3L, "jetbrains.mps.build.mps", 0x3be316509db4513L, "BuildMps_ModuleSourcesKind")).toListSequence();
}
protected void handleAction(Object parameterObject, SNode node, SModel model, IOperationContext operationContext, EditorContext editorContext) {
this.handleAction_impl((SEnumerationLiteral) parameterObject, node, model, operationContext, editorContext);
}
public void handleAction_impl(SEnumerationLiteral parameterObject, SNode node, SModel model, IOperationContext operationContext, EditorContext editorContext) {
SPropertyOperations.set(node, MetaAdapterFactory.getProperty(0xcf935df46994e9cL, 0xa132fa109541cba3L, 0x2c446791464290f7L, 0x3be316509dccb82L, "sourcesKind"), "" + (parameterObject));
}
public boolean isReferentPresentation() {
return false;
}
public String getMatchingText(Object parameterObject) {
return this.getMatchingText_internal((SEnumerationLiteral) parameterObject);
}
public String getMatchingText_internal(SEnumerationLiteral parameterObject) {
return "(with " + SEnumOperations.getMemberName(parameterObject) + ")";
}
}
private EditorCell createConstant_qubgco_d0() {
EditorCell_Constant editorCell = new EditorCell_Constant(getEditorContext(), myNode, ")");
editorCell.setCellId("Constant_qubgco_d0");
Style style = new StyleImpl();
new keywordStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
style.set(StyleAttributes.PUNCTUATION_LEFT, true);
editorCell.getStyle().putAll(style);
editorCell.setDefaultText("");
return editorCell;
}
private static boolean isNotEmptyString(String str) {
return str != null && str.length() > 0;
}
private static boolean isEmptyString(String str) {
return str == null || str.length() == 0;
}
}