浏览代码

Merge pull request #163 from Yakindu/Bugfix_152

#152 fixed
Andreas Mülder 9 年之前
父节点
当前提交
6c93ef5752

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

@@ -46,7 +46,8 @@ public class SCTResourceValidator extends AbstractDeclarativeValidator {
 		for (Map.Entry<SpecificationElement, Collection<Diagnostic>> entry : resource.getLinkingDiagnostics().asMap()
 				.entrySet()) {
 			for (Diagnostic diag : entry.getValue()) {
-				error(diag.getMessage(), entry.getKey(), null, -1);
+				if (entry.getKey().eResource() != null)
+					error(diag.getMessage(), entry.getKey(), null, -1);
 			}
 		}
 	}

+ 1 - 1
plugins/org.yakindu.sct.ui.editor/src/org/yakindu/sct/ui/editor/edithelper/RegionEditHelper.java

@@ -35,7 +35,7 @@ public class RegionEditHelper extends AbstractEditHelper {
 		return new DestroyElementCommand(req) {
 			@Override
 			protected IStatus doExecute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-				if (getElementToDestroy() instanceof State) {
+				if (getElementToDestroy() instanceof State && getElementToDestroy().eResource() != null) {
 					boolean success = DiagramPartitioningUtil.closeSubdiagramEditors((State) getElementToDestroy());
 					if (success)
 						return super.doExecute(monitor, info);