Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian NOYRIT2019-09-30 13:39:58 +0000
committerFlorian NOYRIT2019-09-30 13:39:58 +0000
commit7a225a39cc9f7cb3a001956cc4d744adaf4d881e (patch)
treebe7e0c3ef2caf38fc1b52b5786be3d5fc6834f0e
parentf9daafd1f1bc44125a3c0c1ee12f51d0eb427f8f (diff)
downloadorg.eclipse.papyrus-7a225a39cc9f7cb3a001956cc4d744adaf4d881e.tar.gz
org.eclipse.papyrus-7a225a39cc9f7cb3a001956cc4d744adaf4d881e.tar.xz
org.eclipse.papyrus-7a225a39cc9f7cb3a001956cc4d744adaf4d881e.zip
Bug 551629: [ElementTypes] 'Registred ElementTypes' view does not show
correctly the advices of elementtypes Change-Id: Ie4077f7135584089685084ed5015937b991412f3 Signed-off-by: Florian NOYRIT <florian.noyrit@cea.fr>
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.dev.types/src/org/eclipse/papyrus/dev/types/providers/ElementTypesDetailsContentProvider.java20
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.dev.types/src/org/eclipse/papyrus/dev/types/view/RegistredElementTypesView.java14
2 files changed, 19 insertions, 15 deletions
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.dev.types/src/org/eclipse/papyrus/dev/types/providers/ElementTypesDetailsContentProvider.java b/plugins/toolsmiths/org.eclipse.papyrus.dev.types/src/org/eclipse/papyrus/dev/types/providers/ElementTypesDetailsContentProvider.java
index dd4cf76f863..5cd2b2a7ed1 100644
--- a/plugins/toolsmiths/org.eclipse.papyrus.dev.types/src/org/eclipse/papyrus/dev/types/providers/ElementTypesDetailsContentProvider.java
+++ b/plugins/toolsmiths/org.eclipse.papyrus.dev.types/src/org/eclipse/papyrus/dev/types/providers/ElementTypesDetailsContentProvider.java
@@ -21,6 +21,7 @@ import java.util.List;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil;
+import org.eclipse.gmf.runtime.emf.type.core.ClientContextManager;
import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
@@ -28,7 +29,7 @@ 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.infra.types.core.utils.AdviceComparator;
+import org.eclipse.papyrus.infra.types.core.utils.AdviceUtil;
public class ElementTypesDetailsContentProvider implements ITreeContentProvider {
@@ -55,7 +56,7 @@ public class ElementTypesDetailsContentProvider implements ITreeContentProvider
*/
@Override
public void dispose() {
-
+
}
@@ -68,7 +69,7 @@ public class ElementTypesDetailsContentProvider implements ITreeContentProvider
*/
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
-
+
}
@@ -80,7 +81,7 @@ public class ElementTypesDetailsContentProvider implements ITreeContentProvider
*/
@Override
public Object[] getElements(Object inputElement) {
- ArrayList<Object> result = new ArrayList<Object>();
+ ArrayList<Object> result = new ArrayList<>();
if (inputElement instanceof IElementType) {
if (inputElement instanceof IHintedType) {
result.add("Semantic Hint: " + ((IHintedType) inputElement).getSemanticHint());
@@ -123,7 +124,7 @@ public class ElementTypesDetailsContentProvider implements ITreeContentProvider
}
result.add("Display Name: " + ((IElementType) inputElement).getDisplayName());
- IEditHelperAdvice[] advices = ElementTypeRegistry.getInstance().getEditHelperAdvice(((IElementType) inputElement));
+ IEditHelperAdvice[] advices = ElementTypeRegistry.getInstance().getEditHelperAdvice(((IElementType) inputElement), ClientContextManager.getInstance().getClientContext(contextID));
result.add(Arrays.asList(advices));
}
return result.toArray();
@@ -138,8 +139,11 @@ public class ElementTypesDetailsContentProvider implements ITreeContentProvider
@Override
public Object[] getChildren(Object parentElement) {
if (parentElement instanceof List<?>) {
- Collections.sort((List<IEditHelperAdvice>) parentElement, new AdviceComparator(ElementTypeRegistry.getInstance().getType(typeID), contextID));
- return ((List<?>) parentElement).toArray();
+ IEditHelperAdvice[] parents = new IEditHelperAdvice[((List<?>) parentElement).size()];
+ ((List<?>) parentElement).toArray(parents);
+ IEditHelperAdvice[] sortedAdvices = AdviceUtil.sort(parents, ElementTypeRegistry.getInstance().getType(typeID), contextID);
+ // Collections.sort((List<IEditHelperAdvice>) parentElement, new AdviceComparator(ElementTypeRegistry.getInstance().getType(typeID), contextID));
+ return sortedAdvices;
}
return Collections.emptyList().toArray();
@@ -153,7 +157,7 @@ public class ElementTypesDetailsContentProvider implements ITreeContentProvider
*/
@Override
public Object getParent(Object element) {
-
+
return null;
}
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.dev.types/src/org/eclipse/papyrus/dev/types/view/RegistredElementTypesView.java b/plugins/toolsmiths/org.eclipse.papyrus.dev.types/src/org/eclipse/papyrus/dev/types/view/RegistredElementTypesView.java
index 769c71af8bd..c42f68c5f12 100644
--- a/plugins/toolsmiths/org.eclipse.papyrus.dev.types/src/org/eclipse/papyrus/dev/types/view/RegistredElementTypesView.java
+++ b/plugins/toolsmiths/org.eclipse.papyrus.dev.types/src/org/eclipse/papyrus/dev/types/view/RegistredElementTypesView.java
@@ -19,8 +19,6 @@ import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
import java.util.List;
import org.eclipse.gmf.runtime.emf.type.core.ClientContextManager;
@@ -35,7 +33,7 @@ import org.eclipse.papyrus.dev.types.providers.ElementTypesContentProvider;
import org.eclipse.papyrus.dev.types.providers.ElementTypesDetailsContentProvider;
import org.eclipse.papyrus.dev.types.providers.ElementTypesDetailsLabelProvider;
import org.eclipse.papyrus.dev.types.providers.ElementTypesLabelProvider;
-import org.eclipse.papyrus.infra.types.core.utils.AdviceComparator;
+import org.eclipse.papyrus.infra.types.core.utils.AdviceUtil;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.events.MouseAdapter;
@@ -68,7 +66,7 @@ public class RegistredElementTypesView extends ViewPart {
combo = new Combo(parent, SWT.NONE);
final List<String> itemsList = new ArrayList<>();
- List<IClientContext> contexts = new ArrayList<IClientContext>(ClientContextManager.getInstance().getClientContexts());
+ List<IClientContext> contexts = new ArrayList<>(ClientContextManager.getInstance().getClientContexts());
int index = -1;
int i = 0;
@@ -135,9 +133,11 @@ public class RegistredElementTypesView extends ViewPart {
IEditHelperAdvice[] advices = ElementTypeRegistry.getInstance().getEditHelperAdvice(elementType);
- List<IEditHelperAdvice> advicesList = Arrays.asList(advices);
- Collections.sort(advicesList, new AdviceComparator(elementType, clientContexId));
- for (IEditHelperAdvice advice : advicesList) {
+
+ // List<IEditHelperAdvice> advicesList = Arrays.asList(advices);
+ // Collections.sort(advicesList, new AdviceComparator(elementType, clientContexId));
+ IEditHelperAdvice[] sortedAdvices = AdviceUtil.sort(advices, elementType, clientContexId);
+ for (IEditHelperAdvice advice : sortedAdvices) {
writer.write("\t\t" + advice.getClass().getName() + "\n");
}
}

Back to the top