Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/developer/org.eclipse.papyrus.gmf.editpoliciesstates')
-rw-r--r--plugins/developer/org.eclipse.papyrus.gmf.editpoliciesstates/.classpath7
-rw-r--r--plugins/developer/org.eclipse.papyrus.gmf.editpoliciesstates/.project28
-rw-r--r--plugins/developer/org.eclipse.papyrus.gmf.editpoliciesstates/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--plugins/developer/org.eclipse.papyrus.gmf.editpoliciesstates/META-INF/MANIFEST.MF19
-rw-r--r--plugins/developer/org.eclipse.papyrus.gmf.editpoliciesstates/about.html28
-rw-r--r--plugins/developer/org.eclipse.papyrus.gmf.editpoliciesstates/build.properties8
-rw-r--r--plugins/developer/org.eclipse.papyrus.gmf.editpoliciesstates/plugin.properties3
-rw-r--r--plugins/developer/org.eclipse.papyrus.gmf.editpoliciesstates/plugin.xml14
-rw-r--r--plugins/developer/org.eclipse.papyrus.gmf.editpoliciesstates/src/org/eclipse/papyrus/gmf/editpoliciesstates/Activator.java50
-rw-r--r--plugins/developer/org.eclipse.papyrus.gmf.editpoliciesstates/src/org/eclipse/papyrus/gmf/editpoliciesstates/view/EditPoliciesStateView.java289
-rw-r--r--plugins/developer/org.eclipse.papyrus.gmf.editpoliciesstates/src/org/eclipse/papyrus/gmf/editpoliciesstates/view/EditpolicyLabelProvider.java98
11 files changed, 551 insertions, 0 deletions
diff --git a/plugins/developer/org.eclipse.papyrus.gmf.editpoliciesstates/.classpath b/plugins/developer/org.eclipse.papyrus.gmf.editpoliciesstates/.classpath
new file mode 100644
index 00000000000..2d1a4302f04
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.gmf.editpoliciesstates/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/developer/org.eclipse.papyrus.gmf.editpoliciesstates/.project b/plugins/developer/org.eclipse.papyrus.gmf.editpoliciesstates/.project
new file mode 100644
index 00000000000..5644609803c
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.gmf.editpoliciesstates/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.gmf.editpoliciesstates</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/developer/org.eclipse.papyrus.gmf.editpoliciesstates/.settings/org.eclipse.jdt.core.prefs b/plugins/developer/org.eclipse.papyrus.gmf.editpoliciesstates/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..44217f8c068
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.gmf.editpoliciesstates/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/plugins/developer/org.eclipse.papyrus.gmf.editpoliciesstates/META-INF/MANIFEST.MF b/plugins/developer/org.eclipse.papyrus.gmf.editpoliciesstates/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..bc881bd6fc2
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.gmf.editpoliciesstates/META-INF/MANIFEST.MF
@@ -0,0 +1,19 @@
+Manifest-Version: 1.0
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.emf.facet.common.ui,
+ org.eclipse.gmf.runtime.diagram.ui,
+ org.eclipse.papyrus.infra.core;bundle-version="1.0.0",
+ org.eclipse.papyrus.editor;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.gmfdiag.dnd;bundle-version="1.0.0"
+Bundle-Vendor: %providerName
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 1.0.0.qualifier
+Bundle-Localization: plugin
+Bundle-Name: %pluginName
+Bundle-Activator: org.eclipse.papyrus.gmf.editpoliciesstates.Activator
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.papyrus.gmf.editpoliciesstates;single
+ ton:=true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
diff --git a/plugins/developer/org.eclipse.papyrus.gmf.editpoliciesstates/about.html b/plugins/developer/org.eclipse.papyrus.gmf.editpoliciesstates/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.gmf.editpoliciesstates/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/plugins/developer/org.eclipse.papyrus.gmf.editpoliciesstates/build.properties b/plugins/developer/org.eclipse.papyrus.gmf.editpoliciesstates/build.properties
new file mode 100644
index 00000000000..6be98f93689
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.gmf.editpoliciesstates/build.properties
@@ -0,0 +1,8 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ plugin.properties,\
+ about.html
+src.includes = about.html
diff --git a/plugins/developer/org.eclipse.papyrus.gmf.editpoliciesstates/plugin.properties b/plugins/developer/org.eclipse.papyrus.gmf.editpoliciesstates/plugin.properties
new file mode 100644
index 00000000000..4760ab80448
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.gmf.editpoliciesstates/plugin.properties
@@ -0,0 +1,3 @@
+#Properties file for org.eclipse.papyrus.emf.commandstack
+providerName = Eclipse Modeling Project
+pluginName = A View for editpolicies
diff --git a/plugins/developer/org.eclipse.papyrus.gmf.editpoliciesstates/plugin.xml b/plugins/developer/org.eclipse.papyrus.gmf.editpoliciesstates/plugin.xml
new file mode 100644
index 00000000000..ff37211f6e4
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.gmf.editpoliciesstates/plugin.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.ui.views">
+ <view
+ category="org.eclipse.papyrus.views.category"
+ class="org.eclipse.papyrus.gmf.editpoliciesstates.view.EditPoliciesStateView"
+ id="org.eclipse.papyrus.gmf.editPoliciesstates"
+ name="Editpolicies view"
+ restorable="true">
+ </view>
+ </extension>
+</plugin>
diff --git a/plugins/developer/org.eclipse.papyrus.gmf.editpoliciesstates/src/org/eclipse/papyrus/gmf/editpoliciesstates/Activator.java b/plugins/developer/org.eclipse.papyrus.gmf.editpoliciesstates/src/org/eclipse/papyrus/gmf/editpoliciesstates/Activator.java
new file mode 100644
index 00000000000..cb6b5fc23fe
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.gmf.editpoliciesstates/src/org/eclipse/papyrus/gmf/editpoliciesstates/Activator.java
@@ -0,0 +1,50 @@
+package org.eclipse.papyrus.gmf.editpoliciesstates;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.gmf.editPoliciesstates"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/plugins/developer/org.eclipse.papyrus.gmf.editpoliciesstates/src/org/eclipse/papyrus/gmf/editpoliciesstates/view/EditPoliciesStateView.java b/plugins/developer/org.eclipse.papyrus.gmf.editpoliciesstates/src/org/eclipse/papyrus/gmf/editpoliciesstates/view/EditPoliciesStateView.java
new file mode 100644
index 00000000000..1cce3c304c7
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.gmf.editpoliciesstates/src/org/eclipse/papyrus/gmf/editpoliciesstates/view/EditPoliciesStateView.java
@@ -0,0 +1,289 @@
+/*****************************************************************************
+ * Copyright (c) 2013 CEA LIST.
+ *
+ *
+ * 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:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ */
+package org.eclipse.papyrus.gmf.editpoliciesstates.view;
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.editparts.AbstractEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.papyrus.infra.gmfdiag.dnd.policy.CustomizableDropEditPolicy;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeColumn;
+import org.eclipse.ui.ISelectionListener;
+import org.eclipse.ui.ISelectionService;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.ViewPart;
+
+/**
+ * this class is used to see all editpolicies attached to a editpart
+ * It very specify for papyrus.
+ *
+ *
+ */
+public class EditPoliciesStateView extends ViewPart {
+
+ /**
+ * this a object that represents a line into the table
+ */
+ class EditPolicyDescriptor{
+ public String role="NO ROLE";
+ public EditPolicy policy= null;
+ }
+
+
+ private ArrayList<EditPolicyDescriptor> editPolicyList = new ArrayList<EditPolicyDescriptor>();
+ private ISelectionListener myEditPartlistener;
+ private TreeViewer viewer;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
+ */
+ public void setFocus() {
+ Viewer viewer = getViewer();
+ if (viewer != null && !viewer.getControl().isDisposed()) {
+
+ viewer.getControl().setFocus();
+ }
+ }
+
+ /**
+ * Create the main tree control
+ *
+ * @param parent
+ * @return Tree
+ */
+ protected Tree createTree(Composite parent) {
+ Tree tree = new Tree(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI
+ | SWT.FULL_SELECTION);
+ tree.setLinesVisible(true);
+ return tree;
+ }
+
+ /**
+ * Return the viewer.
+ *
+ * @return TreeViewer
+ */
+ protected TreeViewer getViewer() {
+ return viewer;
+ }
+ /**
+ *
+ * Constructor.
+ *
+ */
+ public EditPoliciesStateView() {
+ myEditPartlistener = new ISelectionListener() {
+
+ public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+
+ if(selection instanceof IStructuredSelection) {
+ Object[] policiesValue=null;
+ Object selectedobject = ((IStructuredSelection)selection).getFirstElement();
+ if(selectedobject instanceof GraphicalEditPart) {
+ GraphicalEditPart graphicalEP = ((GraphicalEditPart)selectedobject);
+ Field policiesFiled = null;
+ try {
+ policiesFiled = AbstractEditPart.class.getDeclaredField("policies");
+ } catch (NoSuchFieldException e ) {
+ e.printStackTrace();
+ }catch (SecurityException e) {
+ e.printStackTrace();
+ }
+ policiesFiled.setAccessible(true);
+
+ try {
+ policiesValue = (Object[])policiesFiled.get(graphicalEP);
+ } catch (IllegalArgumentException e) {
+ e.printStackTrace();
+ }catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ editPolicyList.clear();
+
+ for(int i=0;i<policiesValue.length;i=i+2) {
+ EditPolicyDescriptor epd= new EditPolicyDescriptor();
+ if(policiesValue[i] instanceof String){
+ epd.role=(String)policiesValue[i];
+ editPolicyList.add(epd);
+ }
+
+
+ if(policiesValue[i+1] instanceof EditPolicy){
+ epd.policy=(EditPolicy)policiesValue[i+1];
+ }
+ }
+ if(viewer!=null){
+ viewer.setInput(editPolicyList);
+ }
+ }
+
+ }
+ }
+ };
+ ISelectionService selectionService = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService();
+ selectionService.addSelectionListener(myEditPartlistener);
+
+ }
+
+ protected void createColumns() {
+ viewer.getTree().setHeaderVisible(true);
+ viewer.getTree().setLinesVisible(true);
+
+ TreeColumn tcName =new TreeColumn(viewer.getTree(), SWT.LEFT);
+ tcName.setText("Name");
+ tcName.setWidth(200);
+ TreeColumn tcDescription = new TreeColumn(viewer.getTree(), SWT.LEFT);
+ tcDescription.setText("Description");
+ tcDescription.setWidth(800);
+ }
+
+ @Override
+ public void createPartControl(final org.eclipse.swt.widgets.Composite parent) {
+ final IToolBarManager tbm = getViewSite().getActionBars().getToolBarManager();
+ tbm.add(getClearViewAction());
+ viewer = new TreeViewer(createTree(parent));
+ viewer.setContentProvider(getContentProvider());
+ viewer.setLabelProvider(getLabelProvider());
+ createColumns();
+
+ }
+
+ protected ITableLabelProvider getLabelProvider(){
+ return new EditpolicyLabelProvider();
+ }
+
+ protected Action getClearViewAction(){
+ return new Action() {
+
+ @Override
+ public void run() {
+ clear();
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return true;
+ }
+
+ @Override
+ public String getToolTipText() {
+ return getText();
+ }
+
+ @Override
+ public String getText() {
+ return "Clear the view";
+ }
+
+ };
+ }
+
+
+ protected IContentProvider getContentProvider() {
+ return new ITreeContentProvider() {
+
+ public Object[] getElements(final Object inputElement) {
+ if(inputElement instanceof Collection<?>) {
+ return ((Collection<?>)inputElement).toArray();
+ }
+ return new Object[0];
+
+ }
+
+ public void inputChanged(final Viewer viewer, final Object oldInput, final Object newInput) {
+ // nothing
+ }
+
+ public void dispose() {
+ // nothing
+ }
+
+ public boolean hasChildren(final Object element) {
+
+ return getChildren(element).length != 0;
+ }
+
+ public Object getParent(final Object element) {
+ return null;
+ }
+
+ public Object[] getChildren(final Object parentElement) {
+ if(parentElement instanceof EditPolicyDescriptor) {
+ if ( ((EditPolicyDescriptor)parentElement).policy!=null){
+ if( ((EditPolicyDescriptor)parentElement).policy instanceof CustomizableDropEditPolicy){
+ Field defaultDropEditPolicyField;
+ try {
+ defaultDropEditPolicyField = CustomizableDropEditPolicy.class.getDeclaredField("defaultDropEditPolicy");
+
+ Field defaultCreationEditPolicyField = CustomizableDropEditPolicy.class.getDeclaredField("defaultCreationEditPolicy");
+ defaultDropEditPolicyField.setAccessible(true);
+ defaultCreationEditPolicyField.setAccessible(true);
+
+ EditPolicyDescriptor edp1= new EditPolicyDescriptor();
+ EditPolicyDescriptor edp2= new EditPolicyDescriptor();
+ edp1.policy=(EditPolicy)defaultDropEditPolicyField.get(((EditPolicyDescriptor)parentElement).policy);
+ edp2.policy=(EditPolicy)defaultCreationEditPolicyField.get(((EditPolicyDescriptor)parentElement).policy);
+ edp1.role="defaultDropEditPolicy";
+ edp2.role="defaultCreationEditPolicy";
+ Object[] result= new Object[2];
+ result[0]=edp1;
+ result[1]=edp2;
+ return result;
+ } catch (NoSuchFieldException e ) {
+ e.printStackTrace();
+ }catch (SecurityException e ) {
+ e.printStackTrace();
+ } catch (IllegalArgumentException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ }
+ return new Object[0];
+ }
+ };
+ }
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ ISelectionService selectionService = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService();
+ selectionService.removeSelectionListener(myEditPartlistener);
+ clear();
+ }
+
+ private void clear() {
+ this.editPolicyList.clear();
+ }
+}
diff --git a/plugins/developer/org.eclipse.papyrus.gmf.editpoliciesstates/src/org/eclipse/papyrus/gmf/editpoliciesstates/view/EditpolicyLabelProvider.java b/plugins/developer/org.eclipse.papyrus.gmf.editpoliciesstates/src/org/eclipse/papyrus/gmf/editpoliciesstates/view/EditpolicyLabelProvider.java
new file mode 100644
index 00000000000..535aa863c40
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.gmf.editpoliciesstates/src/org/eclipse/papyrus/gmf/editpoliciesstates/view/EditpolicyLabelProvider.java
@@ -0,0 +1,98 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * 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:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ */
+package org.eclipse.papyrus.gmf.editpoliciesstates.view;
+
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ITableColorProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.papyrus.gmf.editpoliciesstates.view.EditPoliciesStateView.EditPolicyDescriptor;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+
+
+/**
+ * this is the label provider to display editplicies
+ *
+ */
+public class EditpolicyLabelProvider implements ITableLabelProvider, ITableColorProvider {
+ protected Color papyrusColor = new Color(Display.getDefault(), 0, 127, 14);
+ protected Color customizableDropEditPolicyColor = new Color(Display.getDefault(), 0, 38, 255);
+
+ public void removeListener(ILabelProviderListener listener) {
+ }
+
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ public void dispose() {
+ }
+
+ public void addListener(ILabelProviderListener listener) {
+ }
+
+ public String getColumnText(Object element, int columnIndex) {
+ if(element instanceof EditPolicyDescriptor){
+ switch (columnIndex) {
+ case 0:
+ return ((EditPolicyDescriptor)element).role;
+ case 1:
+ if(((EditPolicyDescriptor)element).policy!=null){
+ return ((EditPolicyDescriptor)element).policy.getClass().getName();}
+ else{ return "";}
+
+ }
+
+ }
+ return "cannot display it: "+element;
+ }
+
+ public Image getColumnImage(Object element, int columnIndex) {
+ return null;
+ }
+
+ public Color getForeground(Object element, int columnIndex) {
+ if(element instanceof EditPolicyDescriptor){
+ switch (columnIndex) {
+ case 0:
+ if(((EditPolicyDescriptor)element).policy!=null){
+ if(((EditPolicyDescriptor)element).policy.getClass().getName().contains("CustomizableDropEditPolicy")){
+ return customizableDropEditPolicyColor;
+ }
+ if(((EditPolicyDescriptor)element).policy.getClass().getName().contains("papyrus")){
+ return papyrusColor;
+ }
+ }
+ return Display.getDefault().getSystemColor(0);
+ case 1:
+ if(((EditPolicyDescriptor)element).policy!=null){
+ if(((EditPolicyDescriptor)element).policy.getClass().getName().contains("CustomizableDropEditPolicy")){
+ return customizableDropEditPolicyColor;
+ }
+ if(((EditPolicyDescriptor)element).policy.getClass().getName().contains("papyrus")){
+ return papyrusColor;
+ }
+ }
+ return Display.getDefault().getSystemColor(0);
+
+ }
+
+ }
+ return Display.getDefault().getSystemColor(0);
+ }
+
+ public Color getBackground(Object element, int columnIndex) {
+ return null;
+ }
+};

Back to the top