Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Noyrit2016-05-30 09:38:16 -0400
committerGerrit Code Review @ Eclipse.org2016-05-30 10:49:13 -0400
commit2fd1fc2ab6e806bdd1829ab2f7f4cba327b844c2 (patch)
tree2fc48531a76d756f94c5c34f931fa0cf23bac855 /plugins/developer/org.eclipse.papyrus.dev.types
parenta184cf4e46d73cb7e5c820dcc81ae23ce7d6d0c2 (diff)
downloadorg.eclipse.papyrus-2fd1fc2ab6e806bdd1829ab2f7f4cba327b844c2.tar.gz
org.eclipse.papyrus-2fd1fc2ab6e806bdd1829ab2f7f4cba327b844c2.tar.xz
org.eclipse.papyrus-2fd1fc2ab6e806bdd1829ab2f7f4cba327b844c2.zip
Bug 494921 - Improve the ElementTypesConfiguration framework to provide
ClientContext dependent advice execution ordering Change-Id: I20eb9fc1fec583e94e919061acf622203e8000f4
Diffstat (limited to 'plugins/developer/org.eclipse.papyrus.dev.types')
-rw-r--r--plugins/developer/org.eclipse.papyrus.dev.types/src/org/eclipse/papyrus/dev/types/providers/ElementTypesDetailsContentProvider.java21
-rw-r--r--plugins/developer/org.eclipse.papyrus.dev.types/src/org/eclipse/papyrus/dev/types/utils/AdvicesComparator.java35
-rw-r--r--plugins/developer/org.eclipse.papyrus.dev.types/src/org/eclipse/papyrus/dev/types/view/RegistredElementTypesView.java11
3 files changed, 28 insertions, 39 deletions
diff --git a/plugins/developer/org.eclipse.papyrus.dev.types/src/org/eclipse/papyrus/dev/types/providers/ElementTypesDetailsContentProvider.java b/plugins/developer/org.eclipse.papyrus.dev.types/src/org/eclipse/papyrus/dev/types/providers/ElementTypesDetailsContentProvider.java
index 2b919398f82..18829a02018 100644
--- a/plugins/developer/org.eclipse.papyrus.dev.types/src/org/eclipse/papyrus/dev/types/providers/ElementTypesDetailsContentProvider.java
+++ b/plugins/developer/org.eclipse.papyrus.dev.types/src/org/eclipse/papyrus/dev/types/providers/ElementTypesDetailsContentProvider.java
@@ -26,10 +26,27 @@ import org.eclipse.gmf.runtime.emf.type.core.SpecializationType;
import org.eclipse.gmf.runtime.emf.type.core.edithelper.IEditHelperAdvice;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.papyrus.dev.types.utils.AdvicesComparator;
+import org.eclipse.papyrus.infra.types.core.utils.AdviceComparator;
public class ElementTypesDetailsContentProvider implements ITreeContentProvider {
+ String contextID;
+
+ String typeID;
+
+
+ /**
+ * @param contextID
+ * the contextID to set
+ */
+ public void setContextID(String contextID) {
+ this.contextID = contextID;
+ }
+
+ public void setTypeID(String typeID) {
+ this.typeID = typeID;
+ }
+
/**
* @see org.eclipse.jface.viewers.IContentProvider#dispose()
*
@@ -119,7 +136,7 @@ public class ElementTypesDetailsContentProvider implements ITreeContentProvider
@Override
public Object[] getChildren(Object parentElement) {
if (parentElement instanceof List<?>) {
- Collections.sort((List<IEditHelperAdvice>) parentElement, new AdvicesComparator());
+ Collections.sort((List<IEditHelperAdvice>) parentElement, new AdviceComparator(contextID));
return ((List<?>) parentElement).toArray();
}
diff --git a/plugins/developer/org.eclipse.papyrus.dev.types/src/org/eclipse/papyrus/dev/types/utils/AdvicesComparator.java b/plugins/developer/org.eclipse.papyrus.dev.types/src/org/eclipse/papyrus/dev/types/utils/AdvicesComparator.java
deleted file mode 100644
index 781b4429dca..00000000000
--- a/plugins/developer/org.eclipse.papyrus.dev.types/src/org/eclipse/papyrus/dev/types/utils/AdvicesComparator.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2015 CEA LIST 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:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.dev.types.utils;
-
-import java.util.Comparator;
-
-import org.eclipse.gmf.runtime.emf.type.core.edithelper.IEditHelperAdvice;
-
-
-public class AdvicesComparator implements Comparator<IEditHelperAdvice> {
-
- /**
- * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
- *
- * @param arg0
- * @param arg1
- * @return
- */
- @Override
- public int compare(IEditHelperAdvice o1, IEditHelperAdvice o2) {
- return o1.toString().compareTo(o2.toString());
- }
-
-}
diff --git a/plugins/developer/org.eclipse.papyrus.dev.types/src/org/eclipse/papyrus/dev/types/view/RegistredElementTypesView.java b/plugins/developer/org.eclipse.papyrus.dev.types/src/org/eclipse/papyrus/dev/types/view/RegistredElementTypesView.java
index 37ee95d146c..627b3b86471 100644
--- a/plugins/developer/org.eclipse.papyrus.dev.types/src/org/eclipse/papyrus/dev/types/view/RegistredElementTypesView.java
+++ b/plugins/developer/org.eclipse.papyrus.dev.types/src/org/eclipse/papyrus/dev/types/view/RegistredElementTypesView.java
@@ -44,6 +44,7 @@ public class RegistredElementTypesView extends ViewPart {
SashForm sash = null;
FilteredTree elementTypesFilteredTree = null;
Combo combo = null;
+ ElementTypesDetailsContentProvider elementTypesDetailsContentProvider;
@Override
@@ -81,6 +82,7 @@ public class RegistredElementTypesView extends ViewPart {
IClientContext clientContex = ClientContextManager.getInstance().getClientContext(clientContexId);
if (clientContex != null) {
IElementType[] elementTypes = ElementTypeRegistry.getInstance().getElementTypes(clientContex);
+ elementTypesDetailsContentProvider.setContextID(clientContex.getId());
elementTypesFilteredTree.getViewer().setInput(elementTypes);
}
}
@@ -102,7 +104,8 @@ public class RegistredElementTypesView extends ViewPart {
elementTypesFilteredTree.getViewer().setContentProvider(new ElementTypesContentProvider());
detailsFilteredTree = new FilteredTree(sash, SWT.BORDER, new PatternFilter(), true);
detailsFilteredTree.getViewer().setLabelProvider(new ElementTypesDetailsLabelProvider());
- detailsFilteredTree.getViewer().setContentProvider(new ElementTypesDetailsContentProvider());
+ elementTypesDetailsContentProvider = new ElementTypesDetailsContentProvider();
+ detailsFilteredTree.getViewer().setContentProvider(elementTypesDetailsContentProvider);
if (index != -1) {
combo.select(index);
@@ -113,7 +116,11 @@ public class RegistredElementTypesView extends ViewPart {
@Override
public void selectionChanged(SelectionChangedEvent event) {
if (event.getSelection() instanceof IStructuredSelection) {
- detailsFilteredTree.getViewer().setInput(((IStructuredSelection) event.getSelection()).getFirstElement());
+ Object selection = ((IStructuredSelection) event.getSelection()).getFirstElement();
+ if (selection instanceof IElementType) {
+ elementTypesDetailsContentProvider.setTypeID(((IElementType) selection).getId());
+ detailsFilteredTree.getViewer().setInput(selection);
+ }
}
}

Back to the top