Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas FAUVERGUE2016-11-24 11:20:54 +0000
committerGerrit Code Review @ Eclipse.org2016-11-29 10:57:50 +0000
commitb3141df23ca644573f8b2813ad8859722d418bd9 (patch)
tree6db261c6f918988a7117bfe93731af4ca17f0723 /plugins/infra/nattable
parent6d4f41d7e479bfa607ffde18b16fe8ebdae561c2 (diff)
downloadorg.eclipse.papyrus-b3141df23ca644573f8b2813ad8859722d418bd9.tar.gz
org.eclipse.papyrus-b3141df23ca644573f8b2813ad8859722d418bd9.tar.xz
org.eclipse.papyrus-b3141df23ca644573f8b2813ad8859722d418bd9.zip
Bug 496905: [Diagram][ModelExplorer][Table][Dialog] Papyrus must integrate
the internationalization feature provided by UML. https://bugs.eclipse.org/bugs/show_bug.cgi?id=496905 Commit of infra for internationalization. Change-Id: I1b1859bf111e1ef7a7522212fbe639cf2bd13890 Signed-off-by: Nicolas FAUVERGUE <nicolas.fauvergue@all4tec.net>
Diffstat (limited to 'plugins/infra/nattable')
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/META-INF/MANIFEST.MF4
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/editor/AbstractEMFNattableEditor.java48
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/factory/AbstractNattableEditorFactory.java470
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/handlers/RenameTableHandler.java355
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.edit/META-INF/MANIFEST.MF3
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.edit/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/provider/TableItemProvider.java793
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/META-INF/MANIFEST.MF3
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/handlers/RenameTableHandler.java48
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/META-INF/MANIFEST.MF4
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/model/ui/EObjectInFlatTable.xwt9
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/model/ui/EObjectInTreeTable.xwt11
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/model/ui/SingleTable.xwt9
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/modelelement/NatTableModelElement.java11
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/observable/TableLabelObservableValue.java216
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/utils/Constants.java3
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/META-INF/MANIFEST.MF3
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/INattableModelManager.java8
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/NattableModelManager.java12
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/TableLabelProvider.java143
19 files changed, 1263 insertions, 890 deletions
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/META-INF/MANIFEST.MF b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/META-INF/MANIFEST.MF
index b6aea445f90..17c21e03b24 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/META-INF/MANIFEST.MF
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/META-INF/MANIFEST.MF
@@ -16,7 +16,9 @@ Require-Bundle: org.eclipse.papyrus.infra.nattable;bundle-version="[3.0.0,4.0.0)
org.eclipse.papyrus.infra.emf.nattable;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.infra.services.edit;bundle-version="[2.0.0,3.0.0)",
org.eclipse.papyrus.infra.ui;bundle-version="[2.0.0,3.0.0)";visibility:=reexport,
- org.eclipse.papyrus.infra.types.core;bundle-version="[3.0.0,4.0.0)"
+ org.eclipse.papyrus.infra.types.core;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)",
+ org.eclipse.papyrus.infra.internationalization.common;bundle-version="[1.0.0,2.0.0)"
Bundle-Vendor: %Bundle-Vendor
Bundle-ActivationPolicy: lazy
Bundle-Version: 3.0.0.qualifier
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/editor/AbstractEMFNattableEditor.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/editor/AbstractEMFNattableEditor.java
index 0217ee34ffc..9ee5241d252 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/editor/AbstractEMFNattableEditor.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/editor/AbstractEMFNattableEditor.java
@@ -12,6 +12,7 @@
* Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr
* Christian W. Damus (CEA) - bug 430880
* Christian W. Damus (CEA) - bug 437217
+ * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905
*
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.common.editor;
@@ -32,6 +33,9 @@ import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
import org.eclipse.papyrus.infra.emf.nattable.selection.EObjectSelectionExtractor;
+import org.eclipse.papyrus.infra.internationalization.common.editor.IInternationalizationEditor;
+import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalization;
+import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalizationUtils;
import org.eclipse.papyrus.infra.nattable.common.Activator;
import org.eclipse.papyrus.infra.nattable.common.utils.TableEditorInput;
import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
@@ -56,7 +60,7 @@ import org.eclipse.ui.part.EditorPart;
*
*
*/
-public abstract class AbstractEMFNattableEditor extends EditorPart implements NavigationTarget {
+public abstract class AbstractEMFNattableEditor extends EditorPart implements NavigationTarget, IInternationalizationEditor {
/** the service registry */
protected ServicesRegistry servicesRegistry;
@@ -88,6 +92,9 @@ public abstract class AbstractEMFNattableEditor extends EditorPart implements Na
this.tableManager = NattableModelManagerFactory.INSTANCE.createNatTableModelManager(rawModel, new EObjectSelectionExtractor());
this.synchronizer = new PartNameSynchronizer(rawModel);
this.workspacePreferenceStore = getWorkspaceViewerPreferenceStore();
+
+ // Need to manage the part label synchronizer for the table labels
+ LabelInternationalizationUtils.managePartLabelSynchronizer(rawModel, this);
}
/**
@@ -106,7 +113,7 @@ public abstract class AbstractEMFNattableEditor extends EditorPart implements Na
// IPath path = Activator.getDefault().getStateLocation();
// String id = getIdStr(this.tableManager.getTable());
//
- // String fileName = path.toString() + "/" + id;//$NON-NLS-1$
+ // String fileName = path.toString() + "/" + id;//$NON-NLS-1$
// java.io.File file = new File(fileName);
// this.workspacePreferenceStore = new PreferenceStore(fileName);
// if(file.exists()) {
@@ -164,7 +171,7 @@ public abstract class AbstractEMFNattableEditor extends EditorPart implements Na
final TableEditorInput tableEditorInput = new TableEditorInput(this.tableManager.getTable(), getEditingDomain());
setSite(site);
setInput(tableEditorInput);
- setPartName(this.tableManager.getTable().getName());
+ setPartName(LabelInternationalization.getInstance().getTableLabel(this.tableManager.getTable()));
}
/**
@@ -281,7 +288,7 @@ public abstract class AbstractEMFNattableEditor extends EditorPart implements Na
saveLocalPreferenceStoreValues();
this.tableManager.dispose();
this.synchronizer.dispose();
- this.tableManager= null;
+ this.tableManager = null;
this.servicesRegistry = null;
this.synchronizer = null;
super.dispose();
@@ -323,7 +330,7 @@ public abstract class AbstractEMFNattableEditor extends EditorPart implements Na
@Override
public void notifyChanged(final Notification notification) {
if (notification.getFeature() == NattableconfigurationPackage.eINSTANCE.getTableNamedElement_Name()) {
- setPartName(PartNameSynchronizer.this.papyrusTable.getName());
+ setPartName(LabelInternationalization.getInstance().getTableLabel(PartNameSynchronizer.this.papyrusTable));
}
}
};
@@ -356,12 +363,21 @@ public abstract class AbstractEMFNattableEditor extends EditorPart implements Na
// Set new table
this.papyrusTable = papyrusTable;
// Set editor name
- setPartName(papyrusTable.getName());
+ setPartName(LabelInternationalization.getInstance().getTableLabel(papyrusTable));
// Listen to name change
papyrusTable.eAdapters().add(this.tableNameListener);
}
}
+ /**
+ * @see org.eclipse.ui.part.EditorPart#setPartName(java.lang.String)
+ *
+ * @param partName
+ */
+ @Override
+ public void setPartName(String partName) {
+ super.setPartName(partName);
+ }
/**
*
@@ -414,4 +430,24 @@ public abstract class AbstractEMFNattableEditor extends EditorPart implements Na
public TransactionalEditingDomain getTableContextEditingDomain() {
return TableEditingDomainUtils.getTableContextEditingDomain(getTable());
}
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.internationalization.common.editor.IInternationalizationEditor#modifyPartName(java.lang.String)
+ */
+ @Override
+ public void modifyPartName(final String name) {
+ setPartName(name);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.internationalization.common.editor.IInternationalizationEditor#refreshEditorPart()
+ */
+ @Override
+ public void refreshEditorPart(){
+ // We don't need to refresh the editor part, the table is refreshed alone
+ }
}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/factory/AbstractNattableEditorFactory.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/factory/AbstractNattableEditorFactory.java
index 1e2688b3a99..70d7796647d 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/factory/AbstractNattableEditorFactory.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/factory/AbstractNattableEditorFactory.java
@@ -1,234 +1,236 @@
-/*****************************************************************************
- * Copyright (c) 2011, 2014 LIFL, CEA LIST, 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:
- * Cedric Dumoulin (LIFL) cedric.dumoulin@lifl.fr - Initial API and implementation
- * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr
- * Christian W. Damus (CEA) - bug 392301
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.common.factory;
-
-import java.lang.reflect.Constructor;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.papyrus.infra.core.editor.BackboneException;
-import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IEditorModel;
-import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.papyrus.infra.nattable.Activator;
-import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
-import org.eclipse.papyrus.infra.ui.extension.diagrameditor.AbstractEditorFactory;
-import org.eclipse.papyrus.infra.ui.multidiagram.actionbarcontributor.ActionBarContributorRegistry;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.part.EditorActionBarContributor;
-
-/**
- * Abstract factory for the NattableEditor
- *
- *
- *
- */
-public abstract class AbstractNattableEditorFactory extends AbstractEditorFactory {
-
- /**
- *
- * Constructor.
- *
- * @param editorClass
- * the editor class
- * @param editorType
- * the type of editor
- */
- public AbstractNattableEditorFactory(Class<?> editorClass, String editorType) {
- super(editorClass, editorType);
- }
-
- /**
- * Create the IPageModel that is used by the SashWindows to manage the editor.
- *
- * @see org.eclipse.papyrus.infra.ui.editorsfactory.IEditorFactory#createIPageModel(java.lang.Object)
- *
- * @param pageIdentifier
- * The model pushed in the sashmodel by the creation command
- * @return A model implementing the IPageModel
- */
- @Override
- public IPageModel createIPageModel(Object pageIdentifier) {
- return new NattableEditorModel(pageIdentifier, getServiceRegistry());
- }
-
- /**
- * @see org.eclipse.papyrus.infra.ui.editorsfactory.IEditorFactory#isPageModelFactoryFor(java.lang.Object)
- *
- * @param pageIdentifier
- * @return
- */
- @Override
- public boolean isPageModelFactoryFor(Object pageIdentifier) {
- if (pageIdentifier instanceof Table) {
- return getExpectedType().equals(((Table) pageIdentifier).getTableConfiguration().getType().trim());
- }
- return false;
- }
-
- /**
- * IEditorModel used internally by the SashContainer. This model know how to handle IEditor creation.
- *
- * @author cedric dumoulin
- *
- */
- class NattableEditorModel implements IEditorModel {
-
-
- /**
- * The servicesRegistry provided at creation.
- */
- private ServicesRegistry servicesRegistry;
-
- /**
- * The created editor.
- */
- private IEditorPart editor;
-
- /**
- * The raw model stored in the SashProvider.
- */
- private Table rawModel;
-
- private Image tabIcon;
-
- /**
- *
- * Constructor.
- */
- public NattableEditorModel(Object pageIdentifier, ServicesRegistry servicesRegistry) {
- this.rawModel = (Table) pageIdentifier;
- this.servicesRegistry = servicesRegistry;
- }
-
- /**
- * Create the IEditor for the diagram.
- *
- * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IEditorModel#createIEditorPart()
- * @return
- * @throws PartInitException
- *
- */
- @Override
- public IEditorPart createIEditorPart() throws PartInitException {
- try {
-
- Constructor<?> c = getDiagramClass().getConstructor(ServicesRegistry.class, Table.class);
- IEditorPart newEditor = (IEditorPart) c.newInstance(this.servicesRegistry, this.rawModel);
- // IEditorPart newEditor = new DefaultNattableEditor(getServiceRegistry(), rawModel);
- this.editor = newEditor;
- return this.editor;
-
- } catch (Exception e) {
- // Lets propagate. This is an implementation problem that should be solved by
- // programmer.
- throw new PartInitException("Can't create Nattable", e); //$NON-NLS-1$
- }
-
- }
-
- /**
- * Get the action bar requested by the Editor.
- *
- * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IEditorModel#getActionBarContributor()
- * @return
- *
- */
- @Override
- public EditorActionBarContributor getActionBarContributor() {
-
- String actionBarId = AbstractNattableEditorFactory.this.editorDescriptor.getActionBarContributorId();
-
- // Do nothing if no EditorActionBarContributor is specify.
- if (actionBarId == null || actionBarId.length() == 0) {
- return null;
- }
-
- // Try to get it.
-
- // Get ServiceRegistry
- // ServicesRegistry serviceRegistry = getServicesRegistry();
- ActionBarContributorRegistry registry;
- try {
- registry = this.servicesRegistry.getService(ActionBarContributorRegistry.class);
- } catch (ServiceException e) {
- // Service not found
- Activator.log.error(e);
- return null;
- }
-
- try {
- return registry.getActionBarContributor(actionBarId);
- } catch (BackboneException e) {
- Activator.log.error(e);
- return null;
- }
- }
-
- /**
- * Get the underlying RawModel. Return the Diagram.
- *
- * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel#getRawModel()
- * @return
- *
- */
- @Override
- public Object getRawModel() {
- return this.rawModel;
- }
-
- /**
- * Get the icon to be shown by Tabs
- *
- * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel#getTabIcon()
- * @return
- *
- */
- @Override
- public Image getTabIcon() {
- if (tabIcon == null) {
- ImageDescriptor imageDescriptor = getEditorDescriptor().getIcon();
- if (imageDescriptor != null) {
- tabIcon = imageDescriptor.createImage();
- }
- }
-
- return tabIcon;
- }
-
- /**
- * Get the title of the Diagram.
- *
- * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel#getTabTitle()
- * @return
- *
- */
- @Override
- public String getTabTitle() {
- return this.rawModel.getName();
- }
-
- @Override
- public void dispose() {
- if (tabIcon != null) {
- tabIcon.dispose();
- tabIcon = null;
- }
- }
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011, 2014 LIFL, CEA LIST, 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:
+ * Cedric Dumoulin (LIFL) cedric.dumoulin@lifl.fr - Initial API and implementation
+ * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr
+ * Christian W. Damus (CEA) - bug 392301
+ * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.common.factory;
+
+import java.lang.reflect.Constructor;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.papyrus.infra.core.editor.BackboneException;
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IEditorModel;
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalization;
+import org.eclipse.papyrus.infra.nattable.Activator;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+import org.eclipse.papyrus.infra.ui.extension.diagrameditor.AbstractEditorFactory;
+import org.eclipse.papyrus.infra.ui.multidiagram.actionbarcontributor.ActionBarContributorRegistry;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.part.EditorActionBarContributor;
+
+/**
+ * Abstract factory for the NattableEditor
+ *
+ *
+ *
+ */
+public abstract class AbstractNattableEditorFactory extends AbstractEditorFactory {
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param editorClass
+ * the editor class
+ * @param editorType
+ * the type of editor
+ */
+ public AbstractNattableEditorFactory(Class<?> editorClass, String editorType) {
+ super(editorClass, editorType);
+ }
+
+ /**
+ * Create the IPageModel that is used by the SashWindows to manage the editor.
+ *
+ * @see org.eclipse.papyrus.infra.ui.editorsfactory.IEditorFactory#createIPageModel(java.lang.Object)
+ *
+ * @param pageIdentifier
+ * The model pushed in the sashmodel by the creation command
+ * @return A model implementing the IPageModel
+ */
+ @Override
+ public IPageModel createIPageModel(Object pageIdentifier) {
+ return new NattableEditorModel(pageIdentifier, getServiceRegistry());
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.ui.editorsfactory.IEditorFactory#isPageModelFactoryFor(java.lang.Object)
+ *
+ * @param pageIdentifier
+ * @return
+ */
+ @Override
+ public boolean isPageModelFactoryFor(Object pageIdentifier) {
+ if (pageIdentifier instanceof Table) {
+ return getExpectedType().equals(((Table) pageIdentifier).getTableConfiguration().getType().trim());
+ }
+ return false;
+ }
+
+ /**
+ * IEditorModel used internally by the SashContainer. This model know how to handle IEditor creation.
+ *
+ * @author cedric dumoulin
+ *
+ */
+ class NattableEditorModel implements IEditorModel {
+
+
+ /**
+ * The servicesRegistry provided at creation.
+ */
+ private ServicesRegistry servicesRegistry;
+
+ /**
+ * The created editor.
+ */
+ private IEditorPart editor;
+
+ /**
+ * The raw model stored in the SashProvider.
+ */
+ private Table rawModel;
+
+ private Image tabIcon;
+
+ /**
+ *
+ * Constructor.
+ */
+ public NattableEditorModel(Object pageIdentifier, ServicesRegistry servicesRegistry) {
+ this.rawModel = (Table) pageIdentifier;
+ this.servicesRegistry = servicesRegistry;
+ }
+
+ /**
+ * Create the IEditor for the diagram.
+ *
+ * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IEditorModel#createIEditorPart()
+ * @return
+ * @throws PartInitException
+ *
+ */
+ @Override
+ public IEditorPart createIEditorPart() throws PartInitException {
+ try {
+
+ Constructor<?> c = getDiagramClass().getConstructor(ServicesRegistry.class, Table.class);
+ IEditorPart newEditor = (IEditorPart) c.newInstance(this.servicesRegistry, this.rawModel);
+ // IEditorPart newEditor = new DefaultNattableEditor(getServiceRegistry(), rawModel);
+ this.editor = newEditor;
+ return this.editor;
+
+ } catch (Exception e) {
+ // Lets propagate. This is an implementation problem that should be solved by
+ // programmer.
+ throw new PartInitException("Can't create Nattable", e); //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * Get the action bar requested by the Editor.
+ *
+ * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IEditorModel#getActionBarContributor()
+ * @return
+ *
+ */
+ @Override
+ public EditorActionBarContributor getActionBarContributor() {
+
+ String actionBarId = AbstractNattableEditorFactory.this.editorDescriptor.getActionBarContributorId();
+
+ // Do nothing if no EditorActionBarContributor is specify.
+ if (actionBarId == null || actionBarId.length() == 0) {
+ return null;
+ }
+
+ // Try to get it.
+
+ // Get ServiceRegistry
+ // ServicesRegistry serviceRegistry = getServicesRegistry();
+ ActionBarContributorRegistry registry;
+ try {
+ registry = this.servicesRegistry.getService(ActionBarContributorRegistry.class);
+ } catch (ServiceException e) {
+ // Service not found
+ Activator.log.error(e);
+ return null;
+ }
+
+ try {
+ return registry.getActionBarContributor(actionBarId);
+ } catch (BackboneException e) {
+ Activator.log.error(e);
+ return null;
+ }
+ }
+
+ /**
+ * Get the underlying RawModel. Return the Diagram.
+ *
+ * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel#getRawModel()
+ * @return
+ *
+ */
+ @Override
+ public Object getRawModel() {
+ return this.rawModel;
+ }
+
+ /**
+ * Get the icon to be shown by Tabs
+ *
+ * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel#getTabIcon()
+ * @return
+ *
+ */
+ @Override
+ public Image getTabIcon() {
+ if (tabIcon == null) {
+ ImageDescriptor imageDescriptor = getEditorDescriptor().getIcon();
+ if (imageDescriptor != null) {
+ tabIcon = imageDescriptor.createImage();
+ }
+ }
+
+ return tabIcon;
+ }
+
+ /**
+ * Get the title of the Diagram.
+ *
+ * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel#getTabTitle()
+ * @return
+ *
+ */
+ @Override
+ public String getTabTitle() {
+ return LabelInternationalization.getInstance().getTableLabel(this.rawModel);
+ }
+
+ @Override
+ public void dispose() {
+ if (tabIcon != null) {
+ tabIcon.dispose();
+ tabIcon = null;
+ }
+ }
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/handlers/RenameTableHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/handlers/RenameTableHandler.java
index b59a54eb150..5a14f3dbefb 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/handlers/RenameTableHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.common/src/org/eclipse/papyrus/infra/nattable/common/handlers/RenameTableHandler.java
@@ -1,171 +1,184 @@
-/*****************************************************************************
- * 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:
- * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.common.handlers;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.expressions.IEvaluationContext;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.jface.dialogs.InputDialog;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.nattable.common.messages.Messages;
-import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
-import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor;
-import org.eclipse.papyrus.infra.ui.util.ServiceUtilsForIEvaluationContext;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IEditorPart;
-
-/**
- * This handler allows to rename a Papyrus Table. The handler is activated when
- * the active editor is a Papyrus NatTableEditor.
- *
- * @author Camille Letavernier
- *
- */
-public class RenameTableHandler extends AbstractHandler {
-
- public static final String NEW_TABLE_NAME = Messages.RenameTableHandler_NewName;
-
- public static final String RENAME_AN_EXISTING_TABLE = Messages.RenameTableHandler_RenameAnExistingTable;
-
- /**
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- * @param event
- * @return
- * @throws ExecutionException
- *
- */
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- executeTransaction(event);
-
- return null;
- }
-
- /**
- * Execute as transaction
- *
- * @param event
- */
- private void executeTransaction(ExecutionEvent event) {
-
- // Get requested objects
- final INattableModelManager tableManager;
- try {
- IEvaluationContext context = getIEvaluationContext(event);
- tableManager = lookupTableManager(context);
- } catch (ServiceException e) {
- // silently fails
- return;
- }
-
- if (tableManager == null) {
- return;
- }
-
- // Open the dialog to ask the new name
- String currentName = tableManager.getTableName();
- String newName = null;
- InputDialog dialog = new InputDialog(Display.getCurrent().getActiveShell(), RENAME_AN_EXISTING_TABLE, NEW_TABLE_NAME, currentName, null);
- if (dialog.open() == Window.OK) {
- newName = dialog.getValue();
- if (newName == null || newName.length() <= 0) {
- return;
- }
- } else {
- // cancelled
- return;
- }
-
- tableManager.setTableName(newName);
- }
-
- /**
- * Get the name used in the {@link RecordingCommand}. This name will be
- * visible in undo/redo.
- *
- * @return The command name to show.
- */
- public String getCommandName() {
- return "Rename Table"; //$NON-NLS-1$
- }
-
- protected IEvaluationContext getIEvaluationContext(ExecutionEvent event) {
- if (event.getApplicationContext() instanceof IEvaluationContext) {
- return (IEvaluationContext) event.getApplicationContext();
- }
- return null;
-
- }
-
- /**
- * Get the Table model element. This method can be used from {@link #execute(ExecutionEvent)} or {@link #setEnabled(Object)}.
- *
- * @return The current table
- * @throws ServiceException
- */
- protected INattableModelManager lookupTableManager(IEvaluationContext context) throws ServiceException {
- IEditorPart editor = ServiceUtilsForIEvaluationContext.getInstance().getService(IMultiDiagramEditor.class, context);
-
- INattableModelManager tableManager = editor.getAdapter(INattableModelManager.class);
- return tableManager;
- }
-
- /**
- * Try to lookup the TransactionalEditingDomain.
- *
- * @return
- * @throws ServiceException
- * If the Editing domain can't be found.
- */
- protected TransactionalEditingDomain lookupTransactionalEditingDomain(IEvaluationContext context) throws ServiceException {
-
- // Get page from the event !
- // IWorkbenchPage page =
- // HandlerUtil.getActiveWorkbenchWindow(event).getActivePage();
-
- return ServiceUtilsForIEvaluationContext.getInstance().getTransactionalEditingDomain(context);
- }
-
- /**
- * Called by framework. Need to set the enabled flag.
- *
- * @see org.eclipse.core.commands.AbstractHandler#setEnabled(java.lang.Object)
- *
- * @param evaluationContext
- */
- @Override
- public void setEnabled(Object evaluationContext) {
- if (!(evaluationContext instanceof IEvaluationContext)) {
- setBaseEnabled(false);
- return;
- }
-
- IEvaluationContext context = (IEvaluationContext) evaluationContext;
-
- try {
- // Try to get the Table
- setBaseEnabled(lookupTableManager(context) != null);
- return;
- } catch (ServiceException e) {
- // Can't find ServiceRegistry: disable
- }
-
- // In all other cases
- setBaseEnabled(false);
- }
-}
+/*****************************************************************************
+ * 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:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.common.handlers;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.expressions.IEvaluationContext;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalization;
+import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalizationPreferencesUtils;
+import org.eclipse.papyrus.infra.nattable.common.messages.Messages;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor;
+import org.eclipse.papyrus.infra.ui.util.ServiceUtilsForIEvaluationContext;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IEditorPart;
+
+/**
+ * This handler allows to rename a Papyrus Table. The handler is activated when
+ * the active editor is a Papyrus NatTableEditor.
+ *
+ * @author Camille Letavernier
+ *
+ */
+public class RenameTableHandler extends AbstractHandler {
+
+ public static final String NEW_TABLE_NAME = Messages.RenameTableHandler_NewName;
+
+ public static final String RENAME_AN_EXISTING_TABLE = Messages.RenameTableHandler_RenameAnExistingTable;
+
+ /**
+ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ * @param event
+ * @return
+ * @throws ExecutionException
+ *
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ executeTransaction(event);
+
+ return null;
+ }
+
+ /**
+ * Execute as transaction
+ *
+ * @param event
+ */
+ private void executeTransaction(ExecutionEvent event) {
+
+ // Get requested objects
+ final INattableModelManager tableManager;
+ try {
+ IEvaluationContext context = getIEvaluationContext(event);
+ tableManager = lookupTableManager(context);
+ } catch (ServiceException e) {
+ // silently fails
+ return;
+ }
+
+ if (tableManager == null) {
+ return;
+ }
+
+ final String tableLabel = LabelInternationalization.getInstance().getTableLabelWithoutName(tableManager.getTable());
+ if(null != tableLabel && LabelInternationalizationPreferencesUtils.getInternationalizationPreference(tableManager.getTable())){
+ InputDialog dialog = new InputDialog(Display.getCurrent().getActiveShell(), "Rename table label", "New label:", tableLabel, null); //$NON-NLS-1$ //$NON-NLS-2$
+ if (Window.OK == dialog.open()) {
+ final String label = dialog.getValue();
+
+ tableManager.setTableLabel(label);
+ }
+ }else{
+ // Open the dialog to ask the new name
+ String currentName = tableManager.getTableName();
+ String newName = null;
+ InputDialog dialog = new InputDialog(Display.getCurrent().getActiveShell(), RENAME_AN_EXISTING_TABLE, NEW_TABLE_NAME, currentName, null);
+ if (dialog.open() == Window.OK) {
+ newName = dialog.getValue();
+ if (newName == null || newName.length() <= 0) {
+ return;
+ }
+ } else {
+ // cancelled
+ return;
+ }
+
+ tableManager.setTableName(newName);
+ }
+ }
+
+ /**
+ * Get the name used in the {@link RecordingCommand}. This name will be
+ * visible in undo/redo.
+ *
+ * @return The command name to show.
+ */
+ public String getCommandName() {
+ return "Rename Table"; //$NON-NLS-1$
+ }
+
+ protected IEvaluationContext getIEvaluationContext(ExecutionEvent event) {
+ if (event.getApplicationContext() instanceof IEvaluationContext) {
+ return (IEvaluationContext) event.getApplicationContext();
+ }
+ return null;
+
+ }
+
+ /**
+ * Get the Table model element. This method can be used from {@link #execute(ExecutionEvent)} or {@link #setEnabled(Object)}.
+ *
+ * @return The current table
+ * @throws ServiceException
+ */
+ protected INattableModelManager lookupTableManager(IEvaluationContext context) throws ServiceException {
+ IEditorPart editor = ServiceUtilsForIEvaluationContext.getInstance().getService(IMultiDiagramEditor.class, context);
+
+ INattableModelManager tableManager = editor.getAdapter(INattableModelManager.class);
+ return tableManager;
+ }
+
+ /**
+ * Try to lookup the TransactionalEditingDomain.
+ *
+ * @return
+ * @throws ServiceException
+ * If the Editing domain can't be found.
+ */
+ protected TransactionalEditingDomain lookupTransactionalEditingDomain(IEvaluationContext context) throws ServiceException {
+
+ // Get page from the event !
+ // IWorkbenchPage page =
+ // HandlerUtil.getActiveWorkbenchWindow(event).getActivePage();
+
+ return ServiceUtilsForIEvaluationContext.getInstance().getTransactionalEditingDomain(context);
+ }
+
+ /**
+ * Called by framework. Need to set the enabled flag.
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#setEnabled(java.lang.Object)
+ *
+ * @param evaluationContext
+ */
+ @Override
+ public void setEnabled(Object evaluationContext) {
+ if (!(evaluationContext instanceof IEvaluationContext)) {
+ setBaseEnabled(false);
+ return;
+ }
+
+ IEvaluationContext context = (IEvaluationContext) evaluationContext;
+
+ try {
+ // Try to get the Table
+ setBaseEnabled(lookupTableManager(context) != null);
+ return;
+ } catch (ServiceException e) {
+ // Can't find ServiceRegistry: disable
+ }
+
+ // In all other cases
+ setBaseEnabled(false);
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.edit/META-INF/MANIFEST.MF b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.edit/META-INF/MANIFEST.MF
index 5d9ae837ce9..cad92805ca5 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.edit/META-INF/MANIFEST.MF
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.edit/META-INF/MANIFEST.MF
@@ -1,7 +1,8 @@
Manifest-Version: 1.0
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.12.0,4.0.0)",
org.eclipse.emf.ecore.edit;bundle-version="[2.9.0,3.0.0)";visibility:=reexport,
- org.eclipse.papyrus.infra.nattable.model;bundle-version="[2.0.0,3.0.0)";visibility:=reexport
+ org.eclipse.papyrus.infra.nattable.model;bundle-version="[2.0.0,3.0.0)";visibility:=reexport,
+ org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)"
Export-Package: org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.provider,
org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.provider,
org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.provider,
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.edit/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/provider/TableItemProvider.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.edit/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/provider/TableItemProvider.java
index 9b9d211c77a..05f4113984c 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.edit/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/provider/TableItemProvider.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.model.edit/src-gen/org/eclipse/papyrus/infra/nattable/model/nattable/provider/TableItemProvider.java
@@ -1,396 +1,397 @@
-/**
- * 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.model.nattable.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.ecore.EStructuralFeature;
-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.nattable.model.nattable.NattablePackage;
-import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.NattableaxisconfigurationFactory;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.NattableaxisproviderFactory;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecell.NattablecellFactory;
-import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.provider.TableNamedElementItemProvider;
-
-/**
- * This is the item provider adapter for a {@link org.eclipse.papyrus.infra.nattable.model.nattable.Table} object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
-public class TableItemProvider extends TableNamedElementItemProvider {
- /**
- * This constructs an instance from a factory and a notifier.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public TableItemProvider(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);
-
- addContextPropertyDescriptor(object);
- addOwnerPropertyDescriptor(object);
- addPrototypePropertyDescriptor(object);
- addTableConfigurationPropertyDescriptor(object);
- addInvertAxisPropertyDescriptor(object);
- addCurrentRowAxisProviderPropertyDescriptor(object);
- addCurrentColumnAxisProviderPropertyDescriptor(object);
- }
- return itemPropertyDescriptors;
- }
-
- /**
- * This adds a property descriptor for the Context feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected void addContextPropertyDescriptor(Object object) {
- itemPropertyDescriptors.add
- (createItemPropertyDescriptor
- (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
- getResourceLocator(),
- getString("_UI_Table_context_feature"), //$NON-NLS-1$
- getString("_UI_PropertyDescriptor_description", "_UI_Table_context_feature", "_UI_Table_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- NattablePackage.Literals.TABLE__CONTEXT,
- true,
- false,
- true,
- null,
- null,
- null));
- }
-
- /**
- * This adds a property descriptor for the Owner feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected void addOwnerPropertyDescriptor(Object object) {
- itemPropertyDescriptors.add
- (createItemPropertyDescriptor
- (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
- getResourceLocator(),
- getString("_UI_Table_owner_feature"), //$NON-NLS-1$
- getString("_UI_PropertyDescriptor_description", "_UI_Table_owner_feature", "_UI_Table_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- NattablePackage.Literals.TABLE__OWNER,
- true,
- false,
- true,
- null,
- null,
- null));
- }
-
- /**
- * This adds a property descriptor for the Prototype feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected void addPrototypePropertyDescriptor(Object object) {
- itemPropertyDescriptors.add
- (createItemPropertyDescriptor
- (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
- getResourceLocator(),
- getString("_UI_Table_prototype_feature"), //$NON-NLS-1$
- getString("_UI_PropertyDescriptor_description", "_UI_Table_prototype_feature", "_UI_Table_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- NattablePackage.Literals.TABLE__PROTOTYPE,
- true,
- false,
- true,
- null,
- null,
- null));
- }
-
- /**
- * This adds a property descriptor for the Table Configuration feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected void addTableConfigurationPropertyDescriptor(Object object) {
- itemPropertyDescriptors.add
- (createItemPropertyDescriptor
- (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
- getResourceLocator(),
- getString("_UI_Table_tableConfiguration_feature"), //$NON-NLS-1$
- getString("_UI_PropertyDescriptor_description", "_UI_Table_tableConfiguration_feature", "_UI_Table_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- NattablePackage.Literals.TABLE__TABLE_CONFIGURATION,
- true,
- false,
- true,
- null,
- null,
- null));
- }
-
- /**
- * This adds a property descriptor for the Invert Axis feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected void addInvertAxisPropertyDescriptor(Object object) {
- itemPropertyDescriptors.add
- (createItemPropertyDescriptor
- (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
- getResourceLocator(),
- getString("_UI_Table_invertAxis_feature"), //$NON-NLS-1$
- getString("_UI_PropertyDescriptor_description", "_UI_Table_invertAxis_feature", "_UI_Table_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- NattablePackage.Literals.TABLE__INVERT_AXIS,
- true,
- false,
- false,
- ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
- null,
- null));
- }
-
- /**
- * This adds a property descriptor for the Current Row Axis Provider feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected void addCurrentRowAxisProviderPropertyDescriptor(Object object) {
- itemPropertyDescriptors.add
- (createItemPropertyDescriptor
- (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
- getResourceLocator(),
- getString("_UI_Table_currentRowAxisProvider_feature"), //$NON-NLS-1$
- getString("_UI_PropertyDescriptor_description", "_UI_Table_currentRowAxisProvider_feature", "_UI_Table_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- NattablePackage.Literals.TABLE__CURRENT_ROW_AXIS_PROVIDER,
- true,
- false,
- true,
- null,
- null,
- null));
- }
-
- /**
- * This adds a property descriptor for the Current Column Axis Provider feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected void addCurrentColumnAxisProviderPropertyDescriptor(Object object) {
- itemPropertyDescriptors.add
- (createItemPropertyDescriptor
- (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
- getResourceLocator(),
- getString("_UI_Table_currentColumnAxisProvider_feature"), //$NON-NLS-1$
- getString("_UI_PropertyDescriptor_description", "_UI_Table_currentColumnAxisProvider_feature", "_UI_Table_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- NattablePackage.Literals.TABLE__CURRENT_COLUMN_AXIS_PROVIDER,
- true,
- false,
- true,
- null,
- null,
- null));
- }
-
- /**
- * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
- * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
- * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
- if (childrenFeatures == null) {
- super.getChildrenFeatures(object);
- childrenFeatures.add(NattablePackage.Literals.TABLE__COLUMN_AXIS_PROVIDERS_HISTORY);
- childrenFeatures.add(NattablePackage.Literals.TABLE__ROW_AXIS_PROVIDERS_HISTORY);
- childrenFeatures.add(NattablePackage.Literals.TABLE__LOCAL_ROW_HEADER_AXIS_CONFIGURATION);
- childrenFeatures.add(NattablePackage.Literals.TABLE__LOCAL_COLUMN_HEADER_AXIS_CONFIGURATION);
- childrenFeatures.add(NattablePackage.Literals.TABLE__CELLS);
- }
- return childrenFeatures;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EStructuralFeature getChildFeature(Object object, Object child) {
- // Check the type of the specified child object and return the proper feature to use for
- // adding (see {@link AddCommand}) it as a child.
-
- return super.getChildFeature(object, child);
- }
-
- /**
- * This returns Table.gif.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object getImage(Object object) {
- return overlayImage(object, getResourceLocator().getImage("full/obj16/Table")); //$NON-NLS-1$
- }
-
- /**
- * This returns the label text for the adapted class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String getText(Object object) {
- String label = ((Table)object).getName();
- return label == null || label.length() == 0 ?
- getString("_UI_Table_type") : //$NON-NLS-1$
- getString("_UI_Table_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
-
- /**
- * 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);
-
- switch (notification.getFeatureID(Table.class)) {
- case NattablePackage.TABLE__INVERT_AXIS:
- fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
- return;
- case NattablePackage.TABLE__COLUMN_AXIS_PROVIDERS_HISTORY:
- case NattablePackage.TABLE__ROW_AXIS_PROVIDERS_HISTORY:
- case NattablePackage.TABLE__LOCAL_ROW_HEADER_AXIS_CONFIGURATION:
- case NattablePackage.TABLE__LOCAL_COLUMN_HEADER_AXIS_CONFIGURATION:
- case NattablePackage.TABLE__CELLS:
- fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
- return;
- }
- 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);
-
- newChildDescriptors.add
- (createChildParameter
- (NattablePackage.Literals.TABLE__COLUMN_AXIS_PROVIDERS_HISTORY,
- NattableaxisproviderFactory.eINSTANCE.createSlaveObjectAxisProvider()));
-
- newChildDescriptors.add
- (createChildParameter
- (NattablePackage.Literals.TABLE__COLUMN_AXIS_PROVIDERS_HISTORY,
- NattableaxisproviderFactory.eINSTANCE.createMasterObjectAxisProvider()));
-
- newChildDescriptors.add
- (createChildParameter
- (NattablePackage.Literals.TABLE__ROW_AXIS_PROVIDERS_HISTORY,
- NattableaxisproviderFactory.eINSTANCE.createSlaveObjectAxisProvider()));
-
- newChildDescriptors.add
- (createChildParameter
- (NattablePackage.Literals.TABLE__ROW_AXIS_PROVIDERS_HISTORY,
- NattableaxisproviderFactory.eINSTANCE.createMasterObjectAxisProvider()));
-
- newChildDescriptors.add
- (createChildParameter
- (NattablePackage.Literals.TABLE__LOCAL_ROW_HEADER_AXIS_CONFIGURATION,
- NattableaxisconfigurationFactory.eINSTANCE.createLocalTableHeaderAxisConfiguration()));
-
- newChildDescriptors.add
- (createChildParameter
- (NattablePackage.Literals.TABLE__LOCAL_COLUMN_HEADER_AXIS_CONFIGURATION,
- NattableaxisconfigurationFactory.eINSTANCE.createLocalTableHeaderAxisConfiguration()));
-
- newChildDescriptors.add
- (createChildParameter
- (NattablePackage.Literals.TABLE__CELLS,
- NattablecellFactory.eINSTANCE.createCell()));
- }
-
- /**
- * This returns the label text for {@link org.eclipse.emf.edit.command.CreateChildCommand}.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String getCreateChildText(Object owner, Object feature, Object child, Collection<?> selection) {
- Object childFeature = feature;
- Object childObject = child;
-
- boolean qualify =
- childFeature == NattablePackage.Literals.TABLE__COLUMN_AXIS_PROVIDERS_HISTORY ||
- childFeature == NattablePackage.Literals.TABLE__ROW_AXIS_PROVIDERS_HISTORY ||
- childFeature == NattablePackage.Literals.TABLE__LOCAL_ROW_HEADER_AXIS_CONFIGURATION ||
- childFeature == NattablePackage.Literals.TABLE__LOCAL_COLUMN_HEADER_AXIS_CONFIGURATION;
-
- if (qualify) {
- return getString
- ("_UI_CreateChild_text2", //$NON-NLS-1$
- new Object[] { getTypeText(childObject), getFeatureText(childFeature), getTypeText(owner) });
- }
- return super.getCreateChildText(owner, feature, child, selection);
- }
-
- /**
- * Return the resource locator for this item provider's resources.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public ResourceLocator getResourceLocator() {
- return NattableEditPlugin.INSTANCE;
- }
-
-}
+/**
+ * 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.model.nattable.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.ecore.EStructuralFeature;
+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.internationalization.utils.utils.LabelInternationalization;
+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.nattableaxisconfiguration.NattableaxisconfigurationFactory;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.NattableaxisproviderFactory;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablecell.NattablecellFactory;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.provider.TableNamedElementItemProvider;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.papyrus.infra.nattable.model.nattable.Table} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class TableItemProvider extends TableNamedElementItemProvider {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public TableItemProvider(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);
+
+ addContextPropertyDescriptor(object);
+ addOwnerPropertyDescriptor(object);
+ addPrototypePropertyDescriptor(object);
+ addTableConfigurationPropertyDescriptor(object);
+ addInvertAxisPropertyDescriptor(object);
+ addCurrentRowAxisProviderPropertyDescriptor(object);
+ addCurrentColumnAxisProviderPropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Context feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addContextPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Table_context_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_Table_context_feature", "_UI_Table_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ NattablePackage.Literals.TABLE__CONTEXT,
+ true,
+ false,
+ true,
+ null,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Owner feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addOwnerPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Table_owner_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_Table_owner_feature", "_UI_Table_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ NattablePackage.Literals.TABLE__OWNER,
+ true,
+ false,
+ true,
+ null,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Prototype feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addPrototypePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Table_prototype_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_Table_prototype_feature", "_UI_Table_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ NattablePackage.Literals.TABLE__PROTOTYPE,
+ true,
+ false,
+ true,
+ null,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Table Configuration feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addTableConfigurationPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Table_tableConfiguration_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_Table_tableConfiguration_feature", "_UI_Table_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ NattablePackage.Literals.TABLE__TABLE_CONFIGURATION,
+ true,
+ false,
+ true,
+ null,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Invert Axis feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addInvertAxisPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Table_invertAxis_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_Table_invertAxis_feature", "_UI_Table_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ NattablePackage.Literals.TABLE__INVERT_AXIS,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Current Row Axis Provider feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addCurrentRowAxisProviderPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Table_currentRowAxisProvider_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_Table_currentRowAxisProvider_feature", "_UI_Table_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ NattablePackage.Literals.TABLE__CURRENT_ROW_AXIS_PROVIDER,
+ true,
+ false,
+ true,
+ null,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Current Column Axis Provider feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addCurrentColumnAxisProviderPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Table_currentColumnAxisProvider_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_Table_currentColumnAxisProvider_feature", "_UI_Table_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ NattablePackage.Literals.TABLE__CURRENT_COLUMN_AXIS_PROVIDER,
+ true,
+ false,
+ true,
+ null,
+ null,
+ null));
+ }
+
+ /**
+ * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
+ * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
+ * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
+ if (childrenFeatures == null) {
+ super.getChildrenFeatures(object);
+ childrenFeatures.add(NattablePackage.Literals.TABLE__COLUMN_AXIS_PROVIDERS_HISTORY);
+ childrenFeatures.add(NattablePackage.Literals.TABLE__ROW_AXIS_PROVIDERS_HISTORY);
+ childrenFeatures.add(NattablePackage.Literals.TABLE__LOCAL_ROW_HEADER_AXIS_CONFIGURATION);
+ childrenFeatures.add(NattablePackage.Literals.TABLE__LOCAL_COLUMN_HEADER_AXIS_CONFIGURATION);
+ childrenFeatures.add(NattablePackage.Literals.TABLE__CELLS);
+ }
+ return childrenFeatures;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EStructuralFeature getChildFeature(Object object, Object child) {
+ // Check the type of the specified child object and return the proper feature to use for
+ // adding (see {@link AddCommand}) it as a child.
+
+ return super.getChildFeature(object, child);
+ }
+
+ /**
+ * This returns Table.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/Table")); //$NON-NLS-1$
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ @Override
+ public String getText(Object object) {
+ String label = LabelInternationalization.getInstance().getTableLabel((Table)object);
+ return label == null || label.length() == 0 ?
+ getString("_UI_Table_type") : //$NON-NLS-1$
+ getString("_UI_Table_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+
+ /**
+ * 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);
+
+ switch (notification.getFeatureID(Table.class)) {
+ case NattablePackage.TABLE__INVERT_AXIS:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
+ return;
+ case NattablePackage.TABLE__COLUMN_AXIS_PROVIDERS_HISTORY:
+ case NattablePackage.TABLE__ROW_AXIS_PROVIDERS_HISTORY:
+ case NattablePackage.TABLE__LOCAL_ROW_HEADER_AXIS_CONFIGURATION:
+ case NattablePackage.TABLE__LOCAL_COLUMN_HEADER_AXIS_CONFIGURATION:
+ case NattablePackage.TABLE__CELLS:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
+ return;
+ }
+ 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);
+
+ newChildDescriptors.add
+ (createChildParameter
+ (NattablePackage.Literals.TABLE__COLUMN_AXIS_PROVIDERS_HISTORY,
+ NattableaxisproviderFactory.eINSTANCE.createSlaveObjectAxisProvider()));
+
+ newChildDescriptors.add
+ (createChildParameter
+ (NattablePackage.Literals.TABLE__COLUMN_AXIS_PROVIDERS_HISTORY,
+ NattableaxisproviderFactory.eINSTANCE.createMasterObjectAxisProvider()));
+
+ newChildDescriptors.add
+ (createChildParameter
+ (NattablePackage.Literals.TABLE__ROW_AXIS_PROVIDERS_HISTORY,
+ NattableaxisproviderFactory.eINSTANCE.createSlaveObjectAxisProvider()));
+
+ newChildDescriptors.add
+ (createChildParameter
+ (NattablePackage.Literals.TABLE__ROW_AXIS_PROVIDERS_HISTORY,
+ NattableaxisproviderFactory.eINSTANCE.createMasterObjectAxisProvider()));
+
+ newChildDescriptors.add
+ (createChildParameter
+ (NattablePackage.Literals.TABLE__LOCAL_ROW_HEADER_AXIS_CONFIGURATION,
+ NattableaxisconfigurationFactory.eINSTANCE.createLocalTableHeaderAxisConfiguration()));
+
+ newChildDescriptors.add
+ (createChildParameter
+ (NattablePackage.Literals.TABLE__LOCAL_COLUMN_HEADER_AXIS_CONFIGURATION,
+ NattableaxisconfigurationFactory.eINSTANCE.createLocalTableHeaderAxisConfiguration()));
+
+ newChildDescriptors.add
+ (createChildParameter
+ (NattablePackage.Literals.TABLE__CELLS,
+ NattablecellFactory.eINSTANCE.createCell()));
+ }
+
+ /**
+ * This returns the label text for {@link org.eclipse.emf.edit.command.CreateChildCommand}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getCreateChildText(Object owner, Object feature, Object child, Collection<?> selection) {
+ Object childFeature = feature;
+ Object childObject = child;
+
+ boolean qualify =
+ childFeature == NattablePackage.Literals.TABLE__COLUMN_AXIS_PROVIDERS_HISTORY ||
+ childFeature == NattablePackage.Literals.TABLE__ROW_AXIS_PROVIDERS_HISTORY ||
+ childFeature == NattablePackage.Literals.TABLE__LOCAL_ROW_HEADER_AXIS_CONFIGURATION ||
+ childFeature == NattablePackage.Literals.TABLE__LOCAL_COLUMN_HEADER_AXIS_CONFIGURATION;
+
+ if (qualify) {
+ return getString
+ ("_UI_CreateChild_text2", //$NON-NLS-1$
+ new Object[] { getTypeText(childObject), getFeatureText(childFeature), getTypeText(owner) });
+ }
+ return super.getCreateChildText(owner, feature, child, selection);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return NattableEditPlugin.INSTANCE;
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/META-INF/MANIFEST.MF b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/META-INF/MANIFEST.MF
index 829b9e13a9a..8b10a6fef59 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/META-INF/MANIFEST.MF
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/META-INF/MANIFEST.MF
@@ -17,7 +17,8 @@ Require-Bundle: org.eclipse.papyrus.infra.nattable.model;bundle-version="[2.0.0,
org.eclipse.papyrus.infra.ui;bundle-version="[2.0.0,3.0.0)";visibility:=reexport,
org.eclipse.papyrus.infra.emf;bundle-version="[2.0.0,3.0.0)",
org.eclipse.papyrus.extensionpoints.editors;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.papyrus.views.modelexplorer;bundle-version="[3.0.0,4.0.0)"
+ org.eclipse.papyrus.views.modelexplorer;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)"
Bundle-Vendor: %Bundle-Vendor
Bundle-Version: 3.0.0.qualifier
Bundle-Activator: org.eclipse.papyrus.infra.nattable.modelexplorer.Activator
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/handlers/RenameTableHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/handlers/RenameTableHandler.java
index a1623c64850..097ef1f69fa 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/handlers/RenameTableHandler.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/handlers/RenameTableHandler.java
@@ -9,12 +9,14 @@
* Contributors:
* Juan Cadavid (CEA LIST) juan.cadavid@cea.fr - Initial API and implementation
* Fanch BONNABESSE (ALL4TEC) fanch.bonnabesse@all4tec.net - Bug 497289
+ * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905
*
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.modelexplorer.handlers;
import java.util.List;
+import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.expressions.IEvaluationContext;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -28,6 +30,8 @@ import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.jface.window.Window;
import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
+import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalization;
+import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalizationPreferencesUtils;
import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
import org.eclipse.papyrus.infra.nattable.modelexplorer.messages.Messages;
import org.eclipse.papyrus.views.modelexplorer.DirectEditorEditingSupport;
@@ -48,18 +52,18 @@ public class RenameTableHandler extends AbstractTableCommandHandler {
if (editingDomain != null && tables.size() == 1) {
final Table table = tables.get(0);
- final String currentName = table.getName();
- if (currentName != null) {
-
- AbstractTransactionalCommand cmd = new AbstractTransactionalCommand(editingDomain, "RenameTableCommand", null) { //$NON-NLS-1$
-
+
+ final String tableLabel = LabelInternationalization.getInstance().getTableLabelWithoutName(table);
+ if(null != tableLabel && LabelInternationalizationPreferencesUtils.getInternationalizationPreference(table)){
+ AbstractTransactionalCommand cmd = new AbstractTransactionalCommand(editingDomain, "ChangeTableLabelCommand", null) { //$NON-NLS-1$
+
@Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) {
- InputDialog dialog = new InputDialog(Display.getCurrent().getActiveShell(), Messages.RenameTableHandler_RenameAnExistingTable, Messages.RenameTableHandler_NewName, currentName, null);
- if (dialog.open() == Window.OK) {
- final String name = dialog.getValue();
- if (name != null && name.length() > 0) {
- table.setName(name);
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ InputDialog dialog = new InputDialog(Display.getCurrent().getActiveShell(), "Rename table label...", "New label:", tableLabel, null); //$NON-NLS-1$ //$NON-NLS-2$
+ if (Window.OK == dialog.open()) {
+ final String label = dialog.getValue();
+ if (label != null && label.length() > 0) {
+ LabelInternationalization.getInstance().setTableLabel(table, label, null);
}
return CommandResult.newOKCommandResult();
} else {
@@ -68,6 +72,28 @@ public class RenameTableHandler extends AbstractTableCommandHandler {
}
};
return new GMFtoEMFCommandWrapper(cmd);
+ }else{
+ final String currentName = table.getName();
+ if (currentName != null) {
+
+ AbstractTransactionalCommand cmd = new AbstractTransactionalCommand(editingDomain, "RenameTableCommand", null) { //$NON-NLS-1$
+
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) {
+ InputDialog dialog = new InputDialog(Display.getCurrent().getActiveShell(), Messages.RenameTableHandler_RenameAnExistingTable, Messages.RenameTableHandler_NewName, currentName, null);
+ if (dialog.open() == Window.OK) {
+ final String name = dialog.getValue();
+ if (name != null && name.length() > 0) {
+ table.setName(name);
+ }
+ return CommandResult.newOKCommandResult();
+ } else {
+ return CommandResult.newCancelledCommandResult();
+ }
+ }
+ };
+ return new GMFtoEMFCommandWrapper(cmd);
+ }
}
}
return UnexecutableCommand.INSTANCE;
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/META-INF/MANIFEST.MF b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/META-INF/MANIFEST.MF
index 66893c61ae5..9c025454ff0 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/META-INF/MANIFEST.MF
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/META-INF/MANIFEST.MF
@@ -6,7 +6,9 @@ Require-Bundle: org.eclipse.papyrus.infra.properties.ui;bundle-version="[2.0.0,3
org.eclipse.papyrus.infra.services.edit;bundle-version="[2.0.0,3.0.0)",
org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="[1.2.0,2.0.0)",
org.eclipse.papyrus.infra.emf.nattable;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.infra.nattable.common;bundle-version="[3.0.0,4.0.0)"
+ org.eclipse.papyrus.infra.nattable.common;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)",
+ org.eclipse.papyrus.infra.internationalization;bundle-version="[1.0.0,2.0.0)"
Bundle-Vendor: %Bundle-Vendor
Bundle-ActivationPolicy: lazy
Bundle-Version: 2.2.0.qualifier
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/model/ui/EObjectInFlatTable.xwt b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/model/ui/EObjectInFlatTable.xwt
index 4bf9e016758..0fc1e2013dd 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/model/ui/EObjectInFlatTable.xwt
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/model/ui/EObjectInFlatTable.xwt
@@ -8,10 +8,17 @@
</Composite.layout>
<Composite>
<Composite.layout>
- <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
+ <ppel:PropertiesLayout numColumns="1"></ppel:PropertiesLayout>
</Composite.layout>
<ppe:StringEditor input="{Binding}"
property="EObjectInTable:TableNamedElement:name" customLabel="Name"></ppe:StringEditor>
+ <ppe:StringEditor input="{Binding}"
+ property="EObjectInTable:TableNamedElement:label"></ppe:StringEditor>
+ </Composite>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
+ </Composite.layout>
<ppe:ReferenceLabel input="{Binding}"
property="EObjectInTable:Table:prototype" readOnly="true"
customLabel="View Type"></ppe:ReferenceLabel>
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/model/ui/EObjectInTreeTable.xwt b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/model/ui/EObjectInTreeTable.xwt
index f39d3fb7204..1e2d8ba91ed 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/model/ui/EObjectInTreeTable.xwt
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/model/ui/EObjectInTreeTable.xwt
@@ -8,10 +8,17 @@
</Composite.layout>
<Composite>
<Composite.layout>
- <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
+ <ppel:PropertiesLayout numColumns="1"></ppel:PropertiesLayout>
</Composite.layout>
<ppe:StringEditor input="{Binding}"
- property="EObjectInTable:TableNamedElement:name" customLabel="Name"></ppe:StringEditor>
+ property="EObjectInTable:TableNamedElement:name"></ppe:StringEditor>
+ <ppe:StringEditor input="{Binding}"
+ property="EObjectInTable:TableNamedElement:label"></ppe:StringEditor>
+ </Composite>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
+ </Composite.layout>
<ppe:ReferenceLabel input="{Binding}"
property="EObjectInTable:Table:prototype" readOnly="true"
customLabel="View Type"></ppe:ReferenceLabel>
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/model/ui/SingleTable.xwt b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/model/ui/SingleTable.xwt
index 0452f5604a9..034fdb13d6f 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/model/ui/SingleTable.xwt
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/model/ui/SingleTable.xwt
@@ -8,10 +8,17 @@
</Composite.layout>
<Composite>
<Composite.layout>
- <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
+ <ppel:PropertiesLayout numColumns="1"></ppel:PropertiesLayout>
</Composite.layout>
<ppe:StringEditor input="{Binding}"
property="nattable:nattableconfiguration:TableNamedElement:name"></ppe:StringEditor>
+ <ppe:StringEditor input="{Binding}"
+ property="nattable:nattableconfiguration:TableNamedElement:label"></ppe:StringEditor>
+ </Composite>
+ <Composite>
+ <Composite.layout>
+ <ppel:PropertiesLayout numColumns="2"></ppel:PropertiesLayout>
+ </Composite.layout>
<ppe:ReferenceLabel input="{Binding}"
property="nattable:Table:prototype" readOnly="true" customLabel="View Type"></ppe:ReferenceLabel>
<ppe:ReferenceDialog input="{Binding}" property="nattable:Table:owner"
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/modelelement/NatTableModelElement.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/modelelement/NatTableModelElement.java
index 3b2d0c134ef..09f835c8bf4 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/modelelement/NatTableModelElement.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/modelelement/NatTableModelElement.java
@@ -10,7 +10,7 @@
* Contributors:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
* Christian W. Damus (CEA) - bug 323802
- * Nicolas FAUVERGUE (ALL4tEC) nicolas.fauvergue@all4tec.net - Bug 476618, 192891
+ * Nicolas FAUVERGUE (ALL4tEC) nicolas.fauvergue@all4tec.net - Bug 476618, 192891, 496905
*
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.properties.modelelement;
@@ -76,6 +76,7 @@ import org.eclipse.papyrus.infra.nattable.properties.observable.RowPasteEObjectC
import org.eclipse.papyrus.infra.nattable.properties.observable.RowPasteEObjectElementTypeIdObservableValue;
import org.eclipse.papyrus.infra.nattable.properties.observable.RowPasteObjectDetachedModeObservableValue;
import org.eclipse.papyrus.infra.nattable.properties.observable.RowPasteObjectPostActionsObservableValue;
+import org.eclipse.papyrus.infra.nattable.properties.observable.TableLabelObservableValue;
import org.eclipse.papyrus.infra.nattable.properties.provider.AxisIdentifierLabelProvider;
import org.eclipse.papyrus.infra.nattable.properties.provider.ColumnPostActionIdsProvider;
import org.eclipse.papyrus.infra.nattable.properties.provider.RowPostActionIdsProvider;
@@ -434,6 +435,10 @@ public class NatTableModelElement extends EMFModelElement {
} else if (Constants.COLUMN_PASTED_EOBJECT_AXIS_IDENTIFIER_FEATURE.equals(propertyPath)) {
value = new ColumnPasteEObjectAxisIdentifierObservableValue(table);
}
+
+ else if(Constants.TABLE_LABEL.equals(propertyPath)){
+ value = new TableLabelObservableValue(table);
+ }
if (value != null) {
return value;
@@ -517,6 +522,10 @@ public class NatTableModelElement extends EMFModelElement {
} else if (Constants.COLUMN_PASTED_EOBJECT_AXIS_IDENTIFIER_FEATURE.equals(propertyPath)) {
res = new ColumnAxisIdentifierContentProvider(this.tableModelManager).getElements().length != 0;
}
+
+ else if(Constants.TABLE_LABEL.equals(propertyPath)){
+ res = true;
+ }
}
return res;
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/observable/TableLabelObservableValue.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/observable/TableLabelObservableValue.java
new file mode 100644
index 00000000000..0fc15a455c3
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/observable/TableLabelObservableValue.java
@@ -0,0 +1,216 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST 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:
+ * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.properties.observable;
+
+import org.eclipse.core.databinding.observable.Diffs;
+import org.eclipse.core.databinding.observable.IObserving;
+import org.eclipse.core.databinding.observable.Realm;
+import org.eclipse.core.databinding.observable.value.AbstractObservableValue;
+import org.eclipse.core.databinding.observable.value.ValueDiff;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.papyrus.infra.internationalization.InternationalizationEntry;
+import org.eclipse.papyrus.infra.internationalization.InternationalizationPackage;
+import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalization;
+import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalizationUtils;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+import org.eclipse.papyrus.infra.nattable.properties.Activator;
+import org.eclipse.papyrus.infra.nattable.utils.TableEditingDomainUtils;
+import org.eclipse.papyrus.infra.tools.databinding.ReferenceCountedObservable;
+
+/**
+ * The observable value for the label of the {@link Table}.
+ */
+@SuppressWarnings("rawtypes")
+public class TableLabelObservableValue extends AbstractObservableValue implements IObserving, ReferenceCountedObservable {
+
+ /**
+ * The support reference counting on behalf of an {@code observable}.
+ */
+ private final ReferenceCountedObservable.Support refCount = new ReferenceCountedObservable.Support(this);
+
+ /**
+ * The object instance.
+ */
+ protected Table table;
+
+ /**
+ * The editing domain on which the commands will be executed.
+ */
+ protected EditingDomain domain;
+
+ /**
+ * The listener for the entry modification.
+ */
+ protected Adapter listener;
+
+ /**
+ * The internationalization entry corresponding to the table.
+ */
+ protected InternationalizationEntry entry;
+
+ /**
+ * Constructor.
+ *
+ * @param table
+ * The table.
+ */
+ public TableLabelObservableValue(final Table table) {
+ this(Realm.getDefault(), table);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param realm
+ * The current Realm.
+ * @param table
+ * The table.
+ */
+ public TableLabelObservableValue(final Realm realm, final Table table) {
+ super(realm);
+ this.table = table;
+ this.domain = TableEditingDomainUtils.getTableEditingDomain(table);
+ this.entry = LabelInternationalizationUtils.getInternationalizationEntry(table, table);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.core.databinding.observable.AbstractObservable#dispose()
+ */
+ @Override
+ public synchronized void dispose() {
+ if (null != listener) {
+ entry.eAdapters().remove(listener);
+ listener = null;
+ }
+
+ entry = null;
+ table = null;
+ super.dispose();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.core.databinding.observable.IObserving#getObserved()
+ */
+ public Object getObserved() {
+ return table;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.core.databinding.observable.ChangeManager#firstListenerAdded()
+ */
+ @Override
+ protected void firstListenerAdded() {
+ if (null != entry) {
+ if (null == listener) {
+ listener = new AdapterImpl() {
+ @Override
+ public void notifyChanged(Notification notification) {
+ if (InternationalizationPackage.eINSTANCE.getInternationalizationEntry_Value() == notification.getFeature() && !notification.isTouch()) {
+ final ValueDiff diff = Diffs.createValueDiff(notification.getOldValue(), notification.getNewValue());
+ getRealm().exec(new Runnable() {
+ @SuppressWarnings("unchecked")
+ public void run() {
+ fireValueChange(diff);
+ }
+ });
+ }
+ }
+ };
+ }
+ entry.eAdapters().add(listener);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.core.databinding.observable.value.AbstractObservableValue#doGetValue()
+ */
+ @Override
+ protected Object doGetValue() {
+ return LabelInternationalization.getInstance().getTableLabelWithoutName(table);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.core.databinding.observable.value.AbstractObservableValue#doSetValue(java.lang.Object)
+ */
+ @Override
+ protected void doSetValue(final Object value) {
+ try {
+
+ // Remove the listener on entry
+ if (null != entry && null != listener) {
+ entry.eAdapters().remove(listener);
+ }
+
+ final Command emfCommand = LabelInternationalization.getInstance().getSetTableLabelCommand(domain, table, (String) value, null);
+ domain.getCommandStack().execute(emfCommand);
+
+ // Get the entry after the modification and try to apply listener if possible
+ this.entry = LabelInternationalizationUtils.getInternationalizationEntry(table, table);
+ firstListenerAdded();
+ } catch (Exception ex) {
+ Activator.log.error(ex);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.core.databinding.observable.value.IObservableValue#getValueType()
+ */
+ public Object getValueType() {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.tools.databinding.ReferenceCountedObservable#retain()
+ */
+ public void retain() {
+ refCount.retain();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.tools.databinding.ReferenceCountedObservable#release()
+ */
+ public void release() {
+ refCount.release();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.tools.databinding.ReferenceCountedObservable#autorelease()
+ */
+ public void autorelease() {
+ refCount.autorelease();
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/utils/Constants.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/utils/Constants.java
index 455d5d929d2..23be7ee072d 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/utils/Constants.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.properties/src/org/eclipse/papyrus/infra/nattable/properties/utils/Constants.java
@@ -9,6 +9,7 @@
*
* Contributors:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905
*
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.properties.utils;
@@ -33,6 +34,8 @@ public class Constants {
public static final String TABLE_OWNER = "owner"; //$NON-NLS-1$
public static final String TABLE_CONTEXT = "context"; //$NON-NLS-1$
+
+ public static final String TABLE_LABEL = "label"; //$NON-NLS-1$
public static final String LOCAL_COLUMN_HEADER_AXIS_CONFIGURATION_DISPLAY_LABEL = "localColumnHeaderAxisConfiguration.displayLabel"; //$NON-NLS-1$
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/META-INF/MANIFEST.MF b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/META-INF/MANIFEST.MF
index 936fe2d883f..6a055962af2 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/META-INF/MANIFEST.MF
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/META-INF/MANIFEST.MF
@@ -64,7 +64,8 @@ Require-Bundle: org.eclipse.gmf.runtime.emf.type.core;bundle-version="[1.9.0,2.0
org.eclipse.papyrus.infra.viewpoints.configuration;bundle-version="[2.0.0,3.0.0)";visibility:=reexport,
org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="[1.2.0,2.0.0)",
org.eclipse.papyrus.infra.types.core;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.editor;bundle-version="[2.0.0,3.0.0)"
+ org.eclipse.papyrus.editor;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)"
Bundle-Vendor: %Bundle-Vendor
Bundle-ActivationPolicy: lazy
Bundle-Version: 3.0.0.qualifier
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/INattableModelManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/INattableModelManager.java
index a97fdac8617..f6a45868a84 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/INattableModelManager.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/INattableModelManager.java
@@ -9,6 +9,7 @@
*
* Contributors:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905
*
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.manager.table;
@@ -109,6 +110,13 @@ public interface INattableModelManager extends ITableAxisElementProvider, IDispo
*/
public Command getAddColumnElementCommand(final Collection<Object> objectsToAdd, final int index);
+ /**
+ * This allows to set the label of a table.
+ *
+ * @param label The new label.
+ */
+ public void setTableLabel(final String label);
+
public void setTableName(String name);
public String getTableName();
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/NattableModelManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/NattableModelManager.java
index 5eba65507c7..fc7ad24bc4c 100755
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/NattableModelManager.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/NattableModelManager.java
@@ -9,7 +9,7 @@
*
* Contributors:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 476618
+ * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 476618, 496905
* Nicolas Boulay (Esterel Technologies SAS) - Bug 497467
* Sebastien Bordes (Esterel Technologies SAS) - Bug 497738
*
@@ -70,6 +70,7 @@ import org.eclipse.nebula.widgets.nattable.selection.command.SelectRowsCommand;
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
import org.eclipse.nebula.widgets.nattable.ui.NatEventData;
import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalization;
import org.eclipse.papyrus.infra.nattable.Activator;
import org.eclipse.papyrus.infra.nattable.command.CommandIds;
import org.eclipse.papyrus.infra.nattable.dialog.DisplayedAxisSelectorDialog;
@@ -1765,6 +1766,15 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
return this.rowManager;
}
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager#setTableLabel(java.lang.String)
+ */
+ @Override
+ public void setTableLabel(final String label) {
+ getTableEditingDomain().getCommandStack().execute(LabelInternationalization.getInstance().getSetTableLabelCommand(getTableEditingDomain(), getTable(), label, null));
+ }
@Override
public void setTableName(final String name) {
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/TableLabelProvider.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/TableLabelProvider.java
index f5383eecc89..00e72f39c5f 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/TableLabelProvider.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/provider/TableLabelProvider.java
@@ -1,61 +1,82 @@
-/*****************************************************************************
- * Copyright (c) 2013, 2016 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:
- * Juan Cadavid (CEA LIST) juan.cadavid@cea.fr - Initial API and implementation
- * Christian W. Damus - bug 474467
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.nattable.provider;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
-import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
-import org.eclipse.papyrus.infra.services.labelprovider.service.IFilteredLabelProvider;
-import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototypeLabelProvider;
-import org.eclipse.swt.graphics.Image;
-
-/**
- *
- * This labelprovider provides icon and text for tables to display them in treeviewer AND in the property view
- *
- */
-public class TableLabelProvider extends ViewPrototypeLabelProvider implements IFilteredLabelProvider {
-
- @Override
- public boolean accept(Object object) {
- if (object instanceof IStructuredSelection) {
- return accept((IStructuredSelection) object);
- }
-
- boolean result = EMFHelper.getEObject(object) instanceof Table;
- return result;
- }
-
- /**
- *
- * @param selection
- * a selection
- * @return
- * <code>true</code> if all elements in the selection are accepted
- */
- protected boolean accept(final IStructuredSelection selection) {
- for (final Object current : selection.toList()) {
- if (!accept(current)) {
- return false;
- }
- }
- return true;
- }
-
- @Override
- protected Image getNonCommonIcon(final Object commonObject) {
- return org.eclipse.papyrus.infra.widgets.Activator.getDefault().getImage(org.eclipse.papyrus.infra.nattable.Activator.PLUGIN_ID, "/icons/table.gif");
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2013, 2016 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:
+ * Juan Cadavid (CEA LIST) juan.cadavid@cea.fr - Initial API and implementation
+ * Christian W. Damus - bug 474467
+ * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.nattable.provider;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
+import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalization;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+import org.eclipse.papyrus.infra.services.labelprovider.service.IFilteredLabelProvider;
+import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototypeLabelProvider;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ *
+ * This labelprovider provides icon and text for tables to display them in treeviewer AND in the property view
+ *
+ */
+public class TableLabelProvider extends ViewPrototypeLabelProvider implements IFilteredLabelProvider {
+
+ @Override
+ public boolean accept(Object object) {
+ if (object instanceof IStructuredSelection) {
+ return accept((IStructuredSelection) object);
+ }
+
+ boolean result = EMFHelper.getEObject(object) instanceof Table;
+ return result;
+ }
+
+ /**
+ *
+ * @param selection
+ * a selection
+ * @return
+ * <code>true</code> if all elements in the selection are accepted
+ */
+ protected boolean accept(final IStructuredSelection selection) {
+ for (final Object current : selection.toList()) {
+ if (!accept(current)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.ui.emf.providers.EMFLabelProvider#getText(java.lang.Object)
+ */
+ @Override
+ public String getText(Object element) {
+ String result = null;
+
+ // return the internationalization of the table if this is the case
+ EObject eObject = EMFHelper.getEObject(element);
+ if (eObject instanceof Table) {
+ result = LabelInternationalization.getInstance().getTableLabel((Table) eObject);
+ }
+
+ return null != result ? result : super.getText(element);
+ }
+
+ @Override
+ protected Image getNonCommonIcon(final Object commonObject) {
+ return org.eclipse.papyrus.infra.widgets.Activator.getDefault().getImage(org.eclipse.papyrus.infra.nattable.Activator.PLUGIN_ID, "/icons/table.gif");
+ }
+
+}

Back to the top