Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaged Elaasar2017-04-10 12:05:35 +0000
committerGerrit Code Review @ Eclipse.org2017-04-12 08:24:04 +0000
commitf5e001674caf1e7b70b1d03c9c39d4390c04514c (patch)
tree285dab0e37809f7a82827c64cfeb816fcc1f4044 /plugins/infra/nattable
parent41e1c785d4ef6a5f5f9e827d492e86a54af00ed9 (diff)
downloadorg.eclipse.papyrus-f5e001674caf1e7b70b1d03c9c39d4390c04514c.tar.gz
org.eclipse.papyrus-f5e001674caf1e7b70b1d03c9c39d4390c04514c.tar.xz
org.eclipse.papyrus-f5e001674caf1e7b70b1d03c9c39d4390c04514c.zip
Bug 510451 - Two changes: 1) Make architecture viewpoints exchangeable
between private .sash model and the public .di model, 2) Remove PapyrusSyncTable and refactor its usage for PapyrusTable instead Change-Id: Id5e3cfe313572e7a984dc320e868ca6ced2301c4 Signed-off-by: Maged Elaasar <melaasar@gmail.com>
Diffstat (limited to 'plugins/infra/nattable')
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/plugin.xml6
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/api/TableEditorCreationHelper.java40
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/handlers/AbstractCreateNattableEditorHandler.java535
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/handlers/CreateNatTableEditorHandler.java221
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/handlers/CreateNatTableEditorWithoutDialogHandler.java126
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/handlers/CreateNatTableFromCatalogHandler.java17
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/handlers/DynamicTablesMenuContribution.java3
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/handlers/PolicyDefinedTableHandler.java8
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/helper/SyncTableCommandHelper.java130
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/helper/TableViewPrototype.java20
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/wizards/ChooseNattableConfigWizardPage.java20
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation.edit/META-INF/MANIFEST.MF50
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation.edit/icons/full/obj16/PapyrusSyncTable.gifbin304 -> 0 bytes
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation.edit/plugin.properties7
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation.edit/src-gen/org/eclipse/papyrus/infra/nattable/representation/provider/PapyrusSyncTableItemProvider.java118
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation.edit/src-gen/org/eclipse/papyrus/infra/nattable/representation/provider/PapyrusTableItemProvider.java3
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation.edit/src-gen/org/eclipse/papyrus/infra/nattable/representation/provider/RepresentationEditPlugin.java4
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation.edit/src-gen/org/eclipse/papyrus/infra/nattable/representation/provider/RepresentationItemProviderAdapterFactory.java29
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/META-INF/MANIFEST.MF39
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/model/NattableRepresentation.ecore5
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/model/NattableRepresentation.genmodel5
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/PapyrusSyncTable.java29
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/PapyrusTable.java15
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/RepresentationFactory.java9
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/RepresentationPackage.java154
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/impl/PapyrusSyncTableImpl.java50
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/impl/PapyrusTableImpl.java62
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/impl/RepresentationFactoryImpl.java11
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/impl/RepresentationPackageImpl.java38
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/util/RepresentationAdapterFactory.java18
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/util/RepresentationSwitch.java24
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.config/resources/viewpage.nattableconfiguration38
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/nattableconfiguration/NattableConfigurationRegistry.java316
33 files changed, 749 insertions, 1401 deletions
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/plugin.xml b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/plugin.xml
index de1199dbc77..f46e2674c8d 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/plugin.xml
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/plugin.xml
@@ -227,12 +227,6 @@
</helper>
</extension>
<extension
- point="org.eclipse.papyrus.infra.viewpoints.policy.viewType">
- <helper
- class="org.eclipse.papyrus.infra.nattable.common.helper.SyncTableCommandHelper">
- </helper>
-</extension>
-<extension
point="org.eclipse.ui.commands">
<command
categoryId="org.eclipse.papyrus.infra.nattable.category"
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/api/TableEditorCreationHelper.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/api/TableEditorCreationHelper.java
index 2a55b328ec9..548b6c0ca27 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/api/TableEditorCreationHelper.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/api/TableEditorCreationHelper.java
@@ -21,9 +21,7 @@ import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.osgi.util.NLS;
import org.eclipse.papyrus.infra.architecture.representation.PapyrusRepresentationKind;
@@ -40,8 +38,6 @@ import org.eclipse.papyrus.infra.nattable.common.modelresource.PapyrusNattableMo
import org.eclipse.papyrus.infra.nattable.internal.common.commands.CreateAndOpenTableEditorCommand;
import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.TableConfiguration;
-import org.eclipse.papyrus.infra.nattable.nattableconfiguration.NattableConfigurationRegistry;
-import org.eclipse.papyrus.infra.nattable.representation.PapyrusSyncTable;
import org.eclipse.papyrus.infra.nattable.representation.PapyrusTable;
import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype;
@@ -288,17 +284,8 @@ public class TableEditorCreationHelper {
return new Status(IStatus.ERROR, pluginID, ITableEditorStatusCode.TABLE_VIEW_PROTOTYPE_NOT_FOUND, NLS.bind("The View Prototype to create a {0} table has not been found", this.tableType), null); //$NON-NLS-1$
}
- // 7. get the table configuration uri
- URI tableConfigurationURI = getTableConfigurationURI(tableViewPrototype);
- if (tableConfigurationURI == null) {
- return new Status(IStatus.ERROR, pluginID, ITableEditorStatusCode.TABLE_CONFIGURATION_URI_NOT_FOUND, NLS.bind("The uri of the file View Prototype to create a {0} table has not been found", this.tableType), null); //$NON-NLS-1$
- }
-
- // 8. get the nattable configuration
- final Resource resource = modelSet.getResource(tableConfigurationURI, true);
- if (resource.getContents().get(0) instanceof TableConfiguration) {
- this.tableConfiguration = (TableConfiguration) resource.getContents().get(0);
- }
+ // 7. get the nattable configuration
+ this.tableConfiguration = getTableConfiguration(tableViewPrototype);
if (this.tableConfiguration == null) {
return new Status(IStatus.ERROR, pluginID, ITableEditorStatusCode.TABLE_CONFIGURATION_NOT_FOUND, NLS.bind("Table configuration not found for the table type {0}", this.tableType), null); //$NON-NLS-1$
@@ -368,19 +355,13 @@ public class TableEditorCreationHelper {
* @param viewPrototype
* a view {@link TableViewPrototype}, must not be <code>null</code>
* @return
- * the {@link URI} of the nattable configuration, or <code>null</code> if not found
+ * a TableConfiguration, or <code>null</code> if not found
*/
- protected URI getTableConfigurationURI(TableViewPrototype viewPrototype) {
+ protected TableConfiguration getTableConfiguration(TableViewPrototype viewPrototype) {
Assert.isNotNull(viewPrototype);
if (viewPrototype.getRepresentationKind() instanceof PapyrusTable) {
PapyrusTable papyrusTable = (PapyrusTable) viewPrototype.getRepresentationKind();
- String uri = papyrusTable.getConfiguration();
- if (uri != null && uri.length() > 0) {
- return URI.createURI(uri);
- }
- }
- if (viewPrototype.getRepresentationKind() instanceof PapyrusSyncTable) {
- return NattableConfigurationRegistry.INSTANCE.getConfigurationURI(((PapyrusSyncTable) viewPrototype.getRepresentationKind()).getImplementationID());
+ return papyrusTable.getConfiguration();
}
return null;
}
@@ -412,13 +393,12 @@ public class TableEditorCreationHelper {
return prototype;
}
if (implementationID == null || implementationID.isEmpty()) {
- PapyrusRepresentationKind configuration = prototype.getRepresentationKind();
- if (configuration instanceof PapyrusTable) {
+ PapyrusRepresentationKind representationKind = prototype.getRepresentationKind();
+ if (representationKind instanceof PapyrusTable) {
// we need to load the real table configuration to check the type
- PapyrusTable papyrusTable = (PapyrusTable) configuration;
- String configurationURI = papyrusTable.getConfiguration();
- URI uri = NattableConfigurationRegistry.INSTANCE.getConfigurationURI(tableType);
- if (configurationURI.equals(uri.toString())) { // to check ?
+ PapyrusTable papyrusTable = (PapyrusTable) representationKind;
+ TableConfiguration configuration = papyrusTable.getConfiguration();
+ if (configuration.getType().equals(tableType)) { // to check ?
return prototype;
}
}
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 2d2bf3568d2..5102d7aced5 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,278 +1,257 @@
-/*****************************************************************************
- * Copyright (c) 2011, 2016 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 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
- * 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.common.handlers;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-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.emf.common.command.Command;
-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.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.jface.dialogs.InputDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.infra.core.resource.ModelSet;
-import org.eclipse.papyrus.infra.core.resource.NotFoundException;
-import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.papyrus.infra.core.utils.EditorNameInitializer;
-import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
-import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
-import org.eclipse.papyrus.infra.nattable.Activator;
-import org.eclipse.papyrus.infra.nattable.common.modelresource.PapyrusNattableModel;
-import org.eclipse.papyrus.infra.nattable.messages.Messages;
-import org.eclipse.papyrus.infra.nattable.model.nattable.NattablePackage;
-import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.NattableconfigurationPackage;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.TableConfiguration;
-import org.eclipse.papyrus.infra.nattable.utils.TableHelper;
-import org.eclipse.papyrus.infra.ui.util.ServiceUtilsForHandlers;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-
-/**
- *
- *
- */
-public abstract class AbstractCreateNattableEditorHandler extends AbstractHandler {
-
-
-
-
- /**
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- *
- * @param event
- * @return
- * @throws ExecutionException
- */
- @Override
- public Object execute(final ExecutionEvent event) throws ExecutionException {
- try {
- runAsTransaction(event);
- } catch (final ServiceException e) {
- throw new ExecutionException("Can't create TableEditor", e); //$NON-NLS-1$
- }
- return null;
- }
-
- /**
- * Prompts the user the future table's name
- *
- * @return The name, or <code>null</code> if the user cancelled the creation
- */
- public String askName() {
- // we create a new resourceSet to avoid to load unused config in the resourceset in case of Cancel
- ResourceSet set = new ResourceSetImpl();
- Resource res = set.getResource(getTableEditorConfigurationURI(), true);
- TableConfiguration conf = (TableConfiguration) res.getContents().get(0);
- String defaultName = conf.getName();
- // default Value
- final String nameWithIncrement = EditorNameInitializer.getNameWithIncrement(NattablePackage.eINSTANCE.getTable(), NattableconfigurationPackage.eINSTANCE.getTableNamedElement_Name(), defaultName, getTableContext());
- final InputDialog dialog = new InputDialog(Display.getDefault().getActiveShell(), Messages.AbstractCreateNattableEditorHandler_PapyrusTableCreation, Messages.AbstractCreateNattableEditorHandler_EnterTheNameForTheNewTable, nameWithIncrement, null);
- if (dialog.open() == Window.OK) {
- return dialog.getValue();
- }
- return null;
- }
-
- /**
- * Run the command as a transaction. Create a Transaction and delegate the
- * command to {@link #doExecute(ServicesRegistry)}.
- *
- * @throws ServiceException
- *
- */
- public void runAsTransaction(final ExecutionEvent event) throws ServiceException {
- String name = askName();
- if (name != null) {
- runAsTransaction(event, name);
- }
- }
-
- /**
- * Create the table creation command and execute it. Unlike {@link this#runAsTransaction(ExecutionEvent)}, this method doesn't display a dialog to
- * ask for the name but rather takes it as a parameter.
- *
- * @param event
- * @param name
- * @throws ServiceException
- */
- public void runAsTransaction(final ExecutionEvent event, final String name) throws ServiceException {
- final ServicesRegistry serviceRegistry = ServiceUtilsForHandlers.getInstance().getServiceRegistry(event);
- final TransactionalEditingDomain domain = ServiceUtils.getInstance().getTransactionalEditingDomain(serviceRegistry);
- domain.getCommandStack().execute(new RecordingCommand(domain) {
-
- @Override
- protected void doExecute() {
- try {
- AbstractCreateNattableEditorHandler.this.doExecute(serviceRegistry, name, this.description);
- } catch (final NotFoundException e) {
- Activator.log.error(e);
- } catch (final ServiceException e) {
- Activator.log.error(e);
- }
-
- }
- });
- }
-
- public Command getCreateNattableEditorCommandWithNameInitialization(final TransactionalEditingDomain domain, final ServicesRegistry serviceRegistry, final ExecutionEvent event, final String name) throws ServiceException {
- return new RecordingCommand(domain) {
-
- @Override
- protected void doExecute() {
- try {
- AbstractCreateNattableEditorHandler.this.doExecute(serviceRegistry, name, this.description);
- } catch (final NotFoundException e) {
- Activator.log.error(e);
- } catch (final ServiceException e) {
- Activator.log.error(e);
- }
-
- }
- };
-
- }
-
- /**
- * Do the execution of the command.
- *
- * @param serviceRegistry
- * @throws ServiceException
- * @throws NotFoundException
- */
- public Table doExecute(final ServicesRegistry serviceRegistry, String name, String description) throws ServiceException, NotFoundException {
- final Table editorModel = createEditorModel(serviceRegistry, name, description);
- // 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
- * @throws ServiceException
- * @throws NotFoundException
- * The model where to save the TableInstance is not found.
- */
- protected Table createEditorModel(final ServicesRegistry serviceRegistry, String name, String description) throws ServiceException, NotFoundException {
- 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) modelSet.getModelChecked(PapyrusNattableModel.MODEL_ID);
- table.setContext(getTableContext());
- model.addPapyrusTable(table);
- return table;
- }
-
-
- /**
- *
- * @param resourceSet
- * TODO
- * @return
- * the configuration to use for the new table
- */
- protected TableConfiguration getDefaultTableEditorConfiguration(ResourceSet resourceSet) {
- final Resource resource = resourceSet.getResource(getTableEditorConfigurationURI(), true);
- TableConfiguration tableConfiguration = null;
- if (resource.getContents().get(0) instanceof TableConfiguration) {
- tableConfiguration = (TableConfiguration) resource.getContents().get(0);
- }
- return tableConfiguration;
- }
-
- protected abstract URI getTableEditorConfigurationURI();
-
- /**
- * Returns the context used to create the table
- *
- * @return
- * the context used to create the table or <code>null</code> if not found
- * @throws ServiceException
- */
- protected EObject getTableContext() {
- final List<EObject> selection = getSelection();
-
- if (!selection.isEmpty()) {
- return selection.get(0);
- }
- return null;
- }
-
- /**
- *
- * @return
- */
- protected List<EObject> getSelection() {
- final List<EObject> selectedElements = new ArrayList<EObject>();
- final IWorkbenchWindow ww = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (ww != null) {
- final ISelection selection = ww.getSelectionService().getSelection();
- if (selection instanceof IStructuredSelection) {
-
- final IStructuredSelection structuredSelection = (IStructuredSelection) selection;
-
- final Iterator<?> it = structuredSelection.iterator();
- while (it.hasNext()) {
- final Object object = it.next();
- final EObject currentEObject = EMFHelper.getEObject(object);
-
- if (currentEObject != null) {
- selectedElements.add(currentEObject);
- }
-
- }
- }
- }
- return selectedElements;
- }
-
- /**
- * Get the root element associated with canvas.
- */
- protected EObject getRootElement(final Resource modelResource) {
- EObject rootElement = null;
- if (modelResource != null && modelResource.getContents() != null && modelResource.getContents().size() > 0) {
- final Object root = modelResource.getContents().get(0);
- if (root instanceof EObject) {
- rootElement = (EObject) root;
- }
- }
- return rootElement;
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2011, 2016 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 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
+ * 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
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.common.handlers;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+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.emf.common.command.Command;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.core.resource.NotFoundException;
+import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.core.utils.EditorNameInitializer;
+import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
+import org.eclipse.papyrus.infra.nattable.Activator;
+import org.eclipse.papyrus.infra.nattable.common.modelresource.PapyrusNattableModel;
+import org.eclipse.papyrus.infra.nattable.messages.Messages;
+import org.eclipse.papyrus.infra.nattable.model.nattable.NattablePackage;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.NattableconfigurationPackage;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.TableConfiguration;
+import org.eclipse.papyrus.infra.nattable.utils.TableHelper;
+import org.eclipse.papyrus.infra.ui.util.ServiceUtilsForHandlers;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ *
+ *
+ */
+public abstract class AbstractCreateNattableEditorHandler extends AbstractHandler {
+
+
+
+
+ /**
+ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ *
+ * @param event
+ * @return
+ * @throws ExecutionException
+ */
+ @Override
+ public Object execute(final ExecutionEvent event) throws ExecutionException {
+ try {
+ runAsTransaction(event);
+ } catch (final ServiceException e) {
+ throw new ExecutionException("Can't create TableEditor", e); //$NON-NLS-1$
+ }
+ return null;
+ }
+
+ /**
+ * Prompts the user the future table's name
+ *
+ * @return The name, or <code>null</code> if the user cancelled the creation
+ */
+ public String askName() {
+ // we create a new resourceSet to avoid to load unused config in the resourceset in case of Cancel
+ TableConfiguration conf = getTableEditorConfiguration();
+ String defaultName = conf.getName();
+ // default Value
+ final String nameWithIncrement = EditorNameInitializer.getNameWithIncrement(NattablePackage.eINSTANCE.getTable(), NattableconfigurationPackage.eINSTANCE.getTableNamedElement_Name(), defaultName, getTableContext());
+ final InputDialog dialog = new InputDialog(Display.getDefault().getActiveShell(), Messages.AbstractCreateNattableEditorHandler_PapyrusTableCreation, Messages.AbstractCreateNattableEditorHandler_EnterTheNameForTheNewTable, nameWithIncrement, null);
+ if (dialog.open() == Window.OK) {
+ return dialog.getValue();
+ }
+ return null;
+ }
+
+ /**
+ * Run the command as a transaction. Create a Transaction and delegate the
+ * command to {@link #doExecute(ServicesRegistry)}.
+ *
+ * @throws ServiceException
+ *
+ */
+ public void runAsTransaction(final ExecutionEvent event) throws ServiceException {
+ String name = askName();
+ if (name != null) {
+ runAsTransaction(event, name);
+ }
+ }
+
+ /**
+ * Create the table creation command and execute it. Unlike {@link this#runAsTransaction(ExecutionEvent)}, this method doesn't display a dialog to
+ * ask for the name but rather takes it as a parameter.
+ *
+ * @param event
+ * @param name
+ * @throws ServiceException
+ */
+ public void runAsTransaction(final ExecutionEvent event, final String name) throws ServiceException {
+ final ServicesRegistry serviceRegistry = ServiceUtilsForHandlers.getInstance().getServiceRegistry(event);
+ final TransactionalEditingDomain domain = ServiceUtils.getInstance().getTransactionalEditingDomain(serviceRegistry);
+ domain.getCommandStack().execute(new RecordingCommand(domain) {
+
+ @Override
+ protected void doExecute() {
+ try {
+ AbstractCreateNattableEditorHandler.this.doExecute(serviceRegistry, name, this.description);
+ } catch (final NotFoundException e) {
+ Activator.log.error(e);
+ } catch (final ServiceException e) {
+ Activator.log.error(e);
+ }
+
+ }
+ });
+ }
+
+ public Command getCreateNattableEditorCommandWithNameInitialization(final TransactionalEditingDomain domain, final ServicesRegistry serviceRegistry, final ExecutionEvent event, final String name) throws ServiceException {
+ return new RecordingCommand(domain) {
+
+ @Override
+ protected void doExecute() {
+ try {
+ AbstractCreateNattableEditorHandler.this.doExecute(serviceRegistry, name, this.description);
+ } catch (final NotFoundException e) {
+ Activator.log.error(e);
+ } catch (final ServiceException e) {
+ Activator.log.error(e);
+ }
+
+ }
+ };
+
+ }
+
+ /**
+ * Do the execution of the command.
+ *
+ * @param serviceRegistry
+ * @throws ServiceException
+ * @throws NotFoundException
+ */
+ public Table doExecute(final ServicesRegistry serviceRegistry, String name, String description) throws ServiceException, NotFoundException {
+ final Table editorModel = createEditorModel(serviceRegistry, name, description);
+ // 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
+ * @throws ServiceException
+ * @throws NotFoundException
+ * 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 = getTableEditorConfiguration();
+ 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 ModelSet modelSet = ServiceUtils.getInstance().getModelSet(serviceRegistry);
+ final PapyrusNattableModel model = (PapyrusNattableModel) modelSet.getModelChecked(PapyrusNattableModel.MODEL_ID);
+ table.setContext(getTableContext());
+ model.addPapyrusTable(table);
+ return table;
+ }
+
+
+ protected abstract TableConfiguration getTableEditorConfiguration();
+
+ /**
+ * Returns the context used to create the table
+ *
+ * @return
+ * the context used to create the table or <code>null</code> if not found
+ * @throws ServiceException
+ */
+ protected EObject getTableContext() {
+ final List<EObject> selection = getSelection();
+
+ if (!selection.isEmpty()) {
+ return selection.get(0);
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @return
+ */
+ protected List<EObject> getSelection() {
+ final List<EObject> selectedElements = new ArrayList<EObject>();
+ final IWorkbenchWindow ww = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ if (ww != null) {
+ final ISelection selection = ww.getSelectionService().getSelection();
+ if (selection instanceof IStructuredSelection) {
+
+ final IStructuredSelection structuredSelection = (IStructuredSelection) selection;
+
+ final Iterator<?> it = structuredSelection.iterator();
+ while (it.hasNext()) {
+ final Object object = it.next();
+ final EObject currentEObject = EMFHelper.getEObject(object);
+
+ if (currentEObject != null) {
+ selectedElements.add(currentEObject);
+ }
+
+ }
+ }
+ }
+ return selectedElements;
+ }
+
+ /**
+ * Get the root element associated with canvas.
+ */
+ protected EObject getRootElement(final Resource modelResource) {
+ EObject rootElement = null;
+ if (modelResource != null && modelResource.getContents() != null && modelResource.getContents().size() > 0) {
+ final Object root = modelResource.getContents().get(0);
+ if (root instanceof EObject) {
+ rootElement = (EObject) root;
+ }
+ }
+ return rootElement;
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/handlers/CreateNatTableEditorHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/handlers/CreateNatTableEditorHandler.java
index a1205aea687..0e9b5ff07da 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/handlers/CreateNatTableEditorHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/handlers/CreateNatTableEditorHandler.java
@@ -1,110 +1,111 @@
-/*****************************************************************************
- * 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.common.handlers;
-
-import java.util.Hashtable;
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExecutableExtension;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.papyrus.infra.nattable.nattableconfiguration.NattableConfigurationRegistry;
-
-/**
- * The handler used to create a nattable editor
- *
- * @author Vincent Lorenzo
- *
- */
-public class CreateNatTableEditorHandler extends AbstractCreateNattableEditorHandler implements IExecutableExtension {
-
- /**
- * the name of the parameter of the handler
- */
- private static final String TABLE_TYPE_PARAMETER = "tableType"; //$NON-NLS-1$
-
- /**
- * the type of the table to create
- */
- private String type;
-
- /**
- *
- * Constructor.
- *
- */
- public CreateNatTableEditorHandler() {
- super();
- }
-
-
- /**
- * Set the type of table to be created by this handler
- *
- * @param type
- */
- public void setType(String type) {
- this.type = type;
- }
-
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.common.handlers.AbstractCreateNattableEditorHandler2#getTableEditorConfigurationURI()
- *
- * @return
- */
- @Override
- protected URI getTableEditorConfigurationURI() {
- return NattableConfigurationRegistry.INSTANCE.getConfigurationURI(this.type);
- }
-
- /**
- *
- * @see org.eclipse.core.commands.AbstractHandler#setEnabled(java.lang.Object)
- *
- * @param evaluationContext
- */
- @Override
- public void setEnabled(Object evaluationContext) {
- if (this.type != null) {
- List<EObject> selection = getSelection();
- if (selection.size() == 1) {
- IStatus status = NattableConfigurationRegistry.INSTANCE.canCreateTable(this.type, selection.get(0));
- setBaseEnabled(status.isOK());
- return;
- }
- }
- setBaseEnabled(false);
- }
-
- /**
- *
- * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String, java.lang.Object)
- *
- * @param config
- * @param propertyName
- * @param data
- * @throws CoreException
- */
- @Override
- public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {
- if (data instanceof Hashtable) {
- this.type = (String) ((Hashtable<?, ?>) data).get(TABLE_TYPE_PARAMETER);
- }
- }
-}
+/*****************************************************************************
+ * 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.common.handlers;
+
+import java.util.Hashtable;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExecutableExtension;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.TableConfiguration;
+import org.eclipse.papyrus.infra.nattable.nattableconfiguration.NattableConfigurationRegistry;
+
+/**
+ * The handler used to create a nattable editor
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class CreateNatTableEditorHandler extends AbstractCreateNattableEditorHandler implements IExecutableExtension {
+
+ /**
+ * the name of the parameter of the handler
+ */
+ private static final String TABLE_TYPE_PARAMETER = "tableType"; //$NON-NLS-1$
+
+ /**
+ * the type of the table to create
+ */
+ private String type;
+
+ /**
+ *
+ * Constructor.
+ *
+ */
+ public CreateNatTableEditorHandler() {
+ super();
+ }
+
+
+ /**
+ * Set the type of table to be created by this handler
+ *
+ * @param type
+ */
+ public void setType(String type) {
+ this.type = type;
+ }
+
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.common.handlers.AbstractCreateNattableEditorHandler2#getTableEditorConfiguration()
+ *
+ * @return
+ */
+ @Override
+ protected TableConfiguration getTableEditorConfiguration() {
+ return NattableConfigurationRegistry.INSTANCE.getConfiguration(this.type);
+ }
+
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#setEnabled(java.lang.Object)
+ *
+ * @param evaluationContext
+ */
+ @Override
+ public void setEnabled(Object evaluationContext) {
+ if (this.type != null) {
+ List<EObject> selection = getSelection();
+ if (selection.size() == 1) {
+ IStatus status = NattableConfigurationRegistry.INSTANCE.canCreateTable(this.type, selection.get(0));
+ setBaseEnabled(status.isOK());
+ return;
+ }
+ }
+ setBaseEnabled(false);
+ }
+
+ /**
+ *
+ * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String, java.lang.Object)
+ *
+ * @param config
+ * @param propertyName
+ * @param data
+ * @throws CoreException
+ */
+ @Override
+ public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {
+ if (data instanceof Hashtable) {
+ this.type = (String) ((Hashtable<?, ?>) data).get(TABLE_TYPE_PARAMETER);
+ }
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/handlers/CreateNatTableEditorWithoutDialogHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/handlers/CreateNatTableEditorWithoutDialogHandler.java
index ea3352d83d8..d7586b174d2 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/handlers/CreateNatTableEditorWithoutDialogHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/handlers/CreateNatTableEditorWithoutDialogHandler.java
@@ -1,64 +1,62 @@
-/*****************************************************************************
- * 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.common.handlers;
-
-import org.eclipse.core.commands.ExecutionEvent;
-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.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.TableConfiguration;
-
-/**
- * The handler used to create a nattable editor without the name dialog
- *
- * @author Vincent Lorenzo
- *
- */
-public class CreateNatTableEditorWithoutDialogHandler extends CreateNatTableEditorHandler {
-
-
-
- /**
- *
- * Constructor.
- *
- */
- public CreateNatTableEditorWithoutDialogHandler() {
- super();
- }
-
-
- /**
- * Run the command as a transaction. Create a Transaction and delegate the
- * command to {@link #doExecute(ServicesRegistry)}.
- *
- * @throws ServiceException
- *
- */
- @Override
- public void runAsTransaction(final ExecutionEvent event) throws ServiceException {
- // we create a new resourceSet to avoid to load unused config in the resourceset in case of Cancel
- ResourceSet set = new ResourceSetImpl();
- Resource res = set.getResource(getTableEditorConfigurationURI(), true);
- TableConfiguration conf = (TableConfiguration) res.getContents().get(0);
- String defaultName = conf.getName();
- runAsTransaction(event, defaultName);
- }
-
-
-
-
-}
+/*****************************************************************************
+ * 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.common.handlers;
+
+import org.eclipse.core.commands.ExecutionEvent;
+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.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.TableConfiguration;
+
+/**
+ * The handler used to create a nattable editor without the name dialog
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class CreateNatTableEditorWithoutDialogHandler extends CreateNatTableEditorHandler {
+
+
+
+ /**
+ *
+ * Constructor.
+ *
+ */
+ public CreateNatTableEditorWithoutDialogHandler() {
+ super();
+ }
+
+
+ /**
+ * Run the command as a transaction. Create a Transaction and delegate the
+ * command to {@link #doExecute(ServicesRegistry)}.
+ *
+ * @throws ServiceException
+ *
+ */
+ @Override
+ public void runAsTransaction(final ExecutionEvent event) throws ServiceException {
+ // we create a new resourceSet to avoid to load unused config in the resourceset in case of Cancel
+ TableConfiguration conf = getTableEditorConfiguration();
+ String defaultName = conf.getName();
+ runAsTransaction(event, defaultName);
+ }
+
+
+
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/handlers/CreateNatTableFromCatalogHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/handlers/CreateNatTableFromCatalogHandler.java
index 26d0fb22e4c..3e2f87ad2b8 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/handlers/CreateNatTableFromCatalogHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/handlers/CreateNatTableFromCatalogHandler.java
@@ -36,8 +36,7 @@ import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.infra.nattable.common.Activator;
import org.eclipse.papyrus.infra.nattable.common.helper.TableViewPrototype;
import org.eclipse.papyrus.infra.nattable.common.wizards.CreateNattableFromCatalogWizard;
-import org.eclipse.papyrus.infra.nattable.nattableconfiguration.NattableConfigurationRegistry;
-import org.eclipse.papyrus.infra.nattable.representation.PapyrusSyncTable;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.TableConfiguration;
import org.eclipse.papyrus.infra.nattable.representation.PapyrusTable;
import org.eclipse.papyrus.infra.ui.util.ServiceUtilsForHandlers;
import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype;
@@ -168,7 +167,7 @@ public class CreateNatTableFromCatalogHandler extends AbstractHandler {
for (int i = 0; i < tablesQuantity; i++) {
final String tableNameToCreate = 1 < tablesQuantity ? tableConfigName + "_" + i : tableConfigName; //$NON-NLS-1$
// TODO : The following code line must be replaced by TableEditorCreationHelper.getTableConfigurationURI when the API for table creation is merged
- PolicyDefinedTableHandler handler = new PolicyDefinedTableHandler(getTableConfigurationURI((TableViewPrototype) viewPrototype), context, tableNameToCreate);
+ PolicyDefinedTableHandler handler = new PolicyDefinedTableHandler(getTableConfiguration((TableViewPrototype) viewPrototype), context, tableNameToCreate);
handler.execute(viewPrototype);
}
}
@@ -190,18 +189,12 @@ public class CreateNatTableFromCatalogHandler extends AbstractHandler {
* @param viewPrototype
* a view {@link TableViewPrototype}, must not be <code>null</code>
* @return
- * the {@link URI} of the nattable configuration, or <code>null</code> if not found
+ * a TableConfiguration, or <code>null</code> if not found
*/
- private URI getTableConfigurationURI(final TableViewPrototype viewPrototype) {
+ private TableConfiguration getTableConfiguration(final TableViewPrototype viewPrototype) {
if (viewPrototype.getRepresentationKind() instanceof PapyrusTable) {
PapyrusTable papyrusTable = (PapyrusTable) viewPrototype.getRepresentationKind();
- String uri = papyrusTable.getConfiguration();
- if (uri != null && uri.length() > 0) {
- return URI.createURI(uri);
- }
- }
- if (viewPrototype.getRepresentationKind() instanceof PapyrusSyncTable) {
- return NattableConfigurationRegistry.INSTANCE.getConfigurationURI(((PapyrusSyncTable) viewPrototype.getRepresentationKind()).getImplementationID());
+ return papyrusTable.getConfiguration();
}
return null;
}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/handlers/DynamicTablesMenuContribution.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/handlers/DynamicTablesMenuContribution.java
index dbdd0e3d5f3..cf606490e53 100755
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/handlers/DynamicTablesMenuContribution.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/handlers/DynamicTablesMenuContribution.java
@@ -21,7 +21,6 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.papyrus.infra.nattable.representation.PapyrusSyncTable;
import org.eclipse.papyrus.infra.nattable.representation.PapyrusTable;
import org.eclipse.papyrus.infra.viewpoints.policy.DynamicContribution;
import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
@@ -61,7 +60,7 @@ public class DynamicTablesMenuContribution extends DynamicContribution {
// build a list of all the available prototypes
List<ViewPrototype> data = new ArrayList<ViewPrototype>();
for (final ViewPrototype proto : PolicyChecker.getFor(selection).getPrototypesFor(selection)) {
- if (!(proto.getRepresentationKind() instanceof PapyrusTable || proto.getRepresentationKind() instanceof PapyrusSyncTable)) {
+ if (!(proto.getRepresentationKind() instanceof PapyrusTable)) {
continue;
}
data.add(proto);
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 19e4303a462..7e03e254938 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
@@ -13,7 +13,6 @@
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.common.handlers;
-import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
@@ -23,6 +22,7 @@ import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
import org.eclipse.papyrus.infra.nattable.Activator;
import org.eclipse.papyrus.infra.nattable.common.reconciler.TableVersioningUtils;
import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.TableConfiguration;
import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype;
@@ -32,11 +32,11 @@ import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype;
* @author Laurent Wouters
*/
public class PolicyDefinedTableHandler extends CreateNatTableEditorHandler {
- private URI configuration;
+ private TableConfiguration configuration;
private EObject context;
private String name;
- public PolicyDefinedTableHandler(URI config, EObject context, String name) {
+ public PolicyDefinedTableHandler(TableConfiguration config, EObject context, String name) {
this.configuration = config;
this.context = context;
this.name = name;
@@ -48,7 +48,7 @@ public class PolicyDefinedTableHandler extends CreateNatTableEditorHandler {
}
@Override
- protected URI getTableEditorConfigurationURI() {
+ protected TableConfiguration getTableEditorConfiguration() {
return configuration;
}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/helper/SyncTableCommandHelper.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/helper/SyncTableCommandHelper.java
deleted file mode 100755
index bbd018af7dd..00000000000
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/helper/SyncTableCommandHelper.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*****************************************************************************
- * 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:
- * Laurent Wouters laurent.wouters@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.common.helper;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.papyrus.infra.architecture.representation.PapyrusRepresentationKind;
-import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
-import org.eclipse.papyrus.infra.nattable.nattableconfiguration.NattableConfigurationRegistry;
-import org.eclipse.papyrus.infra.nattable.representation.PapyrusSyncTable;
-import org.eclipse.papyrus.infra.nattable.representation.RepresentationPackage;
-import org.eclipse.papyrus.infra.viewpoints.policy.IViewTypeHelper;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype;
-
-/**
- * Represents the command helper for the viewpoints application to synchronized tables
- *
- * @author Laurent Wouters
- */
-public class SyncTableCommandHelper implements IViewTypeHelper {
- /**
- * ID of the extension point for Papyrus tables
- */
- private static final String EXTENSION_PAPYRUS_SYNC_TABLE = NattableConfigurationRegistry.EXTENSION_ID;
-
- /**
- * The cache of implementations
- */
- private Map<String, String> implementations;
-
- /**
- * The cache of prototypes
- */
- private Map<PapyrusRepresentationKind, TableViewPrototype> cache;
-
-
-
- @Override
- public ViewPrototype getPrototypeFor(PapyrusRepresentationKind configuration) {
- if (!(configuration instanceof PapyrusSyncTable)) {
- return null;
- }
- if (implementations == null) {
- buildImplementationCache();
- }
- if (cache == null) {
- cache = new HashMap<PapyrusRepresentationKind, TableViewPrototype>();
- }
- if (cache.containsKey(configuration)) {
- return cache.get(configuration);
- }
- if (!implementations.containsKey(configuration.getImplementationID())) {
- return null;
- }
- TableViewPrototype proto = new TableViewPrototype((PapyrusSyncTable) configuration, implementations.get(configuration.getImplementationID()));
- cache.put(configuration, proto);
- return proto;
- }
-
- @Override
- public boolean isSupported(EClass type) {
- return (type == RepresentationPackage.eINSTANCE.getPapyrusSyncTable());
- }
-
- @Override
- public boolean isSupported(EObject view) {
- if (!(view instanceof Table)) {
- return false;
- }
- Table table = (Table) view;
- return (table.getPrototype() instanceof PapyrusSyncTable);
- }
-
- @Override
- public ViewPrototype getPrototypeOf(EObject view) {
- if (!isSupported(view)) {
- return null;
- }
- PolicyChecker checker = PolicyChecker.getFor(view);
- PapyrusSyncTable repKind = (PapyrusSyncTable) ((Table)view).getPrototype();
- if (checker.isInViewpoint(repKind))
- return getPrototypeFor(repKind);
- return ViewPrototype.UNAVAILABLE_VIEW;
- }
-
- /**
- * Builds the cache of sync table implementations
- */
- private void buildImplementationCache() {
- implementations = new HashMap<String, String>();
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IExtensionPoint point = registry.getExtensionPoint(EXTENSION_PAPYRUS_SYNC_TABLE);
- IExtension[] extensions = point.getExtensions();
- for (int i = 0; i != extensions.length; i++) {
- IConfigurationElement[] elements = extensions[i].getConfigurationElements();
- for (int j = 0; j != elements.length; j++) {
- if (elements[j].getName().equals("configuration")) {
- String type = elements[j].getAttribute("type");
- String file = elements[j].getAttribute("file");
- if (!file.startsWith("platform:/")) {
- file = "platform:/plugin/" + extensions[i].getContributor().getName() + "/" + file;
- }
- if (!implementations.containsKey(type)) {
- implementations.put(type, file);
- }
- }
- }
- }
- }
-}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/helper/TableViewPrototype.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/helper/TableViewPrototype.java
index d89572d47d1..c8076a2bdf1 100755
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/helper/TableViewPrototype.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/helper/TableViewPrototype.java
@@ -15,11 +15,10 @@ package org.eclipse.papyrus.infra.nattable.common.helper;
import org.eclipse.emf.common.command.AbstractCommand;
import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.papyrus.infra.nattable.common.handlers.PolicyDefinedTableHandler;
import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
-import org.eclipse.papyrus.infra.nattable.representation.PapyrusSyncTable;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.TableConfiguration;
import org.eclipse.papyrus.infra.nattable.representation.PapyrusTable;
import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype;
@@ -30,16 +29,11 @@ import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype;
* @author Laurent Wouters
*/
public class TableViewPrototype extends ViewPrototype {
- private URI configFile;
+ private TableConfiguration configuration;
- public TableViewPrototype(PapyrusTable configuration) {
- super(configuration);
- configFile = URI.createURI(configuration.getConfiguration());
- }
-
- public TableViewPrototype(PapyrusSyncTable configuration, String file) {
- super(configuration);
- configFile = URI.createURI(file);
+ public TableViewPrototype(PapyrusTable prototype) {
+ super(prototype);
+ this.configuration = prototype.getConfiguration();
}
@Override
@@ -54,10 +48,10 @@ public class TableViewPrototype extends ViewPrototype {
@Override
public boolean instantiateOn(EObject owner, String name) {
- if (configFile == null) {
+ if (configuration == null) {
return false;
}
- PolicyDefinedTableHandler handler = new PolicyDefinedTableHandler(configFile, owner, name);
+ PolicyDefinedTableHandler handler = new PolicyDefinedTableHandler(configuration, owner, name);
return handler.execute(this);
}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/wizards/ChooseNattableConfigWizardPage.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/wizards/ChooseNattableConfigWizardPage.java
index 46361c106a9..6ec47a956d1 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/wizards/ChooseNattableConfigWizardPage.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/wizards/ChooseNattableConfigWizardPage.java
@@ -21,9 +21,6 @@ import java.util.Map;
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.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.CheckboxCellEditor;
@@ -42,7 +39,6 @@ import org.eclipse.papyrus.infra.nattable.common.helper.TableViewPrototype;
import org.eclipse.papyrus.infra.nattable.common.messages.Messages;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.TableConfiguration;
import org.eclipse.papyrus.infra.nattable.nattableconfiguration.NattableConfigurationRegistry;
-import org.eclipse.papyrus.infra.nattable.representation.PapyrusSyncTable;
import org.eclipse.papyrus.infra.nattable.representation.PapyrusTable;
import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype;
@@ -132,10 +128,8 @@ public class ChooseNattableConfigWizardPage extends WizardPage {
// Calculate the TableConfiguration for the icon and the description of table
final Map<ViewPrototype, TableConfiguration> tableConfigurations = new HashMap<ViewPrototype, TableConfiguration>(viewPrototypes.size());
for (ViewPrototype viewPrototype : viewPrototypes) {
- final ResourceSet resourceSet = new ResourceSetImpl();
// TODO : The following code line must be replaced by TableEditorCreationHelper.getTableConfigurationURI when the API for table creation is merged
- final Resource resource = resourceSet.getResource(getTableConfigurationURI((TableViewPrototype) viewPrototype), true);
- tableConfigurations.put(viewPrototype, (TableConfiguration) resource.getContents().get(0));
+ tableConfigurations.put(viewPrototype, getTableConfiguration((TableViewPrototype) viewPrototype));
}
colCheckbox.setLabelProvider(new ColumnLabelProvider() {
@@ -357,7 +351,7 @@ public class ChooseNattableConfigWizardPage extends WizardPage {
// build a list of all the available prototypes corresponding to the context
for (final ViewPrototype proto : PolicyChecker.getFor(context).getAllPrototypes()) {
- if ((proto.getRepresentationKind() instanceof PapyrusTable || proto.getRepresentationKind() instanceof PapyrusSyncTable)) {
+ if (proto.getRepresentationKind() instanceof PapyrusTable) {
if (NattableConfigurationRegistry.INSTANCE.canCreateTable(proto.getImplementation(), context).isOK()) {
viewPrototypes.add(proto);
}
@@ -378,16 +372,10 @@ public class ChooseNattableConfigWizardPage extends WizardPage {
* @return
* the {@link URI} of the nattable configuration, or <code>null</code> if not found
*/
- private URI getTableConfigurationURI(final TableViewPrototype viewPrototype) {
+ private TableConfiguration getTableConfiguration(final TableViewPrototype viewPrototype) {
if (viewPrototype.getRepresentationKind() instanceof PapyrusTable) {
PapyrusTable papyrusTable = (PapyrusTable) viewPrototype.getRepresentationKind();
- String uri = papyrusTable.getConfiguration();
- if (uri != null && uri.length() > 0) {
- return URI.createURI(uri);
- }
- }
- if (viewPrototype.getRepresentationKind() instanceof PapyrusSyncTable) {
- return NattableConfigurationRegistry.INSTANCE.getConfigurationURI(((PapyrusSyncTable) viewPrototype.getRepresentationKind()).getImplementationID());
+ return papyrusTable.getConfiguration();
}
return null;
}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation.edit/META-INF/MANIFEST.MF b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation.edit/META-INF/MANIFEST.MF
index d44de34951d..c1e7c892d54 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation.edit/META-INF/MANIFEST.MF
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation.edit/META-INF/MANIFEST.MF
@@ -1,23 +1,27 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.papyrus.infra.nattable.representation.edit;singleton:=true
-Bundle-Version: 1.0.0.qualifier
-Bundle-ClassPath: .
-Bundle-Activator: org.eclipse.papyrus.infra.nattable.representation.provider.RepresentationEditPlugin$Implementation
-Bundle-Vendor: %providerName
-Bundle-Localization: plugin
-Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Export-Package: org.eclipse.papyrus.infra.nattable.representation.provider
-Require-Bundle: org.eclipse.core.runtime,
- org.eclipse.papyrus.infra.nattable.representation;visibility:=reexport;bundle-version="[1.0.0,2.0.0)",
- org.eclipse.emf.edit;visibility:=reexport,
- org.eclipse.papyrus.infra.core.architecture;visibility:=reexport;bundle-version="[1.0.0,2.0.0)",
- org.eclipse.papyrus.infra.core.architecture.edit;visibility:=reexport;bundle-version="[1.0.0,2.0.0)",
- org.eclipse.papyrus.infra.constraints;visibility:=reexport;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.infra.constraints.edit;visibility:=reexport;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.infra.types;visibility:=reexport;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.infra.types.edit;visibility:=reexport;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.infra.architecture.representation;visibility:=reexport;bundle-version="[1.0.0,2.0.0)",
- org.eclipse.papyrus.infra.architecture.representation.edit;visibility:=reexport;bundle-version="[1.0.0,2.0.0)"
-Bundle-ActivationPolicy: lazy
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.papyrus.infra.nattable.representation.edit;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-ClassPath: .
+Bundle-Activator: org.eclipse.papyrus.infra.nattable.representation.provider.RepresentationEditPlugin$Implementation
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Export-Package: org.eclipse.papyrus.infra.nattable.representation.provider
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.papyrus.infra.nattable.representation;bundle-version="[1.0.0,2.0.0)";visibility:=reexport,
+ org.eclipse.emf.edit;visibility:=reexport,
+ org.eclipse.papyrus.infra.core.architecture;bundle-version="[1.0.0,2.0.0)";visibility:=reexport,
+ org.eclipse.papyrus.infra.core.architecture.edit;bundle-version="[1.0.0,2.0.0)";visibility:=reexport,
+ org.eclipse.papyrus.infra.constraints;bundle-version="[3.0.0,4.0.0)";visibility:=reexport,
+ org.eclipse.papyrus.infra.constraints.edit;bundle-version="[3.0.0,4.0.0)";visibility:=reexport,
+ org.eclipse.emf.ecore;visibility:=reexport,
+ org.eclipse.emf.ecore.edit;visibility:=reexport,
+ org.eclipse.papyrus.infra.types;bundle-version="[3.0.0,4.0.0)";visibility:=reexport,
+ org.eclipse.papyrus.infra.types.edit;bundle-version="[3.0.0,4.0.0)";visibility:=reexport,
+ org.eclipse.papyrus.infra.nattable.model;visibility:=reexport,
+ org.eclipse.papyrus.infra.nattable.model.edit;visibility:=reexport,
+ org.eclipse.papyrus.infra.architecture.representation;bundle-version="[1.0.0,2.0.0)";visibility:=reexport,
+ org.eclipse.papyrus.infra.architecture.representation.edit;bundle-version="[1.0.0,2.0.0)";visibility:=reexport
+Bundle-ActivationPolicy: lazy
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation.edit/icons/full/obj16/PapyrusSyncTable.gif b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation.edit/icons/full/obj16/PapyrusSyncTable.gif
deleted file mode 100644
index 6ae6ab02668..00000000000
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation.edit/icons/full/obj16/PapyrusSyncTable.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation.edit/plugin.properties b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation.edit/plugin.properties
index 37a6bb06d8e..8749fb7022f 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation.edit/plugin.properties
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation.edit/plugin.properties
@@ -12,22 +12,15 @@
pluginName = Nattable Representation Edit Support
providerName = Eclipse Modeling Project
-
_UI_CreateChild_text = {0}
_UI_CreateChild_text2 = {1} {0}
_UI_CreateChild_text3 = {1}
_UI_CreateChild_tooltip = Create New {0} Under {1} Feature
_UI_CreateChild_description = Create a new child of type {0} for the {1} feature of the selected {2}.
_UI_CreateSibling_description = Create a new sibling of type {0} for the selected {2}, under the {1} feature of their parent.
-
_UI_PropertyDescriptor_description = The {0} of the {1}
-
-_UI_PapyrusSyncTable_type = Papyrus Sync Table
_UI_PapyrusTable_type = Papyrus Table
_UI_Unknown_type = Object
-
_UI_Unknown_datatype= Value
-
_UI_PapyrusTable_configuration_feature = Configuration
_UI_Unknown_feature = Unspecified
-
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation.edit/src-gen/org/eclipse/papyrus/infra/nattable/representation/provider/PapyrusSyncTableItemProvider.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation.edit/src-gen/org/eclipse/papyrus/infra/nattable/representation/provider/PapyrusSyncTableItemProvider.java
deleted file mode 100644
index 95da8d823e7..00000000000
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation.edit/src-gen/org/eclipse/papyrus/infra/nattable/representation/provider/PapyrusSyncTableItemProvider.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/**
- * Copyright (c) 2017 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:
- * Maged Elaasar - Initial API and implementation
- *
- *
- */
-package org.eclipse.papyrus.infra.nattable.representation.provider;
-
-
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.util.ResourceLocator;
-import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
-import org.eclipse.papyrus.infra.architecture.representation.provider.PapyrusRepresentationKindItemProvider;
-import org.eclipse.papyrus.infra.nattable.representation.PapyrusSyncTable;
-
-/**
- * This is the item provider adapter for a {@link org.eclipse.papyrus.infra.nattable.representation.PapyrusSyncTable} object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
-public class PapyrusSyncTableItemProvider
- extends PapyrusRepresentationKindItemProvider {
- /**
- * This constructs an instance from a factory and a notifier.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public PapyrusSyncTableItemProvider(AdapterFactory adapterFactory) {
- super(adapterFactory);
- }
-
- /**
- * This returns the property descriptors for the adapted class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
- if (itemPropertyDescriptors == null) {
- super.getPropertyDescriptors(object);
-
- }
- return itemPropertyDescriptors;
- }
-
- /**
- * This returns PapyrusSyncTable.gif.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object getImage(Object object) {
- return overlayImage(object, getResourceLocator().getImage("full/obj16/PapyrusSyncTable"));
- }
-
- /**
- * This returns the label text for the adapted class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated NOT
- */
- @Override
- public String getText(Object object) {
- return getTextFor((PapyrusSyncTable) object);
- }
-
- /**
- * This handles model notifications by calling {@link #updateChildren} to update any cached
- * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void notifyChanged(Notification notification) {
- updateChildren(notification);
- super.notifyChanged(notification);
- }
-
- /**
- * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
- * that can be created under this object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
- super.collectNewChildDescriptors(newChildDescriptors, object);
- }
-
- /**
- * Return the resource locator for this item provider's resources.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public ResourceLocator getResourceLocator() {
- return RepresentationEditPlugin.INSTANCE;
- }
-
-}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation.edit/src-gen/org/eclipse/papyrus/infra/nattable/representation/provider/PapyrusTableItemProvider.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation.edit/src-gen/org/eclipse/papyrus/infra/nattable/representation/provider/PapyrusTableItemProvider.java
index 049ec0ae6d7..5fc26c66a7e 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation.edit/src-gen/org/eclipse/papyrus/infra/nattable/representation/provider/PapyrusTableItemProvider.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation.edit/src-gen/org/eclipse/papyrus/infra/nattable/representation/provider/PapyrusTableItemProvider.java
@@ -22,7 +22,6 @@ import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.ResourceLocator;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
-import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ViewerNotification;
import org.eclipse.papyrus.infra.architecture.representation.provider.PapyrusRepresentationKindItemProvider;
import org.eclipse.papyrus.infra.nattable.representation.PapyrusTable;
@@ -78,7 +77,7 @@ public class PapyrusTableItemProvider extends PapyrusRepresentationKindItemProvi
true,
false,
false,
- ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
null,
null));
}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation.edit/src-gen/org/eclipse/papyrus/infra/nattable/representation/provider/RepresentationEditPlugin.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation.edit/src-gen/org/eclipse/papyrus/infra/nattable/representation/provider/RepresentationEditPlugin.java
index 5172eb2f3d0..24589f22d30 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation.edit/src-gen/org/eclipse/papyrus/infra/nattable/representation/provider/RepresentationEditPlugin.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation.edit/src-gen/org/eclipse/papyrus/infra/nattable/representation/provider/RepresentationEditPlugin.java
@@ -17,10 +17,12 @@ import org.eclipse.emf.common.EMFPlugin;
import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.ecore.provider.EcoreEditPlugin;
import org.eclipse.papyrus.infra.constraints.provider.ConstraintsEditPlugin;
import org.eclipse.papyrus.infra.core.architecture.provider.ArchitectureEditPlugin;
+import org.eclipse.papyrus.infra.nattable.model.nattable.provider.NattableEditPlugin;
import org.eclipse.papyrus.infra.types.provider.TypesConfigurationsEditPlugin;
/**
@@ -57,7 +59,9 @@ public final class RepresentationEditPlugin extends EMFPlugin {
(new ResourceLocator [] {
ArchitectureEditPlugin.INSTANCE,
ConstraintsEditPlugin.INSTANCE,
+ EcoreEditPlugin.INSTANCE,
TypesConfigurationsEditPlugin.INSTANCE,
+ NattableEditPlugin.INSTANCE,
org.eclipse.papyrus.infra.architecture.representation.provider.RepresentationEditPlugin.INSTANCE,
});
}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation.edit/src-gen/org/eclipse/papyrus/infra/nattable/representation/provider/RepresentationItemProviderAdapterFactory.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation.edit/src-gen/org/eclipse/papyrus/infra/nattable/representation/provider/RepresentationItemProviderAdapterFactory.java
index fbdf25afc00..de288ee5731 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation.edit/src-gen/org/eclipse/papyrus/infra/nattable/representation/provider/RepresentationItemProviderAdapterFactory.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation.edit/src-gen/org/eclipse/papyrus/infra/nattable/representation/provider/RepresentationItemProviderAdapterFactory.java
@@ -100,29 +100,6 @@ public class RepresentationItemProviderAdapterFactory extends RepresentationAdap
}
/**
- * This keeps track of the one adapter used for all {@link org.eclipse.papyrus.infra.nattable.representation.PapyrusSyncTable} instances.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected PapyrusSyncTableItemProvider papyrusSyncTableItemProvider;
-
- /**
- * This creates an adapter for a {@link org.eclipse.papyrus.infra.nattable.representation.PapyrusSyncTable}.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Adapter createPapyrusSyncTableAdapter() {
- if (papyrusSyncTableItemProvider == null) {
- papyrusSyncTableItemProvider = new PapyrusSyncTableItemProvider(this);
- }
-
- return papyrusSyncTableItemProvider;
- }
-
- /**
* This keeps track of the one adapter used for all {@link org.eclipse.papyrus.infra.nattable.representation.PapyrusTable} instances.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -244,7 +221,6 @@ public class RepresentationItemProviderAdapterFactory extends RepresentationAdap
* @generated
*/
public void dispose() {
- if (papyrusSyncTableItemProvider != null) papyrusSyncTableItemProvider.dispose();
if (papyrusTableItemProvider != null) papyrusTableItemProvider.dispose();
}
@@ -298,11 +274,6 @@ public class RepresentationItemProviderAdapterFactory extends RepresentationAdap
newChildDescriptors.add
(createChildParameter
(ArchitecturePackage.Literals.ARCHITECTURE_DESCRIPTION_LANGUAGE__REPRESENTATION_KINDS,
- RepresentationFactory.eINSTANCE.createPapyrusSyncTable()));
-
- newChildDescriptors.add
- (createChildParameter
- (ArchitecturePackage.Literals.ARCHITECTURE_DESCRIPTION_LANGUAGE__REPRESENTATION_KINDS,
RepresentationFactory.eINSTANCE.createPapyrusTable()));
return null;
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/META-INF/MANIFEST.MF b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/META-INF/MANIFEST.MF
index 88632f8d746..2cb0ccf0565 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/META-INF/MANIFEST.MF
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/META-INF/MANIFEST.MF
@@ -1,19 +1,20 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.papyrus.infra.nattable.representation;singleton:=true
-Bundle-Version: 1.0.0.qualifier
-Bundle-ClassPath: .
-Bundle-Vendor: %providerName
-Bundle-Localization: plugin
-Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Export-Package: org.eclipse.papyrus.infra.nattable.representation,
- org.eclipse.papyrus.infra.nattable.representation.impl,
- org.eclipse.papyrus.infra.nattable.representation.util
-Require-Bundle: org.eclipse.core.runtime,
- org.eclipse.emf.ecore;visibility:=reexport,
- org.eclipse.papyrus.infra.core.architecture;visibility:=reexport;bundle-version="[1.0.0,2.0.0)",
- org.eclipse.papyrus.infra.constraints;visibility:=reexport;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.infra.types;visibility:=reexport;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.infra.architecture.representation;visibility:=reexport;bundle-version="[1.0.0,2.0.0)"
-Bundle-ActivationPolicy: lazy
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.papyrus.infra.nattable.representation;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-ClassPath: .
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Export-Package: org.eclipse.papyrus.infra.nattable.representation,
+ org.eclipse.papyrus.infra.nattable.representation.impl,
+ org.eclipse.papyrus.infra.nattable.representation.util
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.emf.ecore;visibility:=reexport,
+ org.eclipse.papyrus.infra.core.architecture;bundle-version="[1.0.0,2.0.0)";visibility:=reexport,
+ org.eclipse.papyrus.infra.constraints;bundle-version="[3.0.0,4.0.0)";visibility:=reexport,
+ org.eclipse.papyrus.infra.types;bundle-version="[3.0.0,4.0.0)";visibility:=reexport,
+ org.eclipse.papyrus.infra.nattable.model;visibility:=reexport,
+ org.eclipse.papyrus.infra.architecture.representation;bundle-version="[1.0.0,2.0.0)";visibility:=reexport
+Bundle-ActivationPolicy: lazy
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/model/NattableRepresentation.ecore b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/model/NattableRepresentation.ecore
index 629def092b4..91fad58d6fa 100755
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/model/NattableRepresentation.ecore
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/model/NattableRepresentation.ecore
@@ -2,9 +2,8 @@
<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="representation" nsURI="http://www.eclipse.org/papyrus/infra/nattable/representation"
nsPrefix="nattablerepresentation">
- <eClassifiers xsi:type="ecore:EClass" name="PapyrusSyncTable" eSuperTypes="../../org.eclipse.papyrus.infra.architecture.representation/model/Representation.ecore#//PapyrusRepresentationKind"/>
<eClassifiers xsi:type="ecore:EClass" name="PapyrusTable" eSuperTypes="../../org.eclipse.papyrus.infra.architecture.representation/model/Representation.ecore#//PapyrusRepresentationKind">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="configuration" lowerBound="1"
- eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="configuration" lowerBound="1"
+ eType="ecore:EClass ../../org.eclipse.papyrus.infra.nattable.model/model/nattable.ecore#//nattableconfiguration/TableConfiguration"/>
</eClassifiers>
</ecore:EPackage>
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/model/NattableRepresentation.genmodel b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/model/NattableRepresentation.genmodel
index 5b1f3d033b9..d8aa17a2153 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/model/NattableRepresentation.genmodel
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/model/NattableRepresentation.genmodel
@@ -7,14 +7,13 @@
rootExtendsClass="org.eclipse.emf.ecore.impl.MinimalEObjectImpl$Container" testsDirectory="/org.eclipse.papyrus.infra.nattable.representation.tests/src-gen"
importerID="org.eclipse.emf.importer.ecore" complianceLevel="8.0" copyrightFields="false"
editPluginID="org.eclipse.papyrus.infra.nattable.representation.edit" editorPluginID="org.eclipse.papyrus.infra.nattable.representation.editor"
- usedGenPackages="../../org.eclipse.papyrus.infra.core.architecture/model/Architecture.genmodel#//architecture ../../org.eclipse.papyrus.infra.constraints/Model/Constraints.genmodel#//constraints ../../org.eclipse.papyrus.infra.types/model/ElementTypesConfigurations.genmodel#//types ../../org.eclipse.papyrus.infra.architecture.representation/model/Representation.genmodel#//representation"
+ usedGenPackages="../../org.eclipse.papyrus.infra.core.architecture/model/Architecture.genmodel#//architecture ../../org.eclipse.papyrus.infra.constraints/Model/Constraints.genmodel#//constraints ../../org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore ../../org.eclipse.papyrus.infra.types/model/ElementTypesConfigurations.genmodel#//types ../../org.eclipse.papyrus.infra.nattable.model/model/nattable.genmodel#//nattable ../../org.eclipse.papyrus.infra.architecture.representation/model/Representation.genmodel#//representation"
operationReflection="true" importOrganizing="true">
<foreignModel>NattableRepresentation.ecore</foreignModel>
<genPackages prefix="Representation" basePackage="org.eclipse.papyrus.infra.nattable"
disposableProviderFactory="true" childCreationExtenders="true" ecorePackage="NattableRepresentation.ecore#/">
- <genClasses ecoreClass="NattableRepresentation.ecore#//PapyrusSyncTable"/>
<genClasses ecoreClass="NattableRepresentation.ecore#//PapyrusTable">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute NattableRepresentation.ecore#//PapyrusTable/configuration"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EReference NattableRepresentation.ecore#//PapyrusTable/configuration"/>
</genClasses>
</genPackages>
</genmodel:GenModel>
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/PapyrusSyncTable.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/PapyrusSyncTable.java
deleted file mode 100644
index ef48048cc97..00000000000
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/PapyrusSyncTable.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
- * Copyright (c) 2017 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:
- * Maged Elaasar - Initial API and implementation
- *
- *
- */
-package org.eclipse.papyrus.infra.nattable.representation;
-
-import org.eclipse.papyrus.infra.architecture.representation.PapyrusRepresentationKind;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Papyrus Sync Table</b></em>'.
- * <!-- end-user-doc -->
- *
- *
- * @see org.eclipse.papyrus.infra.nattable.representation.RepresentationPackage#getPapyrusSyncTable()
- * @model
- * @generated
- */
-public interface PapyrusSyncTable extends PapyrusRepresentationKind {
-} // PapyrusSyncTable
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/PapyrusTable.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/PapyrusTable.java
index 087a6804b03..a2031d8c15b 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/PapyrusTable.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/PapyrusTable.java
@@ -14,6 +14,7 @@
package org.eclipse.papyrus.infra.nattable.representation;
import org.eclipse.papyrus.infra.architecture.representation.PapyrusRepresentationKind;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.TableConfiguration;
/**
* <!-- begin-user-doc -->
@@ -33,29 +34,29 @@ import org.eclipse.papyrus.infra.architecture.representation.PapyrusRepresentati
*/
public interface PapyrusTable extends PapyrusRepresentationKind {
/**
- * Returns the value of the '<em><b>Configuration</b></em>' attribute.
+ * Returns the value of the '<em><b>Configuration</b></em>' reference.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Configuration</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
- * @return the value of the '<em>Configuration</em>' attribute.
- * @see #setConfiguration(String)
+ * @return the value of the '<em>Configuration</em>' reference.
+ * @see #setConfiguration(TableConfiguration)
* @see org.eclipse.papyrus.infra.nattable.representation.RepresentationPackage#getPapyrusTable_Configuration()
* @model required="true"
* @generated
*/
- String getConfiguration();
+ TableConfiguration getConfiguration();
/**
- * Sets the value of the '{@link org.eclipse.papyrus.infra.nattable.representation.PapyrusTable#getConfiguration <em>Configuration</em>}' attribute.
+ * Sets the value of the '{@link org.eclipse.papyrus.infra.nattable.representation.PapyrusTable#getConfiguration <em>Configuration</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @param value the new value of the '<em>Configuration</em>' attribute.
+ * @param value the new value of the '<em>Configuration</em>' reference.
* @see #getConfiguration()
* @generated
*/
- void setConfiguration(String value);
+ void setConfiguration(TableConfiguration value);
} // PapyrusTable
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/RepresentationFactory.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/RepresentationFactory.java
index bc030866f65..f8ede0cef0a 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/RepresentationFactory.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/RepresentationFactory.java
@@ -33,15 +33,6 @@ public interface RepresentationFactory extends EFactory {
RepresentationFactory eINSTANCE = org.eclipse.papyrus.infra.nattable.representation.impl.RepresentationFactoryImpl.init();
/**
- * Returns a new object of class '<em>Papyrus Sync Table</em>'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return a new object of class '<em>Papyrus Sync Table</em>'.
- * @generated
- */
- PapyrusSyncTable createPapyrusSyncTable();
-
- /**
* Returns a new object of class '<em>Papyrus Table</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/RepresentationPackage.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/RepresentationPackage.java
index 47f3fa52203..1468b11888b 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/RepresentationPackage.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/RepresentationPackage.java
@@ -13,9 +13,9 @@
*/
package org.eclipse.papyrus.infra.nattable.representation;
-import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
/**
* <!-- begin-user-doc -->
@@ -67,124 +67,6 @@ public interface RepresentationPackage extends EPackage {
RepresentationPackage eINSTANCE = org.eclipse.papyrus.infra.nattable.representation.impl.RepresentationPackageImpl.init();
/**
- * The meta object id for the '{@link org.eclipse.papyrus.infra.nattable.representation.impl.PapyrusSyncTableImpl <em>Papyrus Sync Table</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.papyrus.infra.nattable.representation.impl.PapyrusSyncTableImpl
- * @see org.eclipse.papyrus.infra.nattable.representation.impl.RepresentationPackageImpl#getPapyrusSyncTable()
- * @generated
- */
- int PAPYRUS_SYNC_TABLE = 0;
-
- /**
- * The feature id for the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int PAPYRUS_SYNC_TABLE__NAME = org.eclipse.papyrus.infra.architecture.representation.RepresentationPackage.PAPYRUS_REPRESENTATION_KIND__NAME;
-
- /**
- * The feature id for the '<em><b>Description</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int PAPYRUS_SYNC_TABLE__DESCRIPTION = org.eclipse.papyrus.infra.architecture.representation.RepresentationPackage.PAPYRUS_REPRESENTATION_KIND__DESCRIPTION;
-
- /**
- * The feature id for the '<em><b>Qualified Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int PAPYRUS_SYNC_TABLE__QUALIFIED_NAME = org.eclipse.papyrus.infra.architecture.representation.RepresentationPackage.PAPYRUS_REPRESENTATION_KIND__QUALIFIED_NAME;
-
- /**
- * The feature id for the '<em><b>Language</b></em>' container reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int PAPYRUS_SYNC_TABLE__LANGUAGE = org.eclipse.papyrus.infra.architecture.representation.RepresentationPackage.PAPYRUS_REPRESENTATION_KIND__LANGUAGE;
-
- /**
- * The feature id for the '<em><b>Concerns</b></em>' reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int PAPYRUS_SYNC_TABLE__CONCERNS = org.eclipse.papyrus.infra.architecture.representation.RepresentationPackage.PAPYRUS_REPRESENTATION_KIND__CONCERNS;
-
- /**
- * The feature id for the '<em><b>Icon</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int PAPYRUS_SYNC_TABLE__ICON = org.eclipse.papyrus.infra.architecture.representation.RepresentationPackage.PAPYRUS_REPRESENTATION_KIND__ICON;
-
- /**
- * The feature id for the '<em><b>Parent</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int PAPYRUS_SYNC_TABLE__PARENT = org.eclipse.papyrus.infra.architecture.representation.RepresentationPackage.PAPYRUS_REPRESENTATION_KIND__PARENT;
-
- /**
- * The feature id for the '<em><b>Model Rules</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int PAPYRUS_SYNC_TABLE__MODEL_RULES = org.eclipse.papyrus.infra.architecture.representation.RepresentationPackage.PAPYRUS_REPRESENTATION_KIND__MODEL_RULES;
-
- /**
- * The feature id for the '<em><b>Owning Rules</b></em>' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int PAPYRUS_SYNC_TABLE__OWNING_RULES = org.eclipse.papyrus.infra.architecture.representation.RepresentationPackage.PAPYRUS_REPRESENTATION_KIND__OWNING_RULES;
-
- /**
- * The feature id for the '<em><b>Implementation ID</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int PAPYRUS_SYNC_TABLE__IMPLEMENTATION_ID = org.eclipse.papyrus.infra.architecture.representation.RepresentationPackage.PAPYRUS_REPRESENTATION_KIND__IMPLEMENTATION_ID;
-
- /**
- * The number of structural features of the '<em>Papyrus Sync Table</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int PAPYRUS_SYNC_TABLE_FEATURE_COUNT = org.eclipse.papyrus.infra.architecture.representation.RepresentationPackage.PAPYRUS_REPRESENTATION_KIND_FEATURE_COUNT + 0;
-
- /**
- * The number of operations of the '<em>Papyrus Sync Table</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int PAPYRUS_SYNC_TABLE_OPERATION_COUNT = org.eclipse.papyrus.infra.architecture.representation.RepresentationPackage.PAPYRUS_REPRESENTATION_KIND_OPERATION_COUNT + 0;
-
- /**
* The meta object id for the '{@link org.eclipse.papyrus.infra.nattable.representation.impl.PapyrusTableImpl <em>Papyrus Table</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -192,7 +74,7 @@ public interface RepresentationPackage extends EPackage {
* @see org.eclipse.papyrus.infra.nattable.representation.impl.RepresentationPackageImpl#getPapyrusTable()
* @generated
*/
- int PAPYRUS_TABLE = 1;
+ int PAPYRUS_TABLE = 0;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
@@ -285,7 +167,7 @@ public interface RepresentationPackage extends EPackage {
int PAPYRUS_TABLE__IMPLEMENTATION_ID = org.eclipse.papyrus.infra.architecture.representation.RepresentationPackage.PAPYRUS_REPRESENTATION_KIND__IMPLEMENTATION_ID;
/**
- * The feature id for the '<em><b>Configuration</b></em>' attribute.
+ * The feature id for the '<em><b>Configuration</b></em>' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
@@ -313,16 +195,6 @@ public interface RepresentationPackage extends EPackage {
/**
- * Returns the meta object for class '{@link org.eclipse.papyrus.infra.nattable.representation.PapyrusSyncTable <em>Papyrus Sync Table</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Papyrus Sync Table</em>'.
- * @see org.eclipse.papyrus.infra.nattable.representation.PapyrusSyncTable
- * @generated
- */
- EClass getPapyrusSyncTable();
-
- /**
* Returns the meta object for class '{@link org.eclipse.papyrus.infra.nattable.representation.PapyrusTable <em>Papyrus Table</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -333,15 +205,15 @@ public interface RepresentationPackage extends EPackage {
EClass getPapyrusTable();
/**
- * Returns the meta object for the attribute '{@link org.eclipse.papyrus.infra.nattable.representation.PapyrusTable#getConfiguration <em>Configuration</em>}'.
+ * Returns the meta object for the reference '{@link org.eclipse.papyrus.infra.nattable.representation.PapyrusTable#getConfiguration <em>Configuration</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Configuration</em>'.
+ * @return the meta object for the reference '<em>Configuration</em>'.
* @see org.eclipse.papyrus.infra.nattable.representation.PapyrusTable#getConfiguration()
* @see #getPapyrusTable()
* @generated
*/
- EAttribute getPapyrusTable_Configuration();
+ EReference getPapyrusTable_Configuration();
/**
* Returns the factory that creates the instances of the model.
@@ -367,16 +239,6 @@ public interface RepresentationPackage extends EPackage {
*/
interface Literals {
/**
- * The meta object literal for the '{@link org.eclipse.papyrus.infra.nattable.representation.impl.PapyrusSyncTableImpl <em>Papyrus Sync Table</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.papyrus.infra.nattable.representation.impl.PapyrusSyncTableImpl
- * @see org.eclipse.papyrus.infra.nattable.representation.impl.RepresentationPackageImpl#getPapyrusSyncTable()
- * @generated
- */
- EClass PAPYRUS_SYNC_TABLE = eINSTANCE.getPapyrusSyncTable();
-
- /**
* The meta object literal for the '{@link org.eclipse.papyrus.infra.nattable.representation.impl.PapyrusTableImpl <em>Papyrus Table</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -387,12 +249,12 @@ public interface RepresentationPackage extends EPackage {
EClass PAPYRUS_TABLE = eINSTANCE.getPapyrusTable();
/**
- * The meta object literal for the '<em><b>Configuration</b></em>' attribute feature.
+ * The meta object literal for the '<em><b>Configuration</b></em>' reference feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
- EAttribute PAPYRUS_TABLE__CONFIGURATION = eINSTANCE.getPapyrusTable_Configuration();
+ EReference PAPYRUS_TABLE__CONFIGURATION = eINSTANCE.getPapyrusTable_Configuration();
}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/impl/PapyrusSyncTableImpl.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/impl/PapyrusSyncTableImpl.java
deleted file mode 100644
index 34cb0fa3b34..00000000000
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/impl/PapyrusSyncTableImpl.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * Copyright (c) 2017 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:
- * Maged Elaasar - Initial API and implementation
- *
- *
- */
-package org.eclipse.papyrus.infra.nattable.representation.impl;
-
-import org.eclipse.emf.ecore.EClass;
-
-import org.eclipse.papyrus.infra.architecture.representation.impl.PapyrusRepresentationKindImpl;
-
-import org.eclipse.papyrus.infra.nattable.representation.PapyrusSyncTable;
-import org.eclipse.papyrus.infra.nattable.representation.RepresentationPackage;
-
-/**
- * <!-- begin-user-doc -->
- * An implementation of the model object '<em><b>Papyrus Sync Table</b></em>'.
- * <!-- end-user-doc -->
- *
- * @generated
- */
-public class PapyrusSyncTableImpl extends PapyrusRepresentationKindImpl implements PapyrusSyncTable {
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected PapyrusSyncTableImpl() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return RepresentationPackage.Literals.PAPYRUS_SYNC_TABLE;
- }
-
-} //PapyrusSyncTableImpl
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/impl/PapyrusTableImpl.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/impl/PapyrusTableImpl.java
index 86ed00363a5..7911918fe2c 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/impl/PapyrusTableImpl.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/impl/PapyrusTableImpl.java
@@ -17,10 +17,12 @@ import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.papyrus.infra.architecture.representation.impl.PapyrusRepresentationKindImpl;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.TableConfiguration;
import org.eclipse.papyrus.infra.nattable.representation.PapyrusTable;
import org.eclipse.papyrus.infra.nattable.representation.RepresentationPackage;
@@ -39,32 +41,32 @@ import org.eclipse.papyrus.infra.nattable.representation.RepresentationPackage;
*/
public class PapyrusTableImpl extends PapyrusRepresentationKindImpl implements PapyrusTable {
/**
- * The default value of the '{@link #getConfiguration() <em>Configuration</em>}' attribute.
+ * The cached value of the '{@link #getConfiguration() <em>Configuration</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getConfiguration()
* @generated
* @ordered
*/
- protected static final String CONFIGURATION_EDEFAULT = null;
+ protected TableConfiguration configuration;
/**
- * The cached value of the '{@link #getConfiguration() <em>Configuration</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @see #getConfiguration()
* @generated
- * @ordered
*/
- protected String configuration = CONFIGURATION_EDEFAULT;
+ protected PapyrusTableImpl() {
+ super();
+ }
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
- protected PapyrusTableImpl() {
- super();
+ @Override
+ protected EClass eStaticClass() {
+ return RepresentationPackage.Literals.PAPYRUS_TABLE;
}
/**
@@ -72,9 +74,16 @@ public class PapyrusTableImpl extends PapyrusRepresentationKindImpl implements P
* <!-- end-user-doc -->
* @generated
*/
- @Override
- protected EClass eStaticClass() {
- return RepresentationPackage.Literals.PAPYRUS_TABLE;
+ public TableConfiguration getConfiguration() {
+ if (configuration != null && configuration.eIsProxy()) {
+ InternalEObject oldConfiguration = (InternalEObject)configuration;
+ configuration = (TableConfiguration)eResolveProxy(oldConfiguration);
+ if (configuration != oldConfiguration) {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, RepresentationPackage.PAPYRUS_TABLE__CONFIGURATION, oldConfiguration, configuration));
+ }
+ }
+ return configuration;
}
/**
@@ -82,7 +91,7 @@ public class PapyrusTableImpl extends PapyrusRepresentationKindImpl implements P
* <!-- end-user-doc -->
* @generated
*/
- public String getConfiguration() {
+ public TableConfiguration basicGetConfiguration() {
return configuration;
}
@@ -91,8 +100,8 @@ public class PapyrusTableImpl extends PapyrusRepresentationKindImpl implements P
* <!-- end-user-doc -->
* @generated
*/
- public void setConfiguration(String newConfiguration) {
- String oldConfiguration = configuration;
+ public void setConfiguration(TableConfiguration newConfiguration) {
+ TableConfiguration oldConfiguration = configuration;
configuration = newConfiguration;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, RepresentationPackage.PAPYRUS_TABLE__CONFIGURATION, oldConfiguration, configuration));
@@ -107,7 +116,8 @@ public class PapyrusTableImpl extends PapyrusRepresentationKindImpl implements P
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case RepresentationPackage.PAPYRUS_TABLE__CONFIGURATION:
- return getConfiguration();
+ if (resolve) return getConfiguration();
+ return basicGetConfiguration();
}
return super.eGet(featureID, resolve, coreType);
}
@@ -121,7 +131,7 @@ public class PapyrusTableImpl extends PapyrusRepresentationKindImpl implements P
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case RepresentationPackage.PAPYRUS_TABLE__CONFIGURATION:
- setConfiguration((String)newValue);
+ setConfiguration((TableConfiguration)newValue);
return;
}
super.eSet(featureID, newValue);
@@ -136,7 +146,7 @@ public class PapyrusTableImpl extends PapyrusRepresentationKindImpl implements P
public void eUnset(int featureID) {
switch (featureID) {
case RepresentationPackage.PAPYRUS_TABLE__CONFIGURATION:
- setConfiguration(CONFIGURATION_EDEFAULT);
+ setConfiguration((TableConfiguration)null);
return;
}
super.eUnset(featureID);
@@ -151,25 +161,9 @@ public class PapyrusTableImpl extends PapyrusRepresentationKindImpl implements P
public boolean eIsSet(int featureID) {
switch (featureID) {
case RepresentationPackage.PAPYRUS_TABLE__CONFIGURATION:
- return CONFIGURATION_EDEFAULT == null ? configuration != null : !CONFIGURATION_EDEFAULT.equals(configuration);
+ return configuration != null;
}
return super.eIsSet(featureID);
}
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy()) return super.toString();
-
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (configuration: ");
- result.append(configuration);
- result.append(')');
- return result.toString();
- }
-
} //PapyrusTableImpl
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/impl/RepresentationFactoryImpl.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/impl/RepresentationFactoryImpl.java
index c41263447e5..3fe13d73792 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/impl/RepresentationFactoryImpl.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/impl/RepresentationFactoryImpl.java
@@ -67,7 +67,6 @@ public class RepresentationFactoryImpl extends EFactoryImpl implements Represent
@Override
public EObject create(EClass eClass) {
switch (eClass.getClassifierID()) {
- case RepresentationPackage.PAPYRUS_SYNC_TABLE: return createPapyrusSyncTable();
case RepresentationPackage.PAPYRUS_TABLE: return createPapyrusTable();
default:
throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
@@ -79,16 +78,6 @@ public class RepresentationFactoryImpl extends EFactoryImpl implements Represent
* <!-- end-user-doc -->
* @generated
*/
- public PapyrusSyncTable createPapyrusSyncTable() {
- PapyrusSyncTableImpl papyrusSyncTable = new PapyrusSyncTableImpl();
- return papyrusSyncTable;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
public PapyrusTable createPapyrusTable() {
PapyrusTableImpl papyrusTable = new PapyrusTableImpl();
return papyrusTable;
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/impl/RepresentationPackageImpl.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/impl/RepresentationPackageImpl.java
index 8bf6f484fa0..0812859baeb 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/impl/RepresentationPackageImpl.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/impl/RepresentationPackageImpl.java
@@ -13,15 +13,17 @@
*/
package org.eclipse.papyrus.infra.nattable.representation.impl;
-import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.emf.ecore.impl.EPackageImpl;
import org.eclipse.papyrus.infra.constraints.ConstraintsPackage;
import org.eclipse.papyrus.infra.core.architecture.ArchitecturePackage;
-import org.eclipse.papyrus.infra.nattable.representation.PapyrusSyncTable;
+import org.eclipse.papyrus.infra.nattable.model.nattable.NattablePackage;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.NattableconfigurationPackage;
import org.eclipse.papyrus.infra.nattable.representation.PapyrusTable;
import org.eclipse.papyrus.infra.nattable.representation.RepresentationFactory;
import org.eclipse.papyrus.infra.nattable.representation.RepresentationPackage;
@@ -39,13 +41,6 @@ public class RepresentationPackageImpl extends EPackageImpl implements Represent
* <!-- end-user-doc -->
* @generated
*/
- private EClass papyrusSyncTableEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
private EClass papyrusTableEClass = null;
/**
@@ -97,7 +92,9 @@ public class RepresentationPackageImpl extends EPackageImpl implements Represent
// Initialize simple dependencies
ArchitecturePackage.eINSTANCE.eClass();
ConstraintsPackage.eINSTANCE.eClass();
+ EcorePackage.eINSTANCE.eClass();
ElementTypesConfigurationsPackage.eINSTANCE.eClass();
+ NattablePackage.eINSTANCE.eClass();
org.eclipse.papyrus.infra.architecture.representation.RepresentationPackage.eINSTANCE.eClass();
// Create package meta-data objects
@@ -120,15 +117,6 @@ public class RepresentationPackageImpl extends EPackageImpl implements Represent
* <!-- end-user-doc -->
* @generated
*/
- public EClass getPapyrusSyncTable() {
- return papyrusSyncTableEClass;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
public EClass getPapyrusTable() {
return papyrusTableEClass;
}
@@ -138,8 +126,8 @@ public class RepresentationPackageImpl extends EPackageImpl implements Represent
* <!-- end-user-doc -->
* @generated
*/
- public EAttribute getPapyrusTable_Configuration() {
- return (EAttribute)papyrusTableEClass.getEStructuralFeatures().get(0);
+ public EReference getPapyrusTable_Configuration() {
+ return (EReference)papyrusTableEClass.getEStructuralFeatures().get(0);
}
/**
@@ -170,10 +158,8 @@ public class RepresentationPackageImpl extends EPackageImpl implements Represent
isCreated = true;
// Create classes and their features
- papyrusSyncTableEClass = createEClass(PAPYRUS_SYNC_TABLE);
-
papyrusTableEClass = createEClass(PAPYRUS_TABLE);
- createEAttribute(papyrusTableEClass, PAPYRUS_TABLE__CONFIGURATION);
+ createEReference(papyrusTableEClass, PAPYRUS_TABLE__CONFIGURATION);
}
/**
@@ -201,20 +187,18 @@ public class RepresentationPackageImpl extends EPackageImpl implements Represent
// Obtain other dependent packages
org.eclipse.papyrus.infra.architecture.representation.RepresentationPackage theRepresentationPackage_1 = (org.eclipse.papyrus.infra.architecture.representation.RepresentationPackage)EPackage.Registry.INSTANCE.getEPackage(org.eclipse.papyrus.infra.architecture.representation.RepresentationPackage.eNS_URI);
+ NattableconfigurationPackage theNattableconfigurationPackage = (NattableconfigurationPackage)EPackage.Registry.INSTANCE.getEPackage(NattableconfigurationPackage.eNS_URI);
// Create type parameters
// Set bounds for type parameters
// Add supertypes to classes
- papyrusSyncTableEClass.getESuperTypes().add(theRepresentationPackage_1.getPapyrusRepresentationKind());
papyrusTableEClass.getESuperTypes().add(theRepresentationPackage_1.getPapyrusRepresentationKind());
// Initialize classes, features, and operations; add parameters
- initEClass(papyrusSyncTableEClass, PapyrusSyncTable.class, "PapyrusSyncTable", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
-
initEClass(papyrusTableEClass, PapyrusTable.class, "PapyrusTable", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getPapyrusTable_Configuration(), ecorePackage.getEString(), "configuration", null, 1, 1, PapyrusTable.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getPapyrusTable_Configuration(), theNattableconfigurationPackage.getTableConfiguration(), null, "configuration", null, 1, 1, PapyrusTable.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
// Create resource
createResource(eNS_URI);
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/util/RepresentationAdapterFactory.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/util/RepresentationAdapterFactory.java
index f47445a05bf..7de3bf00e19 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/util/RepresentationAdapterFactory.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/util/RepresentationAdapterFactory.java
@@ -84,10 +84,6 @@ public class RepresentationAdapterFactory extends AdapterFactoryImpl {
protected RepresentationSwitch<Adapter> modelSwitch =
new RepresentationSwitch<Adapter>() {
@Override
- public Adapter casePapyrusSyncTable(PapyrusSyncTable object) {
- return createPapyrusSyncTableAdapter();
- }
- @Override
public Adapter casePapyrusTable(PapyrusTable object) {
return createPapyrusTableAdapter();
}
@@ -124,20 +120,6 @@ public class RepresentationAdapterFactory extends AdapterFactoryImpl {
/**
- * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.nattable.representation.PapyrusSyncTable <em>Papyrus Sync Table</em>}'.
- * <!-- begin-user-doc -->
- * This default implementation returns null so that we can easily ignore cases;
- * it's useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.papyrus.infra.nattable.representation.PapyrusSyncTable
- * @generated
- */
- public Adapter createPapyrusSyncTableAdapter() {
- return null;
- }
-
- /**
* Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.nattable.representation.PapyrusTable <em>Papyrus Table</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/util/RepresentationSwitch.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/util/RepresentationSwitch.java
index 1ac0e469c48..ca3b507d880 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/util/RepresentationSwitch.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.representation/src-gen/org/eclipse/papyrus/infra/nattable/representation/util/RepresentationSwitch.java
@@ -82,15 +82,6 @@ public class RepresentationSwitch<T> extends Switch<T> {
@Override
protected T doSwitch(int classifierID, EObject theEObject) {
switch (classifierID) {
- case RepresentationPackage.PAPYRUS_SYNC_TABLE: {
- PapyrusSyncTable papyrusSyncTable = (PapyrusSyncTable)theEObject;
- T result = casePapyrusSyncTable(papyrusSyncTable);
- if (result == null) result = casePapyrusRepresentationKind(papyrusSyncTable);
- if (result == null) result = caseRepresentationKind(papyrusSyncTable);
- if (result == null) result = caseADElement(papyrusSyncTable);
- if (result == null) result = defaultCase(theEObject);
- return result;
- }
case RepresentationPackage.PAPYRUS_TABLE: {
PapyrusTable papyrusTable = (PapyrusTable)theEObject;
T result = casePapyrusTable(papyrusTable);
@@ -105,21 +96,6 @@ public class RepresentationSwitch<T> extends Switch<T> {
}
/**
- * Returns the result of interpreting the object as an instance of '<em>Papyrus Sync Table</em>'.
- * <!-- begin-user-doc -->
- * This implementation returns null;
- * returning a non-null result will terminate the switch.
- * <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Papyrus Sync Table</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T casePapyrusSyncTable(PapyrusSyncTable object) {
- return null;
- }
-
- /**
* Returns the result of interpreting the object as an instance of '<em>Papyrus Table</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.config/resources/viewpage.nattableconfiguration b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.config/resources/viewpage.nattableconfiguration
index 32d6a1b8580..9c25b5d989e 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.config/resources/viewpage.nattableconfiguration
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.views.config/resources/viewpage.nattableconfiguration
@@ -1,19 +1,19 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<nattableconfiguration:TableConfiguration xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:nattableaxis="http://www.eclipse.org/papyrus/nattable/model/table/nattableaxis" xmlns:nattableaxisconfiguration="http://www.eclipse.org/papyrus/nattable/model/table/nattableaxisconfiguration" xmlns:nattableaxisprovider="http://www.eclipse.org/papyrus/nattable/model/table/nattableaxisprovider" xmlns:nattableconfiguration="http://www.eclipse.org/papyrus/nattable/model/nattableconfiguration" xmlns:nattablelabelprovider="http://www.eclipse.org/papyrus/nattable/model/table/nattablecontentprovider" xmlns:nattabletester="http://www.eclipse.org/papyrus/nattable/model/table/nattabletester" description="This table lists all pages (editors) which have the same context than the table of views (or children of the context)" name="TableOfViews" type="PapyrusViewsTable" iconPath="platform:/plugin/org.eclipse.papyrus.infra.nattable.views.config/icons/nattablepageeditor.png" defaultRowAxisProvider="//@rowAxisProviders.0" defaultColumnAxisProvider="//@columnAxisProviders.0">
- <creationTester xsi:type="nattabletester:JavaTableTester" tester="org.eclipse.papyrus.infra.nattable.views.config.creation.tester"/>
- <rowHeaderAxisConfiguration xsi:type="nattableaxisconfiguration:TableHeaderAxisConfiguration" indexStyle="NUMERIC">
- <ownedLabelConfigurations xsi:type="nattablelabelprovider:ObjectLabelProviderConfiguration"/>
- <axisManagers xsi:type="nattableaxisconfiguration:AxisManagerRepresentation" axisManagerId="org.eclipse.papyrus.infra.nattable.pagelist.contents.axis.manager" labelProviderContext="org.eclipse.papyrus.infra.nattable.header.labelprovider" headerLabelConfiguration="//@rowHeaderAxisConfiguration/@ownedLabelConfigurations.0"/>
- </rowHeaderAxisConfiguration>
- <columnHeaderAxisConfiguration xsi:type="nattableaxisconfiguration:TableHeaderAxisConfiguration">
- <ownedLabelConfigurations xsi:type="nattablelabelprovider:FeatureLabelProviderConfiguration"/>
- <axisManagers xsi:type="nattableaxisconfiguration:AxisManagerRepresentation" axisManagerId="org.eclipse.papyrus.infra.nattable.page.view.feature.axis.manager" labelProviderContext="org.eclipse.papyrus.infra.nattable.header.feature.labelprovider"/>
- </columnHeaderAxisConfiguration>
- <columnAxisProviders xsi:type="nattableaxisprovider:SlaveObjectAxisProvider" description="Provides the features of the views" name="Papyrus Views feature provider">
- <axis xsi:type="nattableaxis:FeatureIdAxis" manager="//@columnHeaderAxisConfiguration/@axisManagers.0" element="nattable_editor_pages:/name"/>
- <axis xsi:type="nattableaxis:FeatureIdAxis" manager="//@columnHeaderAxisConfiguration/@axisManagers.0" element="nattable_editor_pages:/context"/>
- <axis xsi:type="nattableaxis:FeatureIdAxis" manager="//@columnHeaderAxisConfiguration/@axisManagers.0" element="nattable_editor_pages:/isOpen"/>
- <axis xsi:type="nattableaxis:FeatureIdAxis" manager="//@columnHeaderAxisConfiguration/@axisManagers.0" element="nattable_editor_pages:/type"/>
- </columnAxisProviders>
- <rowAxisProviders xsi:type="nattableaxisprovider:MasterObjectAxisProvider"/>
-</nattableconfiguration:TableConfiguration>
+<?xml version="1.0" encoding="UTF-8"?>
+<nattableconfiguration:TableConfiguration xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:nattableaxis="http://www.eclipse.org/papyrus/nattable/model/table/nattableaxis" xmlns:nattableaxisprovider="http://www.eclipse.org/papyrus/nattable/model/table/nattableaxisprovider" xmlns:nattableconfiguration="http://www.eclipse.org/papyrus/nattable/model/nattableconfiguration" xmlns:nattablelabelprovider="http://www.eclipse.org/papyrus/nattable/model/table/nattablecontentprovider" xmlns:nattabletester="http://www.eclipse.org/papyrus/nattable/model/table/nattabletester" description="This table lists all pages (editors) which have the same context than the table of views (or children of the context)" name="TableOfViews" type="PapyrusViewsTable" iconPath="platform:/plugin/org.eclipse.papyrus.infra.nattable.views.config/icons/nattablepageeditor.png" defaultRowAxisProvider="//@rowAxisProviders.0" defaultColumnAxisProvider="//@columnAxisProviders.0">
+ <creationTester xsi:type="nattabletester:JavaTableTester" tester="org.eclipse.papyrus.infra.nattable.views.config.creation.tester"/>
+ <rowHeaderAxisConfiguration indexStyle="NUMERIC">
+ <ownedLabelConfigurations xsi:type="nattablelabelprovider:ObjectLabelProviderConfiguration"/>
+ <axisManagers axisManagerId="org.eclipse.papyrus.infra.nattable.pagelist.contents.axis.manager" labelProviderContext="org.eclipse.papyrus.infra.nattable.header.labelprovider" headerLabelConfiguration="//@rowHeaderAxisConfiguration/@ownedLabelConfigurations.0"/>
+ </rowHeaderAxisConfiguration>
+ <columnHeaderAxisConfiguration>
+ <ownedLabelConfigurations xsi:type="nattablelabelprovider:FeatureLabelProviderConfiguration"/>
+ <axisManagers axisManagerId="org.eclipse.papyrus.infra.nattable.page.view.feature.axis.manager" labelProviderContext="org.eclipse.papyrus.infra.nattable.header.feature.labelprovider"/>
+ </columnHeaderAxisConfiguration>
+ <columnAxisProviders xsi:type="nattableaxisprovider:SlaveObjectAxisProvider" description="Provides the features of the views" name="Papyrus Views feature provider">
+ <axis xsi:type="nattableaxis:FeatureIdAxis" manager="//@columnHeaderAxisConfiguration/@axisManagers.0" element="nattable_editor_pages:/name"/>
+ <axis xsi:type="nattableaxis:FeatureIdAxis" manager="//@columnHeaderAxisConfiguration/@axisManagers.0" element="nattable_editor_pages:/context"/>
+ <axis xsi:type="nattableaxis:FeatureIdAxis" manager="//@columnHeaderAxisConfiguration/@axisManagers.0" element="nattable_editor_pages:/isOpen"/>
+ <axis xsi:type="nattableaxis:FeatureIdAxis" manager="//@columnHeaderAxisConfiguration/@axisManagers.0" element="nattable_editor_pages:/type"/>
+ </columnAxisProviders>
+ <rowAxisProviders xsi:type="nattableaxisprovider:MasterObjectAxisProvider"/>
+</nattableconfiguration:TableConfiguration>
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/nattableconfiguration/NattableConfigurationRegistry.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/nattableconfiguration/NattableConfigurationRegistry.java
index d237c76a3fb..a75795dd924 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/nattableconfiguration/NattableConfigurationRegistry.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/nattableconfiguration/NattableConfigurationRegistry.java
@@ -1,158 +1,158 @@
-/*****************************************************************************
- * 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.nattableconfiguration;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IContributor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-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.papyrus.infra.nattable.Activator;
-import org.eclipse.papyrus.infra.nattable.messages.Messages;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.TableConfiguration;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattabletester.AbstractTableTester;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattabletester.JavaTableTester;
-import org.eclipse.papyrus.infra.nattable.tester.ITableTester;
-import org.eclipse.papyrus.infra.nattable.tester.TableTesterRegistry;
-
-
-public class NattableConfigurationRegistry {
-
- public static final String EXTENSION_ID = "org.eclipse.papyrus.infra.nattable.configuration"; //$NON-NLS-1$
-
- public static final String FILE_ATTRIBUTE = "file"; //$NON-NLS-1$
-
- /**
- * the table configuration identified by the type of the table
- */
- private Map<String, TableConfiguration> configsURI;
-
- private ResourceSet resourceSet;
-
- public static final NattableConfigurationRegistry INSTANCE = new NattableConfigurationRegistry();
-
- private NattableConfigurationRegistry() {
- // to prevent instantiation
- initFields();
- }
-
-
- /**
- *
- * @return
- * the list of the known table configuration
- */
- public Collection<TableConfiguration> getTableConfigurations() {
- return configsURI.values();
- }
-
- /**
- *
- *
- * @param newTableConfiguration
- * @return
- */
- public void registerTableConfiguration(final TableConfiguration newTableConfiguration) {
- configsURI.put(newTableConfiguration.getType(), newTableConfiguration);
- }
-
-
- /**
- *
- * @param tableType
- * the type of the table
- * @return
- * the URI of the configuration to use for this table or <code>null</code> if not found
- */
- public URI getConfigurationURI(final String tableType) {
- return this.configsURI.get(tableType).eResource().getURI();
- }
-
- /**
- * inits the fields of the class
- */
- private void initFields() {
- if (this.configsURI == null) {
- this.configsURI = new HashMap<String, TableConfiguration>();
- final IConfigurationElement[] configElements = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_ID);
- this.resourceSet = new ResourceSetImpl();
- for (final IConfigurationElement iConfigurationElement : configElements) {
- Object file = iConfigurationElement.getAttribute(FILE_ATTRIBUTE);
- IContributor contributor = iConfigurationElement.getContributor();
- // we build the uri for the file
- URI uri = URI.createPlatformPluginURI(contributor.getName() + "/" + file.toString(), true);//$NON-NLS-1$ //TODO : maybe a best way?
- Resource res = this.resourceSet.getResource(uri, true);
- if (res.getContents().size() > 0) {
- EObject first = res.getContents().get(0);
- if (first instanceof TableConfiguration) {
- String type = ((TableConfiguration) first).getType();
- if (type != null) {
- if (!this.configsURI.containsKey(type)) {
- this.configsURI.put(type, (TableConfiguration) first);
- } else {
- Activator.log.warn(String.format(Messages.NattableConfigurationRegistry_SeveralConfigurationsWithTheSameType, type));
- }
- } else {
- Activator.log.warn(String.format(Messages.NattableConfigurationRegistry_NoTypeForAConfiguration, uri));
- }
- } else {
- Activator.log.warn(String.format(Messages.NattableConfigurationRegistry_TableConfigurationNotFound, uri));
- }
- } else {
- Activator.log.warn(String.format(Messages.NattableConfigurationRegistry_ResourceEmpty, uri));
- }
- }
- }
- }
-
- /**
- *
- * @param tableType
- * the table type to create
- * @param tableContext
- * the table context
- * @return
- * a status {@link IStatus#OK} when wa can create the table or {@link IStatus#ERROR} if not
- */
- public IStatus canCreateTable(final String tableType, final Object tableContext) {
- TableConfiguration config = this.configsURI.get(tableType);
- if (config != null) {
- AbstractTableTester tester = config.getCreationTester();
- if (tester instanceof JavaTableTester) {
- final String testerId = ((JavaTableTester) tester).getTester();
- final ITableTester myTester = TableTesterRegistry.INSTANCE.getTableTester(testerId);
- if (myTester != null) {
- return myTester.isAllowed(tableContext);
- } else {
- return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.NattableConfigurationRegistry_TesterNotFound);
- }
- } else if (tester == null) {
- return new Status(IStatus.OK, Activator.PLUGIN_ID, Messages.NattableConfigurationRegistry_NoTesterForThisConfiguration);
- } else {
- return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.NattableConfigurationRegistry_TesterNotManager);
- }
- }
- return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.NattableConfigurationRegistry_ConfigurationNotFound);
- }
-
-}
+/*****************************************************************************
+ * 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.nattableconfiguration;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IContributor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+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.papyrus.infra.nattable.Activator;
+import org.eclipse.papyrus.infra.nattable.messages.Messages;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.TableConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattabletester.AbstractTableTester;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattabletester.JavaTableTester;
+import org.eclipse.papyrus.infra.nattable.tester.ITableTester;
+import org.eclipse.papyrus.infra.nattable.tester.TableTesterRegistry;
+
+
+public class NattableConfigurationRegistry {
+
+ public static final String EXTENSION_ID = "org.eclipse.papyrus.infra.nattable.configuration"; //$NON-NLS-1$
+
+ public static final String FILE_ATTRIBUTE = "file"; //$NON-NLS-1$
+
+ /**
+ * the table configuration identified by the type of the table
+ */
+ private Map<String, TableConfiguration> configsURI;
+
+ private ResourceSet resourceSet;
+
+ public static final NattableConfigurationRegistry INSTANCE = new NattableConfigurationRegistry();
+
+ private NattableConfigurationRegistry() {
+ // to prevent instantiation
+ initFields();
+ }
+
+
+ /**
+ *
+ * @return
+ * the list of the known table configuration
+ */
+ public Collection<TableConfiguration> getTableConfigurations() {
+ return configsURI.values();
+ }
+
+ /**
+ *
+ *
+ * @param newTableConfiguration
+ * @return
+ */
+ public void registerTableConfiguration(final TableConfiguration newTableConfiguration) {
+ configsURI.put(newTableConfiguration.getType(), newTableConfiguration);
+ }
+
+
+ /**
+ *
+ * @param tableType
+ * the type of the table
+ * @return
+ * the table configuration or <code>null</code> if not found
+ */
+ public TableConfiguration getConfiguration(final String tableType) {
+ return this.configsURI.get(tableType);
+ }
+
+ /**
+ * inits the fields of the class
+ */
+ private void initFields() {
+ if (this.configsURI == null) {
+ this.configsURI = new HashMap<String, TableConfiguration>();
+ final IConfigurationElement[] configElements = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_ID);
+ this.resourceSet = new ResourceSetImpl();
+ for (final IConfigurationElement iConfigurationElement : configElements) {
+ Object file = iConfigurationElement.getAttribute(FILE_ATTRIBUTE);
+ IContributor contributor = iConfigurationElement.getContributor();
+ // we build the uri for the file
+ URI uri = URI.createPlatformPluginURI(contributor.getName() + "/" + file.toString(), true);//$NON-NLS-1$ //TODO : maybe a best way?
+ Resource res = this.resourceSet.getResource(uri, true);
+ if (res.getContents().size() > 0) {
+ EObject first = res.getContents().get(0);
+ if (first instanceof TableConfiguration) {
+ String type = ((TableConfiguration) first).getType();
+ if (type != null) {
+ if (!this.configsURI.containsKey(type)) {
+ this.configsURI.put(type, (TableConfiguration) first);
+ } else {
+ Activator.log.warn(String.format(Messages.NattableConfigurationRegistry_SeveralConfigurationsWithTheSameType, type));
+ }
+ } else {
+ Activator.log.warn(String.format(Messages.NattableConfigurationRegistry_NoTypeForAConfiguration, uri));
+ }
+ } else {
+ Activator.log.warn(String.format(Messages.NattableConfigurationRegistry_TableConfigurationNotFound, uri));
+ }
+ } else {
+ Activator.log.warn(String.format(Messages.NattableConfigurationRegistry_ResourceEmpty, uri));
+ }
+ }
+ }
+ }
+
+ /**
+ *
+ * @param tableType
+ * the table type to create
+ * @param tableContext
+ * the table context
+ * @return
+ * a status {@link IStatus#OK} when wa can create the table or {@link IStatus#ERROR} if not
+ */
+ public IStatus canCreateTable(final String tableType, final Object tableContext) {
+ TableConfiguration config = this.configsURI.get(tableType);
+ if (config != null) {
+ AbstractTableTester tester = config.getCreationTester();
+ if (tester instanceof JavaTableTester) {
+ final String testerId = ((JavaTableTester) tester).getTester();
+ final ITableTester myTester = TableTesterRegistry.INSTANCE.getTableTester(testerId);
+ if (myTester != null) {
+ return myTester.isAllowed(tableContext);
+ } else {
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.NattableConfigurationRegistry_TesterNotFound);
+ }
+ } else if (tester == null) {
+ return new Status(IStatus.OK, Activator.PLUGIN_ID, Messages.NattableConfigurationRegistry_NoTesterForThisConfiguration);
+ } else {
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.NattableConfigurationRegistry_TesterNotManager);
+ }
+ }
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.NattableConfigurationRegistry_ConfigurationNotFound);
+ }
+
+}

Back to the top