Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvlorenzo2011-05-03 09:52:24 +0000
committervlorenzo2011-05-03 09:52:24 +0000
commit6376137f8d672dc629eca7fe0543f9e9c711ad6e (patch)
tree713cd6d786da5a2258624dfa02b44fda296c303f /incoming
parente37b0f2c80f1af9269c53c17d72aedbd110ddae1 (diff)
downloadorg.eclipse.papyrus-6376137f8d672dc629eca7fe0543f9e9c711ad6e.tar.gz
org.eclipse.papyrus-6376137f8d672dc629eca7fe0543f9e9c711ad6e.tar.xz
org.eclipse.papyrus-6376137f8d672dc629eca7fe0543f9e9c711ad6e.zip
NEW - bug 334240: [Enhancement] [TableEditor] Papyrus shall support Tabular Editors
https://bugs.eclipse.org/bugs/show_bug.cgi?id=334240 NEW - bug 337808: [Enhancement] [SysML][Requirement Table] Papyrus shall support Requirements Table https://bugs.eclipse.org/bugs/show_bug.cgi?id=337808
Diffstat (limited to 'incoming')
-rw-r--r--incoming/org.eclipse.papyrus.sysml.table.requirement/src/org/eclipse/papyrus/sysml/table/requirement/CreateRequirementTableCommand.java13
-rw-r--r--incoming/org.eclipse.papyrus.table.common/src/org/eclipse/papyrus/table/common/handlers/AbstractCreateNattableEditorCommand.java42
2 files changed, 55 insertions, 0 deletions
diff --git a/incoming/org.eclipse.papyrus.sysml.table.requirement/src/org/eclipse/papyrus/sysml/table/requirement/CreateRequirementTableCommand.java b/incoming/org.eclipse.papyrus.sysml.table.requirement/src/org/eclipse/papyrus/sysml/table/requirement/CreateRequirementTableCommand.java
index de598740e02..27eec6e6ce6 100644
--- a/incoming/org.eclipse.papyrus.sysml.table.requirement/src/org/eclipse/papyrus/sysml/table/requirement/CreateRequirementTableCommand.java
+++ b/incoming/org.eclipse.papyrus.sysml.table.requirement/src/org/eclipse/papyrus/sysml/table/requirement/CreateRequirementTableCommand.java
@@ -13,11 +13,15 @@
*****************************************************************************/
package org.eclipse.papyrus.sysml.table.requirement;
+import java.util.ArrayList;
+import java.util.List;
+
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.facet.widgets.nattable.internal.Messages;
import org.eclipse.emf.facet.widgets.nattable.tableconfiguration.TableConfiguration;
import org.eclipse.papyrus.sysml.table.requirement.editor.RequirementTableEditor;
import org.eclipse.papyrus.sysml.util.SysmlResource;
@@ -83,4 +87,13 @@ public class CreateRequirementTableCommand extends AbstractCreateNattableEditorC
}
return false;
}
+
+ @Override
+ protected List<String> getHiddenColumnName() {
+ List<String> hiddenColumns = new ArrayList<String>();
+ hiddenColumns.add(Messages.NatTableWidget_metaclass);
+ //TODO should be externalized, currently not externalized in EMF-Facet
+ hiddenColumns.add("/eContainer"); //$NON-NLS-1$
+ return hiddenColumns;
+ }
}
diff --git a/incoming/org.eclipse.papyrus.table.common/src/org/eclipse/papyrus/table/common/handlers/AbstractCreateNattableEditorCommand.java b/incoming/org.eclipse.papyrus.table.common/src/org/eclipse/papyrus/table/common/handlers/AbstractCreateNattableEditorCommand.java
index d38eb21299b..472052878e7 100644
--- a/incoming/org.eclipse.papyrus.table.common/src/org/eclipse/papyrus/table/common/handlers/AbstractCreateNattableEditorCommand.java
+++ b/incoming/org.eclipse.papyrus.table.common/src/org/eclipse/papyrus/table/common/handlers/AbstractCreateNattableEditorCommand.java
@@ -35,7 +35,9 @@ import org.eclipse.emf.facet.infra.query.ModelQuery;
import org.eclipse.emf.facet.infra.query.ModelQuerySet;
import org.eclipse.emf.facet.infra.query.core.ModelQuerySetCatalog;
import org.eclipse.emf.facet.widgets.nattable.NatTableWidgetUtils;
+import org.eclipse.emf.facet.widgets.nattable.instance.tableinstance.Column;
import org.eclipse.emf.facet.widgets.nattable.instance.tableinstance2.TableInstance2;
+import org.eclipse.emf.facet.widgets.nattable.internal.NatTableWidgetInternalUtils;
import org.eclipse.emf.facet.widgets.nattable.tableconfiguration.TableConfiguration;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.emf.workspace.AbstractEMFOperation;
@@ -226,11 +228,51 @@ public abstract class AbstractCreateNattableEditorCommand extends AbstractHandle
Assert.isNotNull(context);
tableInstance.setContext(context);
+ setHiddenColumns(papyrusTable);
setFillingQueries(papyrusTable);
setSynchronization(papyrusTable);
return papyrusTable;
}
+ /**
+ * Allows to hide the columns created by default
+ *
+ * @param papyrusTable
+ */
+ private void setHiddenColumns(final PapyrusTableInstance papyrusTable) {
+ List<String> hiddenColumnsName = getHiddenColumnName();
+ if(!hiddenColumnsName.isEmpty()) {
+ for(Column column : papyrusTable.getTable().getColumns()) {
+ String name = NatTableWidgetInternalUtils.getColumnName(column);
+ if(hiddenColumnsName.contains(name)) {
+ column.setIsHidden(true);
+ }
+ }
+ }
+ }
+
+ /**
+ * Returns the list of the columns to hide. Currently, the name can be :
+ * <ul>
+ * <li>[Label]</li>
+ * <li>[Metaclass]</li>
+ * <li>/eContainer</li>
+ * </ul>
+ *
+ * @return
+ * the list of the columns to hide
+ */
+ protected List<String> getHiddenColumnName() {
+ return Collections.emptyList();
+ }
+
+ /**
+ * Returns the table configura
+ * tion for the table
+ *
+ * @return
+ * the table configuration of the table
+ */
protected TableConfiguration getTableConfiguration(){
return null;
}

Back to the top