[Activity Explorer] Popup-menu diagram creation not managed by filters
Bug: https://bugs.polarsys.org/show_bug.cgi?id=998
Change-Id: I4f61753101be9577d68839b472eecccd858153e3
Signed-off-by: Joao Barata <jean.barata@thalesgroup.com>
diff --git a/plugins/org.eclipse.amalgam.explorer.activity.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.amalgam.explorer.activity.ui/META-INF/MANIFEST.MF
index 78afd0c..d731f62 100644
--- a/plugins/org.eclipse.amalgam.explorer.activity.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.amalgam.explorer.activity.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.amalgam.explorer.activity.ui;singleton:=true
-Bundle-Version: 1.7.0.qualifier
+Bundle-Version: 1.7.1.qualifier
Bundle-Activator: org.eclipse.amalgam.explorer.activity.ui.ActivityExplorerActivator
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.amalgam.explorer.activity.ui/pom.xml b/plugins/org.eclipse.amalgam.explorer.activity.ui/pom.xml
index 15cc715..9e26a33 100644
--- a/plugins/org.eclipse.amalgam.explorer.activity.ui/pom.xml
+++ b/plugins/org.eclipse.amalgam.explorer.activity.ui/pom.xml
@@ -10,7 +10,7 @@
</parent>
<groupId>org.eclipse.amalgam</groupId>
<artifactId>org.eclipse.amalgam.explorer.activity.ui</artifactId>
- <version>1.7.0-SNAPSHOT</version>
+ <version>1.7.1-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
diff --git a/plugins/org.eclipse.amalgam.explorer.activity.ui/src/org/eclipse/amalgam/explorer/activity/ui/api/editor/pages/viewers/DiagramViewer.java b/plugins/org.eclipse.amalgam.explorer.activity.ui/src/org/eclipse/amalgam/explorer/activity/ui/api/editor/pages/viewers/DiagramViewer.java
index e26d1bc..ced412d 100644
--- a/plugins/org.eclipse.amalgam.explorer.activity.ui/src/org/eclipse/amalgam/explorer/activity/ui/api/editor/pages/viewers/DiagramViewer.java
+++ b/plugins/org.eclipse.amalgam.explorer.activity.ui/src/org/eclipse/amalgam/explorer/activity/ui/api/editor/pages/viewers/DiagramViewer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * Copyright (c) 2006, 2016 THALES GLOBAL SERVICES.
* 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
@@ -20,7 +20,7 @@
import org.eclipse.amalgam.explorer.activity.ui.api.editor.pages.Messages;
import org.eclipse.amalgam.explorer.activity.ui.api.editor.pages.helper.SelectionHelper;
import org.eclipse.amalgam.explorer.activity.ui.api.editor.sections.ActivityExplorerSection;
-import org.eclipse.amalgam.explorer.activity.ui.api.hyperlinkadapter.AbstractNewDiagramHyperlinkAdapter;
+import org.eclipse.amalgam.explorer.activity.ui.api.hyperlinkadapter.IRepresentationProvider;
import org.eclipse.amalgam.explorer.activity.ui.internal.util.ActivityExplorerLoggerService;
import org.eclipse.amalgam.explorer.activity.ui.internal.viewer.diagram.actions.CloneAction;
import org.eclipse.amalgam.explorer.activity.ui.internal.viewer.diagram.actions.DeleteRepresentationAction;
@@ -316,9 +316,9 @@
final Set<String> representations = new HashSet<String>();
for (ExplorerActivity activity : section.getActivities()) {
IHyperlinkListener listener = activity.getListener();
- if (listener instanceof AbstractNewDiagramHyperlinkAdapter) {
+ if (listener instanceof IRepresentationProvider) {
try {
- representations.add(((AbstractNewDiagramHyperlinkAdapter) listener).getRepresentationName());
+ representations.addAll(((IRepresentationProvider) listener).getRepresentationNames());
} catch (Throwable e) {
StringBuilder message = new StringBuilder();
diff --git a/plugins/org.eclipse.amalgam.explorer.activity.ui/src/org/eclipse/amalgam/explorer/activity/ui/api/hyperlinkadapter/AbstractNewDiagramHyperlinkAdapter.java b/plugins/org.eclipse.amalgam.explorer.activity.ui/src/org/eclipse/amalgam/explorer/activity/ui/api/hyperlinkadapter/AbstractNewDiagramHyperlinkAdapter.java
index 94999fd..c8ea192 100644
--- a/plugins/org.eclipse.amalgam.explorer.activity.ui/src/org/eclipse/amalgam/explorer/activity/ui/api/hyperlinkadapter/AbstractNewDiagramHyperlinkAdapter.java
+++ b/plugins/org.eclipse.amalgam.explorer.activity.ui/src/org/eclipse/amalgam/explorer/activity/ui/api/hyperlinkadapter/AbstractNewDiagramHyperlinkAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * Copyright (c) 2006, 2016 THALES GLOBAL SERVICES.
* 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
@@ -11,6 +11,8 @@
package org.eclipse.amalgam.explorer.activity.ui.api.hyperlinkadapter;
import java.util.Collection;
+import java.util.Collections;
+import java.util.Set;
import org.eclipse.amalgam.explorer.activity.ui.internal.util.ActivityExplorerLoggerService;
import org.eclipse.amalgam.explorer.activity.ui.internal.viewer.diagram.actions.NewRepresentationAction;
@@ -28,12 +30,8 @@
/**
* Base class to implement a diagram creation.
- *
*/
-public abstract class AbstractNewDiagramHyperlinkAdapter extends AbstractHyperlinkAdapter {
-
- // private Logger _logger =
- // ReportManagerRegistry.getInstance().subscribe(IReportManagerDefaultComponents.DIAGRAM);
+public abstract class AbstractNewDiagramHyperlinkAdapter extends AbstractHyperlinkAdapter implements IRepresentationProvider {
/**
* Constructor.
@@ -135,7 +133,14 @@
}
/**
- * @return
+ * @return the representation name of the diagram created
*/
public abstract String getRepresentationName();
+
+ /**
+ * @see org.eclipse.amalgam.explorer.activity.ui.api.hyperlinkadapter.IRepresentationProvider#getRepresentationNames()
+ */
+ public Set<String> getRepresentationNames() {
+ return Collections.singleton(getRepresentationName());
+ }
}
diff --git a/plugins/org.eclipse.amalgam.explorer.activity.ui/src/org/eclipse/amalgam/explorer/activity/ui/api/hyperlinkadapter/IRepresentationProvider.java b/plugins/org.eclipse.amalgam.explorer.activity.ui/src/org/eclipse/amalgam/explorer/activity/ui/api/hyperlinkadapter/IRepresentationProvider.java
new file mode 100644
index 0000000..c7d69bc
--- /dev/null
+++ b/plugins/org.eclipse.amalgam.explorer.activity.ui/src/org/eclipse/amalgam/explorer/activity/ui/api/hyperlinkadapter/IRepresentationProvider.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2016 THALES GLOBAL SERVICES.
+ * 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:
+ * Thales - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.amalgam.explorer.activity.ui.api.hyperlinkadapter;
+
+import java.util.Set;
+
+/**
+ * @author Joao Barata
+ */
+public interface IRepresentationProvider {
+
+ /**
+ * @return all the representation names for each created diagram
+ */
+ Set<String> getRepresentationNames();
+
+}
diff --git a/plugins/org.eclipse.amalgam.explorer.activity.ui/src/org/eclipse/amalgam/explorer/activity/ui/api/hyperlinkadapter/PopupMenuLinkAdapter.java b/plugins/org.eclipse.amalgam.explorer.activity.ui/src/org/eclipse/amalgam/explorer/activity/ui/api/hyperlinkadapter/PopupMenuLinkAdapter.java
index b6254b2..2f44483 100644
--- a/plugins/org.eclipse.amalgam.explorer.activity.ui/src/org/eclipse/amalgam/explorer/activity/ui/api/hyperlinkadapter/PopupMenuLinkAdapter.java
+++ b/plugins/org.eclipse.amalgam.explorer.activity.ui/src/org/eclipse/amalgam/explorer/activity/ui/api/hyperlinkadapter/PopupMenuLinkAdapter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2015 THALES GLOBAL SERVICES.
+ * Copyright (c) 2006, 2016 THALES GLOBAL SERVICES.
* 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
@@ -10,6 +10,9 @@
*******************************************************************************/
package org.eclipse.amalgam.explorer.activity.ui.api.hyperlinkadapter;
+import java.util.Collections;
+import java.util.Set;
+
import org.eclipse.amalgam.explorer.activity.ui.internal.QuickMenuCreator;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.ui.forms.events.HyperlinkAdapter;
@@ -20,7 +23,7 @@
* activation.
*
*/
-public abstract class PopupMenuLinkAdapter extends HyperlinkAdapter {
+public abstract class PopupMenuLinkAdapter extends HyperlinkAdapter implements IRepresentationProvider {
/**
* @see org.eclipse.ui.forms.events.HyperlinkAdapter#linkActivated(org.eclipse.ui.forms.events.HyperlinkEvent)
@@ -41,7 +44,14 @@
/**
* Fill the popup menu.
*
- * @param menuManager_p
+ * @param menuManager
*/
- protected abstract void fillPopupMenu(IMenuManager menuManager_p);
+ protected abstract void fillPopupMenu(IMenuManager menuManager);
+
+ /**
+ * @see org.eclipse.amalgam.explorer.activity.ui.api.hyperlinkadapter.IRepresentationProvider#getRepresentationNames()
+ */
+ public Set<String> getRepresentationNames() {
+ return Collections.emptySet();
+ }
}