Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraradermache2013-02-25 09:10:53 +0000
committeraradermache2013-02-25 09:10:53 +0000
commitb8bda59979c3bd77a004ccb941f3b349eeec49b8 (patch)
tree46ac0d3385b949e0c2075b0fdb1c0bf73491b24b
parent56fea79583e3ecd936a4d298f9ce84184223585d (diff)
downloadorg.eclipse.papyrus-b8bda59979c3bd77a004ccb941f3b349eeec49b8.tar.gz
org.eclipse.papyrus-b8bda59979c3bd77a004ccb941f3b349eeec49b8.tar.xz
org.eclipse.papyrus-b8bda59979c3bd77a004ccb941f3b349eeec49b8.zip
Initial import:
View that displays hierarchy of figures, when a graphical element is selected
-rw-r--r--plugins/developer/org.eclipse.papyrus.gmf.figureview/.classpath7
-rw-r--r--plugins/developer/org.eclipse.papyrus.gmf.figureview/.project28
-rw-r--r--plugins/developer/org.eclipse.papyrus.gmf.figureview/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--plugins/developer/org.eclipse.papyrus.gmf.figureview/META-INF/MANIFEST.MF17
-rw-r--r--plugins/developer/org.eclipse.papyrus.gmf.figureview/about.html28
-rw-r--r--plugins/developer/org.eclipse.papyrus.gmf.figureview/bin/org/eclipse/papyrus/gmf/figureview/Activator.classbin0 -> 942 bytes
-rw-r--r--plugins/developer/org.eclipse.papyrus.gmf.figureview/bin/org/eclipse/papyrus/gmf/figureview/view/FigureHierarchyView$1.classbin0 -> 1725 bytes
-rw-r--r--plugins/developer/org.eclipse.papyrus.gmf.figureview/bin/org/eclipse/papyrus/gmf/figureview/view/FigureHierarchyView$2.classbin0 -> 1107 bytes
-rw-r--r--plugins/developer/org.eclipse.papyrus.gmf.figureview/bin/org/eclipse/papyrus/gmf/figureview/view/FigureHierarchyView$3.classbin0 -> 1820 bytes
-rw-r--r--plugins/developer/org.eclipse.papyrus.gmf.figureview/bin/org/eclipse/papyrus/gmf/figureview/view/FigureHierarchyView$EditPolicyDescriptor.classbin0 -> 822 bytes
-rw-r--r--plugins/developer/org.eclipse.papyrus.gmf.figureview/bin/org/eclipse/papyrus/gmf/figureview/view/FigureHierarchyView.classbin0 -> 5192 bytes
-rw-r--r--plugins/developer/org.eclipse.papyrus.gmf.figureview/bin/org/eclipse/papyrus/gmf/figureview/view/FigureLabelProvider.classbin0 -> 2971 bytes
-rw-r--r--plugins/developer/org.eclipse.papyrus.gmf.figureview/build.properties5
-rw-r--r--plugins/developer/org.eclipse.papyrus.gmf.figureview/plugin.properties3
-rw-r--r--plugins/developer/org.eclipse.papyrus.gmf.figureview/plugin.xml14
-rw-r--r--plugins/developer/org.eclipse.papyrus.gmf.figureview/src/org/eclipse/papyrus/gmf/figureview/Activator.java52
-rw-r--r--plugins/developer/org.eclipse.papyrus.gmf.figureview/src/org/eclipse/papyrus/gmf/figureview/view/FigureHierarchyView.java234
-rw-r--r--plugins/developer/org.eclipse.papyrus.gmf.figureview/src/org/eclipse/papyrus/gmf/figureview/view/FigureLabelProvider.java96
18 files changed, 491 insertions, 0 deletions
diff --git a/plugins/developer/org.eclipse.papyrus.gmf.figureview/.classpath b/plugins/developer/org.eclipse.papyrus.gmf.figureview/.classpath
new file mode 100644
index 00000000000..2d1a4302f04
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.gmf.figureview/.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.figureview/.project b/plugins/developer/org.eclipse.papyrus.gmf.figureview/.project
new file mode 100644
index 00000000000..5359c719742
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.gmf.figureview/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.gmf.figureview</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.figureview/.settings/org.eclipse.jdt.core.prefs b/plugins/developer/org.eclipse.papyrus.gmf.figureview/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..44217f8c068
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.gmf.figureview/.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.figureview/META-INF/MANIFEST.MF b/plugins/developer/org.eclipse.papyrus.gmf.figureview/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..316bddf8f41
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.gmf.figureview/META-INF/MANIFEST.MF
@@ -0,0 +1,17 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.papyrus.gmf.figureview;singleton:=true
+Bundle-Version: 0.10.0.qualifier
+Bundle-Activator: org.eclipse.papyrus.gmf.figureview.Activator
+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,
+ org.eclipse.papyrus.editor,
+ org.eclipse.papyrus.infra.gmfdiag.dnd;bundle-version="0.9.2"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
diff --git a/plugins/developer/org.eclipse.papyrus.gmf.figureview/about.html b/plugins/developer/org.eclipse.papyrus.gmf.figureview/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.gmf.figureview/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.figureview/bin/org/eclipse/papyrus/gmf/figureview/Activator.class b/plugins/developer/org.eclipse.papyrus.gmf.figureview/bin/org/eclipse/papyrus/gmf/figureview/Activator.class
new file mode 100644
index 00000000000..5ac02ce52b5
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.gmf.figureview/bin/org/eclipse/papyrus/gmf/figureview/Activator.class
Binary files differ
diff --git a/plugins/developer/org.eclipse.papyrus.gmf.figureview/bin/org/eclipse/papyrus/gmf/figureview/view/FigureHierarchyView$1.class b/plugins/developer/org.eclipse.papyrus.gmf.figureview/bin/org/eclipse/papyrus/gmf/figureview/view/FigureHierarchyView$1.class
new file mode 100644
index 00000000000..86b71ff19d0
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.gmf.figureview/bin/org/eclipse/papyrus/gmf/figureview/view/FigureHierarchyView$1.class
Binary files differ
diff --git a/plugins/developer/org.eclipse.papyrus.gmf.figureview/bin/org/eclipse/papyrus/gmf/figureview/view/FigureHierarchyView$2.class b/plugins/developer/org.eclipse.papyrus.gmf.figureview/bin/org/eclipse/papyrus/gmf/figureview/view/FigureHierarchyView$2.class
new file mode 100644
index 00000000000..cb11b4eec35
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.gmf.figureview/bin/org/eclipse/papyrus/gmf/figureview/view/FigureHierarchyView$2.class
Binary files differ
diff --git a/plugins/developer/org.eclipse.papyrus.gmf.figureview/bin/org/eclipse/papyrus/gmf/figureview/view/FigureHierarchyView$3.class b/plugins/developer/org.eclipse.papyrus.gmf.figureview/bin/org/eclipse/papyrus/gmf/figureview/view/FigureHierarchyView$3.class
new file mode 100644
index 00000000000..301f286f5e4
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.gmf.figureview/bin/org/eclipse/papyrus/gmf/figureview/view/FigureHierarchyView$3.class
Binary files differ
diff --git a/plugins/developer/org.eclipse.papyrus.gmf.figureview/bin/org/eclipse/papyrus/gmf/figureview/view/FigureHierarchyView$EditPolicyDescriptor.class b/plugins/developer/org.eclipse.papyrus.gmf.figureview/bin/org/eclipse/papyrus/gmf/figureview/view/FigureHierarchyView$EditPolicyDescriptor.class
new file mode 100644
index 00000000000..32a8e1bac4f
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.gmf.figureview/bin/org/eclipse/papyrus/gmf/figureview/view/FigureHierarchyView$EditPolicyDescriptor.class
Binary files differ
diff --git a/plugins/developer/org.eclipse.papyrus.gmf.figureview/bin/org/eclipse/papyrus/gmf/figureview/view/FigureHierarchyView.class b/plugins/developer/org.eclipse.papyrus.gmf.figureview/bin/org/eclipse/papyrus/gmf/figureview/view/FigureHierarchyView.class
new file mode 100644
index 00000000000..930eb1a1049
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.gmf.figureview/bin/org/eclipse/papyrus/gmf/figureview/view/FigureHierarchyView.class
Binary files differ
diff --git a/plugins/developer/org.eclipse.papyrus.gmf.figureview/bin/org/eclipse/papyrus/gmf/figureview/view/FigureLabelProvider.class b/plugins/developer/org.eclipse.papyrus.gmf.figureview/bin/org/eclipse/papyrus/gmf/figureview/view/FigureLabelProvider.class
new file mode 100644
index 00000000000..8cc478358f7
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.gmf.figureview/bin/org/eclipse/papyrus/gmf/figureview/view/FigureLabelProvider.class
Binary files differ
diff --git a/plugins/developer/org.eclipse.papyrus.gmf.figureview/build.properties b/plugins/developer/org.eclipse.papyrus.gmf.figureview/build.properties
new file mode 100644
index 00000000000..6f20375d6c7
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.gmf.figureview/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
diff --git a/plugins/developer/org.eclipse.papyrus.gmf.figureview/plugin.properties b/plugins/developer/org.eclipse.papyrus.gmf.figureview/plugin.properties
new file mode 100644
index 00000000000..4760ab80448
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.gmf.figureview/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.figureview/plugin.xml b/plugins/developer/org.eclipse.papyrus.gmf.figureview/plugin.xml
new file mode 100644
index 00000000000..98d410cc54a
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.gmf.figureview/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.figureview.view.FigureHierarchyView"
+ id="org.eclipse.papyrus.gmf.figureview.view"
+ name="Figure hierarchy view"
+ restorable="true">
+ </view>
+ </extension>
+</plugin>
diff --git a/plugins/developer/org.eclipse.papyrus.gmf.figureview/src/org/eclipse/papyrus/gmf/figureview/Activator.java b/plugins/developer/org.eclipse.papyrus.gmf.figureview/src/org/eclipse/papyrus/gmf/figureview/Activator.java
new file mode 100644
index 00000000000..c286a86e843
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.gmf.figureview/src/org/eclipse/papyrus/gmf/figureview/Activator.java
@@ -0,0 +1,52 @@
+package org.eclipse.papyrus.gmf.figureview;
+
+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.figureview"; //$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.figureview/src/org/eclipse/papyrus/gmf/figureview/view/FigureHierarchyView.java b/plugins/developer/org.eclipse.papyrus.gmf.figureview/src/org/eclipse/papyrus/gmf/figureview/view/FigureHierarchyView.java
new file mode 100644
index 00000000000..1e0b1f16e30
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.gmf.figureview/src/org/eclipse/papyrus/gmf/figureview/view/FigureHierarchyView.java
@@ -0,0 +1,234 @@
+/*****************************************************************************
+ * 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:
+ * Ansgar Radermacher (CEA LIST) ansgar.radermacher@cea.fr - Initial API and implementation
+ * Based on edit policy view from patrick.tessier@cea.fr
+ */
+package org.eclipse.papyrus.gmf.figureview.view;
+
+import java.util.ArrayList;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.gef.EditPolicy;
+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.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 shows the figure hierarchy attached to a edit-part
+ *
+ */
+public class FigureHierarchyView 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 FigureHierarchyView() {
+ myEditPartlistener = new ISelectionListener() {
+
+ public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+
+ if(selection instanceof IStructuredSelection) {
+ Object selectedobject = ((IStructuredSelection)selection).getFirstElement();
+ if(selectedobject instanceof GraphicalEditPart) {
+ GraphicalEditPart graphicalEP = ((GraphicalEditPart)selectedobject);
+ IFigure figure = graphicalEP.getContentPane();
+
+ if(viewer != null) {
+ viewer.setInput(new Object[]{ figure });
+ viewer.expandAll();
+ }
+ }
+ }
+ }
+ };
+ 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("Figure");
+ tcName.setWidth(300);
+ TreeColumn tcFigBounds = new TreeColumn(viewer.getTree(), SWT.LEFT);
+ tcFigBounds.setText("Figure bounds");
+ tcFigBounds.setWidth(250);
+ TreeColumn tcLayoutManager = new TreeColumn(viewer.getTree(), SWT.LEFT);
+ tcLayoutManager.setText("Layout manager");
+ tcLayoutManager.setWidth(150);
+ TreeColumn tcBorder = new TreeColumn(viewer.getTree(), SWT.LEFT);
+ tcBorder.setText("Border");
+ tcBorder.setWidth(150);
+ }
+
+ @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 FigureLabelProvider();
+ }
+
+ 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 Object[]) {
+ return (Object[])inputElement;
+ }
+ return null;
+ }
+
+ 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 IFigure) {
+ return ((IFigure)parentElement).getChildren().toArray();
+ }
+ 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.figureview/src/org/eclipse/papyrus/gmf/figureview/view/FigureLabelProvider.java b/plugins/developer/org.eclipse.papyrus.gmf.figureview/src/org/eclipse/papyrus/gmf/figureview/view/FigureLabelProvider.java
new file mode 100644
index 00000000000..82b875b34d1
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.gmf.figureview/src/org/eclipse/papyrus/gmf/figureview/view/FigureLabelProvider.java
@@ -0,0 +1,96 @@
+/*****************************************************************************
+ * 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:
+ * Ansgar Radermacher (CEA LIST) ansgar.radermacher@cea.fr - Initial API and implementation
+ * Based on edit policy view from patrick.tessier@cea.fr
+ *
+ */
+package org.eclipse.papyrus.gmf.figureview.view;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ITableColorProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+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 figures
+ *
+ */
+public class FigureLabelProvider 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 IFigure) {
+ IFigure figure = (IFigure)element;
+ switch(columnIndex) {
+ case 0:
+ String name = figure.getClass().getName();
+ int index = name.lastIndexOf(".");
+ if(index == -1) {
+ return name;
+ }
+ else {
+ return name.substring(index + 1);
+ }
+ case 1:
+ return figure.getBounds().toString();
+ case 2:
+ if(figure.getLayoutManager() != null) {
+ return figure.getLayoutManager().getClass().getSimpleName();
+ }
+ else {
+ return "no layout manager";
+ }
+ case 3:
+ if(figure.getBorder() != null) {
+ return figure.getBorder().getClass().getSimpleName();
+ }
+ else {
+ return "no border";
+ }
+ }
+ }
+ return "cannot display element: " + element;
+ }
+
+ public Image getColumnImage(Object element, int columnIndex) {
+ return null;
+ }
+
+ public Color getForeground(Object element, int columnIndex) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Color getBackground(Object element, int columnIndex) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+};

Back to the top