Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Noyrit2016-01-29 10:02:50 +0000
committerFlorian Noyrit2016-01-29 10:02:50 +0000
commitc33bf090ae301abce757edc6969dbd8326084927 (patch)
treef6460855b0493b814fad96d7572a0cd89a3b7913 /plugins/developer
parentea8ea3da07dd133eed8a6e3f81087c17ad9c5ee5 (diff)
downloadorg.eclipse.papyrus-c33bf090ae301abce757edc6969dbd8326084927.tar.gz
org.eclipse.papyrus-c33bf090ae301abce757edc6969dbd8326084927.tar.xz
org.eclipse.papyrus-c33bf090ae301abce757edc6969dbd8326084927.zip
Improve ElementTypeConfiguration Framework to support:
- Advice execution ordering - Prepare Multiple ClientContext in Papyrus Change-Id: I00b5d3d5e090de1b8fc9926c9073913c90dda47e
Diffstat (limited to 'plugins/developer')
-rw-r--r--plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/view/RegistredElementTypesView.java72
-rw-r--r--plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/xtend-gen/.gitignore1
-rw-r--r--plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/xtend-gen/org/eclipse/papyrus/elementtypesconfigurations/developer/generator/.gitignore2
3 files changed, 52 insertions, 23 deletions
diff --git a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/view/RegistredElementTypesView.java b/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/view/RegistredElementTypesView.java
index ab2398860cc..b41803577ec 100644
--- a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/view/RegistredElementTypesView.java
+++ b/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/src/org/eclipse/papyrus/elementtypesconfigurations/developer/view/RegistredElementTypesView.java
@@ -12,6 +12,10 @@
*****************************************************************************/
package org.eclipse.papyrus.elementtypesconfigurations.developer.view;
+import java.util.ArrayList;
+import java.util.List;
+
+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.IClientContext;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
@@ -22,15 +26,13 @@ import org.eclipse.papyrus.elementtypesconfigurations.developer.providers.Elemen
import org.eclipse.papyrus.elementtypesconfigurations.developer.providers.ElementTypesDetailsContentProvider;
import org.eclipse.papyrus.elementtypesconfigurations.developer.providers.ElementTypesDetailsLabelProvider;
import org.eclipse.papyrus.elementtypesconfigurations.developer.providers.ElementTypesLabelProvider;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.services.edit.internal.context.TypeContext;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.dialogs.FilteredTree;
import org.eclipse.ui.dialogs.PatternFilter;
@@ -38,33 +40,60 @@ import org.eclipse.ui.part.ViewPart;
public class RegistredElementTypesView extends ViewPart {
- IClientContext context = null;
FilteredTree detailsFilteredTree = null;
SashForm sash = null;
FilteredTree elementTypesFilteredTree = null;
+ Combo combo = null;
- public RegistredElementTypesView() {
- try {
- context = TypeContext.getContext();
- } catch (ServiceException e) {
- e.printStackTrace();
- }
- }
@Override
public void createPartControl(Composite parent) {
parent.setLayout(new GridLayout(1, true));
- Button button = new Button(parent, SWT.NONE);
- button.setText("Refresh");
- button.addMouseListener(new MouseAdapter() {
+
+ combo = new Combo(parent, SWT.NONE);
+ final List<String> itemsList = new ArrayList<>();
+ List<IClientContext> contexts = new ArrayList<IClientContext>(ClientContextManager.getInstance().getClientContexts());
+
+ int index = -1;
+ int i = 0;
+ for (IClientContext context : contexts) {
+ itemsList.add(context.getId());
+ if (context.getId().equals(ClientContextManager.getDefaultClientContext().getId())) {
+ index = i;
+ }
+ i++;
+ }
+ String[] items = new String[itemsList.size()];
+ items = itemsList.toArray(items);
+ combo.setItems(items);
+ if (index != -1) {
+ combo.select(index);
+ }
+ combo.addSelectionListener(new SelectionListener() {
@Override
- public void mouseUp(MouseEvent e) {
- IElementType[] elementTypes = ElementTypeRegistry.getInstance().getElementTypes(context);
- elementTypesFilteredTree.getViewer().setInput(elementTypes);
+ public void widgetSelected(SelectionEvent e) {
+ int index = combo.getSelectionIndex();
+
+ String clientContexId = itemsList.get(index);
+
+ if (clientContexId != null) {
+ IClientContext clientContex = ClientContextManager.getInstance().getClientContext(clientContexId);
+ if (clientContex != null) {
+ IElementType[] elementTypes = ElementTypeRegistry.getInstance().getElementTypes(clientContex);
+ elementTypesFilteredTree.getViewer().setInput(elementTypes);
+ }
+ }
+
}
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+
+
+ }
});
+
sash = new SashForm(parent, SWT.HORIZONTAL);
sash.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
@@ -75,8 +104,9 @@ public class RegistredElementTypesView extends ViewPart {
detailsFilteredTree.getViewer().setLabelProvider(new ElementTypesDetailsLabelProvider());
detailsFilteredTree.getViewer().setContentProvider(new ElementTypesDetailsContentProvider());
- IElementType[] elementTypes = ElementTypeRegistry.getInstance().getElementTypes(context);
- elementTypesFilteredTree.getViewer().setInput(elementTypes);
+ if (index != -1) {
+ combo.select(index);
+ }
elementTypesFilteredTree.getViewer().addSelectionChangedListener(new ISelectionChangedListener() {
diff --git a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/xtend-gen/.gitignore b/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/xtend-gen/.gitignore
new file mode 100644
index 00000000000..1c31bab9945
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/xtend-gen/.gitignore
@@ -0,0 +1 @@
+org/ \ No newline at end of file
diff --git a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/xtend-gen/org/eclipse/papyrus/elementtypesconfigurations/developer/generator/.gitignore b/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/xtend-gen/org/eclipse/papyrus/elementtypesconfigurations/developer/generator/.gitignore
deleted file mode 100644
index d728878be1c..00000000000
--- a/plugins/developer/org.eclipse.papyrus.elementtypesconfigurations.developer/xtend-gen/org/eclipse/papyrus/elementtypesconfigurations/developer/generator/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-/ElementTypeRegistryGenerator.java
-/.ElementTypeRegistryGenerator.xtendbin

Back to the top