Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvlorenzo2013-05-02 05:07:23 -0400
committervlorenzo2013-05-02 05:07:23 -0400
commitc8f8f074ecc42802ec9a8058c89cc640d8dcc38f (patch)
treebd36b18e0465d270a1724cb3db19cac06c25e473 /sandbox
parenteb2adb63f5ce9afe2974bbd8531549497e4938f4 (diff)
downloadorg.eclipse.papyrus-c8f8f074ecc42802ec9a8058c89cc640d8dcc38f.tar.gz
org.eclipse.papyrus-c8f8f074ecc42802ec9a8058c89cc640d8dcc38f.tar.xz
org.eclipse.papyrus-c8f8f074ecc42802ec9a8058c89cc640d8dcc38f.zip
407052: [Table 2] The destroy action from the ModelExplorer doesn't work properly when the table is opened
https://bugs.eclipse.org/bugs/show_bug.cgi?id=407052
Diffstat (limited to 'sandbox')
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable.modelexplorer/plugin.xml2
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable.modelexplorer/resources/PapyrusTablesFacet.querySet6
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/queries/GetTableIcon.java26
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/manager/axis/EditorContextSynchronizerAxisManager.java39
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/AbstractAxisManager.java10
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/AbstractSynchronizedOnFeatureAxisManager.java5
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/AbstractNattableWidgetManager.java20
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/NattableModelManager.java78
8 files changed, 103 insertions, 83 deletions
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.modelexplorer/plugin.xml b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.modelexplorer/plugin.xml
index f9e202d14fe..01a4149096f 100644
--- a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.modelexplorer/plugin.xml
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.modelexplorer/plugin.xml
@@ -16,7 +16,7 @@
</facetset>
</extension>
<extension point="org.eclipse.ui.handlers">
- <handler class="org.eclipse.papyrus.infra.nattable.modelexplorer.handlers.DeleteTableHandler" commandId="org.eclipse.ui.edit.delete">
+ <handler class="org.eclipse.papyrus.infra.nattable.modelexplorer.handlers.RenameTableHandler" commandId="org.eclipse.ui.edit.rename">
<activeWhen>
<with variable="selection">
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.modelexplorer/resources/PapyrusTablesFacet.querySet b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.modelexplorer/resources/PapyrusTablesFacet.querySet
index 048ac5a3931..2b220c97629 100644
--- a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.modelexplorer/resources/PapyrusTablesFacet.querySet
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.modelexplorer/resources/PapyrusTablesFacet.querySet
@@ -8,10 +8,6 @@
</queries>
<queries xsi:type="query:JavaModelQuery" name="GetContainedTables" description="Get the collection of all contained tables" upperBound="-1" implementationClassName="org.eclipse.papyrus.infra.nattable.modelexplorer.queries.GetContainedTables">
<returnType xsi:type="ecore:EClass" href="http://www.eclipse.org/papyrus/nattable/model#//Table"/>
- <scope href="http://www.eclipse.org/emf/2002/Ecore#//EObject"></scope>
- </queries>
- <queries xsi:type="query:JavaModelQuery" name="GetTableIcon" description="Return the path to the icon of the corresponding table" implementationClassName="org.eclipse.papyrus.infra.nattable.modelexplorer.queries.GetTableIcon">
- <returnType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- <scope href="http://www.eclipse.org/papyrus/nattable/model#//Table"/>
+ <scope href="http://www.eclipse.org/emf/2002/Ecore#//EObject"/>
</queries>
</query:ModelQuerySet>
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/queries/GetTableIcon.java b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/queries/GetTableIcon.java
deleted file mode 100644
index 39db14e7927..00000000000
--- a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/queries/GetTableIcon.java
+++ /dev/null
@@ -1,26 +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.infra.nattable.modelexplorer.queries;
-
-import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException;
-import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery;
-import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
-import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
-import org.eclipse.papyrus.views.modelexplorer.queries.AbstractGetEditorIconQuery;
-
-/** Return the path to the icon of the corresponding Table */
-public class GetTableIcon extends AbstractGetEditorIconQuery implements IJavaModelQuery<Table, String> {
-
- public String evaluate(final Table context, final ParameterValueList parameterValues) throws ModelQueryExecutionException {
- return "/" + getEditorRegistry(context).getEditorURLIcon(context); //$NON-NLS-1$
- }
-}
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/manager/axis/EditorContextSynchronizerAxisManager.java b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/manager/axis/EditorContextSynchronizerAxisManager.java
index 24ed50e8333..2bdc55b1e39 100644
--- a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/manager/axis/EditorContextSynchronizerAxisManager.java
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/manager/axis/EditorContextSynchronizerAxisManager.java
@@ -25,6 +25,9 @@ import org.eclipse.papyrus.infra.core.sashwindows.di.PageList;
import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef;
import org.eclipse.papyrus.infra.nattable.manager.axis.AbstractSynchronizedOnFeatureAxisManager;
import org.eclipse.papyrus.infra.nattable.manager.cell.CellManagerFactory;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+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.views.config.utils.Utils;
/**
@@ -35,6 +38,26 @@ import org.eclipse.papyrus.infra.nattable.views.config.utils.Utils;
public class EditorContextSynchronizerAxisManager extends AbstractSynchronizedOnFeatureAxisManager {
/**
+ * we keep it to be able to remove the listener during the destruction of the table
+ */
+ private PageList pageList;
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractSynchronizedOnFeatureAxisManager#init(org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager,
+ * org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AxisManagerRepresentation,
+ * org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.AbstractAxisProvider)
+ *
+ * @param manager
+ * @param rep
+ * @param provider
+ */
+ @Override
+ public void init(INattableModelManager manager, AxisManagerRepresentation rep, AbstractAxisProvider provider) {
+ super.init(manager, rep, provider);
+ }
+
+ /**
*
* @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractSynchronizedOnFeatureAxisManager#addContextFeatureValueListener()
*
@@ -50,8 +73,14 @@ public class EditorContextSynchronizerAxisManager extends AbstractSynchronizedOn
}
}
};
- final PageList pageList = Utils.getPageList(getTableManager().getTable());
- pageList.eAdapters().add(this.featureListener);
+ getPageList().eAdapters().add(this.featureListener);
+ }
+
+ private PageList getPageList() {
+ if(this.pageList == null) {
+ this.pageList = Utils.getPageList(getTableManager().getTable());
+ }
+ return this.pageList;
}
/**
@@ -94,8 +123,10 @@ public class EditorContextSynchronizerAxisManager extends AbstractSynchronizedOn
*/
@Override
public void dispose() {
- final PageList pageList = Utils.getPageList(getTableManager().getTable());
- pageList.eAdapters().remove(this.featureListener);
+ if(getPageList() != null) {
+ getPageList().eAdapters().remove(this.featureListener);
+ }
+ this.pageList = null;
super.dispose();
}
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/AbstractAxisManager.java b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/AbstractAxisManager.java
index 6f55a96b6ef..4f2624c8f80 100644
--- a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/AbstractAxisManager.java
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/AbstractAxisManager.java
@@ -52,6 +52,11 @@ public abstract class AbstractAxisManager implements IAxisManager {
protected Adapter axisListener;
/**
+ * the context of the table. We need to keep it, to be able to remove listeners on it, when the table is destroying
+ */
+ private EObject tableContext;
+
+ /**
*
*
* @see org.eclipse.papyrus.infra.nattable.manager.axis.IAxisManager#init(org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager,
@@ -68,7 +73,7 @@ public abstract class AbstractAxisManager implements IAxisManager {
this.tableManager = manager;
this.representedAxisManager = rep;
this.representedContentProvider = provider;
-
+ this.tableContext = manager.getTable().getContext();
this.axisListener = new AdapterImpl() {
@Override
@@ -123,6 +128,7 @@ public abstract class AbstractAxisManager implements IAxisManager {
this.representedContentProvider.eAdapters().remove(this.axisListener);
this.axisListener = null;
}
+ this.tableContext = null;
}
/**
@@ -258,7 +264,7 @@ public abstract class AbstractAxisManager implements IAxisManager {
* the context of the managed table
*/
protected final EObject getTableContext() {
- return getTableManager().getTable().getContext();
+ return this.tableContext;
}
/**
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/AbstractSynchronizedOnFeatureAxisManager.java b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/AbstractSynchronizedOnFeatureAxisManager.java
index 9bef410fa7d..a72877d5e29 100644
--- a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/AbstractSynchronizedOnFeatureAxisManager.java
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/axis/AbstractSynchronizedOnFeatureAxisManager.java
@@ -77,7 +77,8 @@ public abstract class AbstractSynchronizedOnFeatureAxisManager extends AbstractA
}
};
};
- getTableManager().getTable().getContext().eAdapters().add(this.featureListener);
+
+ getTableContext().eAdapters().add(this.featureListener);
}
/**
@@ -123,7 +124,7 @@ public abstract class AbstractSynchronizedOnFeatureAxisManager extends AbstractA
*/
@Override
public void dispose() {
- getTableManager().getTable().getContext().eAdapters().remove(this.featureListener);
+ getTableContext().eAdapters().remove(this.featureListener);
super.dispose();
}
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/AbstractNattableWidgetManager.java b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/AbstractNattableWidgetManager.java
index 29310a86177..be2198ab3ce 100644
--- a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/AbstractNattableWidgetManager.java
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/AbstractNattableWidgetManager.java
@@ -15,6 +15,7 @@ package org.eclipse.papyrus.infra.nattable.manager.table;
import java.util.List;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.edit.ui.dnd.LocalTransfer;
import org.eclipse.jface.action.GroupMarker;
import org.eclipse.jface.action.IAction;
@@ -92,7 +93,12 @@ public abstract class AbstractNattableWidgetManager implements INattableModelMan
/**
* the managed table
*/
- protected Table table;
+ private Table table;
+
+ /**
+ * we need to keep it, to be able to remove the listener on it, when the table is destroying
+ */
+ private EObject tableContext;
/**
* the nattable widget
@@ -139,6 +145,7 @@ public abstract class AbstractNattableWidgetManager implements INattableModelMan
*/
public AbstractNattableWidgetManager(final Table table) {
this.table = table;
+ this.tableContext = table.getContext();
}
/**
@@ -233,7 +240,7 @@ public abstract class AbstractNattableWidgetManager implements INattableModelMan
}
protected void configureNatTable() {
- if(!this.natTable.isDisposed()) {
+ if(this.natTable != null && !this.natTable.isDisposed()) {
this.natTable.setConfigRegistry(createAndInitializeNewConfigRegistry());
this.natTable.setUiBindingRegistry(new UiBindingRegistry(this.natTable));
this.natTable.configure();
@@ -439,5 +446,14 @@ public abstract class AbstractNattableWidgetManager implements INattableModelMan
this.bodyDataProvider.dispose();
this.rowHeaderDataProvider.dispose();
this.columnHeaderDataProvider.dispose();
+ this.tableContext = null;
+ }
+
+ public EObject getTableContext() {
+ return this.tableContext;
+ }
+
+ public Table getTable() {
+ return this.table;
}
}
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 8a694a2e8ac..e7d3c63ccb2 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
@@ -112,7 +112,6 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
*/
private FocusListener focusListener;
-
/**
*
* Constructor.
@@ -123,7 +122,6 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
*/
public NattableModelManager(final Table rawModel) {
super(rawModel);
- // this.table = rawModel;
this.rowProvider = rawModel.getCurrentRowAxisProvider();
this.columnProvider = rawModel.getCurrentColumnAxisProvider();
this.verticalElements = Collections.synchronizedList(new ArrayList<Object>());
@@ -176,7 +174,7 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
}
};
- getEditingDomain(this.table.getContext()).getCommandStack().addCommandStackListener(this.refreshListener);
+ getEditingDomain(getTableContext()).getCommandStack().addCommandStackListener(this.refreshListener);
this.focusListener = new FocusListener() {
@@ -200,8 +198,8 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
final ICommandService commandService = (ICommandService)PlatformUI.getWorkbench().getActiveWorkbenchWindow().getService(ICommandService.class);
if(commandService != null) {
- final AbstractHeaderAxisConfiguration columnAxisConfiguration = HeaderAxisConfigurationManagementUtils.getColumnAbstractHeaderAxisUsedInTable(this.table);
- final AbstractHeaderAxisConfiguration rowAxisConfiguration = HeaderAxisConfigurationManagementUtils.getRowAbstractHeaderAxisUsedInTable(this.table);
+ final AbstractHeaderAxisConfiguration columnAxisConfiguration = HeaderAxisConfigurationManagementUtils.getColumnAbstractHeaderAxisUsedInTable(getTable());
+ final AbstractHeaderAxisConfiguration rowAxisConfiguration = HeaderAxisConfigurationManagementUtils.getRowAbstractHeaderAxisUsedInTable(getTable());
//update the header configuration
org.eclipse.core.commands.Command command = commandService.getCommand(CommandIds.COMMAND_COLUMN_DISPLAY_INDEX_ID);
if(command != null) {
@@ -387,8 +385,8 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
* create the line and the columns managers
*/
protected void init() {
- this.columnManager = createAxisManager(getTable().getTableConfiguration().getColumnHeaderAxisConfiguration().getAxisManagers(), this.table.getCurrentColumnAxisProvider());
- this.rowManager = createAxisManager(getTable().getTableConfiguration().getRowHeaderAxisConfiguration().getAxisManagers(), this.table.getCurrentRowAxisProvider());
+ this.columnManager = createAxisManager(getTable().getTableConfiguration().getColumnHeaderAxisConfiguration().getAxisManagers(), getTable().getCurrentColumnAxisProvider());
+ this.rowManager = createAxisManager(getTable().getTableConfiguration().getRowHeaderAxisConfiguration().getAxisManagers(), getTable().getCurrentRowAxisProvider());
boolean allIsSlave = this.columnManager.isSlave() && this.rowManager.isSlave();
Assert.isTrue(!allIsSlave, Messages.NattableModelManager_AtLeastOfOneTheAxisManagerMustBeAMaster);
}
@@ -425,7 +423,7 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
public void dispose() {
this.columnManager.dispose();
this.rowManager.dispose();
- getEditingDomain(this.table.getContext()).getCommandStack().removeCommandStackListener(this.refreshListener);
+ getEditingDomain(getTableContext()).getCommandStack().removeCommandStackListener(this.refreshListener);
}
/**
@@ -436,7 +434,7 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
* the list of the objects to add in rows
*/
public void addRows(final Collection<Object> objectToAdd) {
- final EditingDomain domain = getEditingDomain(this.table.getContext());
+ final EditingDomain domain = getEditingDomain(getTableContext());
final CompoundCommand cmd = new CompoundCommand(Messages.NattableModelManager_AddRowCommand);
Command tmp = this.rowManager.getAddAxisCommand(domain, objectToAdd);
if(tmp != null) {
@@ -474,7 +472,7 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
* the list of the objects to add in columns
*/
public void addColumns(final Collection<Object> objectToAdd) {
- final EditingDomain domain = getEditingDomain(this.table.getContext());
+ final EditingDomain domain = getEditingDomain(getTableContext());
final CompoundCommand cmd = new CompoundCommand(Messages.NattableModelManager_AddColumnCommand);
Command tmp = this.columnManager.getAddAxisCommand(domain, objectToAdd);
if(tmp != null) {
@@ -519,7 +517,7 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
private EditingDomain getTableEditingDomain() {
ServicesRegistry registry = null;
try {
- registry = ServiceUtilsForEObject.getInstance().getServiceRegistry(this.table);
+ registry = ServiceUtilsForEObject.getInstance().getServiceRegistry(getTable());
return registry.getService(EditingDomain.class);
} catch (final ServiceException e) {
Activator.log.error(Messages.NattableModelManager_ServiceRegistryNotFound, e);
@@ -536,7 +534,7 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
private EditingDomain getContextEditingDomain() {
ServicesRegistry registry = null;
try {
- registry = ServiceUtilsForEObject.getInstance().getServiceRegistry(this.table.getContext());
+ registry = ServiceUtilsForEObject.getInstance().getServiceRegistry(getTableContext());
return registry.getService(EditingDomain.class);
} catch (final ServiceException e) {
Activator.log.error(Messages.NattableModelManager_ServiceRegistryNotFound, e);
@@ -575,7 +573,7 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
public void setDataValue(final int columnIndex, final int rowIndex, final Object newValue) {
final Object obj1 = this.verticalElements.get(columnIndex);
final Object obj2 = this.horizontalElements.get(rowIndex);
- CellManagerFactory.INSTANCE.setCellValue(getEditingDomain(this.table.getContext()), obj1, obj2, newValue);
+ CellManagerFactory.INSTANCE.setCellValue(getEditingDomain(getTableContext()), obj1, obj2, newValue);
}
/**
@@ -624,10 +622,12 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
Display.getDefault().asyncExec(new Runnable() {//required, because we get the event before the changes
public void run() {
- if(axis == NattableModelManager.this.columnProvider) {
- updateColumnContents();
- } else {
- updateRowContents();
+ if(NattableModelManager.this.natTable != null && !NattableModelManager.this.natTable.isDisposed()) {
+ if(axis == NattableModelManager.this.columnProvider) {
+ updateColumnContents();
+ } else {
+ updateRowContents();
+ }
}
}
});
@@ -638,7 +638,7 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
*/
private void updateRowContents() {
NattableModelManager.this.rowManager.updateAxisContents();
- CellEditorDeclaration declaration = getCellEditorDeclarationToUse(this.table);
+ CellEditorDeclaration declaration = getCellEditorDeclarationToUse(getTable());
if(declaration.equals(CellEditorDeclaration.ROW)) {
configureNatTable();
refreshNatTable();
@@ -654,7 +654,7 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
*/
private void updateColumnContents() {
NattableModelManager.this.columnManager.updateAxisContents();
- CellEditorDeclaration declaration = getCellEditorDeclarationToUse(this.table);
+ CellEditorDeclaration declaration = getCellEditorDeclarationToUse(getTable());
if(declaration.equals(CellEditorDeclaration.COLUMN)) {
configureNatTable();
refreshNatTable();
@@ -672,7 +672,7 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
*/
private CellEditorDeclaration getCellEditorDeclarationToUse(final Table table) {
CellEditorDeclaration declaration = table.getTableConfiguration().getCellEditorDeclaration();
- if(this.table.isInvertAxis()) {
+ if(getTable().isInvertAxis()) {
if(declaration.equals(CellEditorDeclaration.COLUMN)) {
declaration = CellEditorDeclaration.ROW;
} else if(declaration.equals(CellEditorDeclaration.ROW)) {
@@ -741,16 +741,16 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
}
public void reorderColumnsElements(final IAxis axisToMove, final int newIndex) {
- final EditingDomain domain = getEditingDomain(this.table.getContext());
+ final EditingDomain domain = getEditingDomain(getTableContext());
//FIXME
- // final Command cmd = MoveCommand.create(getEditingDomain(this.table.getContext()), this.columnProvider, NattableaxisproviderPackage.eINSTANCE.getDefaultAxisProvider_Axis(), axisToMove, newIndex);
+ // final Command cmd = MoveCommand.create(getEditingDomain(getTable().getContext()), this.columnProvider, NattableaxisproviderPackage.eINSTANCE.getDefaultAxisProvider_Axis(), axisToMove, newIndex);
// domain.getCommandStack().execute(cmd);
}
// not tested
public void reorderRowElements(final IAxis axisToMove, final int newIndex) {
- final EditingDomain domain = getEditingDomain(this.table.getContext());
- // final Command cmd = MoveCommand.create(getEditingDomain(this.table.getContext()), this.rowProvider, NattableaxisproviderPackage.eINSTANCE.getDefaultAxisProvider_Axis(), axisToMove, newIndex);
+ final EditingDomain domain = getEditingDomain(getTableContext());
+ // final Command cmd = MoveCommand.create(getEditingDomain(getTable().getContext()), this.rowProvider, NattableaxisproviderPackage.eINSTANCE.getDefaultAxisProvider_Axis(), axisToMove, newIndex);
// domain.getCommandStack().execute(cmd);
}
@@ -761,10 +761,10 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
*/
public void invertAxis() {
final CompoundCommand cmd = new CompoundCommand(Messages.NattableModelManager_SwitchLinesAndColumns);
- final EditingDomain domain = getEditingDomain(this.table.getContext());
- boolean oldValue = this.table.isInvertAxis();
+ final EditingDomain domain = getEditingDomain(getTableContext());
+ boolean oldValue = getTable().isInvertAxis();
if(canInvertAxis()) {
- Command tmp = new SetCommand(domain, this.table, NattablePackage.eINSTANCE.getTable_InvertAxis(), !oldValue);
+ Command tmp = new SetCommand(domain, getTable(), NattablePackage.eINSTANCE.getTable_InvertAxis(), !oldValue);
cmd.append(tmp);
domain.getCommandStack().execute(cmd);
}
@@ -785,7 +785,7 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
}
public Command getAddRowElementCommand(Collection<Object> objectsToAdd) {
- final EditingDomain domain = getEditingDomain(this.table.getContext());
+ final EditingDomain domain = getEditingDomain(getTableContext());
final CompoundCommand cmd = new CompoundCommand(Messages.NattableModelManager_AddRowCommand);
Command tmp = this.rowManager.getAddAxisCommand(domain, objectsToAdd);
if(tmp != null) {
@@ -799,7 +799,7 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
}
public Command getAddColumnElementCommand(Collection<Object> objectsToAdd) {
- final EditingDomain domain = getEditingDomain(this.table.getContext());
+ final EditingDomain domain = getEditingDomain(getTableContext());
final CompoundCommand cmd = new CompoundCommand(Messages.NattableModelManager_AddColumnCommand);
Command tmp = this.columnManager.getAddAxisCommand(domain, objectsToAdd);
if(tmp != null) {
@@ -813,7 +813,7 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
}
public Command getDestroyColumnElementCommand(Collection<Object> objectsToDestroy) {
- final EditingDomain domain = getEditingDomain(this.table.getContext());
+ final EditingDomain domain = getEditingDomain(getTableContext());
final Command cmd = this.columnManager.getDestroyAxisCommand(domain, objectsToDestroy);
return cmd;
}
@@ -826,10 +826,6 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
return false;
}
- public Table getTable() {
- return this.table;
- }
-
public ITableAxisElementProvider getTableAxisElementProvider() {// FIXME :
// must be
// renamed?
@@ -865,7 +861,7 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
Collection<Object> existingColumns = this.columnManager.getAllManagedAxis();
ArrayList<Object> checkedColumns = new ArrayList<Object>();
checkedColumns.addAll(Arrays.asList(dialog.getResult()));
- CommandStack commandStack = getEditingDomain(this.table.getContext()).getCommandStack();
+ CommandStack commandStack = getEditingDomain(getTableContext()).getCommandStack();
ArrayList<Object> columnsToAdd = new ArrayList<Object>(checkedColumns);
columnsToAdd.removeAll(existingColumns);
@@ -908,10 +904,10 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
* @return
*/
public AbstractAxisProvider getVerticalAxisProvider() {
- if(this.table.isInvertAxis()) {
- return this.table.getCurrentRowAxisProvider();
+ if(getTable().isInvertAxis()) {
+ return getTable().getCurrentRowAxisProvider();
} else {
- return this.table.getCurrentColumnAxisProvider();
+ return getTable().getCurrentColumnAxisProvider();
}
}
@@ -922,10 +918,10 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
* @return
*/
public AbstractAxisProvider getHorizontalAxisProvider() {
- if(this.table.isInvertAxis()) {
- return this.table.getCurrentColumnAxisProvider();
+ if(getTable().isInvertAxis()) {
+ return getTable().getCurrentColumnAxisProvider();
} else {
- return this.table.getCurrentRowAxisProvider();
+ return getTable().getCurrentRowAxisProvider();
}
}
}

Back to the top