Quellcode durchsuchen

Refactored StatechartValidationDecorator to use the MarkerBasedDecorator subclass.
Refactored Language Extension to use a more generic base class.
Added language support for conditional breakpoints

Andreas Mülder vor 12 Jahren
Ursprung
Commit
2e1daa0f4a
28 geänderte Dateien mit 342 neuen und 755 gelöschten Zeilen
  1. 5 0
      plugins/org.yakindu.sct.model.stext.ui/src/org/yakindu/sct/model/stext/ui/STextUiModule.java
  2. 0 1
      plugins/org.yakindu.sct.simulation.ui/META-INF/MANIFEST.MF
  3. 1 4
      plugins/org.yakindu.sct.simulation.ui/plugin.xml
  4. 9 13
      plugins/org.yakindu.sct.simulation.ui/src/org/yakindu/sct/simulation/ui/breakpoints/SCTBreakpointDetailPane.java
  5. 116 126
      plugins/org.yakindu.sct.ui.editor/schema/expressions.exsd
  6. 20 21
      plugins/org.yakindu.sct.ui.editor/src/org/yakindu/sct/ui/editor/extensions/ExpressionLanguageProviderExtensions.java
  7. 37 277
      plugins/org.yakindu.sct.ui.editor/src/org/yakindu/sct/ui/editor/providers/StatechartValidationDecorationProvider.java
  8. 5 0
      plugins/org.yakindu.sct.ui.integration.stext/plugin.xml
  9. 27 0
      plugins/org.yakindu.sct.ui.integration.stext/src/org/yakindu/sct/ui/integration/stext/ExpressionExpressionProvider.java
  10. 6 6
      plugins/org.yakindu.sct.ui.integration.stext/src/org/yakindu/sct/ui/integration/stext/StateExpressionProvider.java
  11. 6 6
      plugins/org.yakindu.sct.ui.integration.stext/src/org/yakindu/sct/ui/integration/stext/StatechartExpressionProvider.java
  12. 6 6
      plugins/org.yakindu.sct.ui.integration.stext/src/org/yakindu/sct/ui/integration/stext/TransitionExpressionProvider.java
  13. 30 0
      plugins/org.yakindu.sct.ui.integration.stext/src/org/yakindu/sct/ui/integration/stext/modules/EntryRuleRuntimeModule.java
  14. 34 0
      plugins/org.yakindu.sct.ui.integration.stext/src/org/yakindu/sct/ui/integration/stext/modules/EntryRuleUIModule.java
  15. 0 27
      plugins/org.yakindu.sct.ui.integration.stext/src/org/yakindu/sct/ui/integration/stext/modules/StateRuntimeModule.java
  16. 0 38
      plugins/org.yakindu.sct.ui.integration.stext/src/org/yakindu/sct/ui/integration/stext/modules/StateUIModule.java
  17. 0 26
      plugins/org.yakindu.sct.ui.integration.stext/src/org/yakindu/sct/ui/integration/stext/modules/StatechartRuntimeModule.java
  18. 0 38
      plugins/org.yakindu.sct.ui.integration.stext/src/org/yakindu/sct/ui/integration/stext/modules/StatechartUIModule.java
  19. 0 27
      plugins/org.yakindu.sct.ui.integration.stext/src/org/yakindu/sct/ui/integration/stext/modules/TransitionRuntimeModule.java
  20. 0 29
      plugins/org.yakindu.sct.ui.integration.stext/src/org/yakindu/sct/ui/integration/stext/modules/TransitionUIModule.java
  21. 19 0
      plugins/org.yakindu.sct.ui.integration.stext/src/org/yakindu/sct/ui/integration/stext/parsers/EntryRuleAntlrSTextParser.java
  22. 15 6
      plugins/org.yakindu.sct.ui.integration.stext/src/org/yakindu/sct/ui/integration/stext/parsers/TransitionContentAssistParser.java
  23. 6 0
      plugins/org.yakindu.sct.ui.integration.stext/src/org/yakindu/sct/ui/integration/stext/parsers/IParserConstants.java
  24. 0 17
      plugins/org.yakindu.sct.ui.integration.stext/src/org/yakindu/sct/ui/integration/stext/parsers/StateAntlrParser.java
  25. 0 28
      plugins/org.yakindu.sct.ui.integration.stext/src/org/yakindu/sct/ui/integration/stext/parsers/StateContentAssistParser.java
  26. 0 16
      plugins/org.yakindu.sct.ui.integration.stext/src/org/yakindu/sct/ui/integration/stext/parsers/StatechartAntlrParser.java
  27. 0 29
      plugins/org.yakindu.sct.ui.integration.stext/src/org/yakindu/sct/ui/integration/stext/parsers/StatechartContentAssistParser.java
  28. 0 14
      plugins/org.yakindu.sct.ui.integration.stext/src/org/yakindu/sct/ui/integration/stext/parsers/TransitionAntlrParser.java

+ 5 - 0
plugins/org.yakindu.sct.model.stext.ui/src/org/yakindu/sct/model/stext/ui/STextUiModule.java

@@ -7,6 +7,7 @@ import org.eclipse.xtext.ui.editor.contentassist.antlr.ParserBasedContentAssistC
 import org.eclipse.xtext.ui.editor.hover.DispatchingEObjectTextHover;
 import org.eclipse.xtext.ui.editor.hover.IEObjectHover;
 import org.eclipse.xtext.ui.editor.hover.IEObjectHoverProvider;
+import org.eclipse.xtext.ui.editor.hover.ProblemAnnotationHover;
 import org.eclipse.xtext.ui.editor.model.IResourceForEditorInputFactory;
 import org.eclipse.xtext.ui.editor.model.JavaClassPathResourceForIEditorInputFactory;
 import org.eclipse.xtext.ui.editor.model.ResourceForIEditorInputFactory;
@@ -118,4 +119,8 @@ public class STextUiModule extends
 			return ResourceForIEditorInputFactory.class;
 		}
 	}
+	
+	public Class<? extends org.eclipse.jface.text.ITextHover> bindITextHover() {
+		return ProblemAnnotationHover.class;
+	}
 }

+ 0 - 1
plugins/org.yakindu.sct.simulation.ui/META-INF/MANIFEST.MF

@@ -26,7 +26,6 @@ Require-Bundle: org.eclipse.ui,
  org.eclipse.xtext.xbase.lib,
  org.apache.commons.lang;bundle-version="2.4.0",
  org.yakindu.sct.commons;bundle-version="1.0.0",
- org.yakindu.sct.ui.integration.stext;bundle-version="2.1.1",
  org.eclipse.xtext;bundle-version="2.4.2"
 Bundle-RequiredExecutionEnvironment: J2SE-1.5
 Bundle-ActivationPolicy: lazy

+ 1 - 4
plugins/org.yakindu.sct.simulation.ui/plugin.xml

@@ -181,7 +181,7 @@
          <context decoratorTargets="PRIMARY_VIEW"/>
       </decoratorProvider>
    </extension>
