Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Lorenzo2014-04-03 10:50:52 -0400
committerVincent Lorenzo2014-04-03 10:50:52 -0400
commita49c61523dfbe82e183f0a0d2cce329a69637657 (patch)
tree5f3b6c99eef5b9750452f9d6337c80fa4fb6e75f /plugins
parentcc50dbf1ba45ce0d4edf4bb54581774654fc8ca3 (diff)
downloadorg.eclipse.papyrus-a49c61523dfbe82e183f0a0d2cce329a69637657.tar.gz
org.eclipse.papyrus-a49c61523dfbe82e183f0a0d2cce329a69637657.tar.xz
org.eclipse.papyrus-a49c61523dfbe82e183f0a0d2cce329a69637657.zip
431918: java.lang.IndexOutOfBoundsException on a sysml model creation with only a table
https://bugs.eclipse.org/bugs/show_bug.cgi?id=431918
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