package jetbrains.mps.lang.editor.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.openapi.editor.style.Style;
import jetbrains.mps.editor.runtime.style.StyleImpl;
import jetbrains.mps.lang.editor.editor.Styles_StyleSheet.rootCellModelStyleStyleClass;
import jetbrains.mps.lang.editor.behavior.EditorCellModel__BehaviorDescriptor;
import jetbrains.mps.nodeEditor.cellProviders.CellProviderWithRole;
import jetbrains.mps.lang.editor.cellProviders.PropertyCellProvider;
import jetbrains.mps.lang.editor.editor.Styles_StyleSheet.borderedStyleClass;
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 CellModel_Constant_EditorBuilder_a extends AbstractEditorBuilder {
@NotNull
private SNode myNode;
public CellModel_Constant_EditorBuilder_a(@NotNull EditorContext context, @NotNull SNode node) {
super(context);
myNode = node;
}
@NotNull
@Override
public SNode getNode() {
return myNode;
}
/*package*/ EditorCell createCell() {
return createCollection_8hdu2g_a();
}
private EditorCell createCollection_8hdu2g_a() {
EditorCell_Collection editorCell = new EditorCell_Collection(getEditorContext(), myNode, new CellLayout_Horizontal());
editorCell.setCellId("Collection_8hdu2g_a");
editorCell.setBig(true);
editorCell.setCellContext(getCellFactory().getCellContext());
Style style = new StyleImpl();
new rootCellModelStyleStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
editorCell.getStyle().putAll(style);
if (nodeCondition_8hdu2g_a0a()) {
editorCell.addEditorCell(createComponent_8hdu2g_a0());
}
editorCell.addEditorCell(createProperty_8hdu2g_b0());
if (nodeCondition_8hdu2g_a2a()) {
editorCell.addEditorCell(createComponent_8hdu2g_c0());
}
return editorCell;
}
private boolean nodeCondition_8hdu2g_a0a() {
return EditorCellModel__BehaviorDescriptor.getOpeningTag_idhKxXtpm.invoke(myNode).length() > 0;
}
private boolean nodeCondition_8hdu2g_a2a() {
return EditorCellModel__BehaviorDescriptor.getClosingTag_idhKxXx_K.invoke(myNode).length() > 0;
}
private EditorCell createComponent_8hdu2g_a0() {
EditorCell editorCell = getCellFactory().createEditorComponentCell(myNode, "jetbrains.mps.lang.editor.editor._OpenTag");
return editorCell;
}
private EditorCell createProperty_8hdu2g_b0() {
CellProviderWithRole provider = new PropertyCellProvider(myNode, getEditorContext());
provider.setRole("text");
provider.setNoTargetText("<constant>");
provider.setAllowsEmptyTarget(true);
EditorCell editorCell;
editorCell = provider.createEditorCell(getEditorContext());
editorCell.setCellId("property_text");
Style style = new StyleImpl();
new borderedStyleClass(getEditorContext(), getNode()).apply(style, editorCell);
style.set(StyleAttributes.TEXT_BACKGROUND_COLOR, StyleRegistry.getInstance().getSimpleColor(_StyleParameter_QueryFunction_8hdu2g_a0b0()));
style.set(StyleAttributes.BACKGROUND_COLOR, StyleRegistry.getInstance().getSimpleColor(_StyleParameter_QueryFunction_8hdu2g_a1b0()));
style.set(StyleAttributes.TEXT_COLOR, StyleRegistry.getInstance().getSimpleColor(_StyleParameter_QueryFunction_8hdu2g_a2b0()));
style.set(StyleAttributes.FONT_STYLE, _StyleParameter_QueryFunction_8hdu2g_a3b0());
style.set(StyleAttributes.FONT_SIZE, _StyleParameter_QueryFunction_8hdu2g_a4b0());
style.set(StyleAttributes.UNDERLINED, _StyleParameter_QueryFunction_8hdu2g_a5b0());
style.set(StyleAttributes.STRIKE_OUT, _StyleParameter_QueryFunction_8hdu2g_a6b0());
editorCell.getStyle().putAll(style);
editorCell.addKeyMap(new _SplitConctantCellIntoWordsKeyMap());
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_8hdu2g_a0b0() {
return (Color) EditorCellModel__BehaviorDescriptor.getTextBackgroundColor_idhL7BhMP.invoke(getNode());
}
private Color _StyleParameter_QueryFunction_8hdu2g_a1b0() {
return (Color) EditorCellModel__BehaviorDescriptor.getBackgroundColor_idhL7rNfN.invoke(getNode());
}
private Color _StyleParameter_QueryFunction_8hdu2g_a2b0() {
return (Color) EditorCellModel__BehaviorDescriptor.getForegroundColor_idhL6TA5F.invoke(getNode());
}
private int _StyleParameter_QueryFunction_8hdu2g_a3b0() {
return (int) EditorCellModel__BehaviorDescriptor.getFontStyle_idhLcv3Z9.invoke(getNode());
}
private int _StyleParameter_QueryFunction_8hdu2g_a4b0() {
return (int) EditorCellModel__BehaviorDescriptor.getFontSize_idhLmaQwP.invoke(getNode());
}
private boolean _StyleParameter_QueryFunction_8hdu2g_a5b0() {
return (boolean) EditorCellModel__BehaviorDescriptor.isUnderlined_idhLmqR8u.invoke(getNode());
}
private boolean _StyleParameter_QueryFunction_8hdu2g_a6b0() {
return (boolean) EditorCellModel__BehaviorDescriptor.isStrikeOut_idhNnL8J1.invoke(getNode());
}
private EditorCell createComponent_8hdu2g_c0() {
EditorCell editorCell = getCellFactory().createEditorComponentCell(myNode, "jetbrains.mps.lang.editor.editor._CloseTag");
return editorCell;
}
}