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

compare equality of EObjects by URIs instead of EcoreUtil.equals

Andreas Mülder 12 лет назад
Родитель
Сommit
4ca9f40922

+ 1 - 2
plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/debugmodel/SCTDebugTarget.java

@@ -67,10 +67,9 @@ public class SCTDebugTarget extends SCTDebugElement implements IDebugTarget {
 		this.launch = launch;
 		this.element = element;
 		this.engine = engine;
-		init();
 	}
 
-	private void init() {
+	public void init() {
 		threads = new ArrayList<SCTDebugThread>();
 		DebugPlugin.getDefault().getBreakpointManager().addBreakpointListener(this);
 		executionControl = engine.getExecutionControl();

+ 1 - 0
plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/launch/AbstractSCTLaunchConfigurationDelegate.java

@@ -44,6 +44,7 @@ public abstract class AbstractSCTLaunchConfigurationDelegate extends LaunchConfi
 		Statechart statechart = loadStatechart(filename);
 		SCTDebugTarget target = createDebugTarget(launch, statechart);
 		launch.addDebugTarget(target);
+		target.init();
 		target.start();
 	}
 

+ 3 - 3
plugins/org.yakindu.sct.simulation.core/src/org/yakindu/sct/simulation/core/sruntime/impl/ExecutionSlotImpl.java

@@ -261,9 +261,9 @@ public abstract class ExecutionSlotImpl extends NamedElementImpl implements Exec
 	 */
 	@Override
 	public String toString() {
-		if (eIsProxy()) return super.toString();
-
-		StringBuffer result = new StringBuffer(fqName);
+		if (eIsProxy())
+			return super.toString();
+		StringBuffer result = new StringBuffer(fqName != null ? fqName : "");
 		return result.toString();
 	}
 

+ 1 - 2
plugins/org.yakindu.sct.simulation.ui/src/org/yakindu/sct/simulation/ui/model/presenter/SCTSourceDisplay.java

@@ -111,8 +111,7 @@ public class SCTSourceDisplay implements ISourceDisplay {
 				Collection<Diagram> contents = EcoreUtil.getObjectsByType(sharedDomainResource.getContents(),
 						NotationPackage.Literals.DIAGRAM);
 				for (Diagram diag : contents) {
-					// TODO consider using resource uri as equality constraint
-					if (EcoreUtil.equals(diag.getElement(), diagram.getElement())) {
+					if (EcoreUtil.getURI(diag.getElement()).equals(EcoreUtil.getURI(diagram.getElement()))) {
 						return DiagramPartitioningUtil.openEditor((Diagram) diag);
 					}
 				}