Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra')
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractTableHandler.java17
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnAutoResizeHandler.java44
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDestroyAxisElementHandler.java4
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDestroyAxisHandler.java4
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowAutoResizeHandler.java45
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDestroyAxisElementHandler.java4
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDestroyAxisHandler.java4
7 files changed, 112 insertions, 10 deletions
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractTableHandler.java b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractTableHandler.java
index ceb98614208..1ab42467f20 100644
--- a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractTableHandler.java
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/AbstractTableHandler.java
@@ -157,7 +157,7 @@ public abstract class AbstractTableHandler extends AbstractHandler {
* @return
* the index of the rows which are fully selected
*/
- protected List<Integer> getFullSelectedRows(Object evaluationContext) {
+ protected List<Integer> getFullSelectedRowsIndex(Object evaluationContext) {
final INattableModelManager manager = getCurrentNattableModelManager();
if(manager != null) {
final NatEventData data = getNatEventData(evaluationContext);
@@ -180,7 +180,7 @@ public abstract class AbstractTableHandler extends AbstractHandler {
* @return
* the index of the columns which are fully selected
*/
- protected List<Integer> getFullSelectedColumns(Object evaluationContext) {
+ protected List<Integer> getFullSelectedColumnsIndex(Object evaluationContext) {
final INattableModelManager manager = getCurrentNattableModelManager();
if(manager != null) {
final NatEventData data = getNatEventData(evaluationContext);
@@ -197,6 +197,7 @@ public abstract class AbstractTableHandler extends AbstractHandler {
return Collections.emptyList();
}
+
/**
*
* @return
@@ -222,4 +223,16 @@ public abstract class AbstractTableHandler extends AbstractHandler {
}
return null;
}
+
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#setEnabled(java.lang.Object)
+ *
+ * @param evaluationContext
+ */
+ @Override
+ public void setEnabled(Object evaluationContext) {
+ this.eventData = getNatEventData(evaluationContext);
+ setBaseEnabled(getCurrentNattableModelManager() != null);
+ }
}
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnAutoResizeHandler.java b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnAutoResizeHandler.java
new file mode 100644
index 00000000000..bb76fed59e0
--- /dev/null
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnAutoResizeHandler.java
@@ -0,0 +1,44 @@
+/*****************************************************************************
+ * 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.nebula.widgets.nattable.NatTable;
+import org.eclipse.nebula.widgets.nattable.resize.command.InitializeAutoResizeColumnsCommand;
+import org.eclipse.nebula.widgets.nattable.util.GCFactory;
+
+/**
+ * Handler to resize columns
+ *
+ * @author VL222926
+ *
+ */
+public class ColumnAutoResizeHandler 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 NatTable natTable = this.eventData.getNatTable();
+ natTable.doCommand(new InitializeAutoResizeColumnsCommand(natTable, this.eventData.getColumnPosition(), natTable.getConfigRegistry(), new GCFactory(natTable)));
+ return null;
+ }
+}
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDestroyAxisElementHandler.java b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDestroyAxisElementHandler.java
index 1adc97fd8c8..db2a5de40cf 100644
--- a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDestroyAxisElementHandler.java
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDestroyAxisElementHandler.java
@@ -39,7 +39,7 @@ public class ColumnDestroyAxisElementHandler extends AbstractTableHandler {
public Object execute(ExecutionEvent event) throws ExecutionException {
final IAxisManager axisManager = getColumnAxisManager();
if(axisManager != null) {
- axisManager.destroyAxisElement(getFullSelectedColumns(this.eventData));
+ axisManager.destroyAxisElement(getFullSelectedColumnsIndex(this.eventData));
}
return null;
}
@@ -55,7 +55,7 @@ public class ColumnDestroyAxisElementHandler extends AbstractTableHandler {
final IAxisManager axisManager = getColumnAxisManager();
if(axisManager != null) {
this.eventData = getNatEventData(evaluationContext);
- final List<Integer> col = getFullSelectedColumns(this.eventData);
+ final List<Integer> col = getFullSelectedColumnsIndex(this.eventData);
setBaseEnabled(axisManager.canDestroyAxisElement(col));
} else {
setBaseEnabled(false);
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDestroyAxisHandler.java b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDestroyAxisHandler.java
index 6dfacbb508e..039e0d90d62 100644
--- a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDestroyAxisHandler.java
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/ColumnDestroyAxisHandler.java
@@ -38,7 +38,7 @@ public class ColumnDestroyAxisHandler extends AbstractTableHandler {
public Object execute(ExecutionEvent event) throws ExecutionException {
final IAxisManager axisManager = getColumnAxisManager();
if(axisManager != null) {
- axisManager.destroyAxis(getFullSelectedColumns(this.eventData));
+ axisManager.destroyAxis(getFullSelectedColumnsIndex(this.eventData));
}
return null;
}
@@ -54,7 +54,7 @@ public class ColumnDestroyAxisHandler extends AbstractTableHandler {
final IAxisManager axisManager = getColumnAxisManager();
if(axisManager != null) {
this.eventData = getNatEventData(evaluationContext);
- final List<Integer> col = getFullSelectedColumns(this.eventData);
+ final List<Integer> col = getFullSelectedColumnsIndex(this.eventData);
setBaseEnabled(axisManager.canDestroyAxis(col));
} else {
setBaseEnabled(false);
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowAutoResizeHandler.java b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowAutoResizeHandler.java
new file mode 100644
index 00000000000..a8410990dbf
--- /dev/null
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowAutoResizeHandler.java
@@ -0,0 +1,45 @@
+/*****************************************************************************
+ * 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.nebula.widgets.nattable.NatTable;
+import org.eclipse.nebula.widgets.nattable.resize.command.InitializeAutoResizeRowsCommand;
+import org.eclipse.nebula.widgets.nattable.util.GCFactory;
+
+/**
+ * Handler used to resize rows
+ *
+ * @author VL222926
+ *
+ */
+public class RowAutoResizeHandler 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 NatTable natTable = this.eventData.getNatTable();
+ natTable.doCommand(new InitializeAutoResizeRowsCommand(natTable, this.eventData.getRowPosition(), natTable.getConfigRegistry(), new GCFactory(natTable)));
+ return null;
+ }
+
+}
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDestroyAxisElementHandler.java b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDestroyAxisElementHandler.java
index 13115404da7..412372eb5c6 100644
--- a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDestroyAxisElementHandler.java
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDestroyAxisElementHandler.java
@@ -39,7 +39,7 @@ public class RowDestroyAxisElementHandler extends AbstractTableHandler {
public Object execute(ExecutionEvent event) throws ExecutionException {
final IAxisManager axisManager = getRowAxisManager();
if(axisManager != null) {
- axisManager.destroyAxisElement(getFullSelectedRows(this.eventData));
+ axisManager.destroyAxisElement(getFullSelectedRowsIndex(this.eventData));
}
return null;
}
@@ -55,7 +55,7 @@ public class RowDestroyAxisElementHandler extends AbstractTableHandler {
final IAxisManager axisManager = getRowAxisManager();
if(axisManager != null) {
this.eventData = getNatEventData(evaluationContext);
- final List<Integer> col = getFullSelectedRows(this.eventData);
+ final List<Integer> col = getFullSelectedRowsIndex(this.eventData);
setBaseEnabled(axisManager.canDestroyAxisElement(col));
} else {
setBaseEnabled(false);
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDestroyAxisHandler.java b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDestroyAxisHandler.java
index 26c1f859eea..d8be0b721ef 100644
--- a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDestroyAxisHandler.java
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/handler/RowDestroyAxisHandler.java
@@ -39,7 +39,7 @@ public class RowDestroyAxisHandler extends AbstractTableHandler {
public Object execute(ExecutionEvent event) throws ExecutionException {
final IAxisManager axisManager = getRowAxisManager();
if(axisManager != null) {
- axisManager.destroyAxis(getFullSelectedRows(this.eventData));
+ axisManager.destroyAxis(getFullSelectedRowsIndex(this.eventData));
}
return null;
}
@@ -55,7 +55,7 @@ public class RowDestroyAxisHandler extends AbstractTableHandler {
final IAxisManager axisManager = getRowAxisManager();
if(axisManager != null) {
this.eventData = getNatEventData(evaluationContext);
- final List<Integer> rows = getFullSelectedRows(this.eventData);
+ final List<Integer> rows = getFullSelectedRowsIndex(this.eventData);
setBaseEnabled(axisManager.canDestroyAxis(rows));
}
super.setBaseEnabled(false);

Back to the top