Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas FAUVERGUE2018-11-09 10:11:43 -0500
committerNicolas FAUVERGUE2018-11-12 04:20:56 -0500
commit67ef742e9b4e87e458d6024a366d682951ee870a (patch)
tree9e874c2fa9390fe8d02e655365a1f70253c6aeab
parent2dd5ffbff80f4d6c903a812301479b786507e81f (diff)
downloadorg.eclipse.papyrus-67ef742e9b4e87e458d6024a366d682951ee870a.tar.gz
org.eclipse.papyrus-67ef742e9b4e87e458d6024a366d682951ee870a.tar.xz
org.eclipse.papyrus-67ef742e9b4e87e458d6024a366d682951ee870a.zip
Bug 519381: [Table] Changing Display label value from the property view
doesn't work properly https://bugs.eclipse.org/bugs/show_bug.cgi?id=519381 - Override the execute method in the RowDisplayLabelHeaderHandler to hide/show the row label column of tree table via the context menu - Add a new method postDoSetValue in the AbstractRowHeaderAxisConfigurationObservableValue - Handle the RowDisplayLabelHeaderObservableValue to hide/show the row label column of tree table via the properties view - Update version of plugins Change-Id: I4213183e39011d5276fa566d742306d4f0224d0e Signed-off-by: Thanh Liem PHAN <thanhliem.phan@all4tec.net> Signed-off-by: Nicolas FAUVERGUE <nicolas.fauvergue@cea.fr>
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/META-INF/MANIFEST.MF4
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/pom.xml2
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/observable/AbstractRowHeaderAxisConfigurationObservableValue.java14
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/observable/RowDisplayLabelHeaderObservableValue.java34
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/META-INF/MANIFEST.MF2
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/pom.xml2
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDisplayLabelHeaderHandler.java36
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/NattableModelManager.java38
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/TreeNattableModelManager.java28
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/NatTableFocusUtils.java67
10 files changed, 193 insertions, 34 deletions
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/META-INF/MANIFEST.MF b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/META-INF/MANIFEST.MF
index d0e83a1f744..70d13ae98bd 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/META-INF/MANIFEST.MF
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/META-INF/MANIFEST.MF
@@ -10,11 +10,11 @@ Require-Bundle: org.eclipse.papyrus.infra.properties.ui;bundle-version="[3.0.0,4
org.eclipse.papyrus.infra.nattable.common;bundle-version="[5.0.0,6.0.0)",
org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)",
org.eclipse.papyrus.infra.internationalization;bundle-version="[1.0.0,2.0.0)",
- org.eclipse.papyrus.infra.nattable;bundle-version="[6.0.0,7.0.0)",
+ org.eclipse.papyrus.infra.nattable;bundle-version="[6.1.0,7.0.0)",
org.eclipse.papyrus.infra.architecture.representation;bundle-version="[2.0.0,3.0.0)"
Bundle-Vendor: %Bundle-Vendor
Bundle-ActivationPolicy: lazy
-Bundle-Version: 2.2.100.qualifier
+Bundle-Version: 2.3.0.qualifier
Bundle-Name: %Bundle-Name
Bundle-Activator: org.eclipse.papyrus.infra.nattable.properties.Activator
Bundle-ManifestVersion: 2
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/pom.xml b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/pom.xml
index 0a92136d67b..20a6c9d95fa 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/pom.xml
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/pom.xml
@@ -7,6 +7,6 @@
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.papyrus.infra.nattable.properties</artifactId>
- <version>2.2.100-SNAPSHOT</version>
+ <version>2.3.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project> \ No newline at end of file
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/observable/AbstractRowHeaderAxisConfigurationObservableValue.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/observable/AbstractRowHeaderAxisConfigurationObservableValue.java
index eec5b9bc140..513f25c827f 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/observable/AbstractRowHeaderAxisConfigurationObservableValue.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/observable/AbstractRowHeaderAxisConfigurationObservableValue.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
+ * Copyright (c) 2013, 2018 CEA LIST.
*
*
* All rights reserved. This program and the accompanying materials
@@ -11,6 +11,7 @@
*
* Contributors:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@cea.fr - Bug 516314
*
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.properties.observable;
@@ -68,6 +69,17 @@ public abstract class AbstractRowHeaderAxisConfigurationObservableValue extends
final ICommand cmd = TableCommands.getSetRowHeaderConfigurationValueCommand(getTable(), getManagedFeature(), value);
final TransactionalEditingDomain domain = TableEditingDomainUtils.getTableEditingDomain(getTable());
domain.getCommandStack().execute(new GMFtoEMFCommandWrapper(cmd));
+
+ postDoSetValue();
+ }
+
+ /**
+ * Method allow to do some actions in the concrete class after do set value.
+ *
+ * @since 2.3
+ */
+ protected void postDoSetValue() {
+ // Do nothing in the abstract class
}
}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/observable/RowDisplayLabelHeaderObservableValue.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/observable/RowDisplayLabelHeaderObservableValue.java
index d78d311307d..1520962b68c 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/observable/RowDisplayLabelHeaderObservableValue.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/observable/RowDisplayLabelHeaderObservableValue.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
+ * Copyright (c) 2013, 2018 CEA LIST.
*
*
* All rights reserved. This program and the accompanying materials
@@ -11,14 +11,19 @@
*
* Contributors:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.fr - Bug 516314
*
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.properties.observable;
import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.nebula.widgets.nattable.util.ClientAreaAdapter;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.manager.table.TreeNattableModelManager;
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.NattableaxisconfigurationPackage;
+import org.eclipse.papyrus.infra.nattable.utils.NatTableFocusUtils;
/**
@@ -29,6 +34,9 @@ import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfigurati
*/
public class RowDisplayLabelHeaderObservableValue extends AbstractRowHeaderAxisConfigurationObservableValue {
+ /** The nattable model manager, used to hide/show the Display label of row. */
+ INattableModelManager nattableManager = null;
+
/**
*
* Constructor.
@@ -37,6 +45,7 @@ public class RowDisplayLabelHeaderObservableValue extends AbstractRowHeaderAxisC
*/
public RowDisplayLabelHeaderObservableValue(final Table table) {
super(table, NattableaxisconfigurationPackage.eINSTANCE.getAbstractHeaderAxisConfiguration_DisplayLabel());
+ this.nattableManager = NatTableFocusUtils.getInstance().getCurrentNattableModelManager();
}
/**
@@ -49,4 +58,27 @@ public class RowDisplayLabelHeaderObservableValue extends AbstractRowHeaderAxisC
public Object getValueType() {
return EcorePackage.eINSTANCE.getEBoolean();
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void postDoSetValue() {
+ // If the current nattable manager is a tree one, show/hide the label column according to the Display Label flag
+ if (this.nattableManager instanceof TreeNattableModelManager) {
+
+ final TreeNattableModelManager treeNattableManager = (TreeNattableModelManager) this.nattableManager;
+ final ClientAreaAdapter clientAreaAdapter = new ClientAreaAdapter(treeNattableManager.getRowHeaderLayerStack().getViewportLayer().getClientAreaProvider());
+
+ // If display label is turned on, set width of slider composite to the relevant one to show the label column,
+ // otherwise, set width to 0 to hide it
+ if (treeNattableManager.getTable().getLocalRowHeaderAxisConfiguration().isDisplayLabel()) {
+ clientAreaAdapter.setWidth(treeNattableManager.getWidthOfSliderComposite());
+ } else {
+ clientAreaAdapter.setWidth(0);
+ }
+
+ treeNattableManager.getRowHeaderLayerStack().getViewportLayer().setClientAreaProvider(clientAreaAdapter);
+ }
+ }
}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/META-INF/MANIFEST.MF b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/META-INF/MANIFEST.MF
index d83484b7bdb..98d702ef089 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/META-INF/MANIFEST.MF
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/META-INF/MANIFEST.MF
@@ -74,7 +74,7 @@ Require-Bundle: org.eclipse.gmf.runtime.emf.type.core;bundle-version="[1.9.0,2.0
org.eclipse.papyrus.infra.architecture.representation;bundle-version="[2.0.0,3.0.0)"
Bundle-Vendor: %Bundle-Vendor
Bundle-ActivationPolicy: lazy
-Bundle-Version: 6.0.100.qualifier
+Bundle-Version: 6.1.0.qualifier
Bundle-Name: %Bundle-Name
Bundle-Activator: org.eclipse.papyrus.infra.nattable.Activator
Bundle-ManifestVersion: 2
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/pom.xml b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/pom.xml
index ccb16d47e67..df9bfafd409 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/pom.xml
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/pom.xml
@@ -8,6 +8,6 @@
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.papyrus.infra.nattable</artifactId>
- <version>6.0.100-SNAPSHOT</version>
+ <version>6.1.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project> \ No newline at end of file
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDisplayLabelHeaderHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDisplayLabelHeaderHandler.java
index 12d945c36c5..18ce9dfdca7 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDisplayLabelHeaderHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDisplayLabelHeaderHandler.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
+ * Copyright (c) 2013, 2018 CEA LIST.
*
*
* All rights reserved. This program and the accompanying materials
@@ -11,11 +11,16 @@
*
* Contributors:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 519381
*
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.handler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.nebula.widgets.nattable.util.ClientAreaAdapter;
+import org.eclipse.papyrus.infra.nattable.manager.table.TreeNattableModelManager;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.NattableaxisconfigurationPackage;
/**
@@ -36,4 +41,33 @@ public class RowDisplayLabelHeaderHandler extends AbstractRowChangeHeaderConfigu
protected EStructuralFeature getEditedFeature() {
return NattableaxisconfigurationPackage.eINSTANCE.getAbstractHeaderAxisConfiguration_DisplayLabel();
}
+
+ /**
+ * <pre>
+ * {@inheritDoc}
+ *
+ * Overridden to hide/unhide the row label column in the row header of tree table.
+ * </pre>
+ */
+ @Override
+ public Object execute(final ExecutionEvent event) throws ExecutionException {
+ super.execute(event);
+
+ if (getCurrentNattableModelManager() instanceof TreeNattableModelManager) {
+ TreeNattableModelManager treeNattableManager = (TreeNattableModelManager) getCurrentNattableModelManager();
+ ClientAreaAdapter clientAreaAdapter = new ClientAreaAdapter(treeNattableManager.getRowHeaderLayerStack().getViewportLayer().getClientAreaProvider());
+
+ // If display label is turned on, set width of slider composite to the relevant one to show the label column,
+ // otherwise, set width to 0 to hide it
+ if (treeNattableManager.getTable().getLocalRowHeaderAxisConfiguration().isDisplayLabel()) {
+ clientAreaAdapter.setWidth(treeNattableManager.getWidthOfSliderComposite());
+ } else {
+ clientAreaAdapter.setWidth(0);
+ }
+
+ treeNattableManager.getRowHeaderLayerStack().getViewportLayer().setClientAreaProvider(clientAreaAdapter);
+ }
+
+ return null;
+ }
}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/NattableModelManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/NattableModelManager.java
index cd50320475b..e694bbf1904 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/NattableModelManager.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/NattableModelManager.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2012, 2017 CEA LIST, Esterel Technologies SAS and others.
+ * Copyright (c) 2012, 2017-2018 CEA LIST, Esterel Technologies SAS and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -13,7 +13,7 @@
* Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Bug 476618, 504077, 496905, 508175
* Nicolas Boulay (Esterel Technologies SAS) - Bug 497467
* Sebastien Bordes (Esterel Technologies SAS) - Bug 497738
- * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 459220, 526146, 515737
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 459220, 526146, 515737, 516314
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.manager.table;
@@ -116,6 +116,7 @@ import org.eclipse.papyrus.infra.nattable.utils.AxisUtils;
import org.eclipse.papyrus.infra.nattable.utils.CellMapKey;
import org.eclipse.papyrus.infra.nattable.utils.HeaderAxisConfigurationManagementUtils;
import org.eclipse.papyrus.infra.nattable.utils.NamedStyleConstants;
+import org.eclipse.papyrus.infra.nattable.utils.NatTableFocusUtils;
import org.eclipse.papyrus.infra.nattable.utils.NattableConfigAttributes;
import org.eclipse.papyrus.infra.nattable.utils.StringComparator;
import org.eclipse.papyrus.infra.nattable.utils.StyleUtils;
@@ -263,7 +264,7 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
}
/**
- *
+ *
* Constructor.
*
* @param rawModel
@@ -288,7 +289,7 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
// If needed, initialize the invert axis listener and the update of cells map.
// Other listeners can stay used in all cases.
- // For example: The table reference for properties view, these listeners are not needed and can caught exception
+ // For example: The table reference for properties view, these listeners are not needed and can caught exception
if (initializeListeners) {
this.invertAxisListener = createInvertAxisListener();
@@ -463,10 +464,10 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
*/
protected List<Object> createVerticalElementList() {
// return Collections.synchronizedList(new ArrayList<Object>());
- this.basicVerticalList = GlazedLists.eventList(new ArrayList<Object>());
+ this.basicVerticalList = GlazedLists.eventList(new ArrayList<>());
// it required than vertical element is a filter list -> warning to invert axis?
- this.columnSortedList = new SortedList<Object>(this.basicVerticalList, null);
- this.verticalFilterList = new FilterList<Object>(this.columnSortedList);
+ this.columnSortedList = new SortedList<>(this.basicVerticalList, null);
+ this.verticalFilterList = new FilterList<>(this.columnSortedList);
return this.verticalFilterList;
}
@@ -477,9 +478,9 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
*/
protected List<Object> createHorizontalElementList() {
// return Collections.synchronizedList(new ArrayList<Object>());
- this.basicHorizontalList = GlazedLists.eventList(new ArrayList<Object>());
- this.rowSortedList = new SortedList<Object>(this.basicHorizontalList, null);
- final FilterList<Object> filteredList = new FilterList<Object>(this.rowSortedList);
+ this.basicHorizontalList = GlazedLists.eventList(new ArrayList<>());
+ this.rowSortedList = new SortedList<>(this.basicHorizontalList, null);
+ final FilterList<Object> filteredList = new FilterList<>(this.rowSortedList);
this.horizontalFilterList = filteredList;
return this.horizontalFilterList;
}
@@ -581,6 +582,7 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
@Override
public void focusGained(final FocusEvent e) {
updateToggleActionState();
+ NatTableFocusUtils.getInstance().setCurrentNattableModelManager(this);
}
@@ -792,7 +794,7 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
this.horizontalFilterList = newHorizontalFilterList;
this.verticalFilterList = newVerticalFilterLilst;
-
+
this.rowSortedList = newHorizontalSortedList;
this.columnSortedList = newVerticalSortedList;
@@ -868,7 +870,7 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
*/
protected ICompositeAxisManager createAxisManager(final List<AxisManagerRepresentation> representations, final AbstractAxisProvider contentProvider, final boolean columnAxisManager) {
final ICompositeAxisManager compositeAxisManager = new CompositeAxisManager();
- final List<IAxisManager> managers = new ArrayList<IAxisManager>();
+ final List<IAxisManager> managers = new ArrayList<>();
for (final AxisManagerRepresentation current : representations) {
final IAxisManager manager = AxisManagerFactory.INSTANCE.getAxisManager(current);
Assert.isNotNull(manager);
@@ -1185,8 +1187,8 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
// Keep the selection after the refresh of the table
if (null != selectedCells && !selectedCells.isEmpty()) {
- Collection<Integer> selectedColumns = new ArrayList<Integer>();
- Collection<Integer> selectedRows = new ArrayList<Integer>();
+ Collection<Integer> selectedColumns = new ArrayList<>();
+ Collection<Integer> selectedRows = new ArrayList<>();
// Keep the columns selected before the refresh
if (null != columnPositions && !columnPositions.isEmpty()) {
@@ -1640,16 +1642,16 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
dialog.setInformationDialogValues(Messages.NattableModelManager_DisconnectAxisManagerInformationDialogTitle, dialogQuestion);
dialog.setLabelProvider(labelProvider);
final List<Object> initialSelection = ((CompositeAxisManager) editedAxisManager).getAllManagedAxis(true);
- dialog.setInitialElementSelections(new ArrayList<Object>(initialSelection));
+ dialog.setInitialElementSelections(new ArrayList<>(initialSelection));
final int open = dialog.open();
if (open == Window.OK) {
final Collection<Object> existingColumns = initialSelection;
- final ArrayList<Object> checkedColumns = new ArrayList<Object>();
+ final ArrayList<Object> checkedColumns = new ArrayList<>();
final List<Object> result = Arrays.asList(dialog.getResult());
checkedColumns.addAll(result);
- final ArrayList<Object> columnsToAdd = new ArrayList<Object>(checkedColumns);
+ final ArrayList<Object> columnsToAdd = new ArrayList<>(checkedColumns);
columnsToAdd.removeAll(existingColumns);
final CompoundCommand compoundCommand = new CompoundCommand("Update Existing Axis Command"); //$NON-NLS-1$
if (columnsToAdd.size() > 0) {
@@ -1662,7 +1664,7 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
compoundCommand.append(addAxisElementCommand);
}
- final ArrayList<Object> axisToDestroy = new ArrayList<Object>(existingColumns);
+ final ArrayList<Object> axisToDestroy = new ArrayList<>(existingColumns);
axisToDestroy.removeAll(checkedColumns);
if (axisToDestroy.size() > 0) {
Command destroyAxisElementCommand = null;
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 dbd5e6dc096..1b8f9629640 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
@@ -222,15 +222,15 @@ public class TreeNattableModelManager extends NattableModelManager implements IT
@Override
protected List<Object> createHorizontalElementList() {
// super.createHorizontalElementList();
- EventList<Object> eventList = GlazedLists.eventList(new ArrayList<Object>());
+ EventList<Object> eventList = GlazedLists.eventList(new ArrayList<>());
eventList = GlazedLists.threadSafeList(eventList);
this.basicHorizontalList = eventList;
// must be created before the row sort model
- this.rowSortedList = new SortedList<Object>(this.basicHorizontalList, null);
+ this.rowSortedList = new SortedList<>(this.basicHorizontalList, null);
treeFormat = new DatumTreeFormat(getRowSortModel());
this.expansionModel = new DatumExpansionModel();
- this.horizontalFilterList = new FilterList<Object>(this.rowSortedList);
+ this.horizontalFilterList = new FilterList<>(this.rowSortedList);
this.treeList = new TreeList(this.horizontalFilterList, treeFormat, expansionModel);
return this.treeList;
@@ -347,8 +347,20 @@ public class TreeNattableModelManager extends NattableModelManager implements IT
*
* @return The int value corresponding to the needed row header width.
* @since 2.0
+ * @deprecated since 6.1. Function {@link #getWidthOfSliderComposite()} must be used instead.
*/
+ @Deprecated
protected int getWidthSliderComposite() {
+ return getWidthOfSliderComposite();
+ }
+
+ /**
+ * Get the width of the slider composite.
+ *
+ * @return The int value corresponding to the needed row header width.
+ * @since 6.1
+ */
+ public int getWidthOfSliderComposite() {
int result = 0;
final IntValueStyle valueRowHeader = (IntValueStyle) getTable().getNamedStyle(NattablestylePackage.eINSTANCE.getIntValueStyle(), NamedStyleConstants.ROW_HEADER_WIDTH);
@@ -570,9 +582,9 @@ public class TreeNattableModelManager extends NattableModelManager implements IT
}
}
-
+
/**
- *
+ *
* @param representations
* @param contentProvider
* @param columnAxisManager
@@ -582,7 +594,7 @@ public class TreeNattableModelManager extends NattableModelManager implements IT
*/
protected ICompositeAxisManager createTreeAxisManager(List<AxisManagerRepresentation> representations, AbstractAxisProvider contentProvider, boolean columnAxisManager) {
CompositeTreeAxisManagerForEventList compositeAxisManager = new CompositeTreeAxisManagerForEventList(horizontalFilterList);
- final List<IAxisManagerForEventList> managers = new ArrayList<IAxisManagerForEventList>();
+ final List<IAxisManagerForEventList> managers = new ArrayList<>();
for (AxisManagerRepresentation current : representations) {
final IAxisManager manager = AxisManagerFactory.INSTANCE.getAxisManager(current);
Assert.isTrue(manager instanceof IAxisManagerForEventList);
@@ -617,7 +629,7 @@ public class TreeNattableModelManager extends NattableModelManager implements IT
public int getTreeItemDepth(final ITreeItemAxis axis) {
Format<ITreeItemAxis> format = getTreeFormat();
if (format != null) {
- List<ITreeItemAxis> path = new ArrayList<ITreeItemAxis>();
+ List<ITreeItemAxis> path = new ArrayList<>();
format.getPath(path, axis);
return path.size() - 1;
}
@@ -708,7 +720,7 @@ public class TreeNattableModelManager extends NattableModelManager implements IT
if (depthToShow != null && depthToShow.size() > 0) {
- List<Integer> indexToShow = new ArrayList<Integer>();
+ List<Integer> indexToShow = new ArrayList<>();
for (int i = 0; i < depthToShow.size(); i++) {
Integer curr = depthToShow.get(i);
int tmp = -1;
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/NatTableFocusUtils.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/NatTableFocusUtils.java
new file mode 100644
index 00000000000..9d7b825cdb5
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/NatTableFocusUtils.java
@@ -0,0 +1,67 @@
+/*****************************************************************************
+ * Copyright (c) 2018 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.utils;
+
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+
+/**
+ * This class update the current focused nattable model manager in the application.
+ *
+ * @since 6.1
+ */
+public class NatTableFocusUtils {
+
+ /** The current focused Nattable Model Manager actually focused. */
+ private INattableModelManager nattableManager;
+
+ /** The singleton instance. */
+ private static NatTableFocusUtils instance;
+
+ /**
+ * Private constructor.
+ */
+ private NatTableFocusUtils() {
+ // Do nothing
+ }
+
+ /**
+ * @return The singleton instance
+ */
+ public static NatTableFocusUtils getInstance() {
+ if (null == instance) {
+ instance = new NatTableFocusUtils();
+ }
+ return instance;
+ }
+
+ /**
+ * This allows to set the current Nattable Model Manager.
+ *
+ * @param manager
+ * The current focused Nattable Model Manager
+ */
+ public void setCurrentNattableModelManager(final INattableModelManager manager) {
+ this.nattableManager = manager;
+ }
+
+ /**
+ * @return The current focused Nattable Model Manager
+ */
+ public INattableModelManager getCurrentNattableModelManager() {
+ return this.nattableManager;
+ }
+}

Back to the top