Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Noyrit2016-05-31 11:43:38 +0000
committerFlorian Noyrit2016-05-31 11:49:15 +0000
commit780187632f37b8cdc956a2281c3ada720902c9de (patch)
tree7abc895dcfe54c38b56eb43557a6b8710e670512 /plugins/infra/gmfdiag
parentaa9ed69f347065014ba57f8d12074ba423f04a04 (diff)
downloadorg.eclipse.papyrus-780187632f37b8cdc956a2281c3ada720902c9de.tar.gz
org.eclipse.papyrus-780187632f37b8cdc956a2281c3ada720902c9de.tar.xz
org.eclipse.papyrus-780187632f37b8cdc956a2281c3ada720902c9de.zip
Bug 494921 - Fix DefaultEditHelper to provide
ClientContext dependent advice execution ordering Change-Id: I76ff3387b217194f0d3685f0cafe59449c6b428e
Diffstat (limited to 'plugins/infra/gmfdiag')
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/DefaultEditHelper.java45
1 files changed, 14 insertions, 31 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/DefaultEditHelper.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/DefaultEditHelper.java
index 9ea3d8d6c22..1923421b102 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/DefaultEditHelper.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/DefaultEditHelper.java
@@ -25,7 +25,6 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.gmf.runtime.common.core.command.ICommand;
import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
-import org.eclipse.gmf.runtime.emf.type.core.IClientContext;
import org.eclipse.gmf.runtime.emf.type.core.IContainerDescriptor;
import org.eclipse.gmf.runtime.emf.type.core.IEditHelperContext;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
@@ -341,51 +340,35 @@ public class DefaultEditHelper extends AbstractNotifierEditHelper {
advices = (IEditHelperAdvice[]) contextMap.get(EditHelper_Advice);
}
}
+
}
if (advices == null) {
+
if (editHelperContext instanceof EObject) {
+ // IElementType type = ElementTypeRegistry.getInstance().getElementType((EObject) editHelperContext, req.getClientContext());
+ // advices = CacheRegistry.getInstance().getEditHelperAdvice(req.getClientContext(), type);
advices = ElementTypeRegistry.getInstance().getEditHelperAdvice((EObject) editHelperContext, req.getClientContext());
- IElementType type = ElementTypeRegistry.getInstance().getElementType((EObject) editHelperContext, req.getClientContext());
- if (type != null) {
- Arrays.sort(advices, new AdviceComparator(req.getClientContext().getId()));
- }
} else if (editHelperContext instanceof IElementType) {
advices = CacheRegistry.getInstance().getEditHelperAdvice(req.getClientContext(), ((IElementType) editHelperContext));
- Arrays.sort(advices, new AdviceComparator(req.getClientContext().getId()));
} else if (editHelperContext instanceof IEditHelperContext) {
- IClientContext clientContext = ((IEditHelperContext) editHelperContext).getClientContext();
- IElementType elementType = ((IEditHelperContext) editHelperContext).getElementType();
- EObject eObject = ((IEditHelperContext) editHelperContext).getEObject();
-
- if (clientContext != null) {
- if (elementType != null) {
- advices = CacheRegistry.getInstance().getEditHelperAdvice(req.getClientContext(), elementType);
- Arrays.sort(advices, new AdviceComparator(req.getClientContext().getId()));
- } else if (eObject != null) {
- IElementType type = ElementTypeRegistry.getInstance().getElementType(eObject, req.getClientContext());
- if (type != null) {
- advices = CacheRegistry.getInstance().getEditHelperAdvice(req.getClientContext(), type);
- Arrays.sort(advices, new AdviceComparator(req.getClientContext().getId()));
- }
- }
+ IElementType type = ((IEditHelperContext) editHelperContext).getElementType();
+ if (type != null) {
+ advices = CacheRegistry.getInstance().getEditHelperAdvice(req.getClientContext(), type);
} else {
- if (elementType != null) {
- advices = CacheRegistry.getInstance().getEditHelperAdvice(req.getClientContext(), elementType);
- Arrays.sort(advices, new AdviceComparator(req.getClientContext().getId()));
- } else if (eObject != null) {
- IElementType type = ElementTypeRegistry.getInstance().getElementType(eObject, req.getClientContext());
- if (type != null) {
- advices = CacheRegistry.getInstance().getEditHelperAdvice(req.getClientContext(), type);
- Arrays.sort(advices, new AdviceComparator(req.getClientContext().getId()));
- }
- }
+ advices = ElementTypeRegistry.getInstance().getEditHelperAdvice(editHelperContext);
}
+ } else {
+ advices = ElementTypeRegistry.getInstance().getEditHelperAdvice(editHelperContext);
}
}
+ if (null != advices) {
+ Arrays.sort(advices, new AdviceComparator(req.getClientContext().getId()));
+ }
+
return advices;
}

Back to the top