private void setupOldChild() { if (myCurrentChild != null && myCurrentChild.getUserObject(EditorManager.OLD_NODE_FOR_SUBSTITUTION) != null) { myOldChild = (SNode) myCurrentChild.getUserObject(EditorManager.OLD_NODE_FOR_SUBSTITUTION); } else { myOldChild = myCurrentChild; } }
public SNode getNearestOverloaded(SNode node, SNode leftType, SNode rightType) { if (!(SNodeOperations.isInstanceOf( node, "jetbrains.mps.baseLanguage.structure.BinaryOperation"))) { return null; } SNode result = (SNode) (node.getUserObject("operator")); if (result != null) { return result; } Map<SNode, Boolean> operatorMap = getOverloadedOperators( SNodeOperations.cast(node, "jetbrains.mps.baseLanguage.structure.BinaryOperation"), leftType, rightType); if (MapSequence.fromMap(operatorMap).isEmpty()) { return null; } result = MapSequence.fromMap(operatorMap).first().key(); boolean resultReversed = MapSequence.fromMap(operatorMap).first().value(); for (IMapping<SNode, Boolean> operatorEntry : MapSequence.fromMap(operatorMap)) { SNode operator = operatorEntry.key(); boolean reversed = operatorEntry.value() != resultReversed; if (isSubTypeOperator(operator, result, reversed)) { result = operator; resultReversed = operatorEntry.value(); } } node.putUserObject("operator", result); node.putUserObject("reversed", resultReversed); return result; }
@Override protected void handleChild(Object resultObject, String tagName, Object value) throws SAXException { SNode result = (SNode) resultObject; if ("property".equals(tagName)) { String[] child = (String[]) value; if (child[1] != null) { SNodeAccessUtil.setProperty(result, fieldhelper.readName(child[0]), child[1]); } return; } if ("link".equals(tagName)) { String[] child = (String[]) value; if (child[2] == null) { LOG.error("couldn't create reference '" + child[0] + "' : traget node id is null"); return; } SReference ref = fieldhelper.readLink(result, child[0], child[2], child[1]); if (ref != null) { result.setReference(ref.getRole(), ref); } return; } if ("node".equals(tagName)) { SNode child = (SNode) value; result.addChild(((String) child.getUserObject("role")), child); child.putUserObject("role", null); return; } super.handleChild(resultObject, tagName, value); }
private void handleChild_286176397450364333(Object resultObject, Object value) throws SAXException { SNode result = (SNode) resultObject; SNode child = (SNode) value; if (child != null) { result.addChild(((String) child.getUserObject("role")), child); child.putUserObject("role", null); } }
public boolean isSet(SNode node) { return node.getUserObject(this) != null; }
public Object get(SNode node) { return node.getUserObject(this); }