| /** |
| * generated by Xtext 2.10.0 |
| */ |
| package org.eclipse.emf.henshin.text.ui.labeling; |
| |
| import com.google.common.base.Objects; |
| import com.google.inject.Inject; |
| import org.eclipse.emf.ecore.EAttribute; |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.EReference; |
| import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider; |
| import org.eclipse.emf.henshin.text.henshin_text.AND; |
| import org.eclipse.emf.henshin.text.henshin_text.AndExpression; |
| import org.eclipse.emf.henshin.text.henshin_text.Attribute; |
| import org.eclipse.emf.henshin.text.henshin_text.BoolValue; |
| import org.eclipse.emf.henshin.text.henshin_text.BracketExpression; |
| import org.eclipse.emf.henshin.text.henshin_text.Call; |
| import org.eclipse.emf.henshin.text.henshin_text.CheckDangling; |
| import org.eclipse.emf.henshin.text.henshin_text.ComparisonExpression; |
| import org.eclipse.emf.henshin.text.henshin_text.ConditionEdge; |
| import org.eclipse.emf.henshin.text.henshin_text.ConditionEdges; |
| import org.eclipse.emf.henshin.text.henshin_text.ConditionGraph; |
| import org.eclipse.emf.henshin.text.henshin_text.ConditionGraphRef; |
| import org.eclipse.emf.henshin.text.henshin_text.ConditionNode; |
| import org.eclipse.emf.henshin.text.henshin_text.ConditionNodeTypes; |
| import org.eclipse.emf.henshin.text.henshin_text.ConditionReuseNode; |
| import org.eclipse.emf.henshin.text.henshin_text.ConditionalUnit; |
| import org.eclipse.emf.henshin.text.henshin_text.Conditions; |
| import org.eclipse.emf.henshin.text.henshin_text.Edge; |
| import org.eclipse.emf.henshin.text.henshin_text.Edges; |
| import org.eclipse.emf.henshin.text.henshin_text.EqualityExpression; |
| import org.eclipse.emf.henshin.text.henshin_text.Expression; |
| import org.eclipse.emf.henshin.text.henshin_text.Formula; |
| import org.eclipse.emf.henshin.text.henshin_text.Graph; |
| import org.eclipse.emf.henshin.text.henshin_text.IndependentUnit; |
| import org.eclipse.emf.henshin.text.henshin_text.InjectiveMatching; |
| import org.eclipse.emf.henshin.text.henshin_text.IntegerValue; |
| import org.eclipse.emf.henshin.text.henshin_text.IteratedUnit; |
| import org.eclipse.emf.henshin.text.henshin_text.JavaAttributeValue; |
| import org.eclipse.emf.henshin.text.henshin_text.JavaClassValue; |
| import org.eclipse.emf.henshin.text.henshin_text.JavaImport; |
| import org.eclipse.emf.henshin.text.henshin_text.List; |
| import org.eclipse.emf.henshin.text.henshin_text.LoopUnit; |
| import org.eclipse.emf.henshin.text.henshin_text.Match; |
| import org.eclipse.emf.henshin.text.henshin_text.MinusExpression; |
| import org.eclipse.emf.henshin.text.henshin_text.Model; |
| import org.eclipse.emf.henshin.text.henshin_text.ModelElement; |
| import org.eclipse.emf.henshin.text.henshin_text.MulOrDivExpression; |
| import org.eclipse.emf.henshin.text.henshin_text.MultiRule; |
| import org.eclipse.emf.henshin.text.henshin_text.MultiRuleReuseNode; |
| import org.eclipse.emf.henshin.text.henshin_text.NaturalValue; |
| import org.eclipse.emf.henshin.text.henshin_text.Node; |
| import org.eclipse.emf.henshin.text.henshin_text.Not; |
| import org.eclipse.emf.henshin.text.henshin_text.NotExpression; |
| import org.eclipse.emf.henshin.text.henshin_text.NumberValue; |
| import org.eclipse.emf.henshin.text.henshin_text.ORorXOR; |
| import org.eclipse.emf.henshin.text.henshin_text.OrExpression; |
| import org.eclipse.emf.henshin.text.henshin_text.Parameter; |
| import org.eclipse.emf.henshin.text.henshin_text.ParameterType; |
| import org.eclipse.emf.henshin.text.henshin_text.ParameterValue; |
| import org.eclipse.emf.henshin.text.henshin_text.PlusExpression; |
| import org.eclipse.emf.henshin.text.henshin_text.PriorityUnit; |
| import org.eclipse.emf.henshin.text.henshin_text.Rollback; |
| import org.eclipse.emf.henshin.text.henshin_text.Rule; |
| import org.eclipse.emf.henshin.text.henshin_text.Strict; |
| import org.eclipse.emf.henshin.text.henshin_text.StringValue; |
| import org.eclipse.emf.henshin.text.henshin_text.Unit; |
| import org.eclipse.xtext.ui.label.DefaultEObjectLabelProvider; |
| |
| /** |
| * Provides labels for EObjects. |
| * |
| * See https://www.eclipse.org/Xtext/documentation/304_ide_concepts.html#label-provider |
| */ |
| @SuppressWarnings("all") |
| public class Henshin_textLabelProvider extends DefaultEObjectLabelProvider { |
| @Inject |
| public Henshin_textLabelProvider(final AdapterFactoryLabelProvider delegate) { |
| super(delegate); |
| } |
| |
| public String image(final Model ele) { |
| return "outline/HenshinDiagramFile.gif"; |
| } |
| |
| public String image(final Rule ele) { |
| return "outline/Rule.gif"; |
| } |
| |
| public String image(final Unit ele) { |
| return "outline/Unit.gif"; |
| } |
| |
| public String image(final Parameter ele) { |
| return "outline/Parameter.gif"; |
| } |
| |
| public String text(final Parameter ele) { |
| String _name = ele.getName(); |
| String _plus = (_name + ":"); |
| Object _xifexpression = null; |
| ParameterType _type = ele.getType(); |
| EClass _type_1 = _type.getType(); |
| boolean _notEquals = (!Objects.equal(_type_1, null)); |
| if (_notEquals) { |
| ParameterType _type_2 = ele.getType(); |
| EClass _type_3 = _type_2.getType(); |
| _xifexpression = _type_3.getName(); |
| } else { |
| ParameterType _type_4 = ele.getType(); |
| _xifexpression = _type_4.getEnumType(); |
| } |
| return (_plus + _xifexpression); |
| } |
| |
| public String image(final JavaImport ele) { |
| return "outline/NamedElement.gif"; |
| } |
| |
| public String image(final CheckDangling ele) { |
| return "outline/NamedElement.gif"; |
| } |
| |
| public String image(final InjectiveMatching ele) { |
| return "outline/NamedElement.gif"; |
| } |
| |
| public String image(final Conditions ele) { |
| return "outline/AttributeCondition.gif"; |
| } |
| |
| public String text(final Conditions ele) { |
| return "Conditions"; |
| } |
| |
| public String image(final Graph ele) { |
| return "outline/Graph.gif"; |
| } |
| |
| public String text(final Graph ele) { |
| return "Graph"; |
| } |
| |
| public String image(final Edges ele) { |
| return "outline/Edge.gif"; |
| } |
| |
| public String text(final Edges ele) { |
| return "Edges"; |
| } |
| |
| public String image(final Edge ele) { |
| return "outline/Edge.gif"; |
| } |
| |
| public String text(final Edge ele) { |
| EReference _type = ele.getType(); |
| return _type.getName(); |
| } |
| |
| public String image(final Node ele) { |
| return "outline/Node.gif"; |
| } |
| |
| public String image(final Attribute ele) { |
| return "outline/Attribute.gif"; |
| } |
| |
| public String text(final Attribute ele) { |
| String _xifexpression = null; |
| String _update = ele.getUpdate(); |
| boolean _notEquals = (!Objects.equal(_update, null)); |
| if (_notEquals) { |
| EAttribute _name = ele.getName(); |
| String _name_1 = _name.getName(); |
| _xifexpression = ("set-" + _name_1); |
| } else { |
| EAttribute _name_2 = ele.getName(); |
| _xifexpression = _name_2.getName(); |
| } |
| return _xifexpression; |
| } |
| |
| public String image(final Formula ele) { |
| return "outline/Formula.gif"; |
| } |
| |
| public String text(final Formula ele) { |
| return "Formula"; |
| } |
| |
| public String image(final MultiRule ele) { |
| return "outline/Rule.gif"; |
| } |
| |
| public String image(final MultiRuleReuseNode ele) { |
| return "outline/Node.gif"; |
| } |
| |
| public String text(final MultiRuleReuseNode ele) { |
| Node _name = ele.getName(); |
| return _name.getName(); |
| } |
| |
| public String image(final ORorXOR ele) { |
| String _xifexpression = null; |
| String _op = ele.getOp(); |
| boolean _equals = _op.equals("OR"); |
| if (_equals) { |
| _xifexpression = "outline/Or.gif"; |
| } else { |
| _xifexpression = "outline/Xor.gif"; |
| } |
| return _xifexpression; |
| } |
| |
| public String text(final ORorXOR ele) { |
| String _xifexpression = null; |
| String _op = ele.getOp(); |
| boolean _equals = _op.equals("OR"); |
| if (_equals) { |
| _xifexpression = "OR"; |
| } else { |
| _xifexpression = "COR"; |
| } |
| return _xifexpression; |
| } |
| |
| public String image(final AND ele) { |
| return "outline/And.gif"; |
| } |
| |
| public String text(final AND ele) { |
| return "AND"; |
| } |
| |
| public String image(final Not ele) { |
| return "outline/Not.gif"; |
| } |
| |
| public String text(final Not ele) { |
| return "NOT"; |
| } |
| |
| public String image(final ConditionGraphRef ele) { |
| return "outline/Graph.gif"; |
| } |
| |
| public String text(final ConditionGraphRef ele) { |
| ConditionGraph _conditionGraphRef = ele.getConditionGraphRef(); |
| return _conditionGraphRef.getName(); |
| } |
| |
| public String image(final ConditionGraph ele) { |
| return "outline/Graph.gif"; |
| } |
| |
| public String image(final ConditionEdges ele) { |
| return "outline/Edge.gif"; |
| } |
| |
| public String text(final ConditionEdges ele) { |
| return "Edges"; |
| } |
| |
| public String image(final ConditionEdge ele) { |
| return "outline/Edge.gif"; |
| } |
| |
| public String text(final ConditionEdge ele) { |
| EReference _type = ele.getType(); |
| return _type.getName(); |
| } |
| |
| public String image(final ConditionNode ele) { |
| return "outline/Node.gif"; |
| } |
| |
| public String text(final ConditionNode ele) { |
| return ele.getName(); |
| } |
| |
| public String image(final ConditionReuseNode ele) { |
| return "outline/Node.gif"; |
| } |
| |
| public String text(final ConditionReuseNode ele) { |
| ConditionNodeTypes _name = ele.getName(); |
| return _name.getName(); |
| } |
| |
| public String image(final Match ele) { |
| return "outline/Attribute.gif"; |
| } |
| |
| public String text(final Match ele) { |
| EAttribute _name = ele.getName(); |
| return _name.getName(); |
| } |
| |
| public String image(final Call ele) { |
| String _xifexpression = null; |
| ModelElement _elementCall = ele.getElementCall(); |
| if ((_elementCall instanceof Rule)) { |
| _xifexpression = "outline/RuleCall.gif"; |
| } else { |
| _xifexpression = "outline/UnitCall.gif"; |
| } |
| return _xifexpression; |
| } |
| |
| public String text(final Call ele) { |
| ModelElement _elementCall = ele.getElementCall(); |
| return _elementCall.getName(); |
| } |
| |
| public String image(final Strict ele) { |
| return "outline/NamedElement.gif"; |
| } |
| |
| public String text(final Strict ele) { |
| return "Strict"; |
| } |
| |
| public String image(final Rollback ele) { |
| return "outline/NamedElement.gif"; |
| } |
| |
| public String text(final Rollback ele) { |
| return "Rollback"; |
| } |
| |
| public String image(final IndependentUnit ele) { |
| return "outline/IndependentUnit.gif"; |
| } |
| |
| public String text(final IndependentUnit ele) { |
| return "IndependentUnit"; |
| } |
| |
| public String image(final ConditionalUnit ele) { |
| return "outline/ConditionalUnit.gif"; |
| } |
| |
| public String text(final ConditionalUnit ele) { |
| return "ConditionalUnit"; |
| } |
| |
| public String image(final PriorityUnit ele) { |
| return "outline/PriorityUnit.gif"; |
| } |
| |
| public String text(final PriorityUnit ele) { |
| return "PriorityUnit"; |
| } |
| |
| public String image(final List ele) { |
| return "outline/Unit.gif"; |
| } |
| |
| public String text(final List ele) { |
| return "subUnit"; |
| } |
| |
| public String image(final IteratedUnit ele) { |
| return "outline/IteratedUnit.gif"; |
| } |
| |
| public String text(final IteratedUnit ele) { |
| return "IteratedUnit"; |
| } |
| |
| public String image(final Expression ele) { |
| return "outline/Attribute_yellow.gif"; |
| } |
| |
| public Object text(final Expression ele) { |
| return this.ExpressionToString(ele); |
| } |
| |
| public String image(final LoopUnit ele) { |
| return "outline/LoopUnit.gif"; |
| } |
| |
| public String text(final LoopUnit ele) { |
| return "LoopUnit"; |
| } |
| |
| private Object ExpressionToString(final Expression expression) { |
| boolean _matched = false; |
| if (expression instanceof OrExpression) { |
| _matched=true; |
| Expression _left = ((OrExpression)expression).getLeft(); |
| Object _ExpressionToString = this.ExpressionToString(_left); |
| String _plus = (_ExpressionToString + " OR "); |
| Expression _right = ((OrExpression)expression).getRight(); |
| Object _ExpressionToString_1 = this.ExpressionToString(_right); |
| return (_plus + _ExpressionToString_1); |
| } |
| if (!_matched) { |
| if (expression instanceof AndExpression) { |
| _matched=true; |
| Expression _left = ((AndExpression)expression).getLeft(); |
| Object _ExpressionToString = this.ExpressionToString(_left); |
| String _plus = (_ExpressionToString + " AND "); |
| Expression _right = ((AndExpression)expression).getRight(); |
| Object _ExpressionToString_1 = this.ExpressionToString(_right); |
| return (_plus + _ExpressionToString_1); |
| } |
| } |
| if (!_matched) { |
| if (expression instanceof EqualityExpression) { |
| _matched=true; |
| Expression _left = ((EqualityExpression)expression).getLeft(); |
| Object _ExpressionToString = this.ExpressionToString(_left); |
| String _plus = (_ExpressionToString + " "); |
| String _op = ((EqualityExpression)expression).getOp(); |
| String _plus_1 = (_plus + _op); |
| String _plus_2 = (_plus_1 + " "); |
| Expression _right = ((EqualityExpression)expression).getRight(); |
| Object _ExpressionToString_1 = this.ExpressionToString(_right); |
| return (_plus_2 + _ExpressionToString_1); |
| } |
| } |
| if (!_matched) { |
| if (expression instanceof ComparisonExpression) { |
| _matched=true; |
| Expression _left = ((ComparisonExpression)expression).getLeft(); |
| Object _ExpressionToString = this.ExpressionToString(_left); |
| String _plus = (_ExpressionToString + " "); |
| String _op = ((ComparisonExpression)expression).getOp(); |
| String _plus_1 = (_plus + _op); |
| String _plus_2 = (_plus_1 + " "); |
| Expression _right = ((ComparisonExpression)expression).getRight(); |
| Object _ExpressionToString_1 = this.ExpressionToString(_right); |
| return (_plus_2 + _ExpressionToString_1); |
| } |
| } |
| if (!_matched) { |
| if (expression instanceof PlusExpression) { |
| _matched=true; |
| Expression _left = ((PlusExpression)expression).getLeft(); |
| Object _ExpressionToString = this.ExpressionToString(_left); |
| String _plus = (_ExpressionToString + " + "); |
| Expression _right = ((PlusExpression)expression).getRight(); |
| Object _ExpressionToString_1 = this.ExpressionToString(_right); |
| return (_plus + _ExpressionToString_1); |
| } |
| } |
| if (!_matched) { |
| if (expression instanceof MinusExpression) { |
| _matched=true; |
| Expression _left = ((MinusExpression)expression).getLeft(); |
| Object _ExpressionToString = this.ExpressionToString(_left); |
| String _plus = (_ExpressionToString + " - "); |
| Expression _right = ((MinusExpression)expression).getRight(); |
| Object _ExpressionToString_1 = this.ExpressionToString(_right); |
| return (_plus + _ExpressionToString_1); |
| } |
| } |
| if (!_matched) { |
| if (expression instanceof MulOrDivExpression) { |
| _matched=true; |
| Expression _left = ((MulOrDivExpression)expression).getLeft(); |
| Object _ExpressionToString = this.ExpressionToString(_left); |
| String _plus = (_ExpressionToString + " "); |
| String _op = ((MulOrDivExpression)expression).getOp(); |
| String _plus_1 = (_plus + _op); |
| String _plus_2 = (_plus_1 + " "); |
| Expression _right = ((MulOrDivExpression)expression).getRight(); |
| Object _ExpressionToString_1 = this.ExpressionToString(_right); |
| return (_plus_2 + _ExpressionToString_1); |
| } |
| } |
| if (!_matched) { |
| if (expression instanceof BracketExpression) { |
| _matched=true; |
| Expression _expression = ((BracketExpression)expression).getExpression(); |
| Object _ExpressionToString = this.ExpressionToString(_expression); |
| String _plus = ("(" + _ExpressionToString); |
| return (_plus + ")"); |
| } |
| } |
| if (!_matched) { |
| if (expression instanceof NotExpression) { |
| _matched=true; |
| Expression _expression = ((NotExpression)expression).getExpression(); |
| Object _ExpressionToString = this.ExpressionToString(_expression); |
| return ("!" + _ExpressionToString); |
| } |
| } |
| if (!_matched) { |
| if (expression instanceof ParameterValue) { |
| _matched=true; |
| Parameter _value = ((ParameterValue)expression).getValue(); |
| return _value.getName(); |
| } |
| } |
| if (!_matched) { |
| if (expression instanceof JavaClassValue) { |
| _matched=true; |
| String _value = ((JavaClassValue)expression).getValue(); |
| return (_value + "(...)"); |
| } |
| } |
| if (!_matched) { |
| if (expression instanceof JavaAttributeValue) { |
| _matched=true; |
| return ((JavaAttributeValue)expression).getValue(); |
| } |
| } |
| if (!_matched) { |
| if (expression instanceof StringValue) { |
| _matched=true; |
| return ((StringValue)expression).getValue(); |
| } |
| } |
| if (!_matched) { |
| if (expression instanceof NumberValue) { |
| _matched=true; |
| return ((NumberValue)expression).getValue(); |
| } |
| } |
| if (!_matched) { |
| if (expression instanceof IntegerValue) { |
| _matched=true; |
| return ((IntegerValue)expression).getValue(); |
| } |
| } |
| if (!_matched) { |
| if (expression instanceof NaturalValue) { |
| _matched=true; |
| return Integer.valueOf(((NaturalValue)expression).getValue()); |
| } |
| } |
| if (!_matched) { |
| if (expression instanceof BoolValue) { |
| _matched=true; |
| return Boolean.valueOf(((BoolValue)expression).isValue()); |
| } |
| } |
| return null; |
| } |
| } |