Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Lorenzo2015-12-04 15:50:11 +0000
committervincent lorenzo2015-12-07 15:51:40 +0000
commit8273d980ae48481b714459774d2ab8be4155d8b8 (patch)
treed0b3bc56969958c492480c9dcdbacaffe620b0c4
parentc6530a062e243589efeb66ab152fb298528449cc (diff)
downloadorg.eclipse.papyrus-8273d980ae48481b714459774d2ab8be4155d8b8.tar.gz
org.eclipse.papyrus-8273d980ae48481b714459774d2ab8be4155d8b8.tar.xz
org.eclipse.papyrus-8273d980ae48481b714459774d2ab8be4155d8b8.zip
bug 481727: [Table] Papyrus must refactore the popup menu of the table
https://bugs.eclipse.org/bugs/show_bug.cgi?id=481727 Signed-off-by: Vincent Lorenzo <vincent.lorenzo@cea.fr>
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/plugin.xml4
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/plugin.xml52
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/AbstractNattableWidgetManager.java35
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/TreeNattableModelManager.java24
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/menu/MenuConstants.java37
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/messages.properties4
-rw-r--r--plugins/infra/services/org.eclipse.papyrus.infra.services.validation/plugin.xml4
-rw-r--r--plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.menu/plugin.xml2
-rw-r--r--plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.menu/plugin.xml2
9 files changed, 116 insertions, 48 deletions
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/plugin.xml b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/plugin.xml
index c04c18e6d79..dcd8b404c4d 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/plugin.xml
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/plugin.xml
@@ -270,8 +270,8 @@
<extension
point="org.eclipse.ui.menus">
<menuContribution
- allPopups="false"
- locationURI="popup:org.eclipse.papyrus.infra.nattable.widget.menu?endof=table.generic.actions">
+ allPopups="true"
+ locationURI="popup:org.eclipse.papyrus.infra.nattable.widget.menu?endof=general.separator">
<command
commandId="org.eclipse.papyrus.infra.nattable.common.reload.table.editor.command"
label="Reload Table Editor"
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/plugin.xml b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/plugin.xml
index 02fb532e27f..55cde3dde08 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/plugin.xml
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/plugin.xml
@@ -12,12 +12,8 @@
point="org.eclipse.ui.menus">
<menuContribution
allPopups="true"
- locationURI="popup:org.eclipse.papyrus.infra.nattable.widget.menu">
+ locationURI="popup:org.eclipse.papyrus.infra.nattable.widget.menu?after=general.separator">
- <separator
- name="table.generic.actions"
- visible="false">
- </separator>
<command
commandId="org.eclipse.ui.file.print"
label="Print Table"
@@ -44,10 +40,10 @@
</and>
</visibleWhen>
</command>
- <separator
- name="edit"
- visible="true">
- </separator>
+ </menuContribution>
+ <menuContribution
+ allPopups="true"
+ locationURI="popup:org.eclipse.papyrus.infra.nattable.widget.menu?after=edit.separator">
<command
commandId="org.eclipse.ui.edit.selectAll"
style="push">
@@ -90,10 +86,10 @@
</with>
</visibleWhen>
</command>
- <separator
- name="table.tree.separator"
- visible="true">
- </separator>
+ </menuContribution>
+ <menuContribution
+ allPopups="true"
+ locationURI="popup:org.eclipse.papyrus.infra.nattable.widget.menu?after=tree.separator">
<menu
label="Hierarchic Style">
<visibleWhen>
@@ -139,10 +135,10 @@
</with>
</visibleWhen>
</command>
- <separator
- name="cell.separator"
- visible="true">
- </separator>
+ </menuContribution>
+ <menuContribution
+ allPopups="true"
+ locationURI="popup:org.eclipse.papyrus.infra.nattable.widget.menu?after=cells.separator">
<menu
icon="icons/mergeTable.gif"
label="Merge Options">
@@ -171,10 +167,10 @@
commandId="org.eclipse.papyrus.infra.nattable.mark.as.resolved.command"
style="push">
</command>
- <separator
- name="rows.and.columns.separator"
- visible="true">
- </separator>
+ </menuContribution>
+ <menuContribution
+ allPopups="true"
+ locationURI="popup:org.eclipse.papyrus.infra.nattable.widget.menu?after=rows.and.columns.separator">
<menu
icon="icons/tableColumnAction.gif"
id="org.eclipse.papyrus.infra.nattable.columns.menu"
@@ -512,14 +508,6 @@
style="push">
</command>
</menu>
- <separator
- name="creations"
- visible="true">
- </separator>
- <separator
- name="additions"
- visible="true">
- </separator>
</menuContribution>
<menuContribution
allPopups="true"
@@ -1607,21 +1595,21 @@
defaultHandler="org.eclipse.papyrus.infra.nattable.handler.TreeRowHideAllCategoriesHandler"
description="This command allows to Hide all categories displayed in a table"
id="org.eclipse.papyrus.infra.nattable.row.hide.allcategories.command"
- name="Hide All Categories Command">
+ name="Hide All Categories">
</command>
<command
categoryId="org.eclipse.papyrus.infra.nattable.rows.command.category"
defaultHandler="org.eclipse.papyrus.infra.nattable.handler.TreeRowShowAllCategoriesHandler"
description="This command allows to Show all categories displayed in a table"
id="org.eclipse.papyrus.infra.nattable.row.show.allcategories.command"
- name="Show All Categories Command">
+ name="Show All Categories">
</command>
<command
categoryId="org.eclipse.papyrus.infra.nattable.rows.command.category"
defaultHandler="org.eclipse.papyrus.infra.nattable.handler.TreeRowHideShowCategoryHandler"
description="This command allows to Show/hide the categories for a given depth"
id="org.eclipse.papyrus.infra.nattable.row.show.hide.category.command"
- name="Show/Hide Category for a given depth command">
+ name="Show/Hide Category for a given depth">
</command>
<command
categoryId="org.eclipse.papyrus.infra.nattable.rows.command.category"
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/AbstractNattableWidgetManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/AbstractNattableWidgetManager.java
index 3c9e988b831..e06a874fc02 100755
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/AbstractNattableWidgetManager.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/AbstractNattableWidgetManager.java
@@ -38,6 +38,7 @@ import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
import org.eclipse.jface.util.LocalSelectionTransfer;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionProvider;
@@ -377,7 +378,7 @@ public abstract class AbstractNattableWidgetManager implements INattableModelMan
// register the decoration service
configRegistry.registerConfigAttribute(NattableConfigAttributes.DECORATION_SERVICE_CONFIG_ATTRIBUTE, getDecorationService(), DisplayMode.NORMAL, NattableConfigAttributes.DECORATION_SERVICE_ID);
-
+
this.natTable.setConfigRegistry(configRegistry);
this.natTable.setUiBindingRegistry(new UiBindingRegistry(this.natTable));
this.natTable.configure();
@@ -660,7 +661,7 @@ public abstract class AbstractNattableWidgetManager implements INattableModelMan
*/
public MenuManager createAndRegisterMenuManagerAndSelectionProvider(final NatTable natTable, final IWorkbenchPartSite site, ISelectionProvider selectionProvider) {
final MenuManager menuManager = new MenuManager(MenuConstants.POPUP, MenuConstants.TABLE_POPUP_MENU_ID);
- menuManager.setRemoveAllWhenShown(true);
+ // menuManager.setRemoveAllWhenShown(true);
final Menu menu = menuManager.createContextMenu(this.natTable);
@@ -670,6 +671,36 @@ public abstract class AbstractNattableWidgetManager implements INattableModelMan
site.setSelectionProvider(this.selectionProvider);
}
+ // we create the separator here, and not in the plugin.xml file in order to get the wanted order (in plugin.xml it seems depends on the order of plugin activation
+ Separator separator = new Separator(MenuConstants.GENERAL_SEPARATOR_ID);
+ separator.setVisible(false);// the first one is not visible
+ menuManager.add(separator);
+
+ separator = new Separator(MenuConstants.EDIT_SEPARATOR_ID);
+ separator.setVisible(true);
+ menuManager.add(separator);
+
+ separator = new Separator(MenuConstants.CELL_SEPARATOR_ID);
+ separator.setVisible(true);
+ menuManager.add(separator);
+
+ separator = new Separator(MenuConstants.ROWS_AND_COLUMNS_SEPARATOR_ID);
+ separator.setVisible(true);
+ menuManager.add(separator);
+
+ separator = new Separator(MenuConstants.CREATIONS_SEPARATOR_ID);
+ separator.setVisible(true);
+ menuManager.add(separator);
+
+ separator = new Separator(MenuConstants.TOOLS_SEPARATOR_ID);
+ separator.setVisible(true);
+ menuManager.add(separator);
+
+ // commented to avoid to pollute the table menu with global contribution
+ // separator = new Separator(MenuConstants.ADDITIONS_SEPARATOR_ID);
+ // separator.setVisible(true);
+ // menuManager.add(separator);
+
return menuManager;
}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/TreeNattableModelManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/TreeNattableModelManager.java
index ebb759849ad..1540492824e 100755
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/TreeNattableModelManager.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/TreeNattableModelManager.java
@@ -24,6 +24,10 @@ import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.impl.AdapterImpl;
import org.eclipse.emf.transaction.ResourceSetListener;
import org.eclipse.emf.transaction.RollbackException;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.nebula.widgets.nattable.NatTable;
import org.eclipse.nebula.widgets.nattable.hideshow.ColumnHideShowLayer;
import org.eclipse.nebula.widgets.nattable.hideshow.command.MultiColumnHideCommand;
@@ -46,6 +50,7 @@ import org.eclipse.papyrus.infra.nattable.manager.axis.IAxisManager;
import org.eclipse.papyrus.infra.nattable.manager.axis.IAxisManagerForEventList;
import org.eclipse.papyrus.infra.nattable.manager.axis.ICompositeAxisManager;
import org.eclipse.papyrus.infra.nattable.manager.axis.ITreeItemAxisManagerForEventList;
+import org.eclipse.papyrus.infra.nattable.menu.MenuConstants;
import org.eclipse.papyrus.infra.nattable.model.nattable.NattablePackage;
import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IAxis;
@@ -111,7 +116,7 @@ public class TreeNattableModelManager extends NattableModelManager implements IT
public TreeNattableModelManager(Table rawModel, ISelectionExtractor selectionExtractor) {
super(rawModel, selectionExtractor);
Assert.isTrue(TableHelper.isTreeTable(rawModel));
-
+
// Manage the change axis provider adapter only for the column (row cannot manage refresh)
rawModel.eAdapters().remove(changeAxisProvider);
changeAxisProvider = new AdapterImpl() {
@@ -180,6 +185,23 @@ public class TreeNattableModelManager extends NattableModelManager implements IT
return this.treeList;
}
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.manager.table.AbstractNattableWidgetManager#createAndRegisterMenuManagerAndSelectionProvider(org.eclipse.nebula.widgets.nattable.NatTable, org.eclipse.ui.IWorkbenchPartSite,
+ * org.eclipse.jface.viewers.ISelectionProvider)
+ *
+ * @param natTable
+ * @param site
+ * @param selectionProvider
+ * @return
+ */
+ @Override
+ public MenuManager createAndRegisterMenuManagerAndSelectionProvider(NatTable natTable, IWorkbenchPartSite site, ISelectionProvider selectionProvider) {
+ final MenuManager menuManager = super.createAndRegisterMenuManagerAndSelectionProvider(natTable, site, selectionProvider);
+ final Separator separator = new Separator(MenuConstants.TREE_SEPARATOR_ID);
+ separator.setVisible(true);
+ menuManager.insertAfter(MenuConstants.EDIT_SEPARATOR_ID, separator);
+ return menuManager;
+ }
/**
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/menu/MenuConstants.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/menu/MenuConstants.java
index a9906c7074e..8df669290de 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/menu/MenuConstants.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/menu/MenuConstants.java
@@ -13,6 +13,8 @@
package org.eclipse.papyrus.infra.nattable.menu;
+import org.eclipse.ui.IWorkbenchActionConstants;
+
/**
* @author VL222926
* This class grousp the constant used for table menu
@@ -53,11 +55,6 @@ public class MenuConstants {
public static final String DELIMITER = ":"; //$NON-NLS-1$
/**
- * this separator is used to group contribution for tree table
- */
- public static final String TREE_SEPARATOR_ID = "tree.separator"; //$NON-NLS-1$
-
- /**
* this separator is used to group general contribution
*/
public static final String GENERAL_SEPARATOR_ID = "general.separator"; //$NON-NLS-1$
@@ -66,4 +63,34 @@ public class MenuConstants {
* this separator is used to group edit contribution
*/
public static final String EDIT_SEPARATOR_ID = "edit.separator";
+
+ /**
+ * this separator is used to group contribution for tree table
+ */
+ public static final String TREE_SEPARATOR_ID = "tree.separator"; //$NON-NLS-1$
+
+ /**
+ * this separator is used to group contribution for the cells
+ */
+ public static final String CELL_SEPARATOR_ID = "cells.separator"; //$NON-NLS-1$
+
+ /**
+ * this separator is used to group contribution for the rows
+ */
+ public static final String ROWS_AND_COLUMNS_SEPARATOR_ID = "rows.and.columns.separator"; //$NON-NLS-1$
+
+ /**
+ * this separator is used to group contribution for the creations of new elements
+ */
+ public static final String CREATIONS_SEPARATOR_ID = "creations.separator"; //$NON-NLS-1$
+
+ /**
+ * this separator is used to group contribution for the tools
+ */
+ public static final String TOOLS_SEPARATOR_ID = "tools.separator"; //$NON-NLS-1$
+
+ /**
+ * this separator could be used to group contribution registered on additions, but we do not used it currently to avoid to be polluted by global menu contribution
+ */
+ public static final String ADDITIONS_SEPARATOR_ID = IWorkbenchActionConstants.MB_ADDITIONS;
}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/messages.properties b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/messages.properties
index 43dd8047746..fbb4f36ef35 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/messages.properties
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/messages/messages.properties
@@ -135,9 +135,9 @@ LoadCurrentAxisProvidersDialog_0=Name
LoadCurrentAxisProvidersDialog_1=Description
LoadCurrentAxisProvidersDialog_2=Columns
LoadCurrentAxisProvidersDialog_3=\ (current)
-PapyrusPopupMenuAction_ShowCategoriesOnDepth=Show Categories on depth {0}
+PapyrusPopupMenuAction_ShowCategoriesOnDepth=Show Level-{0} Categories
PasteConfigurationUtils_ContainementFeatureIsNotAReference=The containment feature for the pasted elements is not a reference.
-PasteConfigurationUtils_ContainmentFeatureIsNotAReferenceContainment=The containement feature is not a reference in containment.
+PasteConfigurationUtils_ContainmentFeatureIsNotAReferenceContainment=The containment feature is not a reference in containment.
PasteConfigurationUtils_ContainmentFeatureIsNull=The containment feature for the pasted elements is null.
PasteConfigurationUtils_CreatesElementsAreNotCompatibleWithContainmentFeature=The created elements ({0}) are not compatible with the containmment feature {1}.
PasteConfigurationUtils_ElementIdNotDefined=The element id describing the kind of pasted element is not defined.
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/plugin.xml b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/plugin.xml
index 180a1e14cdc..40a43ec339c 100644
--- a/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/plugin.xml
+++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.validation/plugin.xml
@@ -80,8 +80,8 @@
</command>
</menuContribution>
<menuContribution
- allPopups="false"
- locationURI="popup:org.eclipse.papyrus.infra.nattable.widget.menu?after=additions">
+ allPopups="true"
+ locationURI="popup:org.eclipse.papyrus.infra.nattable.widget.menu?after=tools.separator">
<menu
icon="icons/etool16/validate.gif"
id="org.eclipse.papyrus.views.modelexplorer.popup.validation"
diff --git a/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.menu/plugin.xml b/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.menu/plugin.xml
index a7fcb74faf7..b48570ab753 100644
--- a/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.menu/plugin.xml
+++ b/plugins/sysml/nattable/org.eclipse.papyrus.sysml.nattable.menu/plugin.xml
@@ -412,7 +412,7 @@
point="org.eclipse.ui.menus">
<menuContribution
allPopups="true"
- locationURI="popup:org.eclipse.papyrus.infra.nattable.widget.menu?after=creations">
+ locationURI="popup:org.eclipse.papyrus.infra.nattable.widget.menu?after=org.eclipse.papyrus.uml.nattable.create.uml.menu">
<menu
id="org.eclipse.papyrus.sysml.nattable.create.sysml.menu"
label="Create SysML Element">
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.menu/plugin.xml b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.menu/plugin.xml
index 9f60ca00c78..71aa6ed2d65 100644
--- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.menu/plugin.xml
+++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.menu/plugin.xml
@@ -2460,7 +2460,7 @@
point="org.eclipse.ui.menus">
<menuContribution
allPopups="true"
- locationURI="popup:org.eclipse.papyrus.infra.nattable.widget.menu?after=creations">
+ locationURI="popup:org.eclipse.papyrus.infra.nattable.widget.menu?after=creations.separator">
<menu
id="org.eclipse.papyrus.uml.nattable.create.uml.menu"
label="Create UML Element">

Back to the top