Просмотр исходного кода

Merge branch 'master' into issue_1438

René Beckmann 8 лет назад
Родитель
Сommit
2d12b88c2b
23 измененных файлов с 419 добавлено и 301 удалено
  1. 5 5
      plugins/org.yakindu.base.expressions/src/org/yakindu/base/expressions/validation/ExpressionsJavaValidator.java
  2. 42 47
      plugins/org.yakindu.base.types.edit/src/org/yakindu/base/types/provider/OperationItemProvider.java
  3. 35 0
      plugins/org.yakindu.base.xtext.utils.jface/src/org/yakindu/base/xtext/utils/jface/viewers/ParallelReadXtextDocument.java
  4. 31 22
      plugins/org.yakindu.base.xtext.utils.jface/src/org/yakindu/base/xtext/utils/jface/viewers/StyledTextXtextAdapter.java
  5. 5 0
      plugins/org.yakindu.sct.doc.user/css/yakindu.css
  6. 54 44
      plugins/org.yakindu.sct.domain/src/org/yakindu/sct/domain/extension/DomainStatus.java
  7. 3 2
      plugins/org.yakindu.sct.generator.core/src/org/yakindu/sct/generator/core/execution/GeneratorExecutorLookup.java
  8. 12 12
      plugins/org.yakindu.sct.generator.genmodel/src/org/yakindu/sct/generator/genmodel/validation/SGenJavaValidator.java
  9. 1 1
      plugins/org.yakindu.sct.generator.runner/plugin.xml
  10. 2 2
      plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/validation/DomainValidator.java
  11. 3 0
      plugins/org.yakindu.sct.model.stext.ui/src/org/yakindu/sct/model/stext/ui/STextUiModule.java
  12. 39 2
      plugins/org.yakindu.sct.model.stext.ui/src/org/yakindu/sct/model/stext/ui/contentassist/AsyncXtextContentAssistProcessor.java
  13. 16 27
      plugins/org.yakindu.sct.model.stext.ui/src/org/yakindu/sct/model/stext/ui/contentassist/STextStatefulFactory.java
  14. 5 1
      plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/expressions/STextExpressionParser.java
  15. 7 73
      plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/scoping/URI2ResourceDescriptionCache.java
  16. 2 2
      plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/validation/STextValidationMessages.java
  17. 8 0
      plugins/org.yakindu.sct.ui.editor/plugin.xml
  18. 5 46
      plugins/org.yakindu.sct.ui.editor/src/org/yakindu/sct/ui/editor/partitioning/DiagramPartitioningUtil.java
  19. 111 0
      plugins/org.yakindu.sct.ui.editor/src/org/yakindu/sct/ui/editor/partitioning/SharedEditingDomainFactory.java
  20. 18 10
      plugins/org.yakindu.sct.ui.editor/src/org/yakindu/sct/ui/editor/validation/LiveValidationListener.java
  21. 1 1
      plugins/org.yakindu.sct.ui.editor/src/org/yakindu/sct/ui/editor/wizards/CreationWizard.java
  22. 2 0
      test-plugins/org.yakindu.sct.generator.c.test/src/org/yakindu/sct/generator/c/gtest/GTest.java
  23. 12 4
      test-plugins/org.yakindu.sct.generator.c.test/src/org/yakindu/sct/generator/c/gtest/GTestHelper.java

+ 5 - 5
plugins/org.yakindu.base.expressions/src/org/yakindu/base/expressions/validation/ExpressionsJavaValidator.java

@@ -68,7 +68,7 @@ public class ExpressionsJavaValidator extends org.yakindu.base.expressions.valid
 	public static final String ERROR_BOUND_MISSMATCH_MSG = "Bound mismatch: The type %s is not a valid substitute for the bounded parameter %s of the type %s.";
 
 	public static final String ERROR_DUPLICATE_TYPE_PARAMETER_CODE = "DuplicateTypeParameter";
-	public static final String ERROR_DUPLICATE_TYPE_PARAMETER_MSG = "Duplicate Type Parameter %s.";
+	public static final String ERROR_DUPLICATE_TYPE_PARAMETER_MSG = "Duplicate type parameter %s.";
 
 	public static final String ERROR_CYCLE_DETECTED_CODE = "TypeExtendsItself";
 	public static final String ERROR_CYCLE_DETECTED_MSG = "Cycle detected: the type %s cannot extend itself.";
@@ -76,20 +76,20 @@ public class ExpressionsJavaValidator extends org.yakindu.base.expressions.valid
 	public static final String ERROR_DUPLICATE_PARAMETER_ASSIGNMENT_CODE = "ErrorDuplicateParameterAssignment";
 	public static final String ERROR_DUPLICATE_PARAMETER_ASSIGNMENT_MSG = "Duplicate assignment to parameter '%s'.";
 	
-	public static final String ERROR_ASSIGNMENT_TO_CONST_MSG = "Assignment to constant not allowed.";
 	public static final String ERROR_ASSIGNMENT_TO_CONST_CODE = "AssignmentToConst";
+	public static final String ERROR_ASSIGNMENT_TO_CONST_MSG = "Assignment to constant not allowed.";
 	
-	public static final String ERROR_LEFT_HAND_ASSIGNMENT_MSG = "The left-hand side of an assignment must be a variable.";
 	public static final String ERROR_LEFT_HAND_ASSIGNMENT_CODE = "LeftHandAssignment";
+	public static final String ERROR_LEFT_HAND_ASSIGNMENT_MSG = "The left-hand side of an assignment must be a variable.";
 	
-	public static final String ERROR_WRONG_NUMBER_OF_ARGUMENTS_MSG = "Wrong number of arguments, expected %s .";
 	public static final String ERROR_WRONG_NUMBER_OF_ARGUMENTS_CODE = "WrongNrOfArgs";
+	public static final String ERROR_WRONG_NUMBER_OF_ARGUMENTS_MSG = "Wrong number of arguments, expected %s .";
 	
 	public static final String ERROR_VAR_ARGS_LAST_CODE = "VarArgsMustBeLast";
 	public static final String ERROR_VAR_ARGS_LAST_MSG = "The variable argument type must be the last argument.";
 	
 	public static final String ERROR_WRONG_ANNOTATION_TARGET_CODE = "WrongAnnotationTarget";
-	public static final String ERROR_WRONG_ANNOTATION_TARGET_MSG = "Annotation '%s' can not be applied on %s ";
+	public static final String ERROR_WRONG_ANNOTATION_TARGET_MSG = "Annotation '%s' can not be applied on %s .";
 	
 	public static final String ERROR_OPTIONAL_MUST_BE_LAST_CODE = "OptionalParametersLast";
 	public static final String ERROR_OPTIONAL_MUST_BE_LAST_MSG = "Required parameters must not be defined after optional parameters.";

+ 42 - 47
plugins/org.yakindu.base.types.edit/src/org/yakindu/base/types/provider/OperationItemProvider.java