-  <!-- Breakpoint Detail Pane factory 
+  <!-- Breakpoint Detail Pane factory -->
   <extension point="org.eclipse.debug.ui.detailPaneFactories">
        <detailFactories
              class="org.yakindu.sct.simulation.ui.breakpoints.SCTDetailPaneFactory"
@@ -201,7 +201,4 @@
        </enablement>
        </detailFactories>
 </extension>
--->
-   
-  
 </plugin>

+ 9 - 13
plugins/org.yakindu.sct.simulation.ui/src/org/yakindu/sct/simulation/ui/breakpoints/SCTBreakpointDetailPane.java

@@ -19,16 +19,16 @@ import org.eclipse.jface.layout.GridDataFactory;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.events.FocusAdapter;
 import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.FocusListener;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
 import org.eclipse.ui.IWorkbenchPartSite;
 import org.yakindu.sct.model.sgraph.SGraphPackage;
 import org.yakindu.sct.model.sgraph.Statechart;
-import org.yakindu.sct.model.sgraph.Statement;
 import org.yakindu.sct.simulation.core.breakpoints.SCTBreakpoint;
-import org.yakindu.sct.ui.integration.stext.ExpressionExpressionProvider;
+import org.yakindu.sct.ui.editor.extensions.ExpressionLanguageProviderExtensions;
+import org.yakindu.sct.ui.editor.extensions.IExpressionLanguageProvider;
 
 import de.itemis.xtext.utils.jface.viewers.ContextElementAdapter;
 import de.itemis.xtext.utils.jface.viewers.ContextElementAdapter.IContextElementProvider;
