Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvlorenzo2013-05-23 05:43:25 -0400
committervlorenzo2013-05-23 05:43:25 -0400
commit6b85be6368b97c9316051068fd0bd7078733ff5e (patch)
treebb024f389258a266091e69d7a918f537c3035dfe /sandbox
parent1e353a3e3b9c04d596a841dfc069ace405092c08 (diff)
downloadorg.eclipse.papyrus-6b85be6368b97c9316051068fd0bd7078733ff5e.tar.gz
org.eclipse.papyrus-6b85be6368b97c9316051068fd0bd7078733ff5e.tar.xz
org.eclipse.papyrus-6b85be6368b97c9316051068fd0bd7078733ff5e.zip
408585: [Table 2] Multiline visualization and Edition
https://bugs.eclipse.org/bugs/show_bug.cgi?id=408585
Diffstat (limited to 'sandbox')
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable/icons/auto_resize_column.pngbin0 -> 3128 bytes
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable/icons/auto_resize_row.pngbin0 -> 378 bytes
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable/plugin.xml20
-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
10 files changed, 132 insertions, 10 deletions
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/icons/auto_resize_column.png b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/icons/auto_resize_column.png
new file mode 100644
index 00000000000..2b2dafef7aa
--- /dev/null
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/icons/auto_resize_column.png
Binary files differ
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/icons/auto_resize_row.png b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/icons/auto_resize_row.png
new file mode 100644
index 00000000000..6966e72844b
--- /dev/null
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/icons/auto_resize_row.png
Binary files differ
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/plugin.xml b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/plugin.xml
index fb4b375b930..31cb9fe6ec1 100644
--- a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/plugin.xml
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable/plugin.xml
@@ -924,6 +924,18 @@
id="org.eclipse.papyrus.infra.nattable.destroy.column.element"
name="Destroy Column Element">
</command>
+ <command
+ categoryId="org.eclipse.papyrus.infra.nattable.rows.command.category"
+ defaultHandler="org.eclipse.papyrus.infra.nattable.handler.RowAutoResizeHandler"
+ id="org.eclipse.papyrus.infra.nattable.autoresize.rows"
+ name="AutoResize Row">
+ </command>
+ <command
+ categoryId="org.eclipse.papyrus.infra.nattable.columns.command.category"
+ defaultHandler="org.eclipse.papyrus.infra.nattable.handler.ColumnAutoResizeHandler"
+ id="org.eclipse.papyrus.infra.nattable.autoresize.columns"
+ name="AutoResize Column">
+ </command>
</extension>
<extension
point="org.eclipse.ui.commandImages">
@@ -951,6 +963,14 @@
commandId="org.eclipse.papyrus.infra.nattable.destroy.column"
icon="icons/remove_column.gif">
</image>
+ <image
+ commandId="org.eclipse.papyrus.infra.nattable.autoresize.columns"
+ icon="icons/auto_resize_column.png">
+ </image>
+ <image
+ commandId="org.eclipse.papyrus.infra.nattable.autoresize.rows"
+ icon="icons/auto_resize_row.png">
+ </image>
</extension>
</plugin>
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