@@ -32,9 +32,10 @@ import org.yakindu.base.types.TypesFactory;
 import org.yakindu.base.types.TypesPackage;
 
 /**
- * This is the item provider adapter for a {@link org.yakindu.base.types.Operation} object.
- * <!-- begin-user-doc --> <!--
+ * This is the item provider adapter for a
+ * {@link org.yakindu.base.types.Operation} object. <!-- begin-user-doc --> <!--
  * end-user-doc -->
+ * 
  * @generated
  */
 public class OperationItemProvider extends DeclarationItemProvider {
@@ -65,32 +66,28 @@ public class OperationItemProvider extends DeclarationItemProvider {
 	}
 
 	/**
-	 * This adds a property descriptor for the Variadic feature.
-	 * <!-- begin-user-doc -->
-	 * <!-- end-user-doc -->
+	 * This adds a property descriptor for the Variadic feature. <!-- begin-user-doc
+	 * --> <!-- end-user-doc -->
+	 * 
 	 * @generated
 	 */
 	protected void addVariadicPropertyDescriptor(Object object) {
-		itemPropertyDescriptors.add
-			(createItemPropertyDescriptor
-				(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
-				 getResourceLocator(),
-				 getString("_UI_Operation_variadic_feature"),
-				 getString("_UI_PropertyDescriptor_description", "_UI_Operation_variadic_feature", "_UI_Operation_type"),
-				 TypesPackage.Literals.OPERATION__VARIADIC,
-				 false,
-				 false,
-				 false,
-				 ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
-				 null,
-				 null));
+		itemPropertyDescriptors
+				.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
+						getResourceLocator(), getString("_UI_Operation_variadic_feature"),
+						getString("_UI_PropertyDescriptor_description", "_UI_Operation_variadic_feature",
+								"_UI_Operation_type"),
+						TypesPackage.Literals.OPERATION__VARIADIC, false, false, false,
+						ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, null, null));
 	}
 
 	/**
-	 * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
-	 * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
+	 * This specifies how to implement {@link #getChildren} and is used to deduce an
+	 * appropriate feature for an {@link org.eclipse.emf.edit.command.AddCommand},
+	 * {@link org.eclipse.emf.edit.command.RemoveCommand} or
 	 * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
 	 * <!-- begin-user-doc --> <!-- end-user-doc -->
+	 * 
 	 * @generated
 	 */
 	@Override
@@ -105,19 +102,21 @@ public class OperationItemProvider extends DeclarationItemProvider {
 
 	/**
 	 * <!-- begin-user-doc --> <!-- end-user-doc -->
+	 * 
 	 * @generated
 	 */
 	@Override
 	protected EStructuralFeature getChildFeature(Object object, Object child) {
-		// Check the type of the specified child object and return the proper feature to use for
+		// Check the type of the specified child object and return the proper feature to
+		// use for
 		// adding (see {@link AddCommand}) it as a child.
 
 		return super.getChildFeature(object, child);
 	}
 
 	/**
-	 * This returns Operation.gif.
-	 * <!-- begin-user-doc --> <!-- end-user-doc -->
+	 * This returns Operation.gif. <!-- begin-user-doc --> <!-- end-user-doc -->
+	 * 
 	 * @generated
 	 */
 	@Override
@@ -142,14 +141,14 @@ public class OperationItemProvider extends DeclarationItemProvider {
 			builder.append(sep);
 			builder.append(parameter.getName());
 			builder.append(" : ");
-			String typeName = getTypeName(parameter.getTypeSpecifier());
+			String typeName = parameter.getType().getName();
 			builder.append(typeName);
 			sep = ", ";
 		}
 		builder.append(")");
 		if (operation.getType() != null) {
 			builder.append(" : ");
-			String name = getTypeName(operation.getTypeSpecifier());
+			String name = operation.getType().getName();
 			builder.append(name == null ? "void" : name);
 		}
 		return builder.toString();
@@ -170,10 +169,10 @@ public class OperationItemProvider extends DeclarationItemProvider {
 	}
 
 	/**
-	 * This handles model notifications by calling {@link #updateChildren} to update any cached
-	 * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
-	 * <!-- begin-user-doc --> <!--
-	 * end-user-doc -->
+	 * This handles model notifications by calling {@link #updateChildren} to update
+	 * any cached children and by creating a viewer notification, which it passes to
+	 * {@link #fireNotifyChanged}. <!-- begin-user-doc --> <!-- end-user-doc -->
+	 * 
 	 * @generated
 	 */
 	@Override
@@ -181,21 +180,21 @@ public class OperationItemProvider extends DeclarationItemProvider {
 		updateChildren(notification);
 
 		switch (notification.getFeatureID(Operation.class)) {
-			case TypesPackage.OPERATION__VARIADIC:
-				fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
-				return;
-			case TypesPackage.OPERATION__TYPE_PARAMETERS:
-			case TypesPackage.OPERATION__PARAMETERS:
-				fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
-				return;
+		case TypesPackage.OPERATION__VARIADIC:
+			fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
+			return;
+		case TypesPackage.OPERATION__TYPE_PARAMETERS:
+		case TypesPackage.OPERATION__PARAMETERS:
+			fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
+			return;
 		}
 		super.notifyChanged(notification);
 	}
 
 	/**
-	 * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s
-	 * describing the children that can be created under this object. <!--
-	 * begin-user-doc --> <!-- end-user-doc -->
+	 * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing
+	 * the children that can be created under this object. <!-- begin-user-doc -->
+	 * <!-- end-user-doc -->
 	 * 
 	 * @generated
 	 */
@@ -203,15 +202,11 @@ public class OperationItemProvider extends DeclarationItemProvider {
 	protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
 		super.collectNewChildDescriptors(newChildDescriptors, object);
 
-		newChildDescriptors.add
-			(createChildParameter
-				(TypesPackage.Literals.GENERIC_ELEMENT__TYPE_PARAMETERS,
-				 TypesFactory.eINSTANCE.createTypeParameter()));
+		newChildDescriptors.add(createChildParameter(TypesPackage.Literals.GENERIC_ELEMENT__TYPE_PARAMETERS,
+				TypesFactory.eINSTANCE.createTypeParameter()));
 
-		newChildDescriptors.add
-			(createChildParameter
-				(TypesPackage.Literals.OPERATION__PARAMETERS,
-				 TypesFactory.eINSTANCE.createParameter()));
+		newChildDescriptors.add(createChildParameter(TypesPackage.Literals.OPERATION__PARAMETERS,
+				TypesFactory.eINSTANCE.createParameter()));
 	}
 
 }

+ 35 - 0
plugins/org.yakindu.base.xtext.utils.jface/src/org/yakindu/base/xtext/utils/jface/viewers/ParallelReadXtextDocument.java

@@ -0,0 +1,35 @@
+/** 
+ * Copyright (c) 2017 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.base.xtext.utils.jface.viewers;
+
+import org.eclipse.xtext.ui.editor.model.DocumentTokenSource;
+import org.eclipse.xtext.ui.editor.model.XtextDocument;
+import org.eclipse.xtext.ui.editor.model.edit.ITextEditComposer;
+
+import com.google.inject.Inject;
+
+/**
+ * 
+ * @author andreas muelder - Initial contribution and API
+ * 
+ */
+public class ParallelReadXtextDocument extends XtextDocument {
+
+	@Inject
+	public ParallelReadXtextDocument(DocumentTokenSource tokenSource, ITextEditComposer composer) {
+		super(tokenSource, composer);
+	}
+
+	@Override
+	protected Object getResourceLock() {
+		return new Object();
+	}
+}

