Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPauline DEVILLE2019-09-27 13:56:35 +0000
committervincent lorenzo2019-10-11 06:42:19 +0000
commitfd83dacf8ddc7ec274beb4c75833861cb8b7dd25 (patch)
tree667f22e5cbd4a19ee62428aca721f71f2d677deb /plugins/infra
parent14d6cfe11a63baf87d420ef1a0f35eda84269285 (diff)
downloadorg.eclipse.papyrus-fd83dacf8ddc7ec274beb4c75833861cb8b7dd25.tar.gz
org.eclipse.papyrus-fd83dacf8ddc7ec274beb4c75833861cb8b7dd25.tar.xz
org.eclipse.papyrus-fd83dacf8ddc7ec274beb4c75833861cb8b7dd25.zip
Bug 551566 - [Table] Can not create new table without getting the switch
viewpoint dialog Change-Id: Ifbfabd944fe67b06bbcc8a8a86bed947d64f2a6a Signed-off-by: Pauline DEVILLE <pauline.deville@cea.fr>
Diffstat (limited to 'plugins/infra')
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/META-INF/MANIFEST.MF2
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/pom.xml2
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/handlers/AbstractCreateNattableEditorHandler.java84
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/handlers/PolicyDefinedTableHandler.java6
-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/utils/TableHelper.java88
7 files changed, 144 insertions, 42 deletions
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/META-INF/MANIFEST.MF b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/META-INF/MANIFEST.MF
index a364cce8d08..61118ee7d5c 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/META-INF/MANIFEST.MF
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/META-INF/MANIFEST.MF
@@ -26,7 +26,7 @@ Require-Bundle: org.eclipse.papyrus.infra.nattable;bundle-version="[6.0.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: 5.3.0.qualifier
+Bundle-Version: 5.4.0.qualifier
Bundle-Name: %Bundle-Name
Bundle-Activator: org.eclipse.papyrus.infra.nattable.common.Activator
Bundle-ManifestVersion: 2
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/pom.xml b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/pom.xml
index f867f9080d9..a3029fa8fb3 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/pom.xml
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/pom.xml
@@ -8,6 +8,6 @@
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.papyrus.infra.nattable.common</artifactId>
- <version>5.3.0-SNAPSHOT</version>
+ <version>5.4.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/handlers/AbstractCreateNattableEditorHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/handlers/AbstractCreateNattableEditorHandler.java
index 44561a934af..79eedcf6a9f 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/handlers/AbstractCreateNattableEditorHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/handlers/AbstractCreateNattableEditorHandler.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011, 2016 LIFL, CEA LIST, Christian W. Damus, and others.
+ * Copyright (c) 2011, 2016, 2019 LIFL, CEA LIST, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -12,7 +12,8 @@
* Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation
* Juan Cadavid (CEA-LIST) juan.cadavid@cea.fr - Overloading execution to support creation of multiple tables with an incremental name
* Christian W. Damus - bug 485220
- *
+ * Pauline DEVILLE (CEA LIST) pauline.deville@cea.fr - Bug 551566
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.common.handlers;
@@ -161,8 +162,15 @@ public abstract class AbstractCreateNattableEditorHandler extends AbstractHandle
* Do the execution of the command.
*
* @param serviceRegistry
+ * the service registry
+ * @param name
+ * the name for the table
+ * @param description
+ * the description for the table
* @throws ServiceException
* @throws NotFoundException
+ *
+ * @Deprecated since 5.4.0
*/
public Table doExecute(final ServicesRegistry serviceRegistry, String name, String description) throws ServiceException, NotFoundException {
final Table editorModel = createEditorModel(serviceRegistry, name, description);
@@ -174,14 +182,49 @@ public abstract class AbstractCreateNattableEditorHandler extends AbstractHandle
}
/**
+ * Do the execution of the command.
+ *
+ * @param serviceRegistry
+ * the service registry
+ * @param name
+ * the name for the table
+ * @param description
+ * the description for the table
+ * @param tableKindId
+ * the table kind id
+ * @throws ServiceException
+ * @throws NotFoundException
+ *
+ * @since 5.4.0
+ */
+ public Table doExecute(final ServicesRegistry serviceRegistry, String name, String description, String tableKindId) throws ServiceException, NotFoundException {
+ final Table editorModel = createEditorModel(serviceRegistry, name, description, tableKindId);
+ // Get the mngr allowing to add/open new editor.
+ final IPageManager pageMngr = ServiceUtils.getInstance().getService(IPageManager.class, serviceRegistry);
+ // add the new editor model to the sash.
+ pageMngr.openPage(editorModel);
+ return editorModel;
+ }
+
+ /**
* Create a model identifying the editor. This model will be saved with the
* sash
*
- * @return
+ * @param serviceRegistry
+ * the service registry
+ * @param name
+ * the name for the table
+ * @param description
+ * the description for the table
+ * @return the created table
+ *
* @throws ServiceException
* @throws NotFoundException
* The model where to save the TableInstance is not found.
+ *
+ * @deprecated since 5.4.0
*/
+ @Deprecated
protected Table createEditorModel(final ServicesRegistry serviceRegistry, String name, String description) throws ServiceException, NotFoundException {
final TableConfiguration configuration = getTableEditorConfiguration();
Assert.isNotNull(configuration);
@@ -195,6 +238,37 @@ public abstract class AbstractCreateNattableEditorHandler extends AbstractHandle
return table;
}
+ /**
+ * Create a model identifying the editor. This model will be saved with the
+ * sash
+ *
+ * @param serviceRegistry
+ * the service registry
+ * @param name
+ * the name for the table
+ * @param description
+ * the description for the table
+ * @return the created table
+ *
+ * @throws ServiceException
+ * @throws NotFoundException
+ * The model where to save the TableInstance is not found.
+ *
+ * @since 5.4.0
+ */
+ protected Table createEditorModel(final ServicesRegistry serviceRegistry, String name, String description, String tableKindId) throws ServiceException, NotFoundException {
+ final TableConfiguration configuration = getTableEditorConfiguration();
+ Assert.isNotNull(configuration);
+
+ final Table table = TableHelper.createTable(configuration, null, name, description, tableKindId); // context null here, see bug 410357
+ // Save the model in the associated resource
+ final ModelSet modelSet = ServiceUtils.getInstance().getModelSet(serviceRegistry);
+ final PapyrusNattableModel model = (PapyrusNattableModel) modelSet.getModelChecked(PapyrusNattableModel.MODEL_ID);
+ table.setContext(getTableContext());
+ model.addPapyrusTable(table);
+ return table;
+ }
+
/**
* @since 3.0
@@ -205,7 +279,7 @@ public abstract class AbstractCreateNattableEditorHandler extends AbstractHandle
* Returns the context used to create the table
*
* @return
- * the context used to create the table or <code>null</code> if not found
+ * the context used to create the table or <code>null</code> if not found
* @throws ServiceException
*/
protected EObject getTableContext() {
@@ -222,7 +296,7 @@ public abstract class AbstractCreateNattableEditorHandler extends AbstractHandle
* @return
*/
protected List<EObject> getSelection() {
- final List<EObject> selectedElements = new ArrayList<EObject>();
+ final List<EObject> selectedElements = new ArrayList<>();
final IWorkbenchWindow ww = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (ww != null) {
final ISelection selection = ww.getSelectionService().getSelection();
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/handlers/PolicyDefinedTableHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/handlers/PolicyDefinedTableHandler.java
index 848b0719410..fc52037e3fb 100755
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/handlers/PolicyDefinedTableHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/handlers/PolicyDefinedTableHandler.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
+ * Copyright (c) 2013, 2019 CEA LIST.
*
*
* All rights reserved. This program and the accompanying materials
@@ -11,6 +11,7 @@
*
* Contributors:
* Laurent Wouters laurent.wouters@cea.fr - Initial API and implementation
+ * Pauline DEVILLE (CEA LIST) pauline.deville@cea.fr - Bug 551566
*
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.common.handlers;
@@ -69,10 +70,9 @@ public class PolicyDefinedTableHandler extends CreateNatTableEditorHandler {
@Override
protected void doExecute() {
try {
- Table table = PolicyDefinedTableHandler.this.doExecute(serviceRegistry, name, this.description);
+ Table table = PolicyDefinedTableHandler.this.doExecute(serviceRegistry, name, this.description, prototype.getRepresentationKind().getId());
TableVersioningUtils.stampCurrentVersion(table);
table.setOwner(context);
- table.setTableKindId(prototype.getRepresentationKind().getId());
} catch (Exception ex) {
Activator.log.error(ex);
}
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 aad4fcb34aa..4fa46aa1aab 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
@@ -76,7 +76,7 @@ Require-Bundle: org.eclipse.gmf.runtime.emf.type.core;bundle-version="[1.9.0,2.0
javax.inject;bundle-version="[1.0.0,2.0.0)"
Bundle-Vendor: %Bundle-Vendor
Bundle-ActivationPolicy: lazy
-Bundle-Version: 6.4.0.qualifier
+Bundle-Version: 6.5.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 7f8b5bf318b..2dca78fa70c 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/pom.xml
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/pom.xml
@@ -9,6 +9,6 @@
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.papyrus.infra.nattable</artifactId>
- <version>6.4.0-SNAPSHOT</version>
+ <version>6.5.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/TableHelper.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/TableHelper.java
index 63be739a850..03483c83a4f 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/TableHelper.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/utils/TableHelper.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2013, 2016, 2018 CEA LIST, Esterel Technologies SAS and others.
+ * Copyright (c) 2013, 2016, 2018, 2019 CEA LIST, Esterel Technologies SAS and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -13,6 +13,8 @@
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
* Calin Glitia (Esterel Technologies SAS) - Bug 497654
* Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Bug 535935
+ * Pauline DEVILLE (CEA LIST) pauline.deville@cea.fr - Bug 551566
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.utils;
@@ -53,7 +55,7 @@ public class TableHelper {
* @param configuration
* the configuration used to create the table
* @return
- * the table created from this configuration
+ * the table created from this configuration
*/
public static final Table createTable(final TableConfiguration configuration) {
return createTable(configuration, null);
@@ -62,11 +64,11 @@ public class TableHelper {
/**
*
* @param configuration
- * the configuration used to create the table, cannot be <code>null</code>
+ * the configuration used to create the table, cannot be <code>null</code>
* @param context
* the context of the table
* @return
- * the table created from these parameters
+ * the table created from these parameters
*/
public static final Table createTable(final TableConfiguration configuration, final EObject context) {
return createTable(configuration, context, null);
@@ -81,7 +83,7 @@ public class TableHelper {
* @param name
* the name for the table
* @return
- * the table created from these parameters
+ * the table created from these parameters
*/
public static final Table createTable(final TableConfiguration configuration, final EObject context, final String name) {
return createTable(configuration, context, name, null);
@@ -98,9 +100,32 @@ public class TableHelper {
* @param description
* the description for the table
* @return
- * the table created from these parameters
+ * the table created from these parameters
+ *
+ * @deprecated since 6.5.0
*/
+ @Deprecated
public static final Table createTable(final TableConfiguration configuration, final EObject context, final String name, final String description) {
+ return createTable(configuration, context, name, description, null);
+ }
+
+ /**
+ *
+ * @param configuration
+ * the configuration used to create the table, cannot be <code>null</code>
+ * @param context
+ * the context of the table
+ * @param name
+ * the name for the table
+ * @param description
+ * the description for the table
+ * @param tableKindId
+ * the table kind id
+ *
+ * @return
+ * the table created from these parameters
+ */
+ public static final Table createTable(final TableConfiguration configuration, final EObject context, final String name, final String description, String tableKindId) {
Assert.isNotNull(configuration);
Table table = NattableFactory.eINSTANCE.createTable();
@@ -108,6 +133,7 @@ public class TableHelper {
table.setDescription(description);
table.setName(name);
table.setContext(context);
+ table.setTableKindId(tableKindId);
// the configuration always provides axis provider
AbstractAxisProvider rowProvider = configuration.getDefaultRowAxisProvider();
@@ -127,20 +153,20 @@ public class TableHelper {
IntListValueStyle copy = EcoreUtil.copy(style);
table.getStyles().add(copy);
}
-
-
- if(isMatrixTreeTable(table)) {
- if(null!=configuration.getOwnedCellEditorConfigurations()) {
+
+
+ if (isMatrixTreeTable(table)) {
+ if (null != configuration.getOwnedCellEditorConfigurations()) {
table.setOwnedCellEditorConfigurations(EcoreUtil.copy(configuration.getOwnedCellEditorConfigurations()));
- }else {
- //we can do it because currently, we only have one possible type for that!
+ } else {
+ // we can do it because currently, we only have one possible type for that!
GenericRelationshipMatrixCellEditorConfiguration conf = NattablecelleditorFactory.eINSTANCE.createGenericRelationshipMatrixCellEditorConfiguration();
conf.setCellEditorId("GenericRelationshipMatrixEditorConfiguration"); //$NON-NLS-1$
table.setOwnedCellEditorConfigurations(conf);
}
Assert.isNotNull(table.getOwnedCellEditorConfigurations(), "A matrix must own a CellEditorConfiguration"); //$NON-NLS-1$
}
-
+
return table;
}
@@ -149,7 +175,7 @@ public class TableHelper {
* @param table
* a table
* @return
- * the display style to use for the table, the return value is never <code>null</code>
+ * the display style to use for the table, the return value is never <code>null</code>
*/
public static final DisplayStyle getTableDisplayStyle(final Table table) {
DisplayStyle result = DisplayStyle.NORMAL;
@@ -171,7 +197,7 @@ public class TableHelper {
* @param table
* a table manager
* @return
- * the display style to use for the managed table, the return value is never <code>null</code>
+ * the display style to use for the managed table, the return value is never <code>null</code>
*/
public static final DisplayStyle getTableDisplayStyle(final INattableModelManager tableManager) {
return tableManager != null ? getTableDisplayStyle(tableManager.getTable()) : null;
@@ -185,7 +211,7 @@ public class TableHelper {
* <code>true</code> if the managed table is a tree table
*/
public static final boolean isTreeTable(final INattableModelManager tableManager) {
- return tableManager != null ? isTreeTable(tableManager.getTable()) : false;
+ return tableManager != null ? isTreeTable(tableManager.getTable()) : false;
}
/**
@@ -206,11 +232,12 @@ public class TableHelper {
}
return false;
}
-
+
/**
* This allows to check if this is a tree table.
- *
- * @param tableConfiguration The table configuration.
+ *
+ * @param tableConfiguration
+ * The table configuration.
* @return <code>true</code> if this is a tree table, <code>false</code> otherwise.
*/
public static final boolean isTreeTable(final TableConfiguration tableConfiguration) {
@@ -224,8 +251,9 @@ public class TableHelper {
/**
* This allows to check if the tree table contains a single column for the row header.
- *
- * @param tableConfiguration The table configuration.
+ *
+ * @param tableConfiguration
+ * The table configuration.
* @return <code>true</code> if this is a single column, <code>false</code> otherwise.
*/
public static final boolean isSingleColumnTreeTable(final TableConfiguration tableConfiguration) {
@@ -320,11 +348,11 @@ public class TableHelper {
}
/**
- *
+ *
* @param tableManager
* a table manager
* @return
- * the way to use to declare cell editor for the current table manager, according to invert axis property
+ * the way to use to declare cell editor for the current table manager, according to invert axis property
*/
public static final CellEditorDeclaration getCellEditorDeclaration(final INattableModelManager tableManager) {
return tableManager != null ? getCellEditorDeclaration(tableManager.getTable()) : null;
@@ -332,11 +360,11 @@ public class TableHelper {
/**
- *
+ *
* @param tableManager
* a table manager
* @return
- * the way to use to declare cell editor for the current table, according to invert axis property
+ * the way to use to declare cell editor for the current table, according to invert axis property
*/
public static final CellEditorDeclaration getCellEditorDeclaration(final Table table) {
CellEditorDeclaration declaration = table.getTableConfiguration().getCellEditorDeclaration();
@@ -352,7 +380,7 @@ public class TableHelper {
}
return declaration;
}
-
+
/**
*
@@ -369,13 +397,13 @@ public class TableHelper {
parent = parent.getParent();
}
}
-
+
/**
- *
+ *
* @param table
- * a table
+ * a table
* @return
- * <code>true</code> if the table is a matrix. That is to say
+ * <code>true</code> if the table is a matrix. That is to say
* @since 3.0
*/
public static final boolean isMatrixTreeTable(final Table table) {

Back to the top