@@ -47,24 +47,20 @@ public class SCTBreakpointDetailPane implements IDetailPane, IContextElementProv
 	private SCTBreakpoint sctBreakpoint;
 
 	public void init(IWorkbenchPartSite partSite) {
-		
+
 	}
 
 	public Control createControl(Composite parent) {
 		parent.setBackground(ColorConstants.white);
 		final StyledText txt = new StyledText(parent, SWT.BORDER | SWT.MULTI);
-		txt.addFocusListener(new FocusListener() {
-
+		txt.addFocusListener(new FocusAdapter() {
 			public void focusLost(FocusEvent e) {
-				sctBreakpoint.setExpression((Statement) adapter.getFakeResourceContext().getFakeResource()
-						.getParseResult().getRootASTElement());
-			}
-
-			public void focusGained(FocusEvent e) {
-
+				sctBreakpoint.setExpression(txt.getText());
 			}
 		});
-		ExpressionExpressionProvider provider = new ExpressionExpressionProvider();
+		// TODO:
+		IExpressionLanguageProvider provider = ExpressionLanguageProviderExtensions.getLanguageProvider(
+				"breakpointCondition", "sct");
 		adapter = new StyledTextXtextAdapter(provider.getInjector());
 		adapter.getFakeResourceContext().getFakeResource().eAdapters().add(new ContextElementAdapter(this));
 		adapter.adapt(txt);

+ 116 - 126
plugins/org.yakindu.sct.ui.editor/schema/expressions.exsd

@@ -1,126 +1,116 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.yakindu.sct.ui.editor" xmlns="http://www.w3.org/2001/XMLSchema">
-<annotation>
-      <appinfo>
-         <meta.schema plugin="org.yakindu.sct.ui.editor" id="org.yakindu.sct.ui.editor.expressions" name="org.yakindu.sct.ui.editor.expressions"/>
-      </appinfo>
-      <documentation>
-         [Enter description of this extension point.]
-      </documentation>
-   </annotation>
-
-   <element name="extension">
-      <annotation>
-         <appinfo>
-            <meta.element />
-         </appinfo>
-      </annotation>
-      <complexType>
-         <sequence>
-            <element ref="ExpressionLanguageProvider" minOccurs="1" maxOccurs="unbounded"/>
-         </sequence>
-         <attribute name="point" type="string" use="required">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="id" type="string">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="name" type="string">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-               <appinfo>
-                  <meta.attribute translatable="true"/>
-               </appinfo>
-            </annotation>
-         </attribute>
-      </complexType>
-   </element>
-
-   <element name="ExpressionLanguageProvider">
-      <complexType>
-         <attribute name="class" type="string">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-               <appinfo>
-                  <meta.attribute kind="java" basedOn=":org.yakindu.sct.statechart.diagram.expressions.IExpressionsProvider"/>
-               </appinfo>
-            </annotation>
-         </attribute>
-         <attribute name="resourceExtension" type="string" use="required">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-         </attribute>
-         <attribute name="semanticTarget" use="required">
-            <annotation>
-               <documentation>
-                  
-               </documentation>
-            </annotation>
-            <simpleType>
-               <restriction base="string">
-                  <enumeration value="StatechartSpecification">
-                  </enumeration>
-                  <enumeration value="StateSpecification">
-                  </enumeration>
-                  <enumeration value="TransitionSpecification">
-                  </enumeration>
-               </restriction>
-            </simpleType>
-         </attribute>
-      </complexType>
-   </element>
-
-   <annotation>
-      <appinfo>
-         <meta.section type="since"/>
-      </appinfo>
-      <documentation>
-         [Enter the first release in which this extension point appears.]
-      </documentation>
-   </annotation>
-
-   <annotation>
-      <appinfo>
-         <meta.section type="examples"/>
-      </appinfo>
-      <documentation>
-         [Enter extension point usage example here.]
-      </documentation>
-   </annotation>
-
-   <annotation>
-      <appinfo>
-         <meta.section type="apiinfo"/>
-      </appinfo>
-      <documentation>
-         [Enter API information here.]
-      </documentation>
-   </annotation>
-
-   <annotation>
-      <appinfo>
-         <meta.section type="implementation"/>
-      </appinfo>
-      <documentation>
-         [Enter information about supplied implementation of this extension point.]
-      </documentation>
-   </annotation>
-
-
-</schema>
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.yakindu.sct.ui.editor" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+      <appinfo>
+         <meta.schema plugin="org.yakindu.sct.ui.editor" id="org.yakindu.sct.ui.editor.expressions" name="org.yakindu.sct.ui.editor.expressions"/>
+      </appinfo>
+      <documentation>
+         [Enter description of this extension point.]
+      </documentation>
+   </annotation>
+
+   <element name="extension">
+      <annotation>
+         <appinfo>
+            <meta.element />
+         </appinfo>
+      </annotation>
+      <complexType>
+         <sequence>
+            <element ref="ExpressionLanguageProvider" minOccurs="1" maxOccurs="unbounded"/>
+         </sequence>
+         <attribute name="point" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="id" type="string">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="name" type="string">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+               <appinfo>
+                  <meta.attribute translatable="true"/>
+               </appinfo>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <element name="ExpressionLanguageProvider">
+      <complexType>
+         <attribute name="class" type="string">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+               <appinfo>
+                  <meta.attribute kind="java" basedOn=":org.yakindu.sct.statechart.diagram.expressions.IExpressionsProvider"/>
+               </appinfo>
+            </annotation>
+         </attribute>
+         <attribute name="resourceExtension" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="semanticTarget" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <annotation>
+      <appinfo>
+         <meta.section type="since"/>
+      </appinfo>
+      <documentation>
+         [Enter the first release in which this extension point appears.]
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appinfo>
+         <meta.section type="examples"/>
+      </appinfo>
+      <documentation>
+         [Enter extension point usage example here.]
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appinfo>
+         <meta.section type="apiinfo"/>
+      </appinfo>
+      <documentation>
+         [Enter API information here.]
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appinfo>
+         <meta.section type="implementation"/>
+      </appinfo>
+      <documentation>
+         [Enter information about supplied implementation of this extension point.]
+      </documentation>
+   </annotation>
+
+
+</schema>

+ 20 - 21
plugins/org.yakindu.sct.ui.editor/src/org/yakindu/sct/ui/editor/extensions/ExpressionLanguageProviderExtensions.java

@@ -31,9 +31,10 @@ public class ExpressionLanguageProviderExtensions {
 	private static final String ATTR_RESOURCE_EXTENSION = "resourceExtension";
 
 	private static final String ATTR_SEMANTIC_TARGET = "semanticTarget";
-	
+
 	private static final Map<String, IExpressionLanguageProvider> providerMap = new HashMap<String, IExpressionLanguageProvider>();
 
+	@Deprecated
 	public enum SemanticTarget {
 		StatechartSpecification, StateSpecification, TransitionSpecification
 	}
@@ -42,29 +43,19 @@ public class ExpressionLanguageProviderExtensions {
 		// Not intended to be instantiated
 	}
 
-	/**
-	 * Returns all registered {@link IExpressionLanguageProvider}s
-	 * 
-	 */
-	public static IExpressionLanguageProvider getRegisteredProvider(
-			SemanticTarget target, String resourceExtension) {
-		IConfigurationElement[] configurationElements = Platform
-				.getExtensionRegistry().getConfigurationElementsFor(
-						EXPRESSIONS_EXTENSION);
+	public static IExpressionLanguageProvider getLanguageProvider(String target, String resourceExtension) {
+		IConfigurationElement[] configurationElements = Platform.getExtensionRegistry().getConfigurationElementsFor(
+				EXPRESSIONS_EXTENSION);
 		for (IConfigurationElement configurationElement : configurationElements) {
 			try {
-				String semanticTarget = configurationElement
-						.getAttribute(ATTR_SEMANTIC_TARGET);
-				String registeredExtension = configurationElement
-						.getAttribute(ATTR_RESOURCE_EXTENSION);
-				if (SemanticTarget.valueOf(semanticTarget) == target
-						&& resourceExtension.equals(registeredExtension)) {
-					
-					String key = target.name()+configurationElement.getNamespaceIdentifier();
-					if (providerMap.get(key)!=null) {
+				String semanticTarget = configurationElement.getAttribute(ATTR_SEMANTIC_TARGET);
+				String registeredExtension = configurationElement.getAttribute(ATTR_RESOURCE_EXTENSION);
+				if (target.equals(semanticTarget) && resourceExtension.equals(registeredExtension)) {
+
+					String key = target + configurationElement.getNamespaceIdentifier();
+					if (providerMap.get(key) != null) {
 						return providerMap.get(key);
-					}
-					else {
+					} else {
 						IExpressionLanguageProvider provider = (IExpressionLanguageProvider) configurationElement
 								.createExecutableExtension(ATTR_CLASS);
 						providerMap.put(key, provider);
@@ -77,4 +68,12 @@ public class ExpressionLanguageProviderExtensions {
 		}
 		return new IExpressionLanguageProvider.NullLanguageProvider();
 	}
+
+	@Deprecated
+	/**
+	 * Deprecated, use getLanguageProvider instead.
+	 */
+	public static IExpressionLanguageProvider getRegisteredProvider(SemanticTarget target, String resourceExtension) {
+		return getLanguageProvider(target.name(), resourceExtension);
+	}
 }

+ 37 - 277
plugins/org.yakindu.sct.ui.editor/src/org/yakindu/sct/ui/editor/providers/StatechartValidationDecorationProvider.java

@@ -10,41 +10,18 @@
  */
 package org.yakindu.sct.ui.editor.providers;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
 
-import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
 import org.eclipse.draw2d.FlowLayout;
 import org.eclipse.draw2d.Label;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
-import org.eclipse.gef.EditDomain;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.editparts.AbstractConnectionEditPart;
-import org.eclipse.gmf.runtime.common.core.service.AbstractProvider;
-import org.eclipse.gmf.runtime.common.core.service.IOperation;
-import org.eclipse.gmf.runtime.common.ui.resources.FileChangeManager;
-import org.eclipse.gmf.runtime.common.ui.resources.IFileObserver;
 import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditDomain;
-import org.eclipse.gmf.runtime.diagram.ui.services.decorator.AbstractDecorator;
-import org.eclipse.gmf.runtime.diagram.ui.services.decorator.CreateDecoratorsOperation;
-import org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecorator;
 import org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorProvider;
 import org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorTarget;
-import org.eclipse.gmf.runtime.draw2d.ui.mapmode.MapModeUtil;
-import org.eclipse.gmf.runtime.notation.Diagram;
 import org.eclipse.gmf.runtime.notation.Edge;
 import org.eclipse.gmf.runtime.notation.View;
 import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.ISharedImages;
 import org.eclipse.ui.PlatformUI;
 import org.yakindu.sct.model.sgraph.FinalState;
@@ -52,147 +29,53 @@ import org.yakindu.sct.model.sgraph.Pseudostate;
 import org.yakindu.sct.ui.editor.editor.StatechartDiagramEditor;
 import org.yakindu.sct.ui.editor.validation.IMarkerType;
 
-import com.google.common.collect.Lists;
+import de.itemis.gmf.runtime.commons.decorators.AbstractMarkerBasedDecorationProvider;
 
-/**
- * 
- * This class is copied from GMF Generator code...
- * 
- * TODO: Move common code to gmf.runtime.commons
- */
-@SuppressWarnings("all")
-public class StatechartValidationDecorationProvider extends AbstractProvider
-		implements IDecoratorProvider, IMarkerType {
-
-	private static final String KEY = "validationStatus";
-
-	private static MarkerObserver fileObserver;
+public class StatechartValidationDecorationProvider extends AbstractMarkerBasedDecorationProvider implements
+		IDecoratorProvider, IMarkerType {
 
-	private static Map<String, List<IDecorator>> allDecorators = new HashMap<String, List<IDecorator>>();
+	private static final String KEY = "org.yakindu.sct.ui.editor.validation";
 
-	public void createDecorators(IDecoratorTarget decoratorTarget) {
-		EditPart editPart = (EditPart) decoratorTarget
-				.getAdapter(EditPart.class);
-		if (editPart instanceof GraphicalEditPart
-				|| editPart instanceof AbstractConnectionEditPart) {
-			Object model = editPart.getModel();
-			if ((model instanceof View)) {
-				View view = (View) model;
-			}
-			EditDomain ed = editPart.getViewer().getEditDomain();
-			if (!(ed instanceof DiagramEditDomain)) {
-				return;
-			}
-			if (((DiagramEditDomain) ed).getEditorPart() instanceof StatechartDiagramEditor) {
-				decoratorTarget.installDecorator(KEY, new StatusDecorator(
-						decoratorTarget));
-			}
-		}
+	@Override
+	protected boolean shouldInstall(IEditorPart part) {
+		return part instanceof StatechartDiagramEditor;
 	}
 
-	public boolean provides(IOperation operation) {
-		if (!(operation instanceof CreateDecoratorsOperation)) {
-			return false;
-		}
-		IDecoratorTarget decoratorTarget = ((CreateDecoratorsOperation) operation)
-				.getDecoratorTarget();
-		View view = (View) decoratorTarget.getAdapter(View.class);
-		return view != null;
-	}
-
-	public static void refreshDecorators(View view) {
-		refreshDecorators(ViewUtil.getIdStr(view), view.getDiagram());
+	@Override
+	protected String getDecoratorKey() {
+		return KEY;
 	}
 
-	private static void refreshDecorators(String viewId, Diagram diagram) {
-		final List decorators = viewId != null ? (List) allDecorators
-				.get(viewId) : null;
-		if (decorators == null || decorators.isEmpty() || diagram == null) {
-			return;
-		}
-		final Diagram fdiagram = diagram;
-		PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
-
-			public void run() {
-				for (Iterator it = decorators.iterator(); it.hasNext();) {
-					IDecorator decorator = (IDecorator) it.next();
-					decorator.refresh();
-				}
-			}
-		});
+	@Override
+	protected StatusDecorator createStatusDecorator(IDecoratorTarget decoratorTarget) {
+		return new ValidationDecorator(decoratorTarget);
 	}
 
-	public static class StatusDecorator extends AbstractDecorator {
-
-		private String viewId;
+	public static class ValidationDecorator extends StatusDecorator {
 
-		public StatusDecorator(IDecoratorTarget decoratorTarget) {
+		public ValidationDecorator(IDecoratorTarget decoratorTarget) {
 			super(decoratorTarget);
-			try {
-				final View view = (View) getDecoratorTarget().getAdapter(
-						View.class);
-				TransactionUtil.getEditingDomain(view).runExclusive(
-						new Runnable() {
-
-							public void run() {
-								StatusDecorator.this.viewId = view != null ? ViewUtil
-										.getIdStr(view) : null;
-							}
-						});
-			} catch (Exception e) {
-				e.printStackTrace();
-			}
 		}
 
-		public void refresh() {
-			removeDecoration();
-			View view = (View) getDecoratorTarget().getAdapter(View.class);
-			if (view == null || view.eResource() == null) {
-				return;
-			}
-			EditPart editPart = (EditPart) getDecoratorTarget().getAdapter(
-					EditPart.class);
-			if (editPart == null || editPart.getViewer() == null) {
-				return;
-			}
-
-			// query for all the validation markers of the current resource
+		@Override
+		protected void createDecorators(View view, List<IMarker> markers) {
 			String elementId = ViewUtil.getIdStr(view);
 			if (elementId == null) {
 				return;
 			}
 			int severity = IMarker.SEVERITY_INFO;
 			IMarker foundMarker = null;
-			IResource resource = WorkspaceSynchronizer
-					.getFile(view.eResource());
-			if (resource == null || !resource.exists()) {
-				return;
-			}
-			List<IMarker> markers = Lists.newArrayList();
-			try {
-				markers.addAll(Arrays.asList(resource.findMarkers(
-						SCT_MARKER_TYPE, true, IResource.DEPTH_INFINITE)));
-			} catch (CoreException e) {
-				e.printStackTrace();
-			}
-			if (markers == null || markers.size() == 0) {
-				return;
-			}
 			Label toolTip = null;
 			for (int i = 0; i < markers.size(); i++) {
 				IMarker marker = markers.get(i);
-				String attribute = marker
-						.getAttribute(
-								org.eclipse.gmf.runtime.common.ui.resources.IMarker.ELEMENT_ID,
-								""); //$NON-NLS-1$
+				String attribute = marker.getAttribute(org.eclipse.gmf.runtime.common.ui.resources.IMarker.ELEMENT_ID,
+						"");
 				if (attribute.equals(elementId)) {
-					int nextSeverity = marker.getAttribute(IMarker.SEVERITY,
-							IMarker.SEVERITY_INFO);
+					int nextSeverity = marker.getAttribute(IMarker.SEVERITY, IMarker.SEVERITY_INFO);
 					Image nextImage = getImage(nextSeverity);
 					if (foundMarker == null) {
 						foundMarker = marker;
-						toolTip = new Label(marker.getAttribute(
-								IMarker.MESSAGE, ""), //$NON-NLS-1$
+						toolTip = new Label(marker.getAttribute(IMarker.MESSAGE, ""), //$NON-NLS-1$
 								nextImage);
 					} else {
 						if (toolTip.getChildren().isEmpty()) {
@@ -203,40 +86,32 @@ public class StatechartValidationDecorationProvider extends AbstractProvider
 							comositeLabel.add(toolTip);
 							toolTip = comositeLabel;
 						}
-						toolTip.add(new Label(marker.getAttribute(
-								IMarker.MESSAGE, ""), //$NON-NLS-1$
+						toolTip.add(new Label(marker.getAttribute(IMarker.MESSAGE, ""), //$NON-NLS-1$
 								nextImage));
 					}
-					severity = (nextSeverity > severity) ? nextSeverity
-							: severity;
+					severity = (nextSeverity > severity) ? nextSeverity : severity;
 				}
 			}
 			if (foundMarker == null) {
 				return;
 			}
 
-			// add decoration
-			if (editPart instanceof org.eclipse.gef.GraphicalEditPart) {
-				if (view instanceof Edge) {
-					setDecoration(getDecoratorTarget().addConnectionDecoration(
-							getImage(severity), 50, true));
-				} else {
-					int margin = view.getElement() instanceof Pseudostate
-							|| view.getElement() instanceof FinalState ? 0 : -1;
-					if (editPart instanceof org.eclipse.gef.GraphicalEditPart) {
-						margin = MapModeUtil.getMapMode(
-								((org.eclipse.gef.GraphicalEditPart) editPart)
-										.getFigure()).DPtoLP(margin);
-					}
-					setDecoration(getDecoratorTarget()
-							.addShapeDecoration(getImage(severity),
-									IDecoratorTarget.Direction.NORTH_EAST,
-									margin, true));
-				}
+			if (view instanceof Edge) {
+				setDecoration(getDecoratorTarget().addConnectionDecoration(getImage(severity), 50, true));
+			} else {
+				int margin = view.getElement() instanceof Pseudostate || view.getElement() instanceof FinalState ? 0
+						: -1;
+				setDecoration(getDecoratorTarget().addShapeDecoration(getImage(severity),
+						IDecoratorTarget.Direction.NORTH_EAST, margin, true));
 				getDecoration().setToolTip(toolTip);
 			}
 		}
 
+		@Override
+		protected String getMarkerType() {
+			return SCT_MARKER_TYPE;
+		}
+
 		private Image getImage(int severity) {
 			String imageName = ISharedImages.IMG_OBJS_ERROR_TSK;
 			switch (severity) {
@@ -249,122 +124,7 @@ public class StatechartValidationDecorationProvider extends AbstractProvider
 			default:
 				imageName = ISharedImages.IMG_OBJS_INFO_TSK;
 			}
-			return PlatformUI.getWorkbench().getSharedImages()
-					.getImage(imageName);
-		}
-
-		public void activate() {
-			if (viewId == null) {
-				return;
-			}
-
-			// add self to global decorators registry
-			List list = (List) allDecorators.get(viewId);
-			if (list == null) {
-				list = new ArrayList(2);
-				list.add(this);
-				allDecorators.put(viewId, list);
-			} else if (!list.contains(this)) {
-				list.add(this);
-			}
-
-			// start listening to changes in resources
-			View view = (View) getDecoratorTarget().getAdapter(View.class);
-			if (view == null) {
-				return;
-			}
-			Diagram diagramView = view.getDiagram();
-			if (diagramView == null) {
-				return;
-			}
-			if (fileObserver == null) {
-				FileChangeManager.getInstance().addFileObserver(
-						fileObserver = new MarkerObserver(diagramView));
-			}
-		}
-
-		public void deactivate() {
-			if (viewId == null) {
-				return;
-			}
-
-			// remove self from global decorators registry
-			List list = (List) allDecorators.get(viewId);
-			if (list != null) {
-				list.remove(this);
-				if (list.isEmpty()) {
-					allDecorators.remove(viewId);
-				}
-			}
-
-			// stop listening to changes in resources if there are no more
-			// decorators
-			if (fileObserver != null && allDecorators.isEmpty()) {
-				FileChangeManager.getInstance()
-						.removeFileObserver(fileObserver);
-				fileObserver = null;
-			}
-			super.deactivate();
-		}
-	}
-
-	static class MarkerObserver implements IFileObserver {
-
-		private final Diagram diagram;
-
-		private MarkerObserver(Diagram diagram) {
-			this.diagram = diagram;
-		}
-
-		public void handleFileRenamed(IFile oldFile, IFile file) {
-		}
-
-		public void handleFileMoved(IFile oldFile, IFile file) {
-		}
-
-		public void handleFileDeleted(IFile file) {
-		}
-
-		public void handleFileChanged(IFile file) {
-		}
-
-		public void handleMarkerAdded(IMarker marker) {
-			if (marker
-					.getAttribute(
-							org.eclipse.gmf.runtime.common.ui.resources.IMarker.ELEMENT_ID,
-							null) != null) {
-				handleMarkerChanged(marker);
-			}
-		}
-
-		public void handleMarkerDeleted(IMarker marker, Map attributes) {
-			if (attributes == null)
-				return;
-			String viewId = (String) attributes
-					.get(org.eclipse.gmf.runtime.common.ui.resources.IMarker.ELEMENT_ID);
-			if (viewId == null)
-				return;
-			refreshDecorators(viewId, diagram);
-		}
-
-		public void handleMarkerChanged(IMarker marker) {
-			if (!SCT_MARKER_TYPE.equals(getType(marker))) {
-				return;
-			}
-			String viewId = marker
-					.getAttribute(
-							org.eclipse.gmf.runtime.common.ui.resources.IMarker.ELEMENT_ID,
-							""); //$NON-NLS-1$
-			refreshDecorators(viewId, diagram);
-		}
-
-		private String getType(IMarker marker) {
-			try {
-				return marker.getType();
-			} catch (CoreException e) {
-				e.printStackTrace();
-				return null;
-			}
+			return PlatformUI.getWorkbench().getSharedImages().getImage(imageName);
 		}
 	}
 }

+ 5 - 0
plugins/org.yakindu.sct.ui.integration.stext/plugin.xml

@@ -18,5 +18,10 @@
             resourceExtension="sct"
             semanticTarget="TransitionSpecification">
       </ExpressionLanguageProvider>
+      <ExpressionLanguageProvider
+            class="org.yakindu.sct.ui.integration.stext.ExpressionExpressionProvider"
+            resourceExtension="sct"
+            semanticTarget="breakpointCondition">
+      </ExpressionLanguageProvider>
    </extension>
 </plugin>

+ 27 - 0
plugins/org.yakindu.sct.ui.integration.stext/src/org/yakindu/sct/ui/integration/stext/ExpressionExpressionProvider.java

@@ -0,0 +1,27 @@
+package org.yakindu.sct.ui.integration.stext;
+
+import org.yakindu.sct.model.stext.stext.Expression;
+import org.yakindu.sct.ui.editor.extensions.AbstractExpressionsProvider;
+import org.yakindu.sct.ui.editor.extensions.IExpressionLanguageProvider;
+import org.yakindu.sct.ui.integration.stext.modules.EntryRuleRuntimeModule;
+import org.yakindu.sct.ui.integration.stext.modules.EntryRuleUIModule;
+
+import com.google.inject.Module;
+
+/**
+ * 
+ * @author andreas muelder - Initial contribution and API
+ * 
+ */
+public class ExpressionExpressionProvider extends AbstractExpressionsProvider implements IExpressionLanguageProvider {
+
+	@Override
+	protected Module getRuntimeModule() {
+		return new EntryRuleRuntimeModule(Expression.class);
+	}
+
+	@Override
+	protected Module getUIModule() {
+		return new EntryRuleUIModule(ExtensionsActivator.getDefault(), Expression.class);
+	}
+}

+ 6 - 6
plugins/org.yakindu.sct.ui.integration.stext/src/org/yakindu/sct/ui/integration/stext/StateExpressionProvider.java

@@ -1,9 +1,10 @@
 package org.yakindu.sct.ui.integration.stext;
 
+import org.yakindu.sct.model.stext.stext.StateSpecification;
 import org.yakindu.sct.ui.editor.extensions.AbstractExpressionsProvider;
 import org.yakindu.sct.ui.editor.extensions.IExpressionLanguageProvider;
-import org.yakindu.sct.ui.integration.stext.modules.StateRuntimeModule;
-import org.yakindu.sct.ui.integration.stext.modules.StateUIModule;
+import org.yakindu.sct.ui.integration.stext.modules.EntryRuleRuntimeModule;
+import org.yakindu.sct.ui.integration.stext.modules.EntryRuleUIModule;
 
 import com.google.inject.Module;
 
@@ -12,16 +13,15 @@ import com.google.inject.Module;
  * @author andreas muelder - Initial contribution and API
  * 
  */
-public class StateExpressionProvider extends AbstractExpressionsProvider
-		implements IExpressionLanguageProvider {
+public class StateExpressionProvider extends AbstractExpressionsProvider implements IExpressionLanguageProvider {
 
 	@Override
 	protected Module getRuntimeModule() {
-		return new StateRuntimeModule();
+		return new EntryRuleRuntimeModule(StateSpecification.class);
 	}
 
 	@Override
 	protected Module getUIModule() {
-		return new StateUIModule(ExtensionsActivator.getDefault());
+		return new EntryRuleUIModule(ExtensionsActivator.getDefault(), StateSpecification.class);
 	}
 }

+ 6 - 6
plugins/org.yakindu.sct.ui.integration.stext/src/org/yakindu/sct/ui/integration/stext/StatechartExpressionProvider.java

@@ -1,9 +1,10 @@
 package org.yakindu.sct.ui.integration.stext;
 
+import org.yakindu.sct.model.stext.stext.StatechartSpecification;
 import org.yakindu.sct.ui.editor.extensions.AbstractExpressionsProvider;
 import org.yakindu.sct.ui.editor.extensions.IExpressionLanguageProvider;
-import org.yakindu.sct.ui.integration.stext.modules.StatechartRuntimeModule;
-import org.yakindu.sct.ui.integration.stext.modules.StatechartUIModule;
+import org.yakindu.sct.ui.integration.stext.modules.EntryRuleRuntimeModule;
+import org.yakindu.sct.ui.integration.stext.modules.EntryRuleUIModule;
 
 import com.google.inject.Module;
 
@@ -12,16 +13,15 @@ import com.google.inject.Module;
  * @author andreas muelder - Initial contribution and API
  * 
  */
-public class StatechartExpressionProvider extends AbstractExpressionsProvider
-		implements IExpressionLanguageProvider {
+public class StatechartExpressionProvider extends AbstractExpressionsProvider implements IExpressionLanguageProvider {
 
 	@Override
 	protected Module getRuntimeModule() {
-		return new StatechartRuntimeModule();
+		return new EntryRuleRuntimeModule(StatechartSpecification.class);
 	}
 
 	@Override
 	protected Module getUIModule() {
-		return new StatechartUIModule(ExtensionsActivator.getDefault());
+		return new EntryRuleUIModule(ExtensionsActivator.getDefault(), StatechartSpecification.class);
 	}
 }

+ 6 - 6
plugins/org.yakindu.sct.ui.integration.stext/src/org/yakindu/sct/ui/integration/stext/TransitionExpressionProvider.java

@@ -1,9 +1,10 @@
 package org.yakindu.sct.ui.integration.stext;
 
+import org.yakindu.sct.model.stext.stext.TransitionSpecification;
 import org.yakindu.sct.ui.editor.extensions.AbstractExpressionsProvider;
 import org.yakindu.sct.ui.editor.extensions.IExpressionLanguageProvider;
-import org.yakindu.sct.ui.integration.stext.modules.TransitionRuntimeModule;
-import org.yakindu.sct.ui.integration.stext.modules.TransitionUIModule;
+import org.yakindu.sct.ui.integration.stext.modules.EntryRuleRuntimeModule;
+import org.yakindu.sct.ui.integration.stext.modules.EntryRuleUIModule;
 
 import com.google.inject.Module;
 
@@ -12,16 +13,15 @@ import com.google.inject.Module;
  * @author andreas muelder - Initial contribution and API
  * 
  */
-public class TransitionExpressionProvider extends AbstractExpressionsProvider
-		implements IExpressionLanguageProvider {
+public class TransitionExpressionProvider extends AbstractExpressionsProvider implements IExpressionLanguageProvider {
 
 	@Override
 	protected Module getRuntimeModule() {
-		return new TransitionRuntimeModule();
+		return new EntryRuleRuntimeModule(TransitionSpecification.class);
 	}
 
 	@Override
 	protected Module getUIModule() {
-		return new TransitionUIModule(ExtensionsActivator.getDefault());
+		return new EntryRuleUIModule(ExtensionsActivator.getDefault(), TransitionSpecification.class);
 	}
 }

+ 30 - 0
plugins/org.yakindu.sct.ui.integration.stext/src/org/yakindu/sct/ui/integration/stext/modules/EntryRuleRuntimeModule.java

@@ -0,0 +1,30 @@
+package org.yakindu.sct.ui.integration.stext.modules;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.xtext.parser.IParser;
+import org.yakindu.sct.model.stext.STextRuntimeModule;
+import org.yakindu.sct.ui.integration.stext.parsers.EntryRuleAntlrSTextParser;
+
+import com.google.inject.Binder;
+import com.google.inject.name.Names;
+
+public class EntryRuleRuntimeModule extends STextRuntimeModule {
+
+	private Class<? extends EObject> parserRule;
+
+	public EntryRuleRuntimeModule(Class<? extends EObject> parserRule) {
+		this.parserRule = parserRule;
+	}
+
+	@Override
+	public void configure(Binder binder) {
+		super.configure(binder);
+		binder.bind(String.class).annotatedWith(Names.named(EntryRuleAntlrSTextParser.ENTRY_RULE))
+				.toInstance(parserRule.getSimpleName());
+	}
+
+	@Override
+	public Class<? extends IParser> bindIParser() {
+		return EntryRuleAntlrSTextParser.class;
+	}
+}

+ 34 - 0
plugins/org.yakindu.sct.ui.integration.stext/src/org/yakindu/sct/ui/integration/stext/modules/EntryRuleUIModule.java

@@ -0,0 +1,34 @@
+package org.yakindu.sct.ui.integration.stext.modules;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.eclipse.xtext.ui.editor.contentassist.antlr.IContentAssistParser;
+import org.yakindu.sct.model.stext.ui.STextUiModule;
+import org.yakindu.sct.ui.integration.stext.parsers.EntryRuleAntlrSTextParser;
+import org.yakindu.sct.ui.integration.stext.parsers.EntryRuleContentAssistParser;
+
+import com.google.inject.Binder;
+import com.google.inject.name.Names;
+
+public class EntryRuleUIModule extends STextUiModule {
+
+	private Class<? extends EObject> parserRule;
+
+	public EntryRuleUIModule(AbstractUIPlugin plugin, Class<? extends EObject> parserRule) {
+		super(plugin);
+		this.parserRule = parserRule;
+	}
+
+	@Override
+	public void configure(Binder binder) {
+		super.configure(binder);
+		binder.bind(String.class).annotatedWith(Names.named(EntryRuleAntlrSTextParser.ENTRY_RULE))
+				.toInstance(parserRule.getSimpleName());
+	}
+
+	@Override
+	public Class<? extends IContentAssistParser> bindIContentAssistParser() {
+		return EntryRuleContentAssistParser.class;
+	}
+
+}

+ 0 - 27
plugins/org.yakindu.sct.ui.integration.stext/src/org/yakindu/sct/ui/integration/stext/modules/StateRuntimeModule.java

@@ -1,27 +0,0 @@
-/**
- * Copyright (c) 2011 committers of YAKINDU and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * Contributors:
- * 	committers of YAKINDU - initial API and implementation
- * 
- */
-package org.yakindu.sct.ui.integration.stext.modules;
-
-import org.eclipse.xtext.parser.IParser;
-import org.yakindu.sct.model.stext.STextRuntimeModule;
-import org.yakindu.sct.ui.integration.stext.parsers.StateAntlrParser;
-
-/**
- * 
- * @author andreas muelder - Initial contribution and API
- * 
- */
-public class StateRuntimeModule extends STextRuntimeModule {
-	@Override
-	public Class<? extends IParser> bindIParser() {
-		return StateAntlrParser.class;
-	}
-}

+ 0 - 38
plugins/org.yakindu.sct.ui.integration.stext/src/org/yakindu/sct/ui/integration/stext/modules/StateUIModule.java

@@ -1,38 +0,0 @@
-/**
- * Copyright (c) 2011 committers of YAKINDU and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * Contributors:
- * 	committers of YAKINDU - initial API and implementation
- * 
- */
-package org.yakindu.sct.ui.integration.stext.modules;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.eclipse.xtext.ui.editor.contentassist.antlr.IContentAssistParser;
-import org.eclipse.xtext.ui.editor.hover.ProblemAnnotationHover;
-import org.yakindu.sct.model.stext.ui.STextUiModule;
-import org.yakindu.sct.ui.integration.stext.parsers.StateContentAssistParser;
-
-/**
- * 
- * @author andreas muelder - Initial contribution and API
- * 
- */
-public class StateUIModule extends STextUiModule {
-
-	public StateUIModule(AbstractUIPlugin plugin) {
-		super(plugin);
-	}
-
-	@Override
-	public Class<? extends IContentAssistParser> bindIContentAssistParser() {
-		return StateContentAssistParser.class;
-	}
-
-	public Class<? extends org.eclipse.jface.text.ITextHover> bindITextHover() {
-		return ProblemAnnotationHover.class;
-	}
-}

+ 0 - 26
plugins/org.yakindu.sct.ui.integration.stext/src/org/yakindu/sct/ui/integration/stext/modules/StatechartRuntimeModule.java

@@ -1,26 +0,0 @@
-/**
- * Copyright (c) 2011 committers of YAKINDU and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * Contributors:
- * 	committers of YAKINDU - initial API and implementation
- * 
- */
-package org.yakindu.sct.ui.integration.stext.modules;
-
-import org.eclipse.xtext.parser.IParser;
-import org.yakindu.sct.model.stext.STextRuntimeModule;
-import org.yakindu.sct.ui.integration.stext.parsers.StatechartAntlrParser;
-/**
- * 
- * @author andreas muelder - Initial contribution and API
- * 
- */
-public class StatechartRuntimeModule extends STextRuntimeModule {
-	@Override
-	public Class<? extends IParser> bindIParser() {
-		return StatechartAntlrParser.class;
-	}
-}

+ 0 - 38
plugins/org.yakindu.sct.ui.integration.stext/src/org/yakindu/sct/ui/integration/stext/modules/StatechartUIModule.java

@@ -1,38 +0,0 @@
-/**
- * Copyright (c) 2011 committers of YAKINDU and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * Contributors:
- * 	committers of YAKINDU - initial API and implementation
- * 
- */
-package org.yakindu.sct.ui.integration.stext.modules;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.eclipse.xtext.ui.editor.contentassist.antlr.IContentAssistParser;
-import org.eclipse.xtext.ui.editor.hover.ProblemAnnotationHover;
-import org.yakindu.sct.model.stext.ui.STextUiModule;
-import org.yakindu.sct.ui.integration.stext.parsers.StatechartContentAssistParser;
-/**
- * 
- * @author andreas muelder - Initial contribution and API
- * 
- */
-public class StatechartUIModule extends STextUiModule {
-
-	public StatechartUIModule(AbstractUIPlugin plugin) {
-		super(plugin);
-	}
-
-	@Override
-	public Class<? extends IContentAssistParser> bindIContentAssistParser() {
-		return StatechartContentAssistParser.class;
-	}
-	
-	public Class<? extends org.eclipse.jface.text.ITextHover> bindITextHover() {
-		return ProblemAnnotationHover.class;
-	}
-
-}

+ 0 - 27
plugins/org.yakindu.sct.ui.integration.stext/src/org/yakindu/sct/ui/integration/stext/modules/TransitionRuntimeModule.java

@@ -1,27 +0,0 @@
-/**
- * Copyright (c) 2011 committers of YAKINDU and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * Contributors:
- * 	committers of YAKINDU - initial API and implementation
- * 
- */
-package org.yakindu.sct.ui.integration.stext.modules;
-
-import org.eclipse.xtext.parser.IParser;
-import org.yakindu.sct.model.stext.STextRuntimeModule;
-import org.yakindu.sct.ui.integration.stext.parsers.TransitionAntlrParser;
-
-/**
- * 
- * @author andreas muelder - Initial contribution and API
- * 
- */
-public class TransitionRuntimeModule extends STextRuntimeModule {
-	@Override
-	public Class<? extends IParser> bindIParser() {
-		return TransitionAntlrParser.class;
-	}
-}

+ 0 - 29
plugins/org.yakindu.sct.ui.integration.stext/src/org/yakindu/sct/ui/integration/stext/modules/TransitionUIModule.java

@@ -1,29 +0,0 @@
-package org.yakindu.sct.ui.integration.stext.modules;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.eclipse.xtext.ui.editor.contentassist.antlr.IContentAssistParser;
-import org.eclipse.xtext.ui.editor.hover.ProblemAnnotationHover;
-import org.yakindu.sct.model.stext.ui.STextUiModule;
-import org.yakindu.sct.ui.integration.stext.parsers.TransitionContentAssistParser;
-
-/**
- * 
- * @author andreas muelder - Initial contribution and API
- * 
- */
-public class TransitionUIModule extends STextUiModule {
-
-	public TransitionUIModule(AbstractUIPlugin plugin) {
-		super(plugin);
-	}
-
-	@Override
-	public Class<? extends IContentAssistParser> bindIContentAssistParser() {
-		return TransitionContentAssistParser.class;
-	}
-	
-	public Class<? extends org.eclipse.jface.text.ITextHover> bindITextHover() {
-		return ProblemAnnotationHover.class;
-	}
-	
-}

+ 19 - 0
plugins/org.yakindu.sct.ui.integration.stext/src/org/yakindu/sct/ui/integration/stext/parsers/EntryRuleAntlrSTextParser.java

@@ -0,0 +1,19 @@
+package org.yakindu.sct.ui.integration.stext.parsers;
+
+import org.yakindu.sct.model.stext.parser.antlr.STextParser;
+
+import com.google.inject.Inject;
+import com.google.inject.name.Named;
+
+public class EntryRuleAntlrSTextParser extends STextParser implements IParserConstants {
+
+	@Inject(optional = true)
+	@Named(ENTRY_RULE)
+	private String entryRule;
+
+	@Override
+	protected String getDefaultRuleName() {
+		return entryRule != null ? entryRule : super.getDefaultRuleName();
+	}
+
+}

+ 15 - 6
plugins/org.yakindu.sct.ui.integration.stext/src/org/yakindu/sct/ui/integration/stext/parsers/TransitionContentAssistParser.java

@@ -1,28 +1,37 @@
 package org.yakindu.sct.ui.integration.stext.parsers;
 
+import java.lang.reflect.Method;
 import java.util.Collection;
 
-import org.antlr.runtime.RecognitionException;
 import org.eclipse.xtext.ui.editor.contentassist.antlr.FollowElement;
 import org.eclipse.xtext.ui.editor.contentassist.antlr.internal.AbstractInternalContentAssistParser;
 import org.yakindu.sct.model.stext.ui.contentassist.antlr.STextParser;
 import org.yakindu.sct.model.stext.ui.contentassist.antlr.internal.InternalSTextParser;
 
+import com.google.inject.Inject;
+import com.google.inject.name.Named;
+
 /**
  * 
  * @author muelder
  * 
  */
-public class TransitionContentAssistParser extends STextParser {
+public class EntryRuleContentAssistParser extends STextParser implements IParserConstants {
+
+	@Inject(optional = true)
+	@Named(ENTRY_RULE)
+	private String entryRule;
 
 	@Override
-	protected Collection<FollowElement> getFollowElements(
-			AbstractInternalContentAssistParser parser) {
+	protected Collection<FollowElement> getFollowElements(AbstractInternalContentAssistParser parser) {
+		if (entryRule == null)
+			return super.getFollowElements(parser);
 		try {
 			InternalSTextParser typedParser = (InternalSTextParser) parser;
-			typedParser.entryRuleTransitionSpecification();
+			Method method = typedParser.getClass().getMethod(ENTRY_RULE + entryRule);
+			method.invoke(typedParser);
 			return typedParser.getFollowElements();
-		} catch (RecognitionException ex) {
+		} catch (Exception ex) {
 			throw new RuntimeException(ex);
 		}
 	}

+ 6 - 0
plugins/org.yakindu.sct.ui.integration.stext/src/org/yakindu/sct/ui/integration/stext/parsers/IParserConstants.java

@@ -0,0 +1,6 @@
+package org.yakindu.sct.ui.integration.stext.parsers;
+
+public interface IParserConstants {
+
+	public static final String ENTRY_RULE = "entryRule";
+}

+ 0 - 17
plugins/org.yakindu.sct.ui.integration.stext/src/org/yakindu/sct/ui/integration/stext/parsers/StateAntlrParser.java

@@ -1,17 +0,0 @@
-package org.yakindu.sct.ui.integration.stext.parsers;
-
-import org.yakindu.sct.model.stext.parser.antlr.STextParser;
-import org.yakindu.sct.model.stext.stext.StateSpecification;
-
-
-/**
- * 
- * @author muelder
- * 
- */
-public class StateAntlrParser extends STextParser {
-	@Override
-	protected String getDefaultRuleName() {
-		return StateSpecification.class.getSimpleName();
-	}
-}

+ 0 - 28
plugins/org.yakindu.sct.ui.integration.stext/src/org/yakindu/sct/ui/integration/stext/parsers/StateContentAssistParser.java

@@ -1,28 +0,0 @@
-package org.yakindu.sct.ui.integration.stext.parsers;
-
-import java.util.Collection;
-
-import org.antlr.runtime.RecognitionException;
-import org.eclipse.xtext.ui.editor.contentassist.antlr.FollowElement;
-import org.eclipse.xtext.ui.editor.contentassist.antlr.internal.AbstractInternalContentAssistParser;
-import org.yakindu.sct.model.stext.ui.contentassist.antlr.STextParser;
-import org.yakindu.sct.model.stext.ui.contentassist.antlr.internal.InternalSTextParser;
-/**
- * 
- * @author muelder
- *
- */
-public class StateContentAssistParser extends STextParser   {
-
-	@Override
-	protected Collection<FollowElement> getFollowElements(
-			AbstractInternalContentAssistParser parser) {
-		try {
-			InternalSTextParser typedParser = (InternalSTextParser) parser;
-			typedParser.entryRuleStateSpecification();
-			return typedParser.getFollowElements();
-		} catch(RecognitionException ex) {
-			throw new RuntimeException(ex);
-		}	
-	}
-}

+ 0 - 16
plugins/org.yakindu.sct.ui.integration.stext/src/org/yakindu/sct/ui/integration/stext/parsers/StatechartAntlrParser.java

@@ -1,16 +0,0 @@
-package org.yakindu.sct.ui.integration.stext.parsers;
-
-import org.yakindu.sct.model.stext.parser.antlr.STextParser;
-import org.yakindu.sct.model.stext.stext.StatechartSpecification;
-
-/**
- * 
- * @author muelder
- * 
- */
-public class StatechartAntlrParser extends STextParser {
-	@Override
-	protected String getDefaultRuleName() {
-		return StatechartSpecification.class.getSimpleName();
-	}
-}

+ 0 - 29
plugins/org.yakindu.sct.ui.integration.stext/src/org/yakindu/sct/ui/integration/stext/parsers/StatechartContentAssistParser.java

@@ -1,29 +0,0 @@
-package org.yakindu.sct.ui.integration.stext.parsers;
-
-import java.util.Collection;
-
-import org.antlr.runtime.RecognitionException;
-import org.eclipse.xtext.ui.editor.contentassist.antlr.FollowElement;
-import org.eclipse.xtext.ui.editor.contentassist.antlr.internal.AbstractInternalContentAssistParser;
-import org.yakindu.sct.model.stext.ui.contentassist.antlr.STextParser;
-import org.yakindu.sct.model.stext.ui.contentassist.antlr.internal.InternalSTextParser;
-
-/**
- * 
- * @author muelder
- * 
- */
-public class StatechartContentAssistParser extends STextParser {
-
-	@Override
-	protected Collection<FollowElement> getFollowElements(
-			AbstractInternalContentAssistParser parser) {
-		try {
-			InternalSTextParser typedParser = (InternalSTextParser) parser;
-			typedParser.entryRuleStatechartSpecification();
-			return typedParser.getFollowElements();
-		} catch (RecognitionException ex) {
-			throw new RuntimeException(ex);
-		}
-	}
-}

+ 0 - 14
plugins/org.yakindu.sct.ui.integration.stext/src/org/yakindu/sct/ui/integration/stext/parsers/TransitionAntlrParser.java

@@ -1,14 +0,0 @@
-package org.yakindu.sct.ui.integration.stext.parsers;
-
-import org.yakindu.sct.model.stext.parser.antlr.STextParser;
-import org.yakindu.sct.model.stext.stext.TransitionSpecification;
-
-/**
- * @author muelder
- */
-public class TransitionAntlrParser extends STextParser {
-	@Override
-	protected String getDefaultRuleName() {
-		return TransitionSpecification.class.getSimpleName();
-	}
-}