Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamille Letavernier2014-04-03 11:07:33 -0400
committerCamille Letavernier2014-04-03 11:08:48 -0400
commitd4d720ebc554b9f7b46b19d6a4e89ef39b177f9b (patch)
tree963444e2192e1e83969aaf8b0ae09bfd6c30d1db /plugins
parent1e5d27bfc973067af26f416dd32e597946b3e9b2 (diff)
parentb9b9f5702fb0a32ec6688fd746fca16b778e8303 (diff)
downloadorg.eclipse.papyrus-d4d720ebc554b9f7b46b19d6a4e89ef39b177f9b.tar.gz
org.eclipse.papyrus-d4d720ebc554b9f7b46b19d6a4e89ef39b177f9b.tar.xz
org.eclipse.papyrus-d4d720ebc554b9f7b46b19d6a4e89ef39b177f9b.zip
Synchronize with master
Diffstat (limited to 'plugins')
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/handlers/AbstractCreateNattableEditorHandler.java14
1 files changed, 8 insertions, 6 deletions
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 f7f18c4dede..ae4e19e6f0a 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
@@ -21,6 +21,7 @@ import java.util.List;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.util.URI;
@@ -36,6 +37,7 @@ import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.papyrus.infra.core.editor.BackboneException;
import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
import org.eclipse.papyrus.infra.core.resource.NotFoundException;
import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager;
import org.eclipse.papyrus.infra.core.services.ServiceException;
@@ -184,12 +186,13 @@ public abstract class AbstractCreateNattableEditorHandler extends AbstractHandle
* The model where to save the TableInstance is not found.
*/
protected Table createEditorModel(final ServicesRegistry serviceRegistry, String name, String description) throws ServiceException, NotFoundException {
- final TableConfiguration configuration = getDefaultTableEditorConfiguration();
- assert configuration != null;
+ final ModelSet modelSet = ServiceUtils.getInstance().getModelSet(serviceRegistry);
+ final TableConfiguration configuration = getDefaultTableEditorConfiguration(modelSet);
+ Assert.isNotNull(configuration);
final Table table = TableHelper.createTable(configuration, null, name, description); //context null here, see bug 410357
// Save the model in the associated resource
- final PapyrusNattableModel model = (PapyrusNattableModel)ServiceUtils.getInstance().getModelSet(serviceRegistry).getModelChecked(PapyrusNattableModel.MODEL_ID);
+ final PapyrusNattableModel model = (PapyrusNattableModel)modelSet.getModelChecked(PapyrusNattableModel.MODEL_ID);
model.addPapyrusTable(table);
table.setContext(getTableContext());
return table;
@@ -198,12 +201,11 @@ public abstract class AbstractCreateNattableEditorHandler extends AbstractHandle
/**
*
+ * @param resourceSet TODO
* @return
* the configuration to use for the new table
*/
- protected TableConfiguration getDefaultTableEditorConfiguration() {
- final EObject current = getSelection().get(0);
- final ResourceSet resourceSet = current.eResource().getResourceSet();
+ protected TableConfiguration getDefaultTableEditorConfiguration(ResourceSet resourceSet) {
final Resource resource = resourceSet.getResource(getTableEditorConfigurationURI(), true);
TableConfiguration tableConfiguration = null;
if(resource.getContents().get(0) instanceof TableConfiguration) {

Back to the top