+ 31 - 22
plugins/org.yakindu.base.xtext.utils.jface/src/org/yakindu/base/xtext/utils/jface/viewers/StyledTextXtextAdapter.java

@@ -12,7 +12,12 @@ package org.yakindu.base.xtext.utils.jface.viewers;
 
 import java.util.List;
 
+import org.eclipse.core.internal.jobs.JobManager;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
 import org.eclipse.emf.ecore.EObject;
 import org.eclipse.jface.bindings.keys.KeyStroke;
 import org.eclipse.jface.fieldassist.ControlDecoration;
@@ -80,10 +85,6 @@ import com.google.inject.Provider;
 @SuppressWarnings("restriction")
 public class StyledTextXtextAdapter {
 
-	/**
-	 * The sourceViewer, that provides additional functions to the styled text
-	 * widget
-	 */
 	protected XtextSourceViewer sourceviewer;
 
 	private ValidationJob validationJob;
@@ -110,6 +111,8 @@ public class StyledTextXtextAdapter {
 
 	private ControlDecoration decoration;
 
+	private SourceViewerDecorationSupport decorationSupport;
+
 	public StyledTextXtextAdapter(Injector injector, IXtextFakeContextResourcesProvider contextFakeResourceProvider) {
 		this.contextFakeResourceProvider = contextFakeResourceProvider;
 		injector.injectMembers(this);
@@ -187,7 +190,7 @@ public class StyledTextXtextAdapter {
 			styledText.addFocusListener(listener);
 			styledText.addDisposeListener(listener);
 		} catch (NullPointerException ex) {
-			//Do nothing, not opened within editor context
+			// Do nothing, not opened within editor context
 		}
 
 	}
@@ -197,8 +200,8 @@ public class StyledTextXtextAdapter {
 		decoration.setShowHover(true);
 		decoration.setShowOnlyOnFocus(true);
 
-		final Image image = ImageDescriptor.createFromFile(XtextStyledTextCellEditor.class,
-				"images/content_assist_cue.gif").createImage();
+		final Image image = ImageDescriptor
+				.createFromFile(XtextStyledTextCellEditor.class, "images/content_assist_cue.gif").createImage();
 		decoration.setImage(image);
 		decoration.setDescriptionText("Content Assist Available (CTRL + Space)");
 		decoration.setMarginWidth(2);
@@ -215,8 +218,9 @@ public class StyledTextXtextAdapter {
 	}
 
 	protected ValidationJob createValidationJob() {
-		return new ValidationJob(validator, document, new AnnotationIssueProcessor(document,
-				sourceviewer.getAnnotationModel(), resolutionProvider), CheckMode.ALL);
+		return new ValidationJob(validator, document,
+				new AnnotationIssueProcessor(document, sourceviewer.getAnnotationModel(), resolutionProvider),
+				CheckMode.FAST_ONLY);
 	}
 
 	protected void createFakeResourceContext(Injector injector) {
@@ -227,9 +231,9 @@ public class StyledTextXtextAdapter {
 		sourceviewer = new XtextSourceViewerEx(styledText, preferenceStoreAccess.getPreferenceStore());
 		sourceviewer.configure(configuration);
 		sourceviewer.setDocument(document, new AnnotationModel());
-		SourceViewerDecorationSupport support = new SourceViewerDecorationSupport(sourceviewer, null,
-				new DefaultMarkerAnnotationAccess(), getSharedColors());
-		configureSourceViewerDecorationSupport(support);
+		decorationSupport = new SourceViewerDecorationSupport(sourceviewer, null, new DefaultMarkerAnnotationAccess(),
+				getSharedColors());
+		configureSourceViewerDecorationSupport(decorationSupport);
 	}
 
 	protected ISharedTextColors getSharedColors() {
@@ -237,9 +241,8 @@ public class StyledTextXtextAdapter {
 	}
 
 	/**
-	 * Creates decoration support for the sourceViewer. code is entirely copied
-	 * from {@link XtextEditor} and its super class
-	 * {@link AbstractDecoratedTextEditor}.
+	 * Creates decoration support for the sourceViewer. code is entirely copied from
+	 * {@link XtextEditor} and its super class {@link AbstractDecoratedTextEditor}.
 	 * 
 	 */
 	protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {
@@ -254,7 +257,10 @@ public class StyledTextXtextAdapter {
 				BracketMatchingPreferencesInitializer.COLOR_KEY);
 
 		support.install(preferenceStoreAccess.getPreferenceStore());
+	}
 
+	protected void unconfigureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {
+		support.uninstall();
 	}
 
 	protected void initXtextDocument(XtextFakeResourceContext context) {
@@ -285,8 +291,11 @@ public class StyledTextXtextAdapter {
 	}
 
 	public void dispose() {
+		document.setOutdated(true);
+		if (decorationSupport != null) {
+			unconfigureSourceViewerDecorationSupport(decorationSupport);
+		}
 		uninstallHighlightingHelper();
-		document.disposeInput();
 	}
 
 	protected XtextSourceViewerConfiguration getXtextSourceViewerConfiguration() {
@@ -383,12 +392,12 @@ public class StyledTextXtextAdapter {
 		}
 
 		public void widgetDisposed(DisposeEvent e) {
-            if (selectionProviderOnFocusLost != null) {
-                site.setSelectionProvider(selectionProviderOnFocusLost);
-            }
-            ((StyledText) e.getSource()).removeFocusListener(this);
-            ((StyledText) e.getSource()).removeDisposeListener(this);
-        }
+			if (selectionProviderOnFocusLost != null) {
+				site.setSelectionProvider(selectionProviderOnFocusLost);
+			}
+			((StyledText) e.getSource()).removeFocusListener(this);
+			((StyledText) e.getSource()).removeDisposeListener(this);
+		}
 
 	}
 }

+ 5 - 0
plugins/org.yakindu.sct.doc.user/css/yakindu.css

@@ -107,22 +107,27 @@ body.eclipsehelp {
     .body-container .primary img.tiny {
         width: 23.6%;
         max-width: 23.6%;
+        min-width: 23.6%;
     }
     .body-container .primary img.small {
         width: 38.2%;
         max-width: 38.2%;
+        min-width: 38.2%;
     }
     .body-container .primary img.normal {
         width: 61.8%;
+        max-width: 61.8%;
         min-width: 38.2%;
     }
     .body-container .primary img.large {
         width: 76.4%;
         max-width: 76.4%;
+        min-width: 38.2%;
     }
     .body-container .primary img.full {
         width: 100%;
         max-width: 100%;
+        min-width: 38.2%;
     }
 }
 

+ 54 - 44
plugins/org.yakindu.sct.domain/src/org/yakindu/sct/domain/extension/DomainStatus.java

@@ -1,45 +1,55 @@
-/**
- * Copyright (c) 2016 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.domain.extension;
-
-/**
- * @author andreas muelder - Initial contribution and API
- * 
- */
-public class DomainStatus {
-
-	public static final DomainStatus OK = new DomainStatus(Severity.OK);
-
-	public static enum Severity {
-		OK, ERROR, WARNING, INFO
-	}
-
-	private Severity status;
-	private String message;
-
-	public DomainStatus(Severity status, String message) {
-		this.status = status;
-		this.message = message;
-	}
-
-	public DomainStatus(Severity status) {
-		this.status = status;
-	}
-
-	public Severity getSeverity() {
-		return status;
-	}
-
-	public String getMessage() {
-		return message;
-	}
-
+/**
+ * Copyright (c) 2016 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.domain.extension;
+
+/**
+ * @author andreas muelder - Initial contribution and API
+ * 
+ */
+public class DomainStatus {
+
+	public static final DomainStatus OK = new DomainStatus(Severity.OK);
+
+	public static enum Severity {
+		OK, ERROR, WARNING, INFO
+	}
+
+	private Severity status;
+	private String message;
+	private String shortMessage;
+	
+	public DomainStatus(Severity status, String message) {
+		this(status, message, message);
+	}
+	
+	public DomainStatus(Severity status, String message, String shortMessage) {
+		this.status = status;
+		this.message = message;
+		this.shortMessage = shortMessage;
+	}
+
+	public DomainStatus(Severity status) {
+		this.status = status;
+	}
+
+	public Severity getSeverity() {
+		return status;
+	}
+
+	public String getMessage() {
+		return message;
+	}
+	
+	public String getShortMessage() {
+		return shortMessage;
+	}
+
 }

+ 3 - 2
plugins/org.yakindu.sct.generator.core/src/org/yakindu/sct/generator/core/execution/GeneratorExecutorLookup.java

@@ -10,7 +10,6 @@
  */
 package org.yakindu.sct.generator.core.execution;
 
-import org.eclipse.core.runtime.Assert;
 import org.eclipse.emf.common.util.EList;
 import org.eclipse.emf.ecore.resource.ResourceSet;
 import org.eclipse.emf.ecore.util.EcoreUtil;
@@ -62,12 +61,14 @@ public class GeneratorExecutorLookup {
 		Injector injector = createInjector(entry, description, generatorId);
 		injector.injectMembers(executor);
 		ITypeSystem typeSystem = injector.getInstance(ITypeSystem.class);
+		if (entry.getElementRef() == null || entry.getElementRef().eResource() == null) {
+			throw new RuntimeException("Could not resolve reference to model ");
+		}
 		if (typeSystem instanceof AbstractTypeSystem) {
 			ResourceSet set = entry.getElementRef().eResource().getResourceSet();
 			set.getResources().add(((AbstractTypeSystem) typeSystem).getResource());
 			EcoreUtil.resolveAll(set);
 		}
-		Assert.isNotNull(entry.getElementRef().eResource());
 
 		return executor;
 	}

+ 12 - 12
plugins/org.yakindu.sct.generator.genmodel/src/org/yakindu/sct/generator/genmodel/validation/SGenJavaValidator.java

@@ -57,20 +57,20 @@ import com.google.inject.Injector;
 public class SGenJavaValidator extends AbstractSGenJavaValidator {
 
 	// Error messages
-	public static final String MISSING_REQUIRED_PARAMETER = "Missing required Parameter";
-	public static final String MISSING_REQUIRED_FEATURE = "Missing required feature";
-	public static final String DUPLICATE_PARAMETER = "Duplicate parameter!";
-	public static final String DUPLICATE_FEATURE = "Duplicate feature!";
-	public static final String UNKOWN_GENERATOR = "Unkown Generator";
-	public static final String INCOMPATIBLE_TYPE_BOOLEAN_EXPECTED = "Incompatible type, Boolean expected";
-	public static final String INCOMPATIBLE_TYPE_INTEGER_EXPECTED = "Incompatible type, Integer expected";
-	public static final String INCOMPATIBLE_TYPE_FLOAT_EXPECTED = "Incompatible type, Float expected";
-	public static final String INCOMPATIBLE_TYPE_STRING_EXPECTED = "Incompatible type, String expected";
+	public static final String MISSING_REQUIRED_PARAMETER = "Missing required parameter.";
+	public static final String MISSING_REQUIRED_FEATURE = "Missing required feature.";
+	public static final String DUPLICATE_PARAMETER = "Duplicate parameter.";
+	public static final String DUPLICATE_FEATURE = "Duplicate feature.";
+	public static final String UNKOWN_GENERATOR = "Unknown generator.";
+	public static final String INCOMPATIBLE_TYPE_BOOLEAN_EXPECTED = "Incompatible type, Boolean expected.";
+	public static final String INCOMPATIBLE_TYPE_INTEGER_EXPECTED = "Incompatible type, Integer expected.";
+	public static final String INCOMPATIBLE_TYPE_FLOAT_EXPECTED = "Incompatible type, Float expected.";
+	public static final String INCOMPATIBLE_TYPE_STRING_EXPECTED = "Incompatible type, String expected.";
 	public static final String UNKNOWN_CONTENT_TYPE = "Unknown content type '";
-	public static final String DEPRECATED = "Element is depricated";
-	public static final String EMPTY_SGEN = ".sgen file does not contain any entries";
+	public static final String DEPRECATED = "Element is depricated.";
+	public static final String EMPTY_SGEN = ".sgen file does not contain any entries.";
 	// Failure codes
-	public static final String CODE_REQUIRED_FEATURE = "code_req_feature";
+	public static final String CODE_REQUIRED_FEATURE = "code_req_feature.";
 
 	@Inject
 	private Injector injector;

+ 1 - 1
plugins/org.yakindu.sct.generator.runner/plugin.xml

@@ -19,7 +19,7 @@
          executor="org.yakindu.sct.generator.runner.WorkspaceGeneratorExecutor"
          icon="icons/sct.png"
          id="yakindu::generic"
-         name="Custom Xtend2/Java-based Generator">
+         name="Custom Xtend/Java-based Generator">
       <FeatureLibrary
             library_id="org.yakindu.generator.core.features">
       </FeatureLibrary>

+ 2 - 2
plugins/org.yakindu.sct.model.sgraph/src/org/yakindu/sct/model/sgraph/validation/DomainValidator.java

@@ -43,13 +43,13 @@ public class DomainValidator implements EValidator {
 		if (eObject instanceof DomainElement) {
 			DomainStatus status = DomainRegistry.getDomainStatus(((DomainElement) eObject).getDomainID());
 			if (status.getSeverity() == Severity.ERROR) {
-				diagnostics.add(new BasicDiagnostic(Diagnostic.ERROR, "DomainValidator", 0, status.getMessage(),
+				diagnostics.add(new BasicDiagnostic(Diagnostic.ERROR, "DomainValidator", 0, status.getShortMessage(),
 						new Object[] { eObject }));
 			} else if (status.getSeverity() == Severity.WARNING) {
 				diagnostics.add(new BasicDiagnostic(Diagnostic.WARNING, "DomainValidator", 0, status.getMessage(),
 						new Object[] { eObject }));
 			} else if (status.getSeverity() == Severity.INFO) {
-				diagnostics.add(new BasicDiagnostic(Diagnostic.INFO, "DomainValidator", 0, status.getMessage(),
+				diagnostics.add(new BasicDiagnostic(Diagnostic.INFO, "DomainValidator", 0, status.getShortMessage(),
 						new Object[] { eObject }));
 			}
 		}

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

@@ -26,12 +26,14 @@ import org.eclipse.xtext.ui.editor.hyperlinking.IHyperlinkHelper;
 import org.eclipse.xtext.ui.editor.model.IResourceForEditorInputFactory;
 import org.eclipse.xtext.ui.editor.model.JavaClassPathResourceForIEditorInputFactory;
 import org.eclipse.xtext.ui.editor.model.ResourceForIEditorInputFactory;
+import org.eclipse.xtext.ui.editor.model.XtextDocument;
 import org.eclipse.xtext.ui.editor.syntaxcoloring.IHighlightingConfiguration;
 import org.eclipse.xtext.ui.resource.IResourceSetProvider;
 import org.eclipse.xtext.ui.resource.SimpleResourceSetProvider;
 import org.eclipse.xtext.ui.resource.XtextResourceSetProvider;
 import org.eclipse.xtext.ui.shared.Access;
 import org.yakindu.base.utils.jface.help.CrossRefObjectTextHover;
+import org.yakindu.base.xtext.utils.jface.viewers.ParallelReadXtextDocument;
 import org.yakindu.sct.model.stext.ui.contentassist.AsyncContentAssistContextFactory;
 import org.yakindu.sct.model.stext.ui.contentassist.AsyncXtextContentAssistProcessor;
 import org.yakindu.sct.model.stext.ui.contentassist.STextStatefulFactory;
@@ -81,6 +83,7 @@ public class STextUiModule extends org.yakindu.sct.model.stext.ui.AbstractSTextU
 	public void configure(Binder binder) {
 		super.configure(binder);
 		binder.bind(String.class).annotatedWith(Names.named("stylesheet")).toInstance("/StextHoverStyleSheet.css");
+		binder.bind(XtextDocument.class).to(ParallelReadXtextDocument.class);
 	}
 
 	public com.google.inject.Provider<org.eclipse.xtext.resource.containers.IAllContainersState> provideIAllContainersState() {

+ 39 - 2
plugins/org.yakindu.sct.model.stext.ui/src/org/yakindu/sct/model/stext/ui/contentassist/AsyncXtextContentAssistProcessor.java

@@ -14,9 +14,12 @@ import java.util.Arrays;
 
 import org.eclipse.jface.text.ITextViewer;
 import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.xtext.resource.XtextResource;
 import org.eclipse.xtext.ui.editor.contentassist.CompletionProposalComputer;
 import org.eclipse.xtext.ui.editor.contentassist.XtextContentAssistProcessor;
 import org.eclipse.xtext.ui.editor.model.IXtextDocument;
+import org.eclipse.xtext.util.CancelIndicator;
+import org.eclipse.xtext.util.concurrent.CancelableUnitOfWork;
 
 /**
  * 
@@ -30,11 +33,45 @@ public class AsyncXtextContentAssistProcessor extends XtextContentAssistProcesso
 		if (getContentProposalProvider() == null)
 			return null;
 		IXtextDocument document = (IXtextDocument) viewer.getDocument();
-		CompletionProposalComputer computer = createCompletionProposalComputer(viewer, offset);
-		ICompletionProposal[] result = document.readOnly(computer);
+		final CancelableCompletionProposalComputer computer = createCompletionProposalComputer(viewer, offset);
+		ICompletionProposal[] result = document
+				.readOnly(new CancelableUnitOfWork<ICompletionProposal[], XtextResource>() {
+					@Override
+					public ICompletionProposal[] exec(XtextResource state, CancelIndicator cancelIndicator)
+							throws Exception {
+						computer.setCancelIndicator(cancelIndicator);
+						return computer.exec(state);
+					}
+				});
 		Arrays.sort(result, getCompletionProposalComparator());
 		result = getCompletionProposalPostProcessor().postProcess(result);
 		return result;
 	}
 
+	@Override
+	protected CancelableCompletionProposalComputer createCompletionProposalComputer(ITextViewer viewer, int offset) {
+		return new CancelableCompletionProposalComputer(this, viewer, offset);
+	}
+
+	public static class CancelableCompletionProposalComputer extends CompletionProposalComputer {
+
+		private CancelIndicator cancelIndicator;
+
+		public CancelableCompletionProposalComputer(State state, ITextViewer viewer, int offset) {
+			super(state, viewer, offset);
+		}
+
+		public void setCancelIndicator(CancelIndicator indicator) {
+			this.cancelIndicator = indicator;
+		}
+
+		@Override 
+		public boolean canAcceptMoreProposals() {
+			if (cancelIndicator == null) {
+				return super.canAcceptMoreProposals();
+			}
+			return !cancelIndicator.isCanceled();
+		}
+
+	}
 }

+ 16 - 27
plugins/org.yakindu.sct.model.stext.ui/src/org/yakindu/sct/model/stext/ui/contentassist/STextStatefulFactory.java

@@ -10,21 +10,18 @@
 */
 package org.yakindu.sct.model.stext.ui.contentassist;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
+import java.util.Collections;
 
 import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.ITextViewer;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.xtext.nodemodel.INode;
 import org.eclipse.xtext.parser.IParseResult;
-import org.eclipse.xtext.resource.XtextResource;
 import org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext;
 import org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext.Builder;
 import org.eclipse.xtext.ui.editor.contentassist.antlr.ParserBasedContentAssistContextFactory.StatefulFactory;
 
+import com.google.common.collect.Lists;
+
 /**
  * This class is used to always set a current model when the context for the
  * proposal provider is created. It is used to propose Events as Transition
@@ -34,27 +31,6 @@ import org.eclipse.xtext.ui.editor.contentassist.antlr.ParserBasedContentAssistC
 public class STextStatefulFactory extends StatefulFactory {
 	private IParseResult parseResult;
 
-	@Override
-	public ContentAssistContext[] create(final ITextViewer viewer, final int offset, final XtextResource resource)
-			throws BadLocationException {
-		this.parseResult = resource.getParseResult();
-		if (Display.getCurrent() == null) {
-			final List<ContentAssistContext> result = new ArrayList<>();
-			Display.getDefault().syncExec(new Runnable() {
-				@Override
-				public void run() {
-					try {
-						result.addAll(Arrays.asList(STextStatefulFactory.super.create(viewer, offset, resource)));
-					} catch (BadLocationException e) {
-						e.printStackTrace();
-					}
-				}
-			});
-			return result.toArray(new ContentAssistContext[] {});
-		}
-		return super.create(viewer, offset, resource);
-	}
-
 	@Override
 	public Builder doCreateContext(INode lastCompleteNode, EObject currentModel, EObject previousModel,
 			INode currentNode, String prefix) {
@@ -64,4 +40,17 @@ public class STextStatefulFactory extends StatefulFactory {
 		Builder result = super.doCreateContext(lastCompleteNode, currentModel, previousModel, currentNode, prefix);
 		return result;
 	}
+
+	protected void initializeFromViewerAndResource(final int offset) {
+		if (Display.getCurrent() == null) {
+			Display.getDefault().syncExec(new Runnable() {
+				@Override
+				public void run() {
+					initializeAndAdjustCompletionOffset(offset);
+					initializeNodeAndModelData();
+					contextBuilders = Collections.synchronizedList(Lists.<ContentAssistContext.Builder>newArrayList());
+				}
+			});
+		}
+	}
 }

+ 5 - 1
plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/expressions/STextExpressionParser.java

@@ -88,7 +88,7 @@ public class STextExpressionParser implements IExpressionParser {
 
 	public EObject parseExpression(String expression, String ruleName, String specification) {
 		StextResource resource = getResource();
-		resource.setURI(URI.createURI("path", true));
+		resource.setURI(URI.createURI(getUri(), true));
 		ParserRule parserRule = XtextFactory.eINSTANCE.createParserRule();
 		parserRule.setName(ruleName);
 		IParseResult result = parser.parse(parserRule, new StringReader(expression));
@@ -125,6 +125,10 @@ public class STextExpressionParser implements IExpressionParser {
 		return rootASTElement;
 	}
 
+	protected String getUri() {
+		return "path";
+	}
+
 	public Scope createInternalScope(String contextScope) {
 		ParserRule parserRule = XtextFactory.eINSTANCE.createParserRule();
 		parserRule.setName(InternalScope.class.getSimpleName());

+ 7 - 73
plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/scoping/URI2ResourceDescriptionCache.java

@@ -10,22 +10,14 @@
  */
 package org.yakindu.sct.model.stext.scoping;
 
-import java.util.concurrent.ExecutionException;
-
 import org.eclipse.emf.common.util.URI;
 import org.eclipse.emf.ecore.resource.Resource;
 import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
 import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
-import org.eclipse.emf.workspace.util.WorkspaceSynchronizer.Delegate;
 import org.eclipse.xtext.resource.IResourceDescription;
 import org.eclipse.xtext.resource.IResourceDescription.Manager;
 import org.eclipse.xtext.resource.IResourceServiceProvider;
 
-import com.google.common.cache.CacheBuilder;
-import com.google.common.cache.CacheLoader;
-import com.google.common.cache.LoadingCache;
 import com.google.inject.Inject;
 import com.google.inject.Singleton;
 
@@ -35,46 +27,21 @@ import com.google.inject.Singleton;
  * 
  */
 @Singleton
-public class URI2ResourceDescriptionCache implements Delegate {
+public class URI2ResourceDescriptionCache {
 
-	private static final String DOMAIN_ID = "StatechartDomain";
+	private static final String DOMAIN_ID = "org.yakindu.sct.domain";
 
 	@Inject
 	private IResourceServiceProvider.Registry serviceProviderRegistry;
 
-	private LoadingCache<String, IResourceDescription> cache;
-
-	private WorkspaceSynchronizer workspaceSynchronizer;
-
-	public URI2ResourceDescriptionCache() {
-		cache = CacheBuilder.newBuilder().build(new CacheLoader<String, IResourceDescription>() {
-			@Override
-			public IResourceDescription load(String key) throws Exception {
-				return getInternal(URI.createURI(key));
-			}
-		});
-		TransactionalEditingDomain editingDomain = getEditingDomain();
-		if (editingDomain != null)
-		workspaceSynchronizer = new WorkspaceSynchronizer(editingDomain, this);
-	}
-
 	protected TransactionalEditingDomain getEditingDomain() {
-		return TransactionalEditingDomain.Registry.INSTANCE.getEditingDomain(DOMAIN_ID);
+		TransactionalEditingDomain editingDomain = TransactionalEditingDomain.Registry.INSTANCE
+				.getEditingDomain(DOMAIN_ID);
+		return editingDomain;
 	}
 
-	public synchronized IResourceDescription get(URI uri) {
-		try {
-			IResourceDescription descrpition = cache.get(uri.toString());
-			return descrpition;
-		} catch (ExecutionException e) {
-			e.printStackTrace();
-		}
-		return null;
-
-	}
-
-	protected IResourceDescription getInternal(URI uri) {
-		ResourceSet set = getResourceSet();
+	public IResourceDescription get(URI uri) {
+		ResourceSet set = getEditingDomain().getResourceSet();
 		Resource resource = set.getResource(uri, true);
 		if (resource != null) {
 			IResourceServiceProvider serviceProvider = serviceProviderRegistry.getResourceServiceProvider(uri);
@@ -88,37 +55,4 @@ public class URI2ResourceDescriptionCache implements Delegate {
 		}
 		return null;
 	}
-
-	protected ResourceSet getResourceSet() {
-		if(getEditingDomain() == null) {
-			return new ResourceSetImpl();
-		}
-		return getEditingDomain().getResourceSet();
-	}
-
-	@Override
-	public synchronized boolean handleResourceDeleted(Resource resource) {
-		cache.invalidate(resource.getURI().toString());
-		return true;
-	}
-
-	@Override
-	public synchronized boolean handleResourceMoved(Resource resource, URI newURI) {
-		cache.invalidate(resource.getURI().toString());
-		return true;
-	}
-
-	@Override
-	public synchronized boolean handleResourceChanged(Resource resource) {
-		cache.invalidate(resource.getURI().toString());
-		return true;
-	}
-
-	@Override
-	public synchronized void dispose() {
-		if (workspaceSynchronizer != null)
-			workspaceSynchronizer.dispose();
-		cache.invalidateAll();
-	}
-
 }

+ 2 - 2
plugins/org.yakindu.sct.model.stext/src/org/yakindu/sct/model/stext/validation/STextValidationMessages.java

@@ -35,7 +35,7 @@ public interface STextValidationMessages {
 	public static final String TRANSITION_EXIT_SPEC_NOT_COMPOSITE = "Source state isn't composite.";
 	public static final String TRANSITION_UNBOUND_DEFAULT_ENTRY_POINT = "Target state has regions without 'default' entries.";
 	public static final String TRANSITION_UNBOUND_NAMED_ENTRY_POINT = "Target state has regions without named entries: ";
-	public static final String TRANSITION_NOT_EXISTING_NAMED_EXIT_POINT = "Source State needs at least one region with the named exit point.";
+	public static final String TRANSITION_NOT_EXISTING_NAMED_EXIT_POINT = "Source state needs at least one region with the named exit point.";
 	public static final String TRIGGER_IS_NO_EVENT = "Trigger is no event.";
 	public static final String TOP_LEVEL_REGION_ENTRY_HAVE_TO_BE_A_DEFAULT_ENTRY = "Entry of top level region have to be a default entry.";
 	public static final String REGION_UNBOUND_DEFAULT_ENTRY_POINT = "Region must have a 'default' entry.";
@@ -47,7 +47,7 @@ public interface STextValidationMessages {
 	public static final String ISSUE_TRANSITION_WITHOUT_TRIGGER = "Missing trigger. Transition is never taken. Use 'oncycle' or 'always' instead.";
 	public static final String EXITPOINTSPEC_WITH_TRIGGER = "Transitions with an exit point spec does not have a trigger or guard.";
 	public static final String REFERENCE_TO_VARIABLE = "Cannot reference a variable in a constant initialization.";
-	public static final String CONST_MUST_HAVE_VALUE_MSG = "A constant definition must specify an initial value";
+	public static final String CONST_MUST_HAVE_VALUE_MSG = "A constant definition must specify an initial value.";
 	public static final String CONST_MUST_HAVE_VALUE_CODE = "ConstMustHaveAValue";
 	public static final String REFERENCE_CONSTANT_BEFORE_DEFINED = "Cannot reference a constant from different scope or before it is defined.";
 	public static final String INTERNAL_DECLARATION_UNUSED = "Internal declaration is not used in statechart.";

+ 8 - 0
plugins/org.yakindu.sct.ui.editor/plugin.xml

@@ -866,5 +866,13 @@
       </factory>
    </extension>
   <!-- Added default templates -->
+  
+    <!-- Shared Editing Domain-->
+     <extension
+         point="org.eclipse.emf.transaction.editingDomains">
+      <editingDomain
+            factory="org.yakindu.sct.ui.editor.partitioning.SharedEditingDomainFactory"
+            id="org.yakindu.sct.domain"/>
+   </extension>
    
 </plugin>

+ 5 - 46
plugins/org.yakindu.sct.ui.editor/src/org/yakindu/sct/ui/editor/partitioning/DiagramPartitioningUtil.java

@@ -10,7 +10,6 @@
  */
 package org.yakindu.sct.ui.editor.partitioning;
 
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -20,13 +19,11 @@ import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.runtime.Assert;
 import org.eclipse.emf.common.util.TreeIterator;
-import org.eclipse.emf.common.util.URI;
 import org.eclipse.emf.ecore.EObject;
 import org.eclipse.emf.ecore.resource.Resource;
 import org.eclipse.emf.ecore.util.EcoreUtil;
 import org.eclipse.emf.transaction.TransactionalEditingDomain;
 import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
-import org.eclipse.gmf.runtime.diagram.core.DiagramEditingDomainFactory;
 import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramEditorInput;
 import org.eclipse.gmf.runtime.notation.BooleanValueStyle;
 import org.eclipse.gmf.runtime.notation.Diagram;
@@ -45,7 +42,6 @@ import org.eclipse.ui.part.FileEditorInput;
 import org.yakindu.sct.model.sgraph.CompositeElement;
 import org.yakindu.sct.model.sgraph.State;
 import org.yakindu.sct.model.sgraph.Statechart;
-import org.yakindu.sct.model.sgraph.resource.AbstractSCTResource;
 import org.yakindu.sct.ui.editor.editor.StatechartDiagramEditor;
 import org.yakindu.sct.ui.editor.utils.GMFNotationUtil;
 
@@ -59,7 +55,7 @@ public class DiagramPartitioningUtil {
 	/** GMFs notation {@link Style} id **/
 	public static final String INLINE_STYLE = "isInline";
 
-	private static final String DOMAIN_ID = "StatechartDomain";
+	private static final String DOMAIN_ID = "org.yakindu.sct.domain";
 
 	private DiagramPartitioningUtil() {
 	}
@@ -84,50 +80,14 @@ public class DiagramPartitioningUtil {
 	}
 
 	/**
-	 * Returns the Shared Editing Domain that is used for all Editors acting on
-	 * the same {@link IResource}
+	 * Returns the Shared Editing Domain that is used for all Editors acting on the
+	 * same {@link IResource}
 	 * 
 	 * @return the {@link TransactionalEditingDomain}
 	 */
 	public static synchronized TransactionalEditingDomain getSharedDomain() {
-		TransactionalEditingDomain editingDomain = TransactionalEditingDomain.Registry.INSTANCE
+		return TransactionalEditingDomain.Registry.INSTANCE
 				.getEditingDomain(DOMAIN_ID);
-		if (editingDomain == null) {
-			editingDomain = DiagramEditingDomainFactory.getInstance().createEditingDomain();
-			editingDomain.setID(DOMAIN_ID);
-			TransactionalEditingDomain.Registry.INSTANCE.add(DOMAIN_ID, editingDomain);
-
-			new WorkspaceSynchronizer(editingDomain, new WorkspaceSynchronizer.Delegate() {
-				public boolean handleResourceDeleted(Resource resource) {
-					resource.unload();
-					return true;
-				}
-				public boolean handleResourceMoved(Resource resource, URI newURI) {
-					resource.unload();
-					return true;
-				}
-				public boolean handleResourceChanged(Resource resource) {
-					if (resource instanceof AbstractSCTResource) {
-						// do not unload GMF resources as it might be the one
-						// underlying the currently opened editor
-						return true;
-					}
-					resource.unload();
-					try {
-						resource.load(resource.getResourceSet().getLoadOptions());
-					} catch (IOException e) {
-						e.printStackTrace();
-					}
-
-					return true;
-				}
-
-				public void dispose() {
-					// nothing to dispose (especially as I am shared)
-				}
-			});
-		}
-		return editingDomain;
 	}
 
 	/**
@@ -203,8 +163,7 @@ public class DiagramPartitioningUtil {
 	}
 
 	/**
-	 * Forces the user to close all opened editors for subdiagrams that are
-	 * inlined.
+	 * Forces the user to close all opened editors for subdiagrams that are inlined.
 	 * 
 	 * @return true if all editors were closed, false otherwise
 	 */

+ 111 - 0
plugins/org.yakindu.sct.ui.editor/src/org/yakindu/sct/ui/editor/partitioning/SharedEditingDomainFactory.java

@@ -0,0 +1,111 @@
+/** 
+ * Copyright (c) 2017 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.editor.partitioning;
+
+import java.io.IOException;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
+import org.eclipse.gmf.runtime.diagram.core.DiagramEditingDomainFactory;
+import org.eclipse.gmf.runtime.emf.core.util.CrossReferenceAdapter;
+import org.yakindu.sct.model.sgraph.resource.AbstractSCTResource;
+
+/**
+ * 
+ * @author andreas muelder - Initial contribution and API
+ * 
+ */
+public class SharedEditingDomainFactory extends DiagramEditingDomainFactory
+		implements TransactionalEditingDomain.Factory {
+
+	public static final String DOMAIN_ID = "org.yakindu.sct.domain";
+
+	@Override
+	public TransactionalEditingDomain createEditingDomain() {
+		TransactionalEditingDomain domain = super.createEditingDomain();
+		setup(domain);
+		return domain;
+	}
+
+	@Override
+	public TransactionalEditingDomain createEditingDomain(ResourceSet rset) {
+		TransactionalEditingDomain domain = super.createEditingDomain(rset);
+		setup(domain);
+		return domain;
+	}
+
+	@Override
+	public TransactionalEditingDomain getEditingDomain(ResourceSet rset) {
+		TransactionalEditingDomain domain = super.createEditingDomain(rset);
+		setup(domain);
+		return domain;
+	}
+
+	protected void setup(TransactionalEditingDomain editingDomain) {
+		editingDomain.setID(DOMAIN_ID);
+		replaceCrossReferenceAdapterWithNonResolvingAdapter(editingDomain);
+		new WorkspaceSynchronizer(editingDomain, new WorkspaceSynchronizer.Delegate() {
+			public boolean handleResourceDeleted(Resource resource) {
+				resource.unload();
+				return true;
+			}
+
+			public boolean handleResourceMoved(Resource resource, URI newURI) {
+				resource.unload();
+				return true;
+			}
+
+			public boolean handleResourceChanged(Resource resource) {
+				if (resource instanceof AbstractSCTResource) {
+					// do not unload GMF resources as it might be the one
+					// underlying the currently opened editor
+					return true;
+				}
+				resource.unload();
+				try {
+					resource.load(resource.getResourceSet().getLoadOptions());
+				} catch (IOException e) {
+					e.printStackTrace();
+				}
+				return true;
+			}
+
+			public void dispose() {
+				// nothing to dispose (especially as I am shared)
+			}
+		});
+	}
+
+	protected void replaceCrossReferenceAdapterWithNonResolvingAdapter(final TransactionalEditingDomain domain) {
+		final CrossReferenceAdapter adapter = getCrossReferenceAdapter(domain);
+		if (null != adapter) {
+			adapter.unsetTarget(domain.getResourceSet());
+
+			domain.getResourceSet().eAdapters().remove(adapter);
+			domain.getResourceSet().eAdapters().add(new CrossReferenceAdapter(false));
+		}
+	}
+
+	protected CrossReferenceAdapter getCrossReferenceAdapter(final TransactionalEditingDomain domain) {
+		final EList<Adapter> eAdapters = domain.getResourceSet().eAdapters();
+		for (final Adapter adapter : eAdapters) {
+			if (adapter instanceof CrossReferenceAdapter) {
+				return (CrossReferenceAdapter) adapter;
+			}
+		}
+		return null;
+	}
+}

+ 18 - 10
plugins/org.yakindu.sct.ui.editor/src/org/yakindu/sct/ui/editor/validation/LiveValidationListener.java

@@ -34,6 +34,8 @@ public class LiveValidationListener extends ResourceSetListenerImpl {
 	@Inject
 	private ValidationJob validationJob;
 
+	private Resource resource;
+
 	@Override
 	public void resourceSetChanged(ResourceSetChangeEvent event) {
 		for (Notification notification : event.getNotifications()) {
@@ -42,22 +44,27 @@ public class LiveValidationListener extends ResourceSetListenerImpl {
 					&& notification.getEventType() != Notification.RESOLVE) {
 				EObject eObject = (EObject) notification.getNotifier();
 				if (eObject.eClass().getEPackage() == SGraphPackage.eINSTANCE) {
-					validationJob.cancel();
-					if (liveValidationEnabled()) {
-						validationJob.schedule(DELAY);
-						break;
-					}
+					rescheduleJob();
+					break;
 				} else
 					for (EClass eClass : eObject.eClass().getEAllSuperTypes()) {
 						if (SGraphPackage.eINSTANCE == eClass.getEPackage()) {
-							validationJob.cancel();
-							if (liveValidationEnabled()) {
-								validationJob.schedule(DELAY);
-								return;
-							}
+							rescheduleJob();
+							return;
 						}
 					}
 			}
+			else if (notification.getNotifier() instanceof Resource && this.resource != null
+					&& !this.resource.equals(notification.getNotifier())) {
+				rescheduleJob();
+			}
+		}
+	}
+
+	protected void rescheduleJob() {
+		validationJob.cancel();
+		if (liveValidationEnabled()) {
+			validationJob.schedule(DELAY);
 		}
 	}
 
@@ -73,6 +80,7 @@ public class LiveValidationListener extends ResourceSetListenerImpl {
 	}
 
 	public void setResource(Resource resource) {
+		this.resource = resource;
 		validationJob.setResource(resource);
 		validationJob.setRule(WorkspaceSynchronizer.getFile(resource));
 	}

+ 1 - 1
plugins/org.yakindu.sct.ui.editor/src/org/yakindu/sct/ui/editor/wizards/CreationWizard.java

@@ -105,7 +105,7 @@ public class CreationWizard extends Wizard implements INewWizard {
 	protected void initModelCreationPage() {
 		modelCreationPage = new ModelCreationWizardPage("DiagramModelFile", getSelection(), "sct");
 		modelCreationPage.setTitle("YAKINDU SCT Diagram");
-		modelCreationPage.setDescription("Create a new YAKINDU SCT Diagram File");
+		modelCreationPage.setDescription("Create a new YAKINDU SCT diagram file.");
 		modelCreationPage.setImageDescriptor(StatechartImages.LOGO.imageDescriptor());
 		addPage(modelCreationPage);
 	}

+ 2 - 0
test-plugins/org.yakindu.sct.generator.c.test/src/org/yakindu/sct/generator/c/gtest/GTest.java

@@ -23,6 +23,8 @@ public @interface GTest {
 	String sourceFile();
 	String program();
 	String model();
+	String[] additionalFilesToCopy() default {};
+	String[] additionalFilesToCompile() default {};
 
 	/**
 	 * If no test bundle provided, source files (cc and sgen) are expected to be

+ 12 - 4
test-plugins/org.yakindu.sct.generator.c.test/src/org/yakindu/sct/generator/c/gtest/GTestHelper.java

@@ -15,6 +15,7 @@ import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.List;
 
@@ -66,7 +67,6 @@ public class GTestHelper {
 	}
 
 	public void generate() {
-
 		IPath targetPath = getTargetPath();
 
 		// copy model to JUnit workspace
@@ -84,6 +84,14 @@ public class GTestHelper {
 
 		getGeneratorExecutorLookup().execute(model);
 	}
+	
+	protected List<String> getFilesToCopy() {
+		return new ArrayList<String>(Arrays.asList(owner.getClass().getAnnotation(GTest.class).additionalFilesToCopy()));
+	}
+	
+	protected List<String> getFilesToCompile() {
+		return new ArrayList<String>(Arrays.asList(owner.getClass().getAnnotation(GTest.class).additionalFilesToCompile()));
+	}
 
 	protected GeneratorExecutorLookup getGeneratorExecutorLookup() {
 		return new EclipseContextGeneratorExecutorLookup();
@@ -133,7 +141,7 @@ public class GTestHelper {
 
 	private void copyFilesFromBundleToFolder() {
 		IPath targetPath = getTargetPath();
-		List<String> testDataFiles = new ArrayList<String>();
+		List<String> testDataFiles = getFilesToCopy();
 		getTestDataFiles(testDataFiles);
 		for (String file : testDataFiles) {
 			copyFileFromBundleToFolder(getTestBundle(), file, targetPath);
@@ -146,7 +154,7 @@ public class GTestHelper {
 		List<String> includes = new ArrayList<String>();
 		getIncludes(includes);
 
-		List<String> sourceFiles = new ArrayList<String>();
+		List<String> sourceFiles = getFilesToCompile();
 		getSourceFiles(sourceFiles);
 
 		List<String> command = new ArrayList<String>();
@@ -162,7 +170,7 @@ public class GTestHelper {
 		if (gTestDirectory != null)
 			command.add("-L" + gTestDirectory);
 		for (String sourceFile : sourceFiles) {
-			command.add(sourceFile);
+			command.add(getFileName(sourceFile));
 		}
 		command.add("-lgtest");
 		command.add("-lgtest_main");