Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvlorenzo2013-05-15 04:09:04 -0400
committervlorenzo2013-05-15 04:09:04 -0400
commit4161fdfaf1d4416ae6350cce53807e5005e9010d (patch)
treed32a7cc2edbce58b8a9945e67ac20b12ad2dfbe3 /sandbox
parentaf02d3b9bd51e9d576b6f954dc842946179942c7 (diff)
downloadorg.eclipse.papyrus-4161fdfaf1d4416ae6350cce53807e5005e9010d.tar.gz
org.eclipse.papyrus-4161fdfaf1d4416ae6350cce53807e5005e9010d.tar.xz
org.eclipse.papyrus-4161fdfaf1d4416ae6350cce53807e5005e9010d.zip
400801: [Table 2] Tabular Editor must allow to create new element and add it to the table
https://bugs.eclipse.org/bugs/show_bug.cgi?id=400801 401764: [Table 2] The classes managing the table model and Nattable must be refactored https://bugs.eclipse.org/bugs/show_bug.cgi?id=401764
Diffstat (limited to 'sandbox')
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable/plugin.xml2
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/NattableWidgetPropertyTester.java27
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.sysml.nattable.menu/META-INF/MANIFEST.MF1
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.sysml.nattable.menu/plugin.xml4
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.sysml.nattable.menu/src/org/eclipse/papyrus/sysml/nattable/menu/handlers/SysmlNattableCreateMenu.java7
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.uml.nattable.menu/META-INF/MANIFEST.MF1
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.uml.nattable.menu/plugin.xml18
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.uml.nattable.menu/src/org/eclipse/papyrus/uml/nattable/menu/handlers/UmlNattableCreateMenu.java7
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.uml.nattable.menu/src/org/eclipse/papyrus/uml/nattable/menu/tester/TableEditorPropertyTester.java32
9 files changed, 33 insertions, 66 deletions
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/plugin.xml b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/plugin.xml
index 3cc5a09ad8f..3ccae21fa46 100644
--- a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/plugin.xml
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/plugin.xml
@@ -860,7 +860,7 @@
<extension
point="org.eclipse.ui.commandImages">
<image
- commandId="org.eclipse.papyrus.infra.nattable.invert.axis.command"
+ commandId="org.eclipse.papyrus.infra.nattable.invert.axis"
icon="icons/invertAxis.gif">
</image>
</extension>
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/NattableWidgetPropertyTester.java b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/NattableWidgetPropertyTester.java
index 7a06f239ae2..ad78005cb9c 100644
--- a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/NattableWidgetPropertyTester.java
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/NattableWidgetPropertyTester.java
@@ -22,7 +22,7 @@ import org.eclipse.ui.PlatformUI;
public class NattableWidgetPropertyTester extends PropertyTester {
- private static final String IS_NATTABLE_WIDGET = "isNattableWidget"; //$NON-NLS-1$
+ public static final String IS_NATTABLE_WIDGET = "isNattableWidget"; //$NON-NLS-1$
private static final String HAS_FEATURE_ROW_HEADER_CONFIGURATION = "hasFeatureRowHeaderConfiguration"; //$NON-NLS-1$
@@ -35,12 +35,12 @@ public class NattableWidgetPropertyTester extends PropertyTester {
private static final String CAN_INVERT_AXIS = "canInvertAxis";//$NON-NLS-1$
public boolean test(final Object receiver, final String property, final Object[] args, final Object expectedValue) {
- final IWorkbenchPart current = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getPartService().getActivePart();
- if(current != null) {
- final INattableModelManager manager = (INattableModelManager)current.getAdapter(INattableModelManager.class);
- if(IS_NATTABLE_WIDGET.equals(property) && expectedValue instanceof Boolean) {
- return expectedValue.equals(manager != null);
- } else if(HAS_FEATURE_ROW_HEADER_CONFIGURATION.equals(property) && expectedValue instanceof Boolean) {
+ final INattableModelManager manager = getNattableModelManager();
+ if(IS_NATTABLE_WIDGET.equals(property) && expectedValue instanceof Boolean) {
+ return expectedValue.equals(manager != null);
+ }
+ if(manager != null) {
+ if(HAS_FEATURE_ROW_HEADER_CONFIGURATION.equals(property) && expectedValue instanceof Boolean) {
LabelConfigurationManagementUtils.getRowFeatureLabelConfigurationInTable(manager.getTable());
return expectedValue.equals(LabelConfigurationManagementUtils.hasRowFeatureLabelConfiguration(manager.getTable()));
} else if(HAS_FEATURE_COLUMN_HEADER_CONFIGURATION.equals(property) && expectedValue instanceof Boolean) {
@@ -55,4 +55,17 @@ public class NattableWidgetPropertyTester extends PropertyTester {
}
return false;
}
+
+ /**
+ *
+ * @return
+ * the current nattable model manager or <code>null</code> if not found
+ */
+ protected INattableModelManager getNattableModelManager() {
+ final IWorkbenchPart current = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getPartService().getActivePart();
+ if(current != null) {
+ return (INattableModelManager)current.getAdapter(INattableModelManager.class);
+ }
+ return null;
+ }
}
diff --git a/sandbox/TableV3/org.eclipse.papyrus.sysml.nattable.menu/META-INF/MANIFEST.MF b/sandbox/TableV3/org.eclipse.papyrus.sysml.nattable.menu/META-INF/MANIFEST.MF
index 1282fd98fef..ee03eb56ced 100644
--- a/sandbox/TableV3/org.eclipse.papyrus.sysml.nattable.menu/META-INF/MANIFEST.MF
+++ b/sandbox/TableV3/org.eclipse.papyrus.sysml.nattable.menu/META-INF/MANIFEST.MF
@@ -25,3 +25,4 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.uml2.uml;bundle-version="4.1.0"
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.papyrus.sysml.nattable.menu.handlers
diff --git a/sandbox/TableV3/org.eclipse.papyrus.sysml.nattable.menu/plugin.xml b/sandbox/TableV3/org.eclipse.papyrus.sysml.nattable.menu/plugin.xml
index 133c4ccb938..06b3626fe60 100644
--- a/sandbox/TableV3/org.eclipse.papyrus.sysml.nattable.menu/plugin.xml
+++ b/sandbox/TableV3/org.eclipse.papyrus.sysml.nattable.menu/plugin.xml
@@ -54,9 +54,9 @@
<visibleWhen
checkEnabled="false">
<with
- variable="activePart">
+ variable="selection">
<test
- property="org.eclipse.papyrus.uml.nattable.menu.tester.isTable"
+ property="org.eclipse.papyrus.infra.nattable.tester.isNattableWidget"
value="true">
</test>
</with>
diff --git a/sandbox/TableV3/org.eclipse.papyrus.sysml.nattable.menu/src/org/eclipse/papyrus/sysml/nattable/menu/handlers/SysmlNattableCreateMenu.java b/sandbox/TableV3/org.eclipse.papyrus.sysml.nattable.menu/src/org/eclipse/papyrus/sysml/nattable/menu/handlers/SysmlNattableCreateMenu.java
index 5a394669461..47b2c66344c 100644
--- a/sandbox/TableV3/org.eclipse.papyrus.sysml.nattable.menu/src/org/eclipse/papyrus/sysml/nattable/menu/handlers/SysmlNattableCreateMenu.java
+++ b/sandbox/TableV3/org.eclipse.papyrus.sysml.nattable.menu/src/org/eclipse/papyrus/sysml/nattable/menu/handlers/SysmlNattableCreateMenu.java
@@ -11,8 +11,8 @@
*****************************************************************************/
package org.eclipse.papyrus.sysml.nattable.menu.handlers;
+import org.eclipse.papyrus.infra.nattable.utils.NattableWidgetPropertyTester;
import org.eclipse.papyrus.sysml.service.types.menu.AbstractCreateSysmlChildMenu;
-import org.eclipse.papyrus.uml.nattable.menu.tester.TableEditorPropertyTester;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.menus.IContributionRoot;
@@ -23,13 +23,12 @@ import org.eclipse.ui.services.IServiceLocator;
*/
public class SysmlNattableCreateMenu extends AbstractCreateSysmlChildMenu {
- //FIXME : use the same property tester than in oep.infra.nattable.modelexplorer
- private TableEditorPropertyTester tester = new TableEditorPropertyTester();
+ private NattableWidgetPropertyTester tester = new NattableWidgetPropertyTester();
@Override
public void createContributionItems(IServiceLocator serviceLocator, IContributionRoot additions) {
IWorkbenchPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart();
- if(tester.test(part, TableEditorPropertyTester.IS_TABLE, null, Boolean.TRUE)) {
+ if(tester.test(part, NattableWidgetPropertyTester.IS_NATTABLE_WIDGET, null, Boolean.TRUE)) {
super.createContributionItems(serviceLocator, additions);
}
}
diff --git a/sandbox/TableV3/org.eclipse.papyrus.uml.nattable.menu/META-INF/MANIFEST.MF b/sandbox/TableV3/org.eclipse.papyrus.uml.nattable.menu/META-INF/MANIFEST.MF
index 2ec209f1505..cfce8540098 100644
--- a/sandbox/TableV3/org.eclipse.papyrus.uml.nattable.menu/META-INF/MANIFEST.MF
+++ b/sandbox/TableV3/org.eclipse.papyrus.uml.nattable.menu/META-INF/MANIFEST.MF
@@ -26,5 +26,4 @@ Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.papyrus.uml.nattable.menu,
org.eclipse.papyrus.uml.nattable.menu.handlers,
org.eclipse.papyrus.uml.nattable.menu.messages,
- org.eclipse.papyrus.uml.nattable.menu.tester,
org.eclipse.papyrus.uml.nattable.menu.util
diff --git a/sandbox/TableV3/org.eclipse.papyrus.uml.nattable.menu/plugin.xml b/sandbox/TableV3/org.eclipse.papyrus.uml.nattable.menu/plugin.xml
index 4c073703c74..9a700a1f6c5 100644
--- a/sandbox/TableV3/org.eclipse.papyrus.uml.nattable.menu/plugin.xml
+++ b/sandbox/TableV3/org.eclipse.papyrus.uml.nattable.menu/plugin.xml
@@ -261,9 +261,9 @@
<visibleWhen
checkEnabled="false">
<with
- variable="activePart">
+ variable="selection">
<test
- property="org.eclipse.papyrus.uml.nattable.menu.tester.isTable"
+ property="org.eclipse.papyrus.infra.nattable.tester.isNattableWidget"
value="true">
</test>
</with>
@@ -275,17 +275,5 @@
class="org.eclipse.papyrus.uml.nattable.menu.handlers.UmlNattableCreateMenu"
locationURI="popup:org.eclipse.papyrus.uml.nattable.create.uml.menu">
</menuContribution>
-
-
- </extension>
- <extension
- point="org.eclipse.core.expressions.propertyTesters">
- <propertyTester
- class="org.eclipse.papyrus.uml.nattable.menu.tester.TableEditorPropertyTester"
- id="org.eclipse.papyrus.uml.nattable.menu.tester"
- namespace="org.eclipse.papyrus.uml.nattable.menu.tester"
- properties="isTable"
- type="org.eclipse.ui.IWorkbenchPart">
- </propertyTester>
- </extension>
+ </extension>
</plugin>
diff --git a/sandbox/TableV3/org.eclipse.papyrus.uml.nattable.menu/src/org/eclipse/papyrus/uml/nattable/menu/handlers/UmlNattableCreateMenu.java b/sandbox/TableV3/org.eclipse.papyrus.uml.nattable.menu/src/org/eclipse/papyrus/uml/nattable/menu/handlers/UmlNattableCreateMenu.java
index e3dd2d695bf..58b3762b7c0 100644
--- a/sandbox/TableV3/org.eclipse.papyrus.uml.nattable.menu/src/org/eclipse/papyrus/uml/nattable/menu/handlers/UmlNattableCreateMenu.java
+++ b/sandbox/TableV3/org.eclipse.papyrus.uml.nattable.menu/src/org/eclipse/papyrus/uml/nattable/menu/handlers/UmlNattableCreateMenu.java
@@ -11,7 +11,7 @@
*****************************************************************************/
package org.eclipse.papyrus.uml.nattable.menu.handlers;
-import org.eclipse.papyrus.uml.nattable.menu.tester.TableEditorPropertyTester;
+import org.eclipse.papyrus.infra.nattable.utils.NattableWidgetPropertyTester;
import org.eclipse.papyrus.uml.service.types.menu.AbstractCreateUmlChildMenu;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PlatformUI;
@@ -23,13 +23,12 @@ import org.eclipse.ui.services.IServiceLocator;
*/
public class UmlNattableCreateMenu extends AbstractCreateUmlChildMenu {
- //FIXME : use the same property tester than in oep.infra.nattable.modelexplorer
- private TableEditorPropertyTester tester = new TableEditorPropertyTester();
+ private NattableWidgetPropertyTester tester = new NattableWidgetPropertyTester();
@Override
public void createContributionItems(IServiceLocator serviceLocator, IContributionRoot additions) {
IWorkbenchPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart();
- if(tester.test(part, TableEditorPropertyTester.IS_TABLE, null, Boolean.TRUE)) {
+ if(tester.test(part, NattableWidgetPropertyTester.IS_NATTABLE_WIDGET, null, Boolean.TRUE)) {
super.createContributionItems(serviceLocator, additions);
}
}
diff --git a/sandbox/TableV3/org.eclipse.papyrus.uml.nattable.menu/src/org/eclipse/papyrus/uml/nattable/menu/tester/TableEditorPropertyTester.java b/sandbox/TableV3/org.eclipse.papyrus.uml.nattable.menu/src/org/eclipse/papyrus/uml/nattable/menu/tester/TableEditorPropertyTester.java
deleted file mode 100644
index 8e1be8bc79d..00000000000
--- a/sandbox/TableV3/org.eclipse.papyrus.uml.nattable.menu/src/org/eclipse/papyrus/uml/nattable/menu/tester/TableEditorPropertyTester.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Juan Cadavid (CEA LIST) juan.cadavid@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.uml.nattable.menu.tester;
-
-import org.eclipse.core.expressions.PropertyTester;
-import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-
-
-public class TableEditorPropertyTester extends PropertyTester {
-
- public static final String IS_TABLE = "isTable"; //$NON-NLS-1$
-
- public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
-
- if(receiver instanceof IMultiDiagramEditor && IS_TABLE.equals(property) && expectedValue instanceof Boolean) {
- INattableModelManager manager = (INattableModelManager)((IMultiDiagramEditor)receiver).getActiveEditor().getAdapter(INattableModelManager.class);
- return (expectedValue.equals(manager != null));
- }
- return false;
- }
-
-}

Back to the top