Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvlorenzo2012-01-16 16:32:54 +0000
committervlorenzo2012-01-16 16:32:54 +0000
commit33216e5f1cca85f23d47194b74d45019c9e61401 (patch)
tree7d2e41d87e5b57b5ed68d7fb3a50c6363c08f8fe
parent38780ee2ef8deca355758ceea6f8b24263fb3cd1 (diff)
downloadorg.eclipse.papyrus-33216e5f1cca85f23d47194b74d45019c9e61401.tar.gz
org.eclipse.papyrus-33216e5f1cca85f23d47194b74d45019c9e61401.tar.xz
org.eclipse.papyrus-33216e5f1cca85f23d47194b74d45019c9e61401.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
-rw-r--r--plugins/infra/table/org.eclipse.papyrus.infra.table.common/META-INF/MANIFEST.MF3
-rw-r--r--plugins/infra/table/org.eclipse.papyrus.infra.table.common/plugin.xml6
-rw-r--r--plugins/infra/table/org.eclipse.papyrus.infra.table.common/src/org/eclipse/papyrus/infra/table/common/hyperlink/CreateHyperLinkTableCommand.java64
-rw-r--r--plugins/infra/table/org.eclipse.papyrus.infra.table.common/src/org/eclipse/papyrus/infra/table/common/hyperlink/HyperLinkTableConstants.java26
-rw-r--r--plugins/infra/table/org.eclipse.papyrus.infra.table.common/src/org/eclipse/papyrus/infra/table/common/hyperlink/HyperLinkTableEditor.java38
-rw-r--r--plugins/infra/table/org.eclipse.papyrus.infra.table.common/src/org/eclipse/papyrus/infra/table/common/hyperlink/HyperLinkTableEditorHelper.java66
6 files changed, 202 insertions, 1 deletions
diff --git a/plugins/infra/table/org.eclipse.papyrus.infra.table.common/META-INF/MANIFEST.MF b/plugins/infra/table/org.eclipse.papyrus.infra.table.common/META-INF/MANIFEST.MF
index 272bd805ebd..6571c1b8393 100644
--- a/plugins/infra/table/org.eclipse.papyrus.infra.table.common/META-INF/MANIFEST.MF
+++ b/plugins/infra/table/org.eclipse.papyrus.infra.table.common/META-INF/MANIFEST.MF
@@ -19,7 +19,8 @@ Require-Bundle: org.eclipse.emf.facet.widgets.nattable.instance,
org.eclipse.emf.transaction;bundle-version="1.4.0",
org.eclipse.gmf.runtime.common.core;bundle-version="1.4.1",
org.eclipse.gmf.runtime.emf.type.core;bundle-version="1.4.0",
- org.eclipse.uml2.uml;bundle-version="4.0.0"
+ org.eclipse.uml2.uml;bundle-version="4.0.0",
+ org.eclipse.papyrus.infra.hyperlink
Export-Package: org.eclipse.papyrus.infra.table.common,
org.eclipse.papyrus.infra.table.common.dialog,
org.eclipse.papyrus.infra.table.common.editor,
diff --git a/plugins/infra/table/org.eclipse.papyrus.infra.table.common/plugin.xml b/plugins/infra/table/org.eclipse.papyrus.infra.table.common/plugin.xml
index 32fd466c15b..ddd4e788fb0 100644
--- a/plugins/infra/table/org.eclipse.papyrus.infra.table.common/plugin.xml
+++ b/plugins/infra/table/org.eclipse.papyrus.infra.table.common/plugin.xml
@@ -33,4 +33,10 @@
class="org.eclipse.papyrus.infra.table.common.factory.PapyrusCommandFactory">
</commandFactory>
</extension>
+ <extension
+ point="org.eclipse.papyrus.infra.hyperlink.editor.registration">
+ <editorhyperlink
+ helper="org.eclipse.papyrus.infra.table.common.hyperlink.HyperLinkTableEditorHelper">
+ </editorhyperlink>
+ </extension>
</plugin>
diff --git a/plugins/infra/table/org.eclipse.papyrus.infra.table.common/src/org/eclipse/papyrus/infra/table/common/hyperlink/CreateHyperLinkTableCommand.java b/plugins/infra/table/org.eclipse.papyrus.infra.table.common/src/org/eclipse/papyrus/infra/table/common/hyperlink/CreateHyperLinkTableCommand.java
new file mode 100644
index 00000000000..fbe31894c24
--- /dev/null
+++ b/plugins/infra/table/org.eclipse.papyrus.infra.table.common/src/org/eclipse/papyrus/infra/table/common/hyperlink/CreateHyperLinkTableCommand.java
@@ -0,0 +1,64 @@
+/*****************************************************************************
+ * 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.table.common.hyperlink;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EModelElement;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.emf.commands.CreateEAnnotationCommand;
+import org.eclipse.papyrus.infra.hyperlink.util.HyperLinkConstants;
+
+
+public class CreateHyperLinkTableCommand extends CreateEAnnotationCommand{
+ /** The hyperlink kind. */
+ public String tooltiptext;
+
+ /** The localization. */
+ public String name;
+
+ private EModelElement table;
+
+ protected boolean isDefaultNavigation;
+ /**
+ * Instantiates a new creates the hyper link command.
+ *
+ * @param domain
+ * the domain
+ * @param object
+ * the object for example the view
+ * @param tooltiptext
+ * the hyperlink kind see {@link VisualInformationPapyrusConstant}
+ * @param name
+ * the localization
+ */
+ public CreateHyperLinkTableCommand(TransactionalEditingDomain domain, EModelElement object, String tooltiptext, String name, EModelElement diagram, boolean isDefaultNavigation) {
+ super(domain, object, HyperLinkTableConstants.HYPERLINK_TABLE);
+ this.tooltiptext = tooltiptext;
+ this.name = name;
+ this.table = diagram;
+ this.isDefaultNavigation=isDefaultNavigation;
+ }
+
+ /**
+ * {@inheritedDoc}
+ */
+ protected void doExecute() {
+ EAnnotation eAnnotation = createEAnnotation();
+ eAnnotation.getReferences().add(table);
+ eAnnotation.getDetails().put(HyperLinkConstants.HYPERLINK_TOOLTYPE_TEXT, this.tooltiptext);
+ eAnnotation.getDetails().put(HyperLinkTableConstants.HYPERLINK_TABLE_NAME, this.name); //TODO change that!
+ eAnnotation.getDetails().put(HyperLinkConstants.HYPERLINK_IS_DEFAULT_NAVIGATION, ""+this.isDefaultNavigation);
+ attachEannotation(eAnnotation, getObject());
+ }
+}
diff --git a/plugins/infra/table/org.eclipse.papyrus.infra.table.common/src/org/eclipse/papyrus/infra/table/common/hyperlink/HyperLinkTableConstants.java b/plugins/infra/table/org.eclipse.papyrus.infra.table.common/src/org/eclipse/papyrus/infra/table/common/hyperlink/HyperLinkTableConstants.java
new file mode 100644
index 00000000000..3579ae0fe7a
--- /dev/null
+++ b/plugins/infra/table/org.eclipse.papyrus.infra.table.common/src/org/eclipse/papyrus/infra/table/common/hyperlink/HyperLinkTableConstants.java
@@ -0,0 +1,26 @@
+/*****************************************************************************
+ * 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.table.common.hyperlink;
+
+import org.eclipse.papyrus.infra.hyperlink.util.HyperLinkConstants;
+
+public class HyperLinkTableConstants {
+
+ public static final String HYPERLINK_TABLE = HyperLinkConstants.PAPYRUS_HYPERLINK_PREFIX + "Table";
+
+ public static final String HYPERLINK_TABLE_NAME = "table_name";
+ private HyperLinkTableConstants(){
+ //nothing to do
+ }
+}
diff --git a/plugins/infra/table/org.eclipse.papyrus.infra.table.common/src/org/eclipse/papyrus/infra/table/common/hyperlink/HyperLinkTableEditor.java b/plugins/infra/table/org.eclipse.papyrus.infra.table.common/src/org/eclipse/papyrus/infra/table/common/hyperlink/HyperLinkTableEditor.java
new file mode 100644
index 00000000000..279caf276de
--- /dev/null
+++ b/plugins/infra/table/org.eclipse.papyrus.infra.table.common/src/org/eclipse/papyrus/infra/table/common/hyperlink/HyperLinkTableEditor.java
@@ -0,0 +1,38 @@
+/*****************************************************************************
+ * 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.table.common.hyperlink;
+
+import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkEditor;
+import org.eclipse.papyrus.infra.table.instance.papyrustableinstance.PapyrusTableInstance;
+import org.eclipse.swt.graphics.Image;
+
+public class HyperLinkTableEditor extends HyperLinkEditor{
+
+
+ public Image getImage(Object element) {//TODO remove this method
+ if(element instanceof PapyrusTableInstance){
+ return getEditorRegistry().getEditorIcon(element);
+ }
+ return null;
+ }
+
+ public String getText(Object element) {//TODO remove this method
+ if(element instanceof PapyrusTableInstance){
+ return ((PapyrusTableInstance)element).getName();
+ }
+ return null;
+ }
+
+
+}
diff --git a/plugins/infra/table/org.eclipse.papyrus.infra.table.common/src/org/eclipse/papyrus/infra/table/common/hyperlink/HyperLinkTableEditorHelper.java b/plugins/infra/table/org.eclipse.papyrus.infra.table.common/src/org/eclipse/papyrus/infra/table/common/hyperlink/HyperLinkTableEditorHelper.java
new file mode 100644
index 00000000000..fc825ca08b6
--- /dev/null
+++ b/plugins/infra/table/org.eclipse.papyrus.infra.table.common/src/org/eclipse/papyrus/infra/table/common/hyperlink/HyperLinkTableEditorHelper.java
@@ -0,0 +1,66 @@
+/*****************************************************************************
+ * 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.table.common.hyperlink;
+
+import java.util.List;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EModelElement;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.emf.commands.CreateEAnnotationCommand;
+import org.eclipse.papyrus.infra.hyperlink.helper.AbstractHyperLinkEditorHelper;
+import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkEditor;
+import org.eclipse.papyrus.infra.hyperlink.object.HyperLinkObject;
+import org.eclipse.papyrus.infra.hyperlink.util.HyperLinkConstants;
+import org.eclipse.papyrus.infra.table.instance.papyrustableinstance.PapyrusTableInstance;
+
+
+public class HyperLinkTableEditorHelper extends AbstractHyperLinkEditorHelper {
+
+ @Override
+ public HyperLinkEditor getHyperLinkObjectFor(Object object) {
+ if(object instanceof PapyrusTableInstance) {
+ return new HyperLinkTableEditor();
+ }
+ return null;
+ }
+
+ @Override
+ public CreateEAnnotationCommand getAddHyperLinkCommand(TransactionalEditingDomain domain, EModelElement object, HyperLinkObject hyperlinkObject) {
+ if(hyperlinkObject instanceof HyperLinkTableEditor) {
+ HyperLinkTableEditor hyperLinkDiagram = (HyperLinkTableEditor)hyperlinkObject;
+ return new CreateHyperLinkTableCommand(domain, object, hyperLinkDiagram.getTooltipText(), ((PapyrusTableInstance)hyperLinkDiagram.getObject()).getName(), (EModelElement)hyperLinkDiagram.getObject(), hyperLinkDiagram.getIsDefault());
+ } else {
+ return null;
+ }
+ }
+
+
+ @Override
+ public HyperLinkEditor getHyperLinkObjectForEAnnotation(EAnnotation eAnnotation) {
+ if(eAnnotation.getSource().equals(HyperLinkTableConstants.HYPERLINK_TABLE)) {
+ HyperLinkTableEditor hyperLinkDiagram = new HyperLinkTableEditor();
+ List<EObject> list = eAnnotation.getReferences();
+ if(list.size() > 0) {
+ if(eAnnotation.getReferences().get(0).eResource() != null) {
+ hyperLinkDiagram.setObject(eAnnotation.getReferences().get(0));
+ hyperLinkDiagram.setTooltipText(eAnnotation.getDetails().get(HyperLinkConstants.HYPERLINK_TOOLTYPE_TEXT));
+ return hyperLinkDiagram;
+ }
+ }
+ }
+ return null;
+ }
+}

Back to the top