Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvlorenzo2013-05-14 09:18:51 +0000
committervlorenzo2013-05-14 09:18:51 +0000
commitcc7f378d869983cdcc2be9463f6200110f2081ec (patch)
tree84085bd6cad86260dbb2a54a4753d0067d8a2c00 /sandbox
parentb1dc8dd813dd4cb4a8f95ec09422f95bafb44cfc (diff)
downloadorg.eclipse.papyrus-cc7f378d869983cdcc2be9463f6200110f2081ec.tar.gz
org.eclipse.papyrus-cc7f378d869983cdcc2be9463f6200110f2081ec.tar.xz
org.eclipse.papyrus-cc7f378d869983cdcc2be9463f6200110f2081ec.zip
407986: [Table 2] The user must be able to disconnect the slave axis (automatic addition of axis on the slave)
https://bugs.eclipse.org/bugs/show_bug.cgi?id=407986 Add an action in the popup menu to edit the boolean disconnectSlave
Diffstat (limited to 'sandbox')
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable/plugin.xml48
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/command/CommandIds.java4
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractDisconnectSlaveHandler.java77
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnMasterDisconnectRowSlaveHandler.java36
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowMasterDisconnectColumnSlaveHandler.java36
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/NattableModelManager.java79
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/AxisUtils.java55
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/NattableWidgetPropertyTester.java9
8 files changed, 313 insertions, 31 deletions
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/plugin.xml b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/plugin.xml
index d05df3969a7..132408fcbfc 100644
--- a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/plugin.xml
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/plugin.xml
@@ -222,6 +222,20 @@
style="toggle">
</command>
</menu>
+ <command
+ commandId="org.eclipse.papyrus.infra.nattable.column.disconnect.slave"
+ style="toggle">
+ <visibleWhen>
+ <with
+ variable="selection">
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.papyrus.infra.nattable.tester.hasSlaveRowAxisProvider"
+ value="true">
+ </test>
+ </with>
+ </visibleWhen>
+ </command>
</menu>
<menu
@@ -361,6 +375,20 @@
style="toggle">
</command>
</menu>
+ <command
+ commandId="org.eclipse.papyrus.infra.nattable.row.disconnect.slave"
+ style="toggle">
+ <visibleWhen>
+ <with
+ variable="selection">
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.papyrus.infra.nattable.tester.hasSlaveColumnAxisProvider"
+ value="true">
+ </test>
+ </with>
+ </visibleWhen>
+ </command>
</menu>
</menuContribution>
</extension>
@@ -448,7 +476,7 @@
class="org.eclipse.papyrus.infra.nattable.utils.NattableWidgetPropertyTester"
id="org.eclipse.papyrus.infra.nattable.tester"
namespace="org.eclipse.papyrus.infra.nattable.tester"
- properties="isNattableWidget, hasFeatureRowHeaderConfiguration, hasFeatureColumnHeaderConfiguration"
+ properties="isNattableWidget, hasFeatureRowHeaderConfiguration, hasFeatureColumnHeaderConfiguration, hasSlaveRowAxisProvider, hasSlaveColumnAxisProvider"
type="org.eclipse.jface.viewers.IStructuredSelection">
</propertyTester>
</extension>
@@ -624,6 +652,24 @@
class="org.eclipse.ui.handlers.RadioState:Alphabetic"
id="org.eclipse.ui.commands.radioState">
</state>
+ </command>
+ <command
+ defaultHandler="org.eclipse.papyrus.infra.nattable.handler.RowMasterDisconnectColumnSlaveHandler"
+ id="org.eclipse.papyrus.infra.nattable.row.disconnect.slave"
+ name="Disconnect Column Axis">
+ <state
+ class="org.eclipse.ui.handlers.RegistryToggleState:true"
+ id="org.eclipse.ui.commands.toggleState">
+ </state>
+ </command>
+ <command
+ defaultHandler="org.eclipse.papyrus.infra.nattable.handler.ColumnMasterDisconnectRowSlaveHandler"
+ id="org.eclipse.papyrus.infra.nattable.column.disconnect.slave"
+ name="Disconnect Rows Axis">
+ <state
+ class="org.eclipse.ui.handlers.RegistryToggleState:true"
+ id="org.eclipse.ui.commands.toggleState">
+ </state>
</command>
</extension>
<extension
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/command/CommandIds.java b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/command/CommandIds.java
index 0415257b3de..c329329cbf7 100644
--- a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/command/CommandIds.java
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/command/CommandIds.java
@@ -61,4 +61,8 @@ public class CommandIds {
public static final String COMMAND_COLUMN_LABEL_FEATURE_DISPLAY_NAME = "org.eclipse.papyrus.infra.nattable.column.label.feature.display.name";
+ public static final String COMMAND_ROW_DISCONNECT_SLAVE = "org.eclipse.papyrus.infra.nattable.row.disconnect.slave";
+
+ public static final String COMMAND_COLUMN_DISCONNECT_SLAVE = "org.eclipse.papyrus.infra.nattable.column.disconnect.slave";
+
}
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractDisconnectSlaveHandler.java b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractDisconnectSlaveHandler.java
new file mode 100644
index 00000000000..215e1e52642
--- /dev/null
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractDisconnectSlaveHandler.java
@@ -0,0 +1,77 @@
+/*****************************************************************************
+ * 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
+import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.AbstractAxisProvider;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.MasterObjectAxisProvider;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.NattableaxisproviderPackage;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * Abstract handler used to change the value of the property IMasterAxisProvider#disconnectSlave
+ *
+ * @author vl222926
+ *
+ */
+public abstract class AbstractDisconnectSlaveHandler extends AbstractTableHandler {
+
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ *
+ * @param event
+ * @return
+ * @throws ExecutionException
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ final AbstractAxisProvider axisProvider = getAxisProviderToEdit();
+ if(axisProvider instanceof MasterObjectAxisProvider) {
+ boolean newState = !HandlerUtil.toggleCommandState(event.getCommand());
+ final TransactionalEditingDomain domain = (TransactionalEditingDomain)getTableEditingDomain();
+ final IEditCommandRequest request = new SetRequest(domain, axisProvider, NattableaxisproviderPackage.eINSTANCE.getIMasterAxisProvider_DisconnectSlave(), newState);
+ final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(axisProvider);
+ final ICommand cmd = provider.getEditCommand(request);
+ domain.getCommandStack().execute(new GMFtoEMFCommandWrapper(cmd));
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @return
+ * the axis provider to edit
+ */
+ protected abstract AbstractAxisProvider getAxisProviderToEdit();
+
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#setEnabled(java.lang.Object)
+ *
+ * @param evaluationContext
+ */
+ @Override
+ public void setEnabled(Object evaluationContext) {
+ setBaseEnabled(getAxisProviderToEdit() instanceof MasterObjectAxisProvider);
+ }
+}
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnMasterDisconnectRowSlaveHandler.java b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnMasterDisconnectRowSlaveHandler.java
new file mode 100644
index 00000000000..f6bb5abc124
--- /dev/null
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnMasterDisconnectRowSlaveHandler.java
@@ -0,0 +1,36 @@
+/*****************************************************************************
+ * 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.AbstractAxisProvider;
+import org.eclipse.papyrus.infra.nattable.utils.AxisUtils;
+
+/**
+ *
+ * @author vl222926
+ *
+ */
+public class ColumnMasterDisconnectRowSlaveHandler extends AbstractDisconnectSlaveHandler {
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractDisconnectSlaveHandler#getAxisProviderToEdit()
+ *
+ * @return
+ */
+ protected AbstractAxisProvider getAxisProviderToEdit() {
+ return AxisUtils.getAxisProviderUsedForColumns(getCurrentNattableModelManager());
+ }
+
+}
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowMasterDisconnectColumnSlaveHandler.java b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowMasterDisconnectColumnSlaveHandler.java
new file mode 100644
index 00000000000..cdac44637b7
--- /dev/null
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowMasterDisconnectColumnSlaveHandler.java
@@ -0,0 +1,36 @@
+/*****************************************************************************
+ * 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.handler;
+
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.AbstractAxisProvider;
+import org.eclipse.papyrus.infra.nattable.utils.AxisUtils;
+
+/**
+ *
+ * @author vl222926
+ *
+ */
+public class RowMasterDisconnectColumnSlaveHandler extends AbstractDisconnectSlaveHandler {
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractDisconnectSlaveHandler#getAxisProviderToEdit()
+ *
+ * @return
+ */
+ protected AbstractAxisProvider getAxisProviderToEdit() {
+ return AxisUtils.getAxisProviderUsedForRows(getCurrentNattableModelManager());
+ }
+
+}
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/NattableModelManager.java b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/NattableModelManager.java
index bb29928508f..e89955a1a21 100644
--- a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/NattableModelManager.java
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/NattableModelManager.java
@@ -54,10 +54,13 @@ import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AxisManagerRepresentation;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.AbstractAxisProvider;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.IMasterAxisProvider;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.ISlaveAxisProvider;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.CellEditorDeclaration;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.FeatureLabelProviderConfiguration;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.ILabelProviderConfiguration;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.ObjectLabelProviderConfiguration;
+import org.eclipse.papyrus.infra.nattable.utils.AxisUtils;
import org.eclipse.papyrus.infra.nattable.utils.HeaderAxisConfigurationManagementUtils;
import org.eclipse.papyrus.infra.nattable.utils.NattableConfigAttributes;
import org.eclipse.papyrus.infra.nattable.utils.StringComparator;
@@ -357,6 +360,28 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
}
}
+ //update the property IMasterObjectAxisProvider#disconnectslave
+ if(columnProvider instanceof ISlaveAxisProvider) {
+ command = commandService.getCommand(CommandIds.COMMAND_ROW_DISCONNECT_SLAVE);
+ if(command != null) {
+ final State state = command.getState(CommandIds.TOGGLE_STATE);
+ if(state != null) {
+ state.setValue(((IMasterAxisProvider)rowProvider).isDisconnectSlave());
+ }
+ }
+ }
+
+ if(rowProvider instanceof ISlaveAxisProvider) {
+ command = commandService.getCommand(CommandIds.COMMAND_COLUMN_DISCONNECT_SLAVE);
+ if(command != null) {
+ final State state = command.getState(CommandIds.TOGGLE_STATE);
+ if(state != null) {
+ state.setValue(((IMasterAxisProvider)columnProvider).isDisconnectSlave());
+ }
+ }
+ }
+
+
} else {
throw new RuntimeException(String.format("The Eclipse service {0} has not been found", ICommandService.class)); //$NON-NLS-1$
}
@@ -433,21 +458,13 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
*
* @see org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager#addRows(java.util.Collection)
*
- * @param objectToAdd
+ * @param objectsToAdd
* the list of the objects to add in rows
*/
- public void addRows(final Collection<Object> objectToAdd) {
+ public void addRows(final Collection<Object> objectsToAdd) {
final EditingDomain domain = getContextEditingDomain();
- final CompoundCommand cmd = new CompoundCommand(Messages.NattableModelManager_AddRowCommand);
- Command tmp = this.rowManager.getAddAxisCommand(domain, objectToAdd);
- if(tmp != null) {
- cmd.append(tmp);
- }
- tmp = this.columnManager.getComplementaryAddAxisCommand(domain, objectToAdd);
- if(tmp != null) {
- cmd.append(tmp);
- }
- if(!cmd.isEmpty()) {
+ final Command cmd = getAddRowElementCommand(objectsToAdd);
+ if(cmd != null && cmd.canExecute()) {
domain.getCommandStack().execute(cmd);
}
}
@@ -471,21 +488,13 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
*
* @see org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager#addColumns(java.util.Collection)
*
- * @param objectToAdd
+ * @param objectsToAdd
* the list of the objects to add in columns
*/
- public void addColumns(final Collection<Object> objectToAdd) {
+ public void addColumns(final Collection<Object> objectsToAdd) {
final EditingDomain domain = getContextEditingDomain();
- final CompoundCommand cmd = new CompoundCommand(Messages.NattableModelManager_AddColumnCommand);
- Command tmp = this.columnManager.getAddAxisCommand(domain, objectToAdd);
- if(tmp != null) {
- cmd.append(tmp);
- }
- tmp = this.rowManager.getComplementaryAddAxisCommand(domain, objectToAdd);
- if(tmp != null) {
- cmd.append(tmp);
- }
- if(!cmd.isEmpty()) {
+ final Command cmd = getAddColumnElementCommand(objectsToAdd);
+ if(cmd != null && cmd.canExecute()) {
domain.getCommandStack().execute(cmd);
}
}
@@ -767,9 +776,14 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
if(tmp != null) {
cmd.append(tmp);
}
- tmp = this.columnManager.getComplementaryAddAxisCommand(domain, objectsToAdd);
- if(tmp != null) {
- cmd.append(tmp);
+ final AbstractAxisProvider rowsProvider = AxisUtils.getAxisProviderUsedForRows(this);
+ final AbstractAxisProvider columnsProvider = AxisUtils.getAxisProviderUsedForColumns(this);
+ boolean addComplementaryAxis = rowsProvider instanceof IMasterAxisProvider && columnsProvider instanceof ISlaveAxisProvider && !((IMasterAxisProvider)rowsProvider).isDisconnectSlave();
+ if(addComplementaryAxis) {
+ tmp = this.columnManager.getComplementaryAddAxisCommand(domain, objectsToAdd);
+ if(tmp != null) {
+ cmd.append(tmp);
+ }
}
return cmd;
}
@@ -781,9 +795,14 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
if(tmp != null) {
cmd.append(tmp);
}
- tmp = this.rowManager.getComplementaryAddAxisCommand(domain, objectsToAdd);
- if(tmp != null) {
- cmd.append(tmp);
+ final AbstractAxisProvider rowsProvider = AxisUtils.getAxisProviderUsedForRows(this);
+ final AbstractAxisProvider columnsProvider = AxisUtils.getAxisProviderUsedForColumns(this);
+ boolean addComplementaryAxis = columnsProvider instanceof IMasterAxisProvider && rowsProvider instanceof ISlaveAxisProvider && !((IMasterAxisProvider)columnsProvider).isDisconnectSlave();
+ if(addComplementaryAxis) {
+ tmp = this.rowManager.getComplementaryAddAxisCommand(domain, objectsToAdd);
+ if(tmp != null) {
+ cmd.append(tmp);
+ }
}
return cmd;
}
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/AxisUtils.java b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/AxisUtils.java
index e4a4f265c57..43336f76a4b 100644
--- a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/AxisUtils.java
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/AxisUtils.java
@@ -13,7 +13,10 @@
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.utils;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IdAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.AbstractAxisProvider;
/**
* Common methods for axis management
@@ -51,4 +54,56 @@ public class AxisUtils {
return id;
}
+ /**
+ *
+ * @param table
+ * a table
+ * @return
+ * the axismanager used for rows, managing the invert axis
+ */
+ public static final AbstractAxisProvider getAxisProviderUsedForRows(final Table table) {
+ AbstractAxisProvider provider = table.getCurrentRowAxisProvider();
+ if(table.isInvertAxis()) {
+ provider = table.getCurrentColumnAxisProvider();
+ }
+ return provider;
+ }
+
+ /**
+ *
+ * @param table
+ * a table
+ * @return
+ * the axismanager used for columns, managing the invert axis
+ */
+ public static final AbstractAxisProvider getAxisProviderUsedForColumns(final Table table) {
+ AbstractAxisProvider provider = table.getCurrentColumnAxisProvider();
+ if(table.isInvertAxis()) {
+ provider = table.getCurrentRowAxisProvider();
+ }
+ return provider;
+ }
+
+ /**
+ *
+ * @param manager
+ * a table manager
+ * @return
+ * the axismanager used for rows, managing the invert axis
+ */
+ public static final AbstractAxisProvider getAxisProviderUsedForRows(final INattableModelManager manager) {
+ return getAxisProviderUsedForRows(manager.getTable());
+ }
+
+ /**
+ *
+ * @param manager
+ * a table manager
+ * @return
+ * the axismanager used for columns, managing the invert axis
+ */
+ public static final AbstractAxisProvider getAxisProviderUsedForColumns(final INattableModelManager manager) {
+ return getAxisProviderUsedForColumns(manager.getTable());
+ }
+
}
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 876d9bbae8f..631c8058428 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
@@ -15,6 +15,7 @@ package org.eclipse.papyrus.infra.nattable.utils;
import org.eclipse.core.expressions.PropertyTester;
import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.ISlaveAxisProvider;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PlatformUI;
@@ -27,6 +28,10 @@ public class NattableWidgetPropertyTester extends PropertyTester {
private static final String HAS_FEATURE_COLUMN_HEADER_CONFIGURATION = "hasFeatureColumnHeaderConfiguration"; //$NON-NLS-1$
+ private static final String HAS_SLAVE_ROWS_AXIS_PROVIDER = "hasSlaveRowAxisProvider"; //$NON-NLS-1$
+
+ private static final String HAS_SLAVE_COLUMNS_AXIS_PROVIDER = "hasSlaveColumnAxisProvider"; //$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) {
@@ -38,6 +43,10 @@ public class NattableWidgetPropertyTester extends PropertyTester {
return expectedValue.equals(LabelConfigurationManagementUtils.hasRowFeatureLabelConfiguration(manager.getTable()));
} else if(HAS_FEATURE_COLUMN_HEADER_CONFIGURATION.equals(property) && expectedValue instanceof Boolean) {
return expectedValue.equals(LabelConfigurationManagementUtils.hasColumnFeatureLabelConfiguration(manager.getTable()));
+ } else if(HAS_SLAVE_COLUMNS_AXIS_PROVIDER.equals(property) && expectedValue instanceof Boolean) {
+ return expectedValue.equals(AxisUtils.getAxisProviderUsedForColumns(manager) instanceof ISlaveAxisProvider);
+ } else if(HAS_SLAVE_ROWS_AXIS_PROVIDER.equals(property) && expectedValue instanceof Boolean) {
+ return expectedValue.equals(AxisUtils.getAxisProviderUsedForRows(manager) instanceof ISlaveAxisProvider);
}
}
return false;

Back to the top