Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcletavernie2013-02-04 09:51:45 +0000
committercletavernie2013-02-04 09:51:45 +0000
commit6a94865fd1ac67c9b6f603d88f9d99b682b2ac63 (patch)
tree561b443a70b76182baf03e3a38b44155d194660c /incoming
parent1fa89e8995d5a65dbe0590970c4fbb93d5cf06fc (diff)
downloadorg.eclipse.papyrus-6a94865fd1ac67c9b6f603d88f9d99b682b2ac63.tar.gz
org.eclipse.papyrus-6a94865fd1ac67c9b6f603d88f9d99b682b2ac63.tar.xz
org.eclipse.papyrus-6a94865fd1ac67c9b6f603d88f9d99b682b2ac63.zip
367938: [Refactoring][Diagram Common] the package oep.uml.diagram.common.ui.hyperlink should be moved in a new plugin
https://bugs.eclipse.org/bugs/show_bug.cgi?id=367938 391945: [Refactoring] Part 2: Refactoring on Kepler (0.10) https://bugs.eclipse.org/bugs/show_bug.cgi?id=391945 Move oep.infra.gmfdiag.hyperlink to its final SVN location
Diffstat (limited to 'incoming')
-rw-r--r--incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/.classpath7
-rw-r--r--incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/.project28
-rw-r--r--incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/META-INF/MANIFEST.MF27
-rw-r--r--incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/about.html28
-rw-r--r--incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/build.properties7
-rw-r--r--incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/plugin.xml20
-rw-r--r--incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/Activator.java69
-rw-r--r--incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/dnd/HyperlinkDropStrategy.java125
-rw-r--r--incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/editpolicies/HyperLinkPopupBarEditPolicy.java681
-rw-r--r--incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/editpolicies/NavigationEditPolicy.java245
-rw-r--r--incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/providers/HyperlinkEditPolicyProvider.java59
-rw-r--r--incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/ui/AdvancedHLManager.java125
-rw-r--r--incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/ui/HyperLinkDiagramConstants.java32
-rw-r--r--incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/ui/LocalDefaultLinkDiagramTab.java360
15 files changed, 0 insertions, 1820 deletions
diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/.classpath b/incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/.classpath
deleted file mode 100644
index 2d1a4302f04..00000000000
--- a/incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?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/incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/.project b/incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/.project
deleted file mode 100644
index 094c2587586..00000000000
--- a/incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.papyrus.infra.gmfdiag.hyperlink</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/incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/.settings/org.eclipse.jdt.core.prefs b/incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 44217f8c068..00000000000
--- a/incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,7 +0,0 @@
-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/incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/META-INF/MANIFEST.MF b/incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/META-INF/MANIFEST.MF
deleted file mode 100644
index a0d2114dac7..00000000000
--- a/incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,27 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: GMF Diagram Hyperlink (Incubation)
-Bundle-SymbolicName: org.eclipse.papyrus.infra.gmfdiag.hyperlink;singleton:=true
-Bundle-Version: 0.10.0.qualifier
-Bundle-Activator: org.eclipse.papyrus.infra.gmfdiag.hyperlink.Activator
-Bundle-Vendor: Eclipse Modeling Project
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.papyrus.infra.hyperlink;bundle-version="0.10.0",
- org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="0.10.0",
- org.eclipse.papyrus.infra.gmfdiag.navigation;bundle-version="0.10.0",
- org.eclipse.gmf.runtime.common.core;bundle-version="1.4.1",
- org.eclipse.gmf.runtime.notation;bundle-version="1.5.0",
- org.eclipse.emf.transaction;bundle-version="1.4.0",
- org.eclipse.papyrus.infra.core;bundle-version="0.10.0",
- org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.0",
- org.eclipse.papyrus.infra.emf;bundle-version="0.10.0",
- org.eclipse.papyrus.infra.core.log;bundle-version="0.10.0",
- org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.6.0",
- org.eclipse.papyrus.infra.services.labelprovider;bundle-version="0.10.0",
- org.eclipse.papyrus.infra.gmfdiag.dnd;bundle-version="0.10.0"
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Bundle-ActivationPolicy: lazy
-Export-Package: org.eclipse.papyrus.infra.gmfdiag.hyperlink,
- org.eclipse.papyrus.infra.gmfdiag.hyperlink.editpolicies,
- org.eclipse.papyrus.infra.gmfdiag.hyperlink.ui
diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/about.html b/incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/about.html
deleted file mode 100644
index 209103075a7..00000000000
--- a/incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/about.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!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>November 14, 2008</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> \ No newline at end of file
diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/build.properties b/incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/build.properties
deleted file mode 100644
index e3693a3b66e..00000000000
--- a/incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/build.properties
+++ /dev/null
@@ -1,7 +0,0 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- about.html,\
- plugin.xml
-src.includes = about.html
diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/plugin.xml b/incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/plugin.xml
deleted file mode 100644
index 58a5a833629..00000000000
--- a/incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/plugin.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
- <extension
- point="org.eclipse.gmf.runtime.diagram.ui.editpolicyProviders">
- <editpolicyProvider
- class="org.eclipse.papyrus.infra.gmfdiag.hyperlink.providers.HyperlinkEditPolicyProvider">
- <Priority
- name="Lowest">
- </Priority>
- </editpolicyProvider>
- </extension>
- <extension
- point="org.eclipse.papyrus.infra.gmfdiag.dnd.dropStrategy">
- <strategy
- strategy="org.eclipse.papyrus.infra.gmfdiag.hyperlink.dnd.HyperlinkDropStrategy">
- </strategy>
- </extension>
-
-</plugin>
diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/Activator.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/Activator.java
deleted file mode 100644
index 0c13db06cd0..00000000000
--- a/incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/Activator.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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:
- * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.hyperlink;
-
-import org.eclipse.papyrus.infra.core.log.LogHelper;
-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.infra.gmfdiag.hyperlink"; //$NON-NLS-1$
-
- // The shared instance
- private static Activator plugin;
-
- public static LogHelper log;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- log = new LogHelper(this);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- 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/incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/dnd/HyperlinkDropStrategy.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/dnd/HyperlinkDropStrategy.java
deleted file mode 100644
index 75107e4f872..00000000000
--- a/incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/dnd/HyperlinkDropStrategy.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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:
- * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.hyperlink.dnd;
-
-import org.eclipse.emf.ecore.EModelElement;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.papyrus.commands.Activator;
-import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
-import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
-import org.eclipse.papyrus.infra.gmfdiag.common.helper.SemanticElementHelper;
-import org.eclipse.papyrus.infra.gmfdiag.dnd.strategy.TransactionalDropStrategy;
-import org.eclipse.papyrus.infra.hyperlink.commands.CreateHyperLinkPageCommand;
-import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * A Strategy to drop shortcuts to nested editors on GMF Diagram elements
- *
- * @author Camille Letavernier
- *
- */
-public class HyperlinkDropStrategy extends TransactionalDropStrategy {
-
- /**
- * {@inheritDoc}
- */
- public String getLabel() {
- return "Create hyperlinks";
- }
-
- public String getDescription() {
- return "Creates an hyperlink to Papyrus nested editor (e.g. Diagram, Table, ...) on a Diagram element";
- }
-
- public Image getImage() {
- return null;
- }
-
- public String getID() {
- return "org.eclipse.papyrus.infra.gmfdiag.dnd.CreateHyperlink";
- }
-
- @Deprecated
- public int getPriority() {
- return 0;
- }
-
- @Override
- public Command doGetCommand(Request request, final EditPart targetEditPart) {
- if(request instanceof DropObjectsRequest) {
-
- View view = getTargetView(targetEditPart);
- if(view == null) {
- return null;
- }
-
- final View mainView = SemanticElementHelper.findPrimaryView(view);
- if(mainView instanceof Diagram) {
- //We cannot create hyperlinks from the root edit part
- return null;
- }
-
- final DropObjectsRequest dropRequest = (DropObjectsRequest)request;
-
- final ServicesRegistry registry;
- try {
- registry = ServiceUtilsForEObject.getInstance().getServiceRegistry(mainView);
- IPageMngr pageManager = ServiceUtils.getInstance().getIPageMngr(registry);
-
- for(Object droppedObject : dropRequest.getObjects()) {
- if(!(droppedObject instanceof EObject && pageManager.allPages().contains(droppedObject))) {
- return null;
- }
- }
- } catch (ServiceException ex) {
- Activator.log.error(ex);
- return null;
- }
-
- return new Command() {
-
- @Override
- public void execute() {
-
- try {
- ILabelProvider labelProvider = registry.getService(LabelProviderService.class).getLabelProvider();
- TransactionalEditingDomain domain = ServiceUtils.getInstance().getTransactionalEditingDomain(registry);
-
- for(Object droppedObject : dropRequest.getObjects()) {
- String text = labelProvider.getText(droppedObject);
- CreateHyperLinkPageCommand command = new CreateHyperLinkPageCommand(domain, mainView, text, text, (EModelElement)droppedObject, true);
- command.execute();
- }
- } catch (ServiceException ex) {
- Activator.log.error(ex);
- }
-
-
- }
- };
- }
-
- return null;
- }
-}
diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/editpolicies/HyperLinkPopupBarEditPolicy.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/editpolicies/HyperLinkPopupBarEditPolicy.java
deleted file mode 100644
index 408038c5275..00000000000
--- a/incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/editpolicies/HyperLinkPopupBarEditPolicy.java
+++ /dev/null
@@ -1,681 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009 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.infra.gmfdiag.hyperlink.editpolicies;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.draw2d.ColorConstants;
-import org.eclipse.draw2d.FigureCanvas;
-import org.eclipse.draw2d.Graphics;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.MouseEvent;
-import org.eclipse.draw2d.MouseListener;
-import org.eclipse.draw2d.RoundedRectangle;
-import org.eclipse.draw2d.Viewport;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.emf.ecore.EModelElement;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.DragTracker;
-import org.eclipse.gef.EditPartViewer;
-import org.eclipse.gef.Handle;
-import org.eclipse.gef.LayerConstants;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DiagramAssistantEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramGraphicalViewer;
-import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.viewers.CellLabelProvider;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.papyrus.infra.core.editorsfactory.IPageIconsRegistry;
-import org.eclipse.papyrus.infra.core.editorsfactory.PageIconsRegistry;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
-import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
-import org.eclipse.papyrus.infra.gmfdiag.common.utils.ServiceUtilsForEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.hyperlink.ui.AdvancedHLManager;
-import org.eclipse.papyrus.infra.hyperlink.Activator;
-import org.eclipse.papyrus.infra.hyperlink.helper.AbstractHyperLinkHelper;
-import org.eclipse.papyrus.infra.hyperlink.helper.HyperLinkHelperFactory;
-import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkObject;
-import org.eclipse.papyrus.infra.hyperlink.ui.HyperLinkManagerShell;
-import org.eclipse.papyrus.infra.hyperlink.util.HyperLinkException;
-import org.eclipse.papyrus.infra.hyperlink.util.HyperLinkHelpersRegistrationUtil;
-import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-/**
- * The Class HyperLinkPopupBarEditPolicy can be applied on edit part to display
- * shortcuts on sub-diagrams or to associate hyper-link of files
- */
-public class HyperLinkPopupBarEditPolicy extends DiagramAssistantEditPolicy {
-
- /**
- * Default tool placed on the popup bar.
- *
- * @author affrantz@us.ibm.com modified by Patrick Tessier
- */
-
- private class PopupBarLabelHandle extends Label implements Handle {
-
- /**
- * flag to drawFocus rect around the handle when the mouse rolls over
- * it.
- */
- private boolean myMouseOver = false;
-
- /** The dragTracker CreationTool associated with the handle *. */
- private Object myObject = null;
-
- /**
- * constructor.
- *
- * @param theImage
- * the image to display
- * @param anObject
- * the an object
- */
- public PopupBarLabelHandle(Object anObject, Image theImage) {
- super(theImage);
- myObject = anObject;
- this.setOpaque(true);
- this.setBackgroundColor(ColorConstants.buttonLightest);
- }
-
- /**
- * Dispose.
- */
- public void dispose() {
- //Nothing. Do not dispose the Image, as it may be shared
-
- // if(this.getIcon() != null && (!this.getIcon().isDisposed())) {
- // this.getIcon().dispose();
- // }
- }
-
- /**
- * Gets the accessible location.
- *
- * @return the accessible location
- *
- * @see org.eclipse.gef.Handle#getAccessibleLocation()
- */
- public Point getAccessibleLocation() {
- return null;
- }
-
- /**
- * {@inheritedDoc}
- */
- public DragTracker getDragTracker() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /**
- * Gets the referenced object.
- *
- * @return the referenced object
- *
- * @see org.eclipse.gef.Handle#getDragTracker()
- */
- public Object getReferencedObject() {
- return myObject;
- }
-
- /**
- * Handle mouse entered.
- *
- * @param event
- * the event
- *
- * @see org.eclipse.draw2d.IFigure#handleMouseEntered(org.eclipse.draw2d.MouseEvent)
- * flip myMouseOver bit and repaint
- */
- @Override
- public void handleMouseEntered(MouseEvent event) {
-
- super.handleMouseEntered(event);
- this.setBackgroundColor(ColorConstants.button);
- myMouseOver = true;
- // repaint();
- }
-
- /**
- * Handle mouse exited.
- *
- * @param event
- * the event
- *
- * @see org.eclipse.draw2d.IFigure#handleMouseExited(org.eclipse.draw2d.MouseEvent)
- * flip myMouseOver bit and repaint
- */
- @Override
- public void handleMouseExited(MouseEvent event) {
-
- super.handleMouseExited(event);
- this.setBackgroundColor(ColorConstants.white);
- myMouseOver = false;
- // repaint();
- }
-
- /**
- * Handle mouse pressed.
- *
- * @param event
- * the event
- *
- * @see org.eclipse.draw2d.IFigure#handleMousePressed(org.eclipse.draw2d.MouseEvent)
- * set PopupBarEditPolicy.myActionMoveFigure bit so the popup bar
- * is not dismissed after creating an item in the editpart
- */
- @Override
- public void handleMousePressed(MouseEvent event) {
- if(1 == event.button) {
- }
- super.handleMousePressed(event);
- }
-
- /**
- * Paint border.
- *
- * @param graphics
- * the graphics
- *
- * @see org.eclipse.draw2d.Figure#paintBorder(org.eclipse.draw2d.Graphics)
- * paint a focus rectangle for the label if the mouse is inside the
- * label
- */
- @Override
- protected void paintBorder(Graphics graphics) {
- super.paintBorder(graphics);
-
- if(myMouseOver) {
-
- Rectangle area = getClientArea();
- graphics.setForegroundColor(ColorConstants.black);
- graphics.setBackgroundColor(ColorConstants.white);
-
- graphics.drawFocus(area.x, area.y, area.width - 1, area.height - 1);
-
- }
-
- }
-
- /**
- * Paint figure.
- *
- * @param graphics
- * the graphics
- *
- * @see org.eclipse.draw2d.Figure#paintFigure(org.eclipse.draw2d.Graphics)
- */
- @Override
- protected void paintFigure(Graphics graphics) {
- if(!isEnabled()) {
- Image theImage = this.getIcon();
- if(theImage != null) {
- graphics.translate(bounds.x, bounds.y);
- graphics.drawImage(theImage, getIconLocation());
- graphics.translate(-bounds.x, -bounds.y);
- return;
- }
-
- }
- super.paintFigure(graphics);
-
- }
- }
-
- /**
- * The Class PopupBarLabelPlusHandle.
- */
- private class PopupBarLabelPlusHandle extends PopupBarLabelHandle {
-
- /**
- * Instantiates a new popup bar label plus handle.
- */
- public PopupBarLabelPlusHandle() {
- super(null, AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.papyrus.uml.diagram.common", "/icons/obj16/Plus.gif").createImage());
- // TODO Auto-generated constructor stub
- }
- }
-
- /**
- * Listens for mouse key presses so the popup bar can be dismissed if the
- * context menu is displayed.
- *
- * @author affrantz@us.ibm.com
- */
- private class PopupBarMouseListener extends MouseListener.Stub {
-
- /**
- * Mouse pressed.
- *
- * @param me
- * the me
- *
- * @see org.eclipse.draw2d.MouseListener#mousePressed(org.eclipse.draw2d.MouseEvent)
- */
- @Override
- public void mousePressed(MouseEvent me) {
- if(3 == me.button) // context menu, hide the popup bar
- {
- hideDiagramAssistant();
- }
- if(1 == me.button) // context menu, hide the popup bar
- {
- if(me.getSource() instanceof PopupBarLabelPlusHandle) {
- hyperLinkManagerShell = new AdvancedHLManager(getEditorRegistry(), ((IGraphicalEditPart)getHost()).getEditingDomain(), (EModelElement)((IGraphicalEditPart)getHost()).getNotationView().getElement(), ((IGraphicalEditPart)getHost()).getNotationView(), hyperlinkHelperFactory);
- hyperLinkManagerShell.setInput(hyperLinkObjectList);
- hyperLinkManagerShell.open();
-
- } else if(me.getSource() instanceof PopupBarLabelHandle) {
- if((((PopupBarLabelHandle)me.getSource()).getReferencedObject()) instanceof HyperLinkObject) {
- HyperLinkObject hyperLinkObject = (HyperLinkObject)(((PopupBarLabelHandle)me.getSource()).getReferencedObject());
- hyperLinkObject.executeSelectPressed();
- }
- }
-
- hideDiagramAssistant();
-
- }
- super.mousePressed(me);
- // setPopupBarOnDiagramActivated(true);
- }
-
- /**
- * {@inheritedDoc}
- */
- @Override
- public void mouseReleased(MouseEvent me) {
- super.mouseReleased(me);
-
- }
- }
-
- /**
- * This is the figure that represents the ballon portion of the popup bar.
- *
- * @author affrantz@us.ibm.com
- */
- private class RoundedRectangleWithTail extends RoundedRectangle {
-
- /**
- * constructor.
- */
- public RoundedRectangleWithTail() {
- // we do not make the myActionTailFigue opaque because it
- // doesn't look good when magnification is set.
- this.setFill(true);
- this.setBackgroundColor(ColorConstants.yellow);
- this.setForegroundColor(ColorConstants.orange);
- this.setVisible(true);
- this.setEnabled(true);
- this.setOpaque(true);
-
- }
-
- }
-
- /** The editor registry. */
- private IPageIconsRegistry editorRegistry;
-
- /** The figure bar. */
- private IFigure figureBar;
-
- /** The hyper link manager shell. */
- private HyperLinkManagerShell hyperLinkManagerShell;
-
- /** Images created that must be deleted when popup bar is removed. */
- protected List<Image> imagesToBeDisposed = new ArrayList<Image>();
-
- /** mouse keys listener for the owner shape. */
- private final PopupBarMouseListener myMouseKeyListener = new PopupBarMouseListener();
-
- protected ArrayList<HyperLinkObject> hyperLinkObjectList;
-
- protected HyperLinkHelperFactory hyperlinkHelperFactory;
-
- /**
- * {@inheritedDoc}
- */
- @Override
- public void activate() {
- super.activate();
- }
-
- public HyperLinkPopupBarEditPolicy() {
- super();
- ArrayList<AbstractHyperLinkHelper> hyperLinkHelpers = new ArrayList<AbstractHyperLinkHelper>();
- //TODO
- // hyperLinkHelpers.add(new DiagramHyperLinkHelper());
- // hyperLinkHelpers.add(new DocumentHyperLinkHelper());
- // hyperLinkHelpers.add(new WebHyperLinkHelper());
- hyperLinkHelpers.addAll(HyperLinkHelpersRegistrationUtil.INSTANCE.getAllRegisteredHyperLinkHelper());
- hyperlinkHelperFactory = new HyperLinkHelperFactory(hyperLinkHelpers);
- }
-
- /**
- * Adds the object list in the popup bar.
- *
- * @param imageLocation
- * the image location that will represent the object
- * @param positonwidth
- * the positonwidth to display the icon into the popup
- * @param objectList
- * the object list to add
- *
- * @return the int the new position after adding all objects in the list
- */
- public int addObjectList(int positonwidth, List<?> objectList) {
- for(int i = 0; i < objectList.size(); i++) {
- PopupBarLabelHandle handle = null;
-
- ILabelProvider labelProvider = null;
- try {
- EObject contextElement = EMFHelper.getEObject(getHost());
- labelProvider = ServiceUtilsForEObject.getInstance().getService(LabelProviderService.class, contextElement).getLabelProvider();
- } catch (ServiceException ex) {
- Activator.log.error(ex);
- }
-
- if(labelProvider == null) {
- labelProvider = new LabelProvider();
- }
-
- handle = new PopupBarLabelHandle(hyperLinkObjectList.get(i), labelProvider.getImage(objectList.get(i)));
-
- Rectangle r1 = new Rectangle();
- r1.setLocation(positonwidth, 5);
- positonwidth += 20;
- r1.setSize(16, 16);
-
- Label l = new Label();
- if(labelProvider instanceof CellLabelProvider) {
- l.setText(((CellLabelProvider)labelProvider).getToolTipText(hyperLinkObjectList.get(i)));
- } else {
- l.setText(labelProvider.getText(hyperLinkObjectList.get(i)));
- }
- handle.setToolTip(l);
-
- handle.setPreferredSize(16, 16);
- handle.setBounds(r1);
- handle.setBackgroundColor(ColorConstants.white);
- getFigureBar().add(handle);
- handle.addMouseListener(this.myMouseKeyListener);
- handle.addMouseMotionListener(this);
-
- }
- return positonwidth;
-
- }
-
- /**
- * Return the EditorRegistry for nested editor descriptors. Subclass should
- * implements this method in order to return the registry associated to the
- * extension point namespace.
- *
- * @return the EditorRegistry for nested editor descriptors
- *
- * @generated NOT
- */
- protected IPageIconsRegistry createEditorRegistry() {
- try {
- return ServiceUtilsForEditPart.getInstance().getService(IPageIconsRegistry.class, getHost());
- } catch (ServiceException e) {
- // Return an empty registry always providing null;
- return new PageIconsRegistry();
- }
- }
-
- /**
- * Creates the popup bar figure.
- *
- * @return the i figure
- */
- protected IFigure createPopupBarFigure() {
- figureBar = new RoundedRectangleWithTail();
- return figureBar;
- }
-
- /**
- * Gets the editor registry.
- *
- * @return the singleton eINSTANCE of editor registry
- *
- * @generated NOT Get the EditorRegistry used to create editor instances.
- * This default implementation return the singleton eINSTANCE.
- * This method can be subclassed to return another registry.
- */
- protected IPageIconsRegistry getEditorRegistry() {
- if(editorRegistry == null) {
- editorRegistry = createEditorRegistry();
- }
- return editorRegistry;
- }
-
- /**
- * Gets the figure bar.
- *
- * @return the figure bar
- */
- protected IFigure getFigureBar() {
-
- return figureBar;
- }
-
- /**
- * {@inheritedDoc}
- */
- @Override
- protected void hideDiagramAssistant() {
- if(getFigureBar() != null) {
- getFigureBar().removeMouseMotionListener(this);
- getFigureBar().removeMouseListener(myMouseKeyListener);
- IFigure layer = getLayer(LayerConstants.HANDLE_LAYER);
- if(getFigureBar().getParent() != null) {
- layer.remove(getFigureBar());
- }
-
- if(imagesToBeDisposed != null) {
- for(Iterator iter = figureBar.getChildren().iterator(); iter.hasNext();) {
- Object current = iter.next();
- if(current instanceof PopupBarLabelHandle) {
- ((PopupBarLabelHandle)current).dispose();
- }
- }
- imagesToBeDisposed.clear();
- }
- }
- figureBar = null;
- }
-
- /**
- * {@inheritedDoc}
- */
- @Override
- protected boolean isDiagramAssistant(Object object) {
- return object instanceof RoundedRectangleWithTail || object instanceof PopupBarLabelHandle;
- }
-
- /**
- * {@inheritedDoc}
- */
- @Override
- protected boolean isDiagramAssistantShowing() {
-
- return true;
- }
-
- /**
- * {@inheritedDoc}.
- *
- * @return true, if checks if is preference on
- */
- @Override
- protected boolean isPreferenceOn() {
- return true;
- }
-
- /**
- * fill the popup bar.
- *
- * @return the width of popup bar
- */
- protected int populatePopup() {
- int xLoc = 5;
- if(getFigureBar() != null) {
- // add all subdiagrams
-
- try {
- hyperLinkObjectList = (ArrayList<HyperLinkObject>)hyperlinkHelperFactory.getAllreferenced(((IGraphicalEditPart)getHost()).getNotationView());
- } catch (HyperLinkException e) {
- e.printStackTrace();
- }
- xLoc = addObjectList(xLoc, hyperLinkObjectList);
- // add the PLUS button
- PopupBarLabelHandle handle = new PopupBarLabelPlusHandle();
- Rectangle r1 = new Rectangle();
- r1.setLocation(xLoc, 5);
- xLoc += 20;
- r1.setSize(16, 16);
-
- Label l = new Label();
- l.setText("Add hyperlink");
-
- handle.setToolTip(l);
- handle.setPreferredSize(16, 16);
- handle.setBounds(r1);
- handle.setBackgroundColor(ColorConstants.white);
- getFigureBar().add(handle);
- handle.addMouseListener(this.myMouseKeyListener);
- handle.addMouseMotionListener(this);
- }
- return xLoc;
- }
-
- /**
- * {@inheritedDoc}.
- *
- * @param referencePoint
- * the reference point
- */
- @Override
- protected void showDiagramAssistant(Point referencePoint) {
- if(getFigureBar() == null) {
- createPopupBarFigure();
- int width = populatePopup();
- IFigure layer = getLayer(LayerConstants.HANDLE_LAYER);
- layer.add(getFigureBar());
- if(referencePoint == null) {
- referencePoint = getHostFigure().getBounds().getCenter();
- }
- Point position = getHostFigure().getBounds().getBottomLeft();
- getHostFigure().translateToAbsolute(position);
- EditPartViewer viewer = getHost().getRoot().getViewer();
- Viewport viewport = null;
- if(viewer instanceof DiagramGraphicalViewer) {
- viewport = ((FigureCanvas)((DiagramGraphicalViewer)viewer).getControl()).getViewport();
- }
- if(viewport != null) {
- position.x = position.x + viewport.getClientArea().x;
- position.y = position.y + viewport.getClientArea().y;
- }
- getFigureBar().setSize(width, 30);
- getFigureBar().setLocation(position);
- getFigureBar().setBackgroundColor(ColorConstants.white);
- getFigureBar().setForegroundColor(ColorConstants.orange);
-
- // dismiss the popup bar after a delay
- if(!shouldAvoidHidingDiagramAssistant()) {
- hideDiagramAssistantAfterDelay(getDisappearanceDelay());
- }
- }
- }
-
- @Override
- protected boolean shouldShowDiagramAssistant() {
- return getHost().isActive() && isPreferenceOn() && isHostEditable() && isHostResolvable() && isDiagramPartActive();
- }
-
- /**
- * Checks if the diagram part is active.
- *
- * @return True if the diagram part is active; false otherwise.
- */
- private boolean isDiagramPartActive() {
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
-
- if(window != null) {
- IWorkbenchPage page = window.getActivePage();
- if(page != null) {
- IWorkbenchPart activePart = page.getActivePart();
-
- IDiagramWorkbenchPart editorPart = null;
-
- if(activePart instanceof IDiagramWorkbenchPart) {
- editorPart = (IDiagramWorkbenchPart)activePart;
- } else if(activePart instanceof IAdaptable) {
- editorPart = (IDiagramWorkbenchPart)((IAdaptable)activePart).getAdapter(IDiagramWorkbenchPart.class);
- }
-
- if(editorPart == null) {
- return false;
- }
-
- return editorPart.getDiagramEditPart().getRoot().equals(((IGraphicalEditPart)getHost()).getRoot());
- }
- }
- return false;
- }
-
- /**
- * Checks if the host editpart is editable.
- *
- * @return True if the host is editable; false otherwise.
- */
- private boolean isHostEditable() {
- if(getHost() instanceof GraphicalEditPart) {
- return ((GraphicalEditPart)getHost()).isEditModeEnabled();
- }
- return true;
- }
-
- /**
- * Is the host's semantic reference resolvable (if applicable)?
- *
- * @return true if the semantic reference is resolvable, true if there is no
- * semantic reference, and false otherwise
- */
- private boolean isHostResolvable() {
- final View view = (View)getHost().getModel();
- EObject element = view.getElement();
- if(element != null) {
- return !element.eIsProxy();
- }
- return true;
- }
-}
diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/editpolicies/NavigationEditPolicy.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/editpolicies/NavigationEditPolicy.java
deleted file mode 100644
index a1fc04804bd..00000000000
--- a/incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/editpolicies/NavigationEditPolicy.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2010 Atos Origin.
- *
- *
- * 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:
- * Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation
- * Patrick Tessier (CEA LIST)-modification
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.hyperlink.editpolicies;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.emf.ecore.EModelElement;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.OpenEditPolicy;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.papyrus.commands.CreationCommandDescriptor;
-import org.eclipse.papyrus.infra.core.editorsfactory.IPageIconsRegistry;
-import org.eclipse.papyrus.infra.core.editorsfactory.PageIconsRegistry;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.gmfdiag.common.DiagramsUtil;
-import org.eclipse.papyrus.infra.gmfdiag.common.utils.ServiceUtilsForEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.hyperlink.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.hyperlink.ui.AdvancedHLManager;
-import org.eclipse.papyrus.infra.gmfdiag.navigation.ExistingNavigableElement;
-import org.eclipse.papyrus.infra.gmfdiag.navigation.NavigableElement;
-import org.eclipse.papyrus.infra.gmfdiag.navigation.NavigationHelper;
-import org.eclipse.papyrus.infra.gmfdiag.navigation.preference.INavigationPreferenceConstant;
-import org.eclipse.papyrus.infra.hyperlink.helper.AbstractHyperLinkHelper;
-import org.eclipse.papyrus.infra.hyperlink.helper.HyperLinkHelperFactory;
-import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkEditor;
-import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkObject;
-import org.eclipse.papyrus.infra.hyperlink.ui.EditorNavigationDialog;
-import org.eclipse.papyrus.infra.hyperlink.ui.HyperLinkManagerShell;
-import org.eclipse.papyrus.infra.hyperlink.util.HyperLinkHelpersRegistrationUtil;
-
-/**
- * This class is used to open a new diagram when the double click is detected.
- * It is dependent of papyrus environment
- */
-public class NavigationEditPolicy extends OpenEditPolicy {
-
- public static final String NAVIGATION_POLICY = "NavigationEditPolicy";
-
- public NavigationEditPolicy() {
- }
-
- /**
- *
- * @param request
- * @return get the command to open a new diagram
- */
- @Override
- protected Command getOpenCommand(Request request) {
- final IGraphicalEditPart gep;
-
- // in order to obtain the list of default diagram we need to fin the
- // edit part that refers to default diagram
-
- // if this a label of a compartment, the good editpart is the parent
- if((IGraphicalEditPart)getHost() instanceof CompartmentEditPart) {
- gep = (IGraphicalEditPart)getHost().getParent();
- } else {
-
- gep = (IGraphicalEditPart)getHost();
- }
- final EObject semanticElement = gep.resolveSemanticElement();
-
- // navigable element by using heuristic
- List<NavigableElement> navElements = null;
-
- // defaultHyperlinks
- final ArrayList<HyperLinkObject> defaultHyperLinkObject = new ArrayList<HyperLinkObject>();
- final ArrayList<HyperLinkObject> hyperLinkObjectList;
- // Diagrams that will be found by using heuristic
- HashMap<NavigableElement, List<Diagram>> existingDiagrams = new HashMap<NavigableElement, List<Diagram>>();
-
- if(semanticElement == null) {
- return UnexecutableCommand.INSTANCE;
- }
- // initialition of code to extract hyperlinks, in the future to do with
- // extension points
- ArrayList<AbstractHyperLinkHelper> hyperLinkHelpers = new ArrayList<AbstractHyperLinkHelper>();
- // hyperLinkHelpers.add(new DiagramHyperLinkHelper());
- // hyperLinkHelpers.add(new DocumentHyperLinkHelper());
- // hyperLinkHelpers.add(new WebHyperLinkHelper());
- hyperLinkHelpers.addAll(HyperLinkHelpersRegistrationUtil.INSTANCE.getAllRegisteredHyperLinkHelper());
- final HyperLinkHelperFactory hyperlinkHelperFactory = new HyperLinkHelperFactory(hyperLinkHelpers);
-
- try {
- // fill the list of default hyperlinks
- hyperLinkObjectList = (ArrayList<HyperLinkObject>)hyperlinkHelperFactory.getAllreferenced(gep.getNotationView());
-
- Iterator<HyperLinkObject> iterator = hyperLinkObjectList.iterator();
- while(iterator.hasNext()) {
- HyperLinkObject hyperlinkObject = iterator.next();
- if(hyperlinkObject.getIsDefault()) {
-
- defaultHyperLinkObject.add(hyperlinkObject);
- }
-
- }
-
- // fill navigation by using heuristics
- navElements = NavigationHelper.getInstance().getAllNavigableElements(semanticElement);
- HashMap<NavigableElement, List<CreationCommandDescriptor>> possibleCreations = new HashMap<NavigableElement, List<CreationCommandDescriptor>>();
-
- // test which kind of navigation by consulting preference
- String navigationKind = Activator.getDefault().getPreferenceStore().getString(INavigationPreferenceConstant.PAPYRUS_NAVIGATION_DOUBLECLICK_KIND);
-
- // no naviagation
- if(navigationKind.equals(INavigationPreferenceConstant.NO_NAVIGATION)) {
- // do nothing
- return UnexecutableCommand.INSTANCE;
- }
-
- // navigation by using heuristic
- // add list of diagram navigables by using heuristic
- if(navigationKind.equals(INavigationPreferenceConstant.EXPLICIT_IMPLICIT_NAVIGATION)) {
- for(NavigableElement navElement : navElements) {
- final EObject element = navElement.getElement();
- if(navElement instanceof ExistingNavigableElement) {
- List<Diagram> associatedDiagrams = DiagramsUtil.getAssociatedDiagrams(element, null);
-
- // ignore the current diagram
- associatedDiagrams.remove(gep.getNotationView().getDiagram());
- if(associatedDiagrams != null && !associatedDiagrams.isEmpty()) {
- existingDiagrams.put(navElement, associatedDiagrams);
- }
- }
- }
-
- Iterator<List<Diagram>> iter = existingDiagrams.values().iterator();
- while(iter.hasNext()) {
- List<Diagram> list = iter.next();
- Iterator<Diagram> iterDiagram = list.iterator();
- while(iterDiagram.hasNext()) {
- Diagram diagram = iterDiagram.next();
- HyperLinkEditor hyperLinkEditor = new HyperLinkEditor();
- hyperLinkEditor.setObject(diagram);
- hyperLinkEditor.setTooltipText(diagram.getName() + " (found by heuristic)");
- // look for if a hyperlink already exists
- HyperLinkObject foundHyperlink = null;
- for(int i = 0; i < defaultHyperLinkObject.size() && foundHyperlink == null; i++) {
- if(defaultHyperLinkObject.get(i).getObject().equals(diagram)) {
- foundHyperlink = defaultHyperLinkObject.get(i);
- }
- }
- // the diagram was not into the list of existing default
- // hyperlink
- if(foundHyperlink == null) {
- defaultHyperLinkObject.add(hyperLinkEditor);
- }
- }
- }
- }
- if(defaultHyperLinkObject.size() == 0) {
- Command command = new Command() {
-
- @Override
- public void execute() {
- EObject semanticElement = gep.getNotationView().getElement();
- if(semanticElement instanceof EModelElement) {
- HyperLinkManagerShell hyperLinkManagerShell = new AdvancedHLManager(createEditorRegistry(), ((IGraphicalEditPart)getHost()).getEditingDomain(), (EModelElement)semanticElement, gep.getNotationView(), hyperlinkHelperFactory);
- hyperLinkManagerShell.setInput(hyperLinkObjectList);
- hyperLinkManagerShell.open();
- }
- }
- };
- return command;
- }
- if(defaultHyperLinkObject.size() == 1) {
- // open the diagram
- Command command = new Command() {
-
- @Override
- public void execute() {
- super.execute();
- defaultHyperLinkObject.get(0).executeSelectPressed();
- }
- };
- return command;
-
- }
- if(defaultHyperLinkObject.size() > 1) {
- // open a dialog to choose a diagram
- EditorNavigationDialog diagramNavigationDialog = new EditorNavigationDialog(getHost().getViewer().getControl().getShell(), defaultHyperLinkObject, semanticElement);
- diagramNavigationDialog.open();
- final List<HyperLinkObject> hList = diagramNavigationDialog.getSelectedHyperlinks();
- Command command = new Command() {
-
- @Override
- public void execute() {
- super.execute();
-
- Iterator<HyperLinkObject> iter = hList.iterator();
- while(iter.hasNext()) {
- HyperLinkObject hyperlinkObject = iter.next();
- hyperlinkObject.executeSelectPressed();
- }
- }
- };
- return command;
-
- }
-
- } catch (Exception e) {
- Activator.log.error("Impossible to load hyperlinks", e);
- }
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- * Return the EditorRegistry for nested editor descriptors. Subclass should
- * implements this method in order to return the registry associated to the
- * extension point namespace.
- *
- * @return the EditorRegistry for nested editor descriptors
- *
- * @generated NOT
- */
- protected IPageIconsRegistry createEditorRegistry() {
- try {
- return ServiceUtilsForEditPart.getInstance().getService(IPageIconsRegistry.class, getHost());
- } catch (ServiceException e) {
- // Return an empty registry always providing null;
- return new PageIconsRegistry();
- }
- }
-
-}
diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/providers/HyperlinkEditPolicyProvider.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/providers/HyperlinkEditPolicyProvider.java
deleted file mode 100644
index 06151d93396..00000000000
--- a/incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/providers/HyperlinkEditPolicyProvider.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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:
- * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.hyperlink.providers;
-
-import org.eclipse.gef.EditPart;
-import org.eclipse.gmf.runtime.common.core.service.AbstractProvider;
-import org.eclipse.gmf.runtime.common.core.service.IOperation;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
-import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.CreateEditPoliciesOperation;
-import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.IEditPolicyProvider;
-import org.eclipse.papyrus.infra.gmfdiag.hyperlink.editpolicies.HyperLinkPopupBarEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.hyperlink.editpolicies.NavigationEditPolicy;
-
-/**
- * An EditPolicyProvider for Navigation and Hyperlinks
- *
- * @author Camille Letavernier
- *
- */
-public class HyperlinkEditPolicyProvider extends AbstractProvider implements IEditPolicyProvider {
-
- /**
- * {@inheritDoc}
- *
- * This provider can handle GraphicalEditParts
- */
- public boolean provides(IOperation operation) {
- if(operation instanceof CreateEditPoliciesOperation) {
- CreateEditPoliciesOperation epOperation = (CreateEditPoliciesOperation)operation;
- return epOperation.getEditPart() instanceof IGraphicalEditPart;
- }
- return false;
- }
-
- /**
- * {@inheritDoc}
- *
- * Installs the Hyperlink and Navigation edit policies
- */
- public void createEditPolicies(EditPart editPart) {
- if(editPart instanceof IPrimaryEditPart) {
- editPart.installEditPolicy(EditPolicyRoles.POPUPBAR_ROLE, new HyperLinkPopupBarEditPolicy());
- }
- editPart.installEditPolicy(NavigationEditPolicy.NAVIGATION_POLICY, new NavigationEditPolicy());
-
- }
-
-}
diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/ui/AdvancedHLManager.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/ui/AdvancedHLManager.java
deleted file mode 100644
index f0f75a128d8..00000000000
--- a/incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/ui/AdvancedHLManager.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2009-2011 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
- * Arthur Daussy (Atos) arthur.daussy@atos.net - Bug 363827 - [Improvement] Diagram creation, remember the latest tab chosen
- * Vincent Lorenzo (CEA-LIST) Vincent.lorenzo@cea.fr (refactoring of the hyperlink)
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.hyperlink.ui;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.emf.ecore.EModelElement;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
-import org.eclipse.papyrus.infra.core.editorsfactory.IPageIconsRegistry;
-import org.eclipse.papyrus.infra.hyperlink.helper.HyperLinkHelperFactory;
-import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkEditor;
-import org.eclipse.papyrus.infra.hyperlink.ui.AbstractHyperLinkTab;
-import org.eclipse.papyrus.infra.hyperlink.ui.HyperLinkManagerShell;
-
-/**
- *
- * This hyperlink manager can manage default hyperlinks and creation of diagram with heuristic
- */
-public class AdvancedHLManager extends HyperLinkManagerShell {
-
-
- /**
- *
- * Constructor.
- *
- * @param editorFactoryRegistry
- * the editor factory registry
- * @param model
- * the model that contains all elements
- * @param domain
- * the domain in order to execute command
- * @param umlElement
- * the uml element linked to the view
- * @param aview
- * the view of the uml element
- *
- */
- public AdvancedHLManager(IPageIconsRegistry editorFactoryRegistry, TransactionalEditingDomain domain, EModelElement semanticElement, View aview, HyperLinkHelperFactory hyperHelperFactory) {
- super(editorFactoryRegistry, domain, semanticElement, aview, hyperHelperFactory);
- }
-
- /**
- * this method parse the command to extract created diagram and construct a list of hyperlinkDiagrams
- *
- * @param creationcommand
- * a gmf command
- * @return the list of hyperlinks diagram
- */
- protected ArrayList<HyperLinkEditor> getCreatedHyperlinkDiagramsWithHeuristic(ICommand creationcommand) {
- ArrayList<Diagram> diagrams = new ArrayList<Diagram>();
- if(creationcommand instanceof CompositeCommand) {
- CompositeCommand compositeCommand = (CompositeCommand)creationcommand;
- Object value = compositeCommand.getCommandResult().getReturnValue();
- if(value instanceof ArrayList) {
- diagrams.addAll((Collection<Diagram>)value);
- }
- }
- ArrayList<HyperLinkEditor> hyperLinkDiagrams = new ArrayList<HyperLinkEditor>();
- for(int i = 0; i < diagrams.size(); i++) {
- HyperLinkEditor hyperLinkEditor = new HyperLinkEditor();
- hyperLinkEditor.setObject(diagrams.get(i));
- hyperLinkEditor.setIsDefault(true);
- hyperLinkEditor.setTooltipText(diagrams.get(i).getName());
- hyperLinkDiagrams.add(hyperLinkEditor);
- }
- return hyperLinkDiagrams;
- }
-
- @Override
- protected void doAction() {
- super.doAction();
- // defaultTab = getDefaultHyperLinkTab();
- final LocalDefaultLinkDiagramTab heuristicTab = getHeuristicTab();
- ArrayList<HyperLinkEditor> defaultdiagramsWithHeuristic = new ArrayList<HyperLinkEditor>();
- //if the default diagrams is opened, get created default diagrams
- if(heuristicTab.getDefaultHyperlinkComposite().isVisible()) {
- heuristicTab.okPressed();
- ICommand creationCommand = heuristicTab.getCommand();
- //TODO : should be chained with the others command
- transactionalEditingDomain.getCommandStack().execute(new GMFtoEMFCommandWrapper(heuristicTab.getCommand()));
- defaultdiagramsWithHeuristic.addAll(getCreatedHyperlinkDiagramsWithHeuristic(creationCommand));
- }
-
-
-
- //add into the list all diagram create by using heuristic
- for(int i = 0; i < defaultdiagramsWithHeuristic.size(); i++) {
- allhypHyperlinkObjects.add(0, defaultdiagramsWithHeuristic.get(i));
- }
-
- }
-
- private LocalDefaultLinkDiagramTab getHeuristicTab() {
- int i = 0;
- LocalDefaultLinkDiagramTab tab = null;
- for(AbstractHyperLinkTab current : tabList) {
- if(current instanceof LocalDefaultLinkDiagramTab) {
- tab = (LocalDefaultLinkDiagramTab)current;
- i++;
- }
- }
- Assert.isTrue(i == 1);
- Assert.isNotNull(tab);
- return tab;
- }
-}
diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/ui/HyperLinkDiagramConstants.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/ui/HyperLinkDiagramConstants.java
deleted file mode 100644
index 2375d7d0767..00000000000
--- a/incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/ui/HyperLinkDiagramConstants.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.hyperlink.ui;
-
-import org.eclipse.papyrus.infra.hyperlink.util.HyperLinkConstants;
-
-
-public class HyperLinkDiagramConstants {
-
- private HyperLinkDiagramConstants(){
- //nothing to do
- }
-
- /**
- * this is a key of eAnnnotation that contains hypertext link or referenced document
- **/
- public static final String HYPERLINK_DIAGRAM = HyperLinkConstants.PAPYRUS_HYPERLINK_PREFIX+ "Diagram";
-
- public static final String HYPERLINK_DIAGRAM_NAME = "diagram_name";
-
-}
diff --git a/incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/ui/LocalDefaultLinkDiagramTab.java b/incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/ui/LocalDefaultLinkDiagramTab.java
deleted file mode 100644
index 1595c2a7fa2..00000000000
--- a/incoming/org.eclipse.papyrus.infra.gmfdiag.hyperlink/src/org/eclipse/papyrus/infra/gmfdiag/hyperlink/ui/LocalDefaultLinkDiagramTab.java
+++ /dev/null
@@ -1,360 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2011 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.infra.gmfdiag.hyperlink.ui;
-
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.papyrus.commands.CreationCommandDescriptor;
-import org.eclipse.papyrus.commands.CreationCommandRegistry;
-import org.eclipse.papyrus.commands.ICreationCommandRegistry;
-import org.eclipse.papyrus.infra.core.editor.BackboneException;
-import org.eclipse.papyrus.infra.core.resource.ModelSet;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
-import org.eclipse.papyrus.infra.gmfdiag.hyperlink.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.navigation.CreatedNavigableElement;
-import org.eclipse.papyrus.infra.gmfdiag.navigation.NavigableElement;
-import org.eclipse.papyrus.infra.gmfdiag.navigation.NavigationHelper;
-import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkObject;
-import org.eclipse.papyrus.infra.hyperlink.ui.AbstractHyperLinkTab;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.custom.CTabFolder;
-import org.eclipse.swt.custom.CTabItem;
-import org.eclipse.swt.custom.TableEditor;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * this is the tab in charge to display the hyperlink diagram created by using heuristic for the property default
- * the code was extract from {@link NavigationCreateDiagramDialog}
- *
- */
-public class LocalDefaultLinkDiagramTab extends AbstractHyperLinkTab {
-
- private static final String CREATION_ENTRY_KEY = "CREATION_ENTRY";
-
- private static final String ELEMENT_TYPE_COMBO_KEY = "ELEMENT_TYPE_COMBO";
-
- private static final String DIAGRAM_TYPE_COMBO_KEY = "DIAGRAM_TYPE_COMBO";
-
- private static final String DIAGRAM_NAME_TEXT_KEY = "DIAGRAM_NAME_TEXT";
-
- private static final String[] COLUMN_NAMES = { "Navigation type", "Feature", "Element type", "Diagram type", "Diagram name" };
-
- private static final int[] COLUMN_WIDTHS = { 80, 120, 120, 200, 120 };
-
- private Map<NavigableElement, List<CreationCommandDescriptor>> possibleCreations;
-
- private ICommand command = null;
-
- private Table table;
-
- private EObject semanticElement;
-
-
- private class NavigableGroupKey {
-
-
- public NavigableElement ancestor = null;
-
- public EStructuralFeature feature = null;
-
- @Override
- public int hashCode() {
- return 0;
- }
-
- @Override
- public boolean equals(Object obj) {
- if(obj instanceof NavigableGroupKey) {
- NavigableGroupKey grpKey = (NavigableGroupKey)obj;
- return grpKey.ancestor == ancestor && grpKey.feature == feature;
- }
- return false;
- }
- }
-
- private Composite defaultHyperlinkComposite;
-
-
- /**
- * @return the composite that contains the table
- * **/
- public Composite getDefaultHyperlinkComposite() {
- return defaultHyperlinkComposite;
- }
-
- /**
- *
- * Constructor.
- *
- * @param tabFolder
- * the parent tabfolder
- * @param semanticElement
- * the element from which diagram can be created
- */
- @Deprecated
- public LocalDefaultLinkDiagramTab(CTabFolder tabFolder, EObject semanticElement) {
- this.semanticElement = semanticElement;
- //init list of descriptor to fill the table
- initLocalNavigableElement();
- //associate the composite to the tabfolder
- CTabItem tbtmDefaultsHyperlinks = new CTabItem(tabFolder, SWT.NONE);
- tbtmDefaultsHyperlinks.setText("Hyperlink diagram with Heuristic");
- defaultHyperlinkComposite = new Composite(tabFolder, SWT.NONE);
- defaultHyperlinkComposite.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
- createArea(defaultHyperlinkComposite);
- tbtmDefaultsHyperlinks.setControl(defaultHyperlinkComposite);
- }
-
- public LocalDefaultLinkDiagramTab() {
- super();
- }
-
- @Override
- public void init(CTabFolder tabFolder, List<HyperLinkObject> hyperlinkObjects, EObject element) {
- super.init(tabFolder, hyperlinkObjects, element);
- this.semanticElement = element;
- //init list of descriptor to fill the table
- initLocalNavigableElement();
- //associate the composite to the tabfolder
- CTabItem tbtmDefaultsHyperlinks = new CTabItem(tabFolder, SWT.NONE);
- tbtmDefaultsHyperlinks.setText("Hyperlink diagram with Heuristic");
- defaultHyperlinkComposite = new Composite(tabFolder, SWT.NONE);
- defaultHyperlinkComposite.setLayout(new GridLayout(1, false));
- defaultHyperlinkComposite.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
- createArea(defaultHyperlinkComposite);
- tbtmDefaultsHyperlinks.setControl(defaultHyperlinkComposite);
- }
-
- /**
- * get the command to create diagrams from the selection done into the table
- *
- * @return the command in charge of the creation of the diagrams
- * **/
- public ICommand getCommand() {
- return command;
- }
-
- /**
- * code that is called when the button ok is selected
- */
- protected void okPressed() {
- ModelSet modelSet;
-
- try {
- modelSet = ServiceUtilsForEObject.getInstance().getModelSet(semanticElement);
- } catch (ServiceException ex) {
- Activator.log.error(ex);
- return;
- }
-
- CompositeCommand compositeCommand = new CompositeCommand("Create diagrams");
-
- for(TableItem tableItem : table.getItems()) {
- try {
- CCombo elementTypeCombo = (CCombo)tableItem.getData(ELEMENT_TYPE_COMBO_KEY);
- int elementTypeSelectionIndex = elementTypeCombo.getSelectionIndex();
- CCombo diagramTypeCombo = (CCombo)tableItem.getData(DIAGRAM_TYPE_COMBO_KEY);
- int diagramTypeSelectionIndex = diagramTypeCombo.getSelectionIndex();
-
- if(tableItem.getChecked() && elementTypeSelectionIndex != -1 && diagramTypeSelectionIndex != -1) {
- List<NavigableElement> possibleElements = (List<NavigableElement>)tableItem.getData(CREATION_ENTRY_KEY);
- NavigableElement navElement = possibleElements.get(elementTypeSelectionIndex);
-
- CreationCommandDescriptor desc = possibleCreations.get(navElement).get(diagramTypeSelectionIndex);
-
- Text diagramNameText = (Text)tableItem.getData(DIAGRAM_NAME_TEXT_KEY);
-
- compositeCommand.add(NavigationHelper.getLinkCreateAndOpenNavigableDiagramCommand(navElement, desc.getCommand(), diagramNameText.getText(), modelSet));
- }
- } catch (BackboneException e) {
- e.printStackTrace();
- }
- }
-
- command = compositeCommand;
-
- }
-
- /**
- * construction the ui
- *
- * @param parent
- * the composite that contains table.
- * @return the table contained in the composite
- */
- protected Control createArea(Composite parent) {
-
- table = new Table(parent, SWT.BORDER | SWT.V_SCROLL | SWT.CHECK);
- table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
- table.setHeaderVisible(true);
- table.setLinesVisible(true);
- // table.setBounds(10, 20, 650, 170);
-
- for(int i = 0; i < COLUMN_NAMES.length; i++) {
- TableColumn col = new TableColumn(table, SWT.NONE);
- col.setText(COLUMN_NAMES[i]);
- col.setWidth(COLUMN_WIDTHS[i]);
- col.setResizable(true);
- }
-
- // regroup CreatedNavigableElement which has same ancestor and use the same feature of this ancestor
- Map<NavigableGroupKey, List<NavigableElement>> successorsMap = new HashMap<NavigableGroupKey, List<NavigableElement>>();
-
- for(Entry<NavigableElement, List<CreationCommandDescriptor>> possibleCreationEntry : possibleCreations.entrySet()) {
- NavigableElement navElement = possibleCreationEntry.getKey();
-
- NavigableGroupKey groupKey = new NavigableGroupKey();
-
- // ignore containing feature if we are on the root element
- // because it is a direct diagram creation
- // => the feature has no meaning in this case
- if(!semanticElement.equals(navElement.getElement())) {
- groupKey.feature = navElement.getFeature();
- }
-
- if(navElement instanceof CreatedNavigableElement) {
- groupKey.ancestor = ((CreatedNavigableElement)navElement).getPreviousNavigableElement();
- }
-
- List<NavigableElement> successors = successorsMap.get(groupKey);
- if(successors == null) {
- successors = new LinkedList<NavigableElement>();
- successorsMap.put(groupKey, successors);
- }
- successors.add(navElement);
- }
-
- // handle group
- for(Entry<NavigableGroupKey, List<NavigableElement>> successorsEntry : successorsMap.entrySet()) {
- NavigableGroupKey groupKey = successorsEntry.getKey();
- List<NavigableElement> successors = successorsEntry.getValue();
-
-
- TableItem tableItem = new TableItem(table, SWT.NONE);
- tableItem.setChecked(false);
- tableItem.setData(CREATION_ENTRY_KEY, successors);
-
- //////FIXME///////
- //tableItem.setText(0, UMLNavigationHelper.getNavigationTypeFromFeature(groupKey.feature)); //Remove this dependency to UML. LabelProviderService?
- tableItem.setText(0, "Unknown");
- //////////////////
-
- String featureString = "";
- if(groupKey.feature != null) {
- featureString = groupKey.feature.getName();
- }
- tableItem.setText(1, featureString);
-
- TableEditor diagramTypeEditor = new TableEditor(table);
- final CCombo diagramTypeCombo = new CCombo(table, SWT.NONE);
- diagramTypeEditor.grabHorizontal = true;
- diagramTypeEditor.setEditor(diagramTypeCombo, tableItem, 3);
- tableItem.setData(DIAGRAM_TYPE_COMBO_KEY, diagramTypeCombo);
-
- TableEditor elementTypeEditor = new TableEditor(table);
- final CCombo elementTypeCombo = new CCombo(table, SWT.NONE);
- for(NavigableElement successor : successors) {
- String typeName = successor.getElement().eClass().getName();
- elementTypeCombo.add(typeName);
- elementTypeCombo.setData(typeName, successor);
- }
- elementTypeEditor.grabHorizontal = true;
- elementTypeEditor.setEditor(elementTypeCombo, tableItem, 2);
- tableItem.setData(ELEMENT_TYPE_COMBO_KEY, elementTypeCombo);
- elementTypeCombo.addModifyListener(new ModifyListener() {
-
- public void modifyText(ModifyEvent e) {
- String currentTypeName = ((CCombo)e.widget).getText();
-
- NavigableElement successor = (NavigableElement)elementTypeCombo.getData(currentTypeName);
-
- diagramTypeCombo.clearSelection();
- diagramTypeCombo.removeAll();
- for(CreationCommandDescriptor desc : possibleCreations.get(successor)) {
- diagramTypeCombo.add(desc.getLabel());
- }
- diagramTypeCombo.select(0);
- }
- });
- elementTypeCombo.select(0);
-
- TableEditor diagramNameEditor = new TableEditor(table);
- Text text = new Text(table, SWT.NONE);
- text.setText("DefaultName");
- diagramNameEditor.grabHorizontal = true;
- diagramNameEditor.setEditor(text, tableItem, 4);
- tableItem.setData(DIAGRAM_NAME_TEXT_KEY, text);
- }
-
- parent.pack();
- return table;
- }
-
-
- /**
- * this method is used to construct descriptors of heuristic to construct diagrams.
- * These descriptors will be displayed in the table.
- */
- protected void initLocalNavigableElement() {
- List<NavigableElement> navElements = NavigationHelper.getInstance().getAllNavigableElements(semanticElement);
- possibleCreations = new HashMap<NavigableElement, List<CreationCommandDescriptor>>();
-
- for(NavigableElement navElement : navElements) {
- final EObject element = navElement.getElement();
-
- List<CreationCommandDescriptor> possibleCommandDescs = new LinkedList<CreationCommandDescriptor>();
- for(final CreationCommandDescriptor desc : getCreationCommandRegistry().getCommandDescriptors()) {
- if(desc.getCondition() == null || desc.getCondition().create(element)) {
- possibleCommandDescs.add(desc);
- }
- }
- if(!possibleCommandDescs.isEmpty()) {
- possibleCreations.put(navElement, possibleCommandDescs);
- }
- }
- }
-
- /**
- * @return the creation command registry
- */
- protected static ICreationCommandRegistry getCreationCommandRegistry() {
- return CreationCommandRegistry.getInstance(org.eclipse.papyrus.infra.core.Activator.PLUGIN_ID);
- }
-
- @Override
- public void setInput(List<HyperLinkObject> hyperLinkObjectList) {
- //nothing to do here?
- }
-
-}

Back to the top