Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxime Porhel2021-07-22 12:00:31 -0400
committerGerrit Code Review @ Eclipse.org2021-07-22 12:00:31 -0400
commit76fba4ce2b40269bd6f0cedcbae3d00bb8fa9e15 (patch)
tree8afb0b4a363547c5db0db90f1c2bb9bde3845308 /plugins
parent78a12a8e3a17a57870480a0660b359b40c5f9fc7 (diff)
parent1cc86b5d90b290e6837174f1789d15dd992ad219 (diff)
downloadorg.eclipse.sirius-master.tar.gz
org.eclipse.sirius-master.tar.xz
org.eclipse.sirius-master.zip
Merge "[531282] Cleanup step before diagram modularization"HEADmaster
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.sirius.diagram.sequence.model/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/CombinedFragmentMappingSpec.java12
-rw-r--r--plugins/org.eclipse.sirius.diagram.sequence.model/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/EndOfLifeMappingSpec.java13
-rw-r--r--plugins/org.eclipse.sirius.diagram.sequence.model/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/ExecutionMappingSpec.java14
-rw-r--r--plugins/org.eclipse.sirius.diagram.sequence.model/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/InstanceRoleMappingSpec.java12
-rw-r--r--plugins/org.eclipse.sirius.diagram.sequence.model/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/InteractionUseMappingSpec.java13
-rw-r--r--plugins/org.eclipse.sirius.diagram.sequence.model/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/ObservationPointMappingSpec.java13
-rw-r--r--plugins/org.eclipse.sirius.diagram.sequence.model/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/OperandMappingSpec.java13
-rw-r--r--plugins/org.eclipse.sirius.diagram.sequence.model/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/StateMappingSpec.java12
-rw-r--r--plugins/org.eclipse.sirius.diagram/plugin.properties1
-rw-r--r--plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/metamodel/description/extensions/IContainerMappingExt.java12
-rw-r--r--plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/metamodel/description/extensions/INodeMappingExt.java12
-rw-r--r--plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/metamodel/description/spec/ContainerMappingSpec.java17
-rw-r--r--plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/metamodel/description/spec/NodeMappingSpec.java16
-rw-r--r--plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/metamodel/helper/ContainerMappingWithInterpreterHelper.java68
-rw-r--r--plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/metamodel/helper/NodeMappingHelper.java78
-rw-r--r--plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/metamodel/operations/DDiagramElementContainerWithInterpreterOperations.java50
-rw-r--r--plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/metamodel/operations/DDiagramElementSpecOperations.java13
-rw-r--r--plugins/org.eclipse.sirius.diagram/src/org/eclipse/sirius/diagram/Messages.java5
-rw-r--r--plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/suite/diagram/AllDiagramPluginsTests.java2
-rw-r--r--plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/mappings/NodeMappingTest.java62
20 files changed, 20 insertions, 418 deletions
diff --git a/plugins/org.eclipse.sirius.diagram.sequence.model/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/CombinedFragmentMappingSpec.java b/plugins/org.eclipse.sirius.diagram.sequence.model/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/CombinedFragmentMappingSpec.java
index 0fa385b7e5..03e6038695 100644
--- a/plugins/org.eclipse.sirius.diagram.sequence.model/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/CombinedFragmentMappingSpec.java
+++ b/plugins/org.eclipse.sirius.diagram.sequence.model/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/CombinedFragmentMappingSpec.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2018 THALES GLOBAL SERVICES.
+ * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -14,11 +14,9 @@ package org.eclipse.sirius.diagram.sequence.business.internal.metamodel.descript
import java.util.HashMap;
import java.util.Map;
-import java.util.WeakHashMap;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.sirius.common.tools.api.util.EObjectCouple;
import org.eclipse.sirius.diagram.DDiagramElement;
import org.eclipse.sirius.diagram.business.internal.metamodel.description.extensions.IContainerMappingExt;
import org.eclipse.sirius.diagram.business.internal.metamodel.helper.ContainerMappingWithInterpreterHelper;
@@ -34,20 +32,12 @@ public class CombinedFragmentMappingSpec extends CombinedFragmentMappingImpl imp
private final Map<EObject, EList<DSemanticDecorator>> viewContainerDone = new HashMap<EObject, EList<DSemanticDecorator>>();
- private final Map<EObjectCouple, EList<EObject>> candidatesCache = new WeakHashMap<EObjectCouple, EList<EObject>>();
-
@Override
public Map<EObject, EList<DSemanticDecorator>> getViewContainerDone() {
return viewContainerDone;
}
@Override
- public Map<EObjectCouple, EList<EObject>> getCandidatesCache() {
- return candidatesCache;
- }
-
-
- @Override
public EList<DDiagramElement> findDNodeFromEObject(final EObject object) {
return ContainerMappingWithInterpreterHelper.findDNodeFromEObject(this, object);
}
diff --git a/plugins/org.eclipse.sirius.diagram.sequence.model/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/EndOfLifeMappingSpec.java b/plugins/org.eclipse.sirius.diagram.sequence.model/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/EndOfLifeMappingSpec.java
index 5942b9bff2..ec8901c5f2 100644
--- a/plugins/org.eclipse.sirius.diagram.sequence.model/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/EndOfLifeMappingSpec.java
+++ b/plugins/org.eclipse.sirius.diagram.sequence.model/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/EndOfLifeMappingSpec.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2018 THALES GLOBAL SERVICES.
+ * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -14,11 +14,9 @@ package org.eclipse.sirius.diagram.sequence.business.internal.metamodel.descript
import java.util.HashMap;
import java.util.Map;
-import java.util.WeakHashMap;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.sirius.common.tools.api.util.EObjectCouple;
import org.eclipse.sirius.diagram.DDiagramElement;
import org.eclipse.sirius.diagram.business.internal.metamodel.description.extensions.INodeMappingExt;
import org.eclipse.sirius.diagram.business.internal.metamodel.helper.NodeMappingHelper;
@@ -34,28 +32,19 @@ public class EndOfLifeMappingSpec extends EndOfLifeMappingImpl implements INodeM
private final Map<EObject, EList<DSemanticDecorator>> viewNodesDone = new HashMap<EObject, EList<DSemanticDecorator>>();
- private final Map<EObjectCouple, EList<EObject>> candidatesCache = new WeakHashMap<EObjectCouple, EList<EObject>>();
-
@Override
public Map<EObject, EList<DSemanticDecorator>> getViewNodesDone() {
return viewNodesDone;
}
@Override
- public Map<EObjectCouple, EList<EObject>> getCandidatesCache() {
- return candidatesCache;
- }
-
- @Override
public EList<DDiagramElement> findDNodeFromEObject(final EObject object) {
return NodeMappingHelper.findDNodeFromEObject(this, object);
}
-
@Override
public String toString() {
return new StringBuffer(getClass().getName()).append(" ").append(getName()).toString(); //$NON-NLS-1$
}
-
}
diff --git a/plugins/org.eclipse.sirius.diagram.sequence.model/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/ExecutionMappingSpec.java b/plugins/org.eclipse.sirius.diagram.sequence.model/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/ExecutionMappingSpec.java
index f494af29d4..012937ad06 100644
--- a/plugins/org.eclipse.sirius.diagram.sequence.model/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/ExecutionMappingSpec.java
+++ b/plugins/org.eclipse.sirius.diagram.sequence.model/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/ExecutionMappingSpec.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2018 THALES GLOBAL SERVICES.
+ * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -14,11 +14,9 @@ package org.eclipse.sirius.diagram.sequence.business.internal.metamodel.descript
import java.util.HashMap;
import java.util.Map;
-import java.util.WeakHashMap;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.sirius.common.tools.api.util.EObjectCouple;
import org.eclipse.sirius.diagram.DDiagramElement;
import org.eclipse.sirius.diagram.business.internal.metamodel.description.extensions.INodeMappingExt;
import org.eclipse.sirius.diagram.business.internal.metamodel.helper.NodeMappingHelper;
@@ -34,29 +32,19 @@ public class ExecutionMappingSpec extends ExecutionMappingImpl implements INodeM
private final Map<EObject, EList<DSemanticDecorator>> viewNodesDone = new HashMap<EObject, EList<DSemanticDecorator>>();
- private final Map<EObjectCouple, EList<EObject>> candidatesCache = new WeakHashMap<EObjectCouple, EList<EObject>>();
-
@Override
public Map<EObject, EList<DSemanticDecorator>> getViewNodesDone() {
return viewNodesDone;
}
@Override
- public Map<EObjectCouple, EList<EObject>> getCandidatesCache() {
- return candidatesCache;
- }
-
-
- @Override
public EList<DDiagramElement> findDNodeFromEObject(final EObject object) {
return NodeMappingHelper.findDNodeFromEObject(this, object);
}
-
@Override
public String toString() {
return new StringBuffer(getClass().getName()).append(" ").append(getName()).toString(); //$NON-NLS-1$
}
-
}
diff --git a/plugins/org.eclipse.sirius.diagram.sequence.model/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/InstanceRoleMappingSpec.java b/plugins/org.eclipse.sirius.diagram.sequence.model/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/InstanceRoleMappingSpec.java
index ce879b673c..3f0c8b31b3 100644
--- a/plugins/org.eclipse.sirius.diagram.sequence.model/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/InstanceRoleMappingSpec.java
+++ b/plugins/org.eclipse.sirius.diagram.sequence.model/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/InstanceRoleMappingSpec.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2018 THALES GLOBAL SERVICES.
+ * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -14,11 +14,9 @@ package org.eclipse.sirius.diagram.sequence.business.internal.metamodel.descript
import java.util.HashMap;
import java.util.Map;
-import java.util.WeakHashMap;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.sirius.common.tools.api.util.EObjectCouple;
import org.eclipse.sirius.diagram.DDiagramElement;
import org.eclipse.sirius.diagram.business.internal.metamodel.description.extensions.INodeMappingExt;
import org.eclipse.sirius.diagram.business.internal.metamodel.helper.NodeMappingHelper;
@@ -34,20 +32,12 @@ public class InstanceRoleMappingSpec extends InstanceRoleMappingImpl implements
private final Map<EObject, EList<DSemanticDecorator>> viewNodesDone = new HashMap<EObject, EList<DSemanticDecorator>>();
- private final Map<EObjectCouple, EList<EObject>> candidatesCache = new WeakHashMap<EObjectCouple, EList<EObject>>();
-
@Override
public Map<EObject, EList<DSemanticDecorator>> getViewNodesDone() {
return viewNodesDone;
}
@Override
- public Map<EObjectCouple, EList<EObject>> getCandidatesCache() {
- return candidatesCache;
- }
-
-
- @Override
public EList<DDiagramElement> findDNodeFromEObject(final EObject object) {
return NodeMappingHelper.findDNodeFromEObject(this, object);
}
diff --git a/plugins/org.eclipse.sirius.diagram.sequence.model/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/InteractionUseMappingSpec.java b/plugins/org.eclipse.sirius.diagram.sequence.model/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/InteractionUseMappingSpec.java
index c8eb692f67..ff176e9de2 100644
--- a/plugins/org.eclipse.sirius.diagram.sequence.model/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/InteractionUseMappingSpec.java
+++ b/plugins/org.eclipse.sirius.diagram.sequence.model/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/InteractionUseMappingSpec.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2018 THALES GLOBAL SERVICES.
+ * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -14,11 +14,9 @@ package org.eclipse.sirius.diagram.sequence.business.internal.metamodel.descript
import java.util.HashMap;
import java.util.Map;
-import java.util.WeakHashMap;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.sirius.common.tools.api.util.EObjectCouple;
import org.eclipse.sirius.diagram.DDiagramElement;
import org.eclipse.sirius.diagram.business.internal.metamodel.description.extensions.IContainerMappingExt;
import org.eclipse.sirius.diagram.business.internal.metamodel.helper.ContainerMappingWithInterpreterHelper;
@@ -34,25 +32,16 @@ public class InteractionUseMappingSpec extends InteractionUseMappingImpl impleme
private final Map<EObject, EList<DSemanticDecorator>> viewContainerDone = new HashMap<EObject, EList<DSemanticDecorator>>();
- private final Map<EObjectCouple, EList<EObject>> candidatesCache = new WeakHashMap<EObjectCouple, EList<EObject>>();
-
@Override
public Map<EObject, EList<DSemanticDecorator>> getViewContainerDone() {
return viewContainerDone;
}
@Override
- public Map<EObjectCouple, EList<EObject>> getCandidatesCache() {
- return candidatesCache;
- }
-
-
- @Override
public EList<DDiagramElement> findDNodeFromEObject(final EObject object) {
return ContainerMappingWithInterpreterHelper.findDNodeFromEObject(this, object);
}
-
@Override
public String toString() {
return new StringBuffer(getClass().getName()).append(" ").append(getName()).toString(); //$NON-NLS-1$
diff --git a/plugins/org.eclipse.sirius.diagram.sequence.model/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/ObservationPointMappingSpec.java b/plugins/org.eclipse.sirius.diagram.sequence.model/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/ObservationPointMappingSpec.java
index a2d1087778..a44ff34058 100644
--- a/plugins/org.eclipse.sirius.diagram.sequence.model/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/ObservationPointMappingSpec.java
+++ b/plugins/org.eclipse.sirius.diagram.sequence.model/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/ObservationPointMappingSpec.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2018 THALES GLOBAL SERVICES.
+ * Copyright (c) 2012, 2021 THALES GLOBAL SERVICES.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -14,11 +14,9 @@ package org.eclipse.sirius.diagram.sequence.business.internal.metamodel.descript
import java.util.HashMap;
import java.util.Map;
-import java.util.WeakHashMap;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.sirius.common.tools.api.util.EObjectCouple;
import org.eclipse.sirius.diagram.DDiagramElement;
import org.eclipse.sirius.diagram.business.internal.metamodel.description.extensions.INodeMappingExt;
import org.eclipse.sirius.diagram.business.internal.metamodel.helper.NodeMappingHelper;
@@ -34,28 +32,19 @@ public class ObservationPointMappingSpec extends ObservationPointMappingImpl imp
private final Map<EObject, EList<DSemanticDecorator>> viewNodesDone = new HashMap<EObject, EList<DSemanticDecorator>>();
- private final Map<EObjectCouple, EList<EObject>> candidatesCache = new WeakHashMap<EObjectCouple, EList<EObject>>();
-
@Override
public Map<EObject, EList<DSemanticDecorator>> getViewNodesDone() {
return viewNodesDone;
}
@Override
- public Map<EObjectCouple, EList<EObject>> getCandidatesCache() {
- return candidatesCache;
- }
-
- @Override
public EList<DDiagramElement> findDNodeFromEObject(final EObject object) {
return NodeMappingHelper.findDNodeFromEObject(this, object);
}
-
@Override
public String toString() {
return new StringBuffer(getClass().getName()).append(" ").append(getName()).toString(); //$NON-NLS-1$
}
-
}
diff --git a/plugins/org.eclipse.sirius.diagram.sequence.model/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/OperandMappingSpec.java b/plugins/org.eclipse.sirius.diagram.sequence.model/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/OperandMappingSpec.java
index 9227f6deb8..c19b219e56 100644
--- a/plugins/org.eclipse.sirius.diagram.sequence.model/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/OperandMappingSpec.java
+++ b/plugins/org.eclipse.sirius.diagram.sequence.model/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/OperandMappingSpec.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2018 THALES GLOBAL SERVICES.
+ * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -14,11 +14,9 @@ package org.eclipse.sirius.diagram.sequence.business.internal.metamodel.descript
import java.util.HashMap;
import java.util.Map;
-import java.util.WeakHashMap;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.sirius.common.tools.api.util.EObjectCouple;
import org.eclipse.sirius.diagram.DDiagramElement;
import org.eclipse.sirius.diagram.business.internal.metamodel.description.extensions.IContainerMappingExt;
import org.eclipse.sirius.diagram.business.internal.metamodel.helper.ContainerMappingWithInterpreterHelper;
@@ -34,25 +32,16 @@ public class OperandMappingSpec extends OperandMappingImpl implements IContainer
private final Map<EObject, EList<DSemanticDecorator>> viewContainerDone = new HashMap<EObject, EList<DSemanticDecorator>>();
- private final Map<EObjectCouple, EList<EObject>> candidatesCache = new WeakHashMap<EObjectCouple, EList<EObject>>();
-
@Override
public Map<EObject, EList<DSemanticDecorator>> getViewContainerDone() {
return viewContainerDone;
}
@Override
- public Map<EObjectCouple, EList<EObject>> getCandidatesCache() {
- return candidatesCache;
- }
-
-
- @Override
public EList<DDiagramElement> findDNodeFromEObject(final EObject object) {
return ContainerMappingWithInterpreterHelper.findDNodeFromEObject(this, object);
}
-
@Override
public String toString() {
return new StringBuffer(getClass().getName()).append(" ").append(getName()).toString(); //$NON-NLS-1$
diff --git a/plugins/org.eclipse.sirius.diagram.sequence.model/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/StateMappingSpec.java b/plugins/org.eclipse.sirius.diagram.sequence.model/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/StateMappingSpec.java
index 064ac83352..d9e15f1cb5 100644
--- a/plugins/org.eclipse.sirius.diagram.sequence.model/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/StateMappingSpec.java
+++ b/plugins/org.eclipse.sirius.diagram.sequence.model/src/org/eclipse/sirius/diagram/sequence/business/internal/metamodel/description/StateMappingSpec.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2018 THALES GLOBAL SERVICES.
+ * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -14,11 +14,9 @@ package org.eclipse.sirius.diagram.sequence.business.internal.metamodel.descript
import java.util.HashMap;
import java.util.Map;
-import java.util.WeakHashMap;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.sirius.common.tools.api.util.EObjectCouple;
import org.eclipse.sirius.diagram.DDiagramElement;
import org.eclipse.sirius.diagram.business.internal.metamodel.description.extensions.INodeMappingExt;
import org.eclipse.sirius.diagram.business.internal.metamodel.helper.NodeMappingHelper;
@@ -34,24 +32,16 @@ public class StateMappingSpec extends StateMappingImpl implements INodeMappingEx
private final Map<EObject, EList<DSemanticDecorator>> viewNodesDone = new HashMap<EObject, EList<DSemanticDecorator>>();
- private final Map<EObjectCouple, EList<EObject>> candidatesCache = new WeakHashMap<EObjectCouple, EList<EObject>>();
-
@Override
public Map<EObject, EList<DSemanticDecorator>> getViewNodesDone() {
return viewNodesDone;
}
@Override
- public Map<EObjectCouple, EList<EObject>> getCandidatesCache() {
- return candidatesCache;
- }
-
- @Override
public EList<DDiagramElement> findDNodeFromEObject(final EObject object) {
return NodeMappingHelper.findDNodeFromEObject(this, object);
}
-
@Override
public String toString() {
return new StringBuffer(getClass().getName()).append(" ").append(getName()).toString(); //$NON-NLS-1$
diff --git a/plugins/org.eclipse.sirius.diagram/plugin.properties b/plugins/org.eclipse.sirius.diagram/plugin.properties
index 12a2b9a5b0..206e160918 100644
--- a/plugins/org.eclipse.sirius.diagram/plugin.properties
+++ b/plugins/org.eclipse.sirius.diagram/plugin.properties
@@ -230,7 +230,6 @@ HideDDiagramElementLabel_hideLabel = Hide label
HideDDiagramElementLabel_hideLabels = Hide labels
NodeFilter_notNullErrorMsg = The node must not be null
NodeIdentifier_parametersErrorMsg = semantic & mappingName are mandatories
-NodeMappingHelper_methodInvocationErrorMsg = [NodeMapping.getNodesCandidates(EObject semanticOrigin, EObject container)] This method must not be invoked. Use [NodeMapping.getNodesCandidates(EObject semanticOrigin, EObject container, EObject containerView)] instead.
NodeMappingHelper_nodeCreationErrorMsg = Error creating nodes : domain class is not defined on a mapping
NoteAttachmentWithoutSourceOrTargetMigrationParticipant_title=Migration done on {0} for "Corrupted note attachments" (the result of this migration will be saved on the next session save):
NoteAttachmentWithoutSourceOrTargetMigrationParticipant_edgesRemoved=\n\t* {0} corrupted note attachments have been removed from diagram "{1}".
diff --git a/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/metamodel/description/extensions/IContainerMappingExt.java b/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/metamodel/description/extensions/IContainerMappingExt.java
index 9d0008512b..5d029f187e 100644
--- a/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/metamodel/description/extensions/IContainerMappingExt.java
+++ b/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/metamodel/description/extensions/IContainerMappingExt.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 THALES GLOBAL SERVICES.
+ * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -16,13 +16,11 @@ import java.util.Map;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.sirius.common.tools.api.util.EObjectCouple;
import org.eclipse.sirius.diagram.description.ContainerMapping;
import org.eclipse.sirius.viewpoint.DSemanticDecorator;
/**
- * Extension to the ContainerMapping interface to support more efficient
- * implementation.
+ * Extension to the ContainerMapping interface to support more efficient implementation.
*
* @author pcdavid
*/
@@ -34,10 +32,4 @@ public interface IContainerMappingExt extends ContainerMapping {
*/
Map<EObject, EList<DSemanticDecorator>> getViewContainerDone();
- /**
- * Return the candidates cache for this mapping.
- *
- * @return the candidates cache for this mapping.
- */
- Map<EObjectCouple, EList<EObject>> getCandidatesCache();
}
diff --git a/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/metamodel/description/extensions/INodeMappingExt.java b/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/metamodel/description/extensions/INodeMappingExt.java
index 24d23a0db0..a1fa91df0a 100644
--- a/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/metamodel/description/extensions/INodeMappingExt.java
+++ b/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/metamodel/description/extensions/INodeMappingExt.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 THALES GLOBAL SERVICES.
+ * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -16,13 +16,11 @@ import java.util.Map;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.sirius.common.tools.api.util.EObjectCouple;
import org.eclipse.sirius.diagram.description.NodeMapping;
import org.eclipse.sirius.viewpoint.DSemanticDecorator;
/**
- * Extension to the ContainerMapping interface used by the actual
- * implementation.
+ * Extension to the ContainerMapping interface used by the actual implementation.
*
* @author pcdavid
*/
@@ -34,10 +32,4 @@ public interface INodeMappingExt extends NodeMapping {
*/
Map<EObject, EList<DSemanticDecorator>> getViewNodesDone();
- /**
- * Return the candidates cache for this mapping.
- *
- * @return the candidates cache for this mapping.
- */
- Map<EObjectCouple, EList<EObject>> getCandidatesCache();
}
diff --git a/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/metamodel/description/spec/ContainerMappingSpec.java b/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/metamodel/description/spec/ContainerMappingSpec.java
index fbf1be4d84..b53f7792b3 100644
--- a/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/metamodel/description/spec/ContainerMappingSpec.java
+++ b/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/metamodel/description/spec/ContainerMappingSpec.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2018 THALES GLOBAL SERVICES.
+ * Copyright (c) 2007, 2021 THALES GLOBAL SERVICES.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -14,12 +14,10 @@ package org.eclipse.sirius.diagram.business.internal.metamodel.description.spec;
import java.util.HashMap;
import java.util.Map;
-import java.util.WeakHashMap;
import org.eclipse.emf.common.util.BasicEList;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.sirius.common.tools.api.util.EObjectCouple;
import org.eclipse.sirius.diagram.DDiagramElement;
import org.eclipse.sirius.diagram.business.internal.metamodel.description.extensions.IContainerMappingExt;
import org.eclipse.sirius.diagram.description.impl.ContainerMappingImpl;
@@ -34,8 +32,6 @@ public class ContainerMappingSpec extends ContainerMappingImpl implements IConta
private final Map<EObject, EList<DSemanticDecorator>> viewContainerDone = new HashMap<EObject, EList<DSemanticDecorator>>();
- private final Map<EObjectCouple, EList<EObject>> candidatesCache = new WeakHashMap<EObjectCouple, EList<EObject>>();
-
/**
* {@inheritDoc}
*/
@@ -48,15 +44,6 @@ public class ContainerMappingSpec extends ContainerMappingImpl implements IConta
* {@inheritDoc}
*/
@Override
- public Map<EObjectCouple, EList<EObject>> getCandidatesCache() {
- return candidatesCache;
- }
-
-
- /**
- * {@inheritDoc}
- */
- @Override
public EList<DDiagramElement> findDNodeFromEObject(final EObject object) {
EList result = this.getViewContainerDone().get(object);
if (result == null) {
@@ -65,8 +52,6 @@ public class ContainerMappingSpec extends ContainerMappingImpl implements IConta
return result;
}
-
-
/**
* {@inheritDoc}
*/
diff --git a/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/metamodel/description/spec/NodeMappingSpec.java b/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/metamodel/description/spec/NodeMappingSpec.java
index f63a54a0ce..3b1b286312 100644
--- a/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/metamodel/description/spec/NodeMappingSpec.java
+++ b/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/metamodel/description/spec/NodeMappingSpec.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2018 THALES GLOBAL SERVICES.
+ * Copyright (c) 2007, 2021 THALES GLOBAL SERVICES.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -14,11 +14,9 @@ package org.eclipse.sirius.diagram.business.internal.metamodel.description.spec;
import java.util.HashMap;
import java.util.Map;
-import java.util.WeakHashMap;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.sirius.common.tools.api.util.EObjectCouple;
import org.eclipse.sirius.diagram.DDiagramElement;
import org.eclipse.sirius.diagram.business.internal.metamodel.description.extensions.INodeMappingExt;
import org.eclipse.sirius.diagram.business.internal.metamodel.helper.NodeMappingHelper;
@@ -35,8 +33,6 @@ public class NodeMappingSpec extends NodeMappingImpl implements INodeMappingExt
private final Map<EObject, EList<DSemanticDecorator>> viewNodesDone = new HashMap<EObject, EList<DSemanticDecorator>>();
- private final Map<EObjectCouple, EList<EObject>> candidatesCache = new WeakHashMap<EObjectCouple, EList<EObject>>();
-
/**
* {@inheritDoc}
*/
@@ -49,15 +45,6 @@ public class NodeMappingSpec extends NodeMappingImpl implements INodeMappingExt
* {@inheritDoc}
*/
@Override
- public Map<EObjectCouple, EList<EObject>> getCandidatesCache() {
- return candidatesCache;
- }
-
-
- /**
- * {@inheritDoc}
- */
- @Override
public EList<DDiagramElement> findDNodeFromEObject(final EObject object) {
throw new UnsupportedOperationException();
}
@@ -66,7 +53,6 @@ public class NodeMappingSpec extends NodeMappingImpl implements INodeMappingExt
* Behavior inherited from DiagramElementMapping
*/
-
/**
* {@inheritDoc}
*/
diff --git a/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/metamodel/helper/ContainerMappingWithInterpreterHelper.java b/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/metamodel/helper/ContainerMappingWithInterpreterHelper.java
index 592778fe68..4a98873cd0 100644
--- a/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/metamodel/helper/ContainerMappingWithInterpreterHelper.java
+++ b/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/metamodel/helper/ContainerMappingWithInterpreterHelper.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2019 THALES GLOBAL SERVICES.
+ * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -21,17 +21,13 @@ import java.util.LinkedList;
import org.eclipse.emf.common.util.BasicEList;
import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.common.util.UniqueEList;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.sirius.business.api.logger.RuntimeLoggerManager;
import org.eclipse.sirius.business.api.session.Session;
import org.eclipse.sirius.business.api.session.SessionManager;
-import org.eclipse.sirius.common.tools.DslCommonPlugin;
import org.eclipse.sirius.common.tools.api.interpreter.EvaluationException;
import org.eclipse.sirius.common.tools.api.interpreter.IInterpreter;
import org.eclipse.sirius.common.tools.api.interpreter.IInterpreterSiriusVariables;
-import org.eclipse.sirius.common.tools.api.util.EObjectCouple;
-import org.eclipse.sirius.common.tools.api.util.RefreshIdsHolder;
import org.eclipse.sirius.common.tools.api.util.StringUtil;
import org.eclipse.sirius.diagram.ContainerStyle;
import org.eclipse.sirius.diagram.DDiagram;
@@ -50,7 +46,6 @@ import org.eclipse.sirius.diagram.business.api.query.ContainerMappingQuery;
import org.eclipse.sirius.diagram.business.api.query.EObjectQuery;
import org.eclipse.sirius.diagram.business.internal.metamodel.description.extensions.IContainerMappingExt;
import org.eclipse.sirius.diagram.business.internal.metamodel.description.operations.AbstractNodeMappingSpecOperations;
-import org.eclipse.sirius.diagram.business.internal.metamodel.description.operations.SiriusElementMappingSpecOperations;
import org.eclipse.sirius.diagram.business.internal.metamodel.description.spec.ContainerMappingSpec;
import org.eclipse.sirius.diagram.description.AbstractNodeMapping;
import org.eclipse.sirius.diagram.description.ContainerMapping;
@@ -64,7 +59,6 @@ import org.eclipse.sirius.diagram.description.tool.ContainerDropDescription;
import org.eclipse.sirius.ecore.extender.business.api.accessor.ModelAccessor;
import org.eclipse.sirius.ext.base.Option;
import org.eclipse.sirius.ext.base.Options;
-import org.eclipse.sirius.tools.api.profiler.SiriusTasksKey;
import org.eclipse.sirius.viewpoint.DSemanticDecorator;
import org.eclipse.sirius.viewpoint.SiriusPlugin;
import org.eclipse.sirius.viewpoint.Style;
@@ -98,7 +92,6 @@ public final class ContainerMappingWithInterpreterHelper {
*/
public static void clearDNodesDone(IContainerMappingExt self) {
self.getViewContainerDone().clear();
- self.getCandidatesCache().clear();
}
/**
@@ -136,65 +129,6 @@ public final class ContainerMappingWithInterpreterHelper {
}
/**
- * Implementation of {@link ContainerMapping#getNodesCandidates(EObject, EObject, EObject)}.
- *
- * @param self
- * the container mapping.
- * @param semanticOrigin
- * the origin of the computation.
- * @param container
- * the semantic element (DSemanticDecorator.getTarget()) of the DDiagramElement (or
- * DDiagramElementContainer or DDiagram) that contains the containers.
- * @param containerView
- * the DDiagramElement (or DDiagramElementContainer or DDiagram) that contains the containers.
- * @return all semantic candidates for this mapping. It checks the DiagramElementMapping.getPreconditionExpression()
- * and return all objects that satisfied the expression.
- */
- public static EList<EObject> getNodesCandidates(IContainerMappingExt self, EObject semanticOrigin, EObject container, EObject containerView) {
- DslCommonPlugin.PROFILER.startWork(SiriusTasksKey.GET_CONTAINER_CANDIDATES_KEY);
- //
- // find the parent diagram.
- DDiagram diagram = null;
- if (containerView instanceof DDiagramElement) {
- diagram = ((DDiagramElement) containerView).getParentDiagram();
- } else if (containerView instanceof DDiagram) {
- diagram = (DDiagram) containerView;
- }
- //
- // The container variable.
- EObject safeContainer;
- if (container == null) {
- safeContainer = semanticOrigin;
- } else {
- safeContainer = container;
- }
- final EObjectCouple couple = new EObjectCouple(semanticOrigin, safeContainer, RefreshIdsHolder.getOrCreateHolder(diagram));
- EList<EObject> result = self.getCandidatesCache().get(couple);
- if (result == null) {
- result = new UniqueEList<EObject>();
- Iterator<EObject> it;
- it = DiagramElementMappingHelper.getSemanticIterator(self, semanticOrigin, diagram);
- if (self.getDomainClass() != null) {
- while (it.hasNext()) {
- final EObject eObj = it.next();
- if (isInstanceOf(eObj, self.getDomainClass()) && SiriusElementMappingSpecOperations.checkPrecondition(self, eObj, safeContainer, containerView)) {
- result.add(eObj);
- }
- }
- } else {
- SiriusPlugin.getDefault().error(Messages.ContainerMappingHelper_nodeCreationErrorMsg, new RuntimeException());
- }
- self.getCandidatesCache().put(couple, result);
- }
- DslCommonPlugin.PROFILER.stopWork(SiriusTasksKey.GET_CONTAINER_CANDIDATES_KEY);
- return result;
- }
-
- private static boolean isInstanceOf(EObject eObj, final String typename) {
- return SiriusPlugin.getDefault().getModelAccessorRegistry().getModelAccessor(eObj).eInstanceOf(eObj, typename);
- }
-
- /**
* Get mapping of dropped object.
*
* @param dropTool
diff --git a/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/metamodel/helper/NodeMappingHelper.java b/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/metamodel/helper/NodeMappingHelper.java
index ac5ad8fbd0..6b27372492 100644
--- a/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/metamodel/helper/NodeMappingHelper.java
+++ b/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/metamodel/helper/NodeMappingHelper.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2019 THALES GLOBAL SERVICES.
+ * Copyright (c) 2010, 2021 THALES GLOBAL SERVICES.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -13,31 +13,25 @@
package org.eclipse.sirius.diagram.business.internal.metamodel.helper;
import java.util.Collections;
-import java.util.Iterator;
import org.eclipse.emf.common.util.BasicEList;
import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.common.util.UniqueEList;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.sirius.business.api.logger.RuntimeLoggerManager;
import org.eclipse.sirius.common.tools.DslCommonPlugin;
import org.eclipse.sirius.common.tools.api.interpreter.EvaluationException;
import org.eclipse.sirius.common.tools.api.interpreter.IInterpreter;
import org.eclipse.sirius.common.tools.api.interpreter.IInterpreterSiriusVariables;
-import org.eclipse.sirius.common.tools.api.util.EObjectCouple;
-import org.eclipse.sirius.common.tools.api.util.RefreshIdsHolder;
import org.eclipse.sirius.common.tools.api.util.StringUtil;
import org.eclipse.sirius.diagram.DDiagram;
import org.eclipse.sirius.diagram.DDiagramElement;
import org.eclipse.sirius.diagram.DNode;
import org.eclipse.sirius.diagram.DNodeListElement;
import org.eclipse.sirius.diagram.DiagramFactory;
-import org.eclipse.sirius.diagram.Messages;
import org.eclipse.sirius.diagram.NodeStyle;
import org.eclipse.sirius.diagram.ResizeKind;
import org.eclipse.sirius.diagram.business.internal.metamodel.description.extensions.INodeMappingExt;
import org.eclipse.sirius.diagram.business.internal.metamodel.description.operations.AbstractNodeMappingSpecOperations;
-import org.eclipse.sirius.diagram.business.internal.metamodel.description.operations.SiriusElementMappingSpecOperations;
import org.eclipse.sirius.diagram.description.NodeMapping;
import org.eclipse.sirius.diagram.description.style.NodeStyleDescription;
import org.eclipse.sirius.ext.base.Option;
@@ -71,72 +65,6 @@ public final class NodeMappingHelper {
}
/**
- * Implementation of {@link NodeMapping#getNodesCandidates(EObject, EObject)}.
- *
- * @param self
- * the node mapping.
- * @param semanticOrigin
- * the root element.
- * @param container
- * the container element.
- * @return all semantic elements that are candidates for the mapping.
- */
- public static EList<EObject> getNodesCandidates(NodeMapping self, EObject semanticOrigin, EObject container) {
- SiriusPlugin.getDefault().warning(Messages.NodeMappingHelper_methodInvocationErrorMsg, null);
- return NodeMappingHelper.getNodesCandidates((INodeMappingExt) self, semanticOrigin, container, null);
- }
-
- /**
- * ! Implementation of {@link NodeMapping#getNodesCandidates(EObject, EObject, EObject)}.
- *
- * @param self
- * the node mapping.
- * @param semanticOrigin
- * the root element.
- * @param container
- * the container element.
- * @param containerView
- * the view of the container.
- * @return all semantic elements that are candidates for the mapping.
- */
- public static EList<EObject> getNodesCandidates(INodeMappingExt self, EObject semanticOrigin, final EObject container, final EObject containerView) {
- DslCommonPlugin.PROFILER.startWork(SiriusTasksKey.GET_NODE_CANDIDATES_KEY);
- EObject safeContainer;
- if (container == null) {
- safeContainer = semanticOrigin;
- } else {
- safeContainer = container;
- }
-
- DDiagram diagram = null;
- if (containerView instanceof DDiagramElement) {
- diagram = ((DDiagramElement) containerView).getParentDiagram();
- } else if (containerView instanceof DDiagram) {
- diagram = (DDiagram) containerView;
- }
- final EObjectCouple couple = new EObjectCouple(semanticOrigin, safeContainer, RefreshIdsHolder.getOrCreateHolder(diagram));
- EList<EObject> result = self.getCandidatesCache().get(couple);
- if (result == null) {
- result = new UniqueEList<EObject>();
- Iterator<EObject> it;
- it = DiagramElementMappingHelper.getSemanticIterator(self, semanticOrigin, diagram);
- if (self.getDomainClass() != null) {
- while (it.hasNext()) {
- final EObject eObj = it.next();
- if (NodeMappingHelper.isInstanceOf(eObj, self.getDomainClass()) && SiriusElementMappingSpecOperations.checkPrecondition(self, eObj, safeContainer, containerView)) {
- result.add(eObj);
- }
- }
- } else {
- SiriusPlugin.getDefault().error(Messages.NodeMappingHelper_nodeCreationErrorMsg, new RuntimeException());
- }
- self.getCandidatesCache().put(couple, result);
- }
- DslCommonPlugin.PROFILER.stopWork(SiriusTasksKey.GET_NODE_CANDIDATES_KEY);
- return result;
- }
-
- /**
* Implementation of {@link NodeMapping#createNode(EObject, EObject, DDiagram)}.
*
* @param self
@@ -328,8 +256,7 @@ public final class NodeMappingHelper {
// getting the right style description : default or conditional
DDiagram parentDiagram = listElement.getParentDiagram();
if (container != null) {
- style = (NodeStyleDescription) new MappingWithInterpreterHelper(interpreter).getBestStyleDescription(self, modelElement, listElement, container.getTarget(),
- parentDiagram);
+ style = (NodeStyleDescription) new MappingWithInterpreterHelper(interpreter).getBestStyleDescription(self, modelElement, listElement, container.getTarget(), parentDiagram);
}
if (style != null && !StringUtil.isEmpty(style.getLabelExpression())) {
@@ -395,7 +322,6 @@ public final class NodeMappingHelper {
*/
public static void clearDNodesDone(INodeMappingExt self) {
self.getViewNodesDone().clear();
- self.getCandidatesCache().clear();
}
/**
diff --git a/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/metamodel/operations/DDiagramElementContainerWithInterpreterOperations.java b/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/metamodel/operations/DDiagramElementContainerWithInterpreterOperations.java
index 52096fe534..f3074fa9ea 100644
--- a/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/metamodel/operations/DDiagramElementContainerWithInterpreterOperations.java
+++ b/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/metamodel/operations/DDiagramElementContainerWithInterpreterOperations.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2018 THALES GLOBAL SERVICES.
+ * Copyright (c) 2007, 2021 THALES GLOBAL SERVICES.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -28,20 +28,15 @@ import org.eclipse.sirius.common.tools.api.util.StringUtil;
import org.eclipse.sirius.diagram.DDiagram;
import org.eclipse.sirius.diagram.DDiagramElement;
import org.eclipse.sirius.diagram.DDiagramElementContainer;
-import org.eclipse.sirius.diagram.DSemanticDiagram;
import org.eclipse.sirius.diagram.DragAndDropTarget;
import org.eclipse.sirius.diagram.Messages;
import org.eclipse.sirius.diagram.business.api.query.DDiagramQuery;
import org.eclipse.sirius.diagram.business.api.query.DiagramElementMappingQuery;
-import org.eclipse.sirius.diagram.business.internal.metamodel.description.extensions.IContainerMappingExt;
import org.eclipse.sirius.diagram.business.internal.metamodel.helper.ContainerMappingWithInterpreterHelper;
-import org.eclipse.sirius.diagram.business.internal.metamodel.helper.DSemanticDiagramHelper;
-import org.eclipse.sirius.diagram.description.ContainerMapping;
import org.eclipse.sirius.diagram.description.DiagramElementMapping;
import org.eclipse.sirius.diagram.description.DragAndDropTargetDescription;
import org.eclipse.sirius.diagram.description.Layer;
import org.eclipse.sirius.diagram.description.tool.ContainerDropDescription;
-import org.eclipse.sirius.viewpoint.DSemanticDecorator;
import org.eclipse.sirius.viewpoint.SiriusPlugin;
import org.eclipse.sirius.viewpoint.description.tool.AbstractToolDescription;
import org.eclipse.sirius.viewpoint.description.tool.DragSource;
@@ -76,49 +71,6 @@ public final class DDiagramElementContainerWithInterpreterOperations {
}
/**
- * Validated the specified container.
- *
- * @param container
- * the container to validate.
- * @return <code>true</code> if the container is valid.
- */
- public static boolean validate(final DDiagramElementContainer container) {
- ContainerMapping actualMapping = container.getActualMapping();
- if (actualMapping != null && container.getTarget() != null && DDiagramElementContainerWithInterpreterOperations.getFirstParentWithSemantic(container) != null) {
- final EObject mySemanticElement = container.getTarget();
- final EObject representedParent = DDiagramElementContainerWithInterpreterOperations.getFirstParentWithSemantic(container);
- EObject representedParentSemantic = DDiagramElementContainerWithInterpreterOperations.getFirstParentWithSemantic(container).getTarget();
- if (representedParent instanceof DSemanticDiagram) {
- representedParentSemantic = DSemanticDiagramHelper.getRootContent((DSemanticDiagram) representedParent);
- }
- if (!ContainerMappingWithInterpreterHelper
- .getNodesCandidates((IContainerMappingExt) actualMapping, representedParentSemantic, ((DSemanticDecorator) representedParent).getTarget(), container).contains(mySemanticElement)) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Return the first parent of the specified container that is a {@link DSemanticDecorator}.
- *
- * @param container
- * the container.
- * @return the first parent of the specified container that is a {@link DSemanticDecorator}.
- */
- public static DSemanticDecorator getFirstParentWithSemantic(final DDiagramElementContainer container) {
- DSemanticDecorator result = null;
- EObject cur = container.eContainer();
- while (cur != null && result == null) {
- if (cur instanceof DSemanticDecorator) {
- result = (DSemanticDecorator) cur;
- }
- cur = cur.eContainer();
- }
- return result;
- }
-
- /**
* Return the best drop description.
*
* @param description
diff --git a/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/metamodel/operations/DDiagramElementSpecOperations.java b/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/metamodel/operations/DDiagramElementSpecOperations.java
index b14052368f..af185ece1a 100644
--- a/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/metamodel/operations/DDiagramElementSpecOperations.java
+++ b/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/metamodel/operations/DDiagramElementSpecOperations.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2008, 2009 THALES GLOBAL SERVICES.
+ * Copyright (c) 2007, 2021 THALES GLOBAL SERVICES.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -49,15 +49,4 @@ public final class DDiagramElementSpecOperations {
return result;
}
- /**
- * Validate the element.
- *
- * @param elem
- * the element to validate.
- * @return <code>true</code> if the element is valid.
- */
- public static boolean validate(final DDiagramElement elem) {
- return true;
- }
-
}
diff --git a/plugins/org.eclipse.sirius.diagram/src/org/eclipse/sirius/diagram/Messages.java b/plugins/org.eclipse.sirius.diagram/src/org/eclipse/sirius/diagram/Messages.java
index fd750dc54d..8fa99288ab 100644
--- a/plugins/org.eclipse.sirius.diagram/src/org/eclipse/sirius/diagram/Messages.java
+++ b/plugins/org.eclipse.sirius.diagram/src/org/eclipse/sirius/diagram/Messages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2015, 2019 Obeo.
+ * Copyright (c) 2015, 2021 Obeo.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -209,9 +209,6 @@ public final class Messages {
public static String NodeIdentifier_parametersErrorMsg;
@TranslatableMessage
- public static String NodeMappingHelper_methodInvocationErrorMsg;
-
- @TranslatableMessage
public static String NodeMappingHelper_nodeCreationErrorMsg;
@TranslatableMessage
diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/suite/diagram/AllDiagramPluginsTests.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/suite/diagram/AllDiagramPluginsTests.java
index 2421fcaf74..369248df1c 100644
--- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/suite/diagram/AllDiagramPluginsTests.java
+++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/suite/diagram/AllDiagramPluginsTests.java
@@ -35,7 +35,6 @@ import org.eclipse.sirius.tests.unit.api.mappings.EdgeMappingTest;
import org.eclipse.sirius.tests.unit.api.mappings.MappingImportAndFiltersTests;
import org.eclipse.sirius.tests.unit.api.mappings.MappingsReuseTests;
import org.eclipse.sirius.tests.unit.api.mappings.NodeMappingImportTests;
-import org.eclipse.sirius.tests.unit.api.mappings.NodeMappingTest;
import org.eclipse.sirius.tests.unit.api.mm.MMTest;
import org.eclipse.sirius.tests.unit.api.mmextension.ExtensionPaletteToolTest;
import org.eclipse.sirius.tests.unit.api.refresh.ChangeIdAndLabelTests;
@@ -485,7 +484,6 @@ public class AllDiagramPluginsTests {
suite.addTestSuite(ActivateLayerOnInvalidDiagramTest.class);
suite.addTestSuite(MultipleMappingImportTests.class);
suite.addTestSuite(MultipleMappingImportTests2.class);
- suite.addTestSuite(NodeMappingTest.class);
suite.addTestSuite(EdgeMappingTest.class);
suite.addTestSuite(ContainerMappingImportTests.class);
suite.addTestSuite(CompartmentMappingsTests.class);
diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/mappings/NodeMappingTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/mappings/NodeMappingTest.java
deleted file mode 100644
index 702ae4dd7d..0000000000
--- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/mappings/NodeMappingTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010, 2018 THALES GLOBAL SERVICES.
- * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.sirius.tests.unit.api.mappings;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.sirius.diagram.DDiagram;
-import org.eclipse.sirius.diagram.DiagramFactory;
-import org.eclipse.sirius.diagram.business.internal.metamodel.description.extensions.INodeMappingExt;
-import org.eclipse.sirius.diagram.business.internal.metamodel.helper.ContentHelper;
-import org.eclipse.sirius.diagram.business.internal.metamodel.helper.NodeMappingHelper;
-import org.eclipse.sirius.diagram.description.DiagramDescription;
-import org.eclipse.sirius.diagram.description.NodeMapping;
-import org.eclipse.sirius.tests.support.api.SiriusDiagramTestCase;
-import org.eclipse.sirius.viewpoint.description.RepresentationDescription;
-
-/**
- * Tests for NodeMapping usage.
- *
- * @author lredor
- */
-public class NodeMappingTest extends SiriusDiagramTestCase implements MappingsReuseTestModeler {
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- genericSetUp(TEST_SEMANTIC_MODEL_PATH, MODELER_PATH);
- initViewpoint(DEFAULT_VIEWPOINT_NAME);
- }
-
- /**
- * Test getNodesCandidates() (avoid Stack overflow of #2121).
- *
- * @throws Exception
- */
- public void testGetNodesCandidates() throws Exception {
- assertEquals("Bad number of Sirius", 1, viewpoints.size());
- assertEquals("Bad number of Representations", 6, viewpoints.iterator().next().getOwnedRepresentations().size());
- assertEquals("Bad name for the first representation", "Common", viewpoints.iterator().next().getOwnedRepresentations().get(0).getName());
- assertEquals("Bad name for the first representation", "Common", viewpoints.iterator().next().getOwnedRepresentations().get(0).getName());
- RepresentationDescription representationDesc = viewpoints.iterator().next().getOwnedRepresentations().get(0);
- assertTrue("Bad type for representation", representationDesc instanceof DiagramDescription);
- DiagramDescription diagDesc = (DiagramDescription) representationDesc;
- DDiagram diag = DiagramFactory.eINSTANCE.createDDiagram();
- for (NodeMapping nodeMapping : ContentHelper.getAllNodeMappings(diagDesc, false)) {
- if (COMMON_NODE_MAPPING_ON_ECLASS.equals(nodeMapping.getName())) {
- EList<EObject> nodesCandidates = NodeMappingHelper.getNodesCandidates((INodeMappingExt) nodeMapping, semanticModel, semanticModel, diag);
- assertEquals("Bad number of nodes candidates for mapping \"" + COMMON_NODE_MAPPING_ON_ECLASS + "\"", 1, nodesCandidates.size());
- }
- }
- }
-}

Back to the top