Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas FAUVERGUE2016-12-15 12:36:45 +0000
committerGerrit Code Review @ Eclipse.org2016-12-15 16:25:33 +0000
commit169c86a4a168a14f1921d5737158c286b40adab3 (patch)
tree14a30a344381bfb5ececb95554e35f7cc76ae15c /plugins/infra/nattable
parentded4880e2074015ec976ffb7fc29e236d6f9efa2 (diff)
downloadorg.eclipse.papyrus-169c86a4a168a14f1921d5737158c286b40adab3.tar.gz
org.eclipse.papyrus-169c86a4a168a14f1921d5737158c286b40adab3.tar.xz
org.eclipse.papyrus-169c86a4a168a14f1921d5737158c286b40adab3.zip
Bug 509278: [Internationalization] Diagram and Table labels in Model
Explorer must be managed by custom facet https://bugs.eclipse.org/bugs/show_bug.cgi?id=509278 - Manage the diagram and table labels with facet - Remove internationalization dependency from emf.facet.custom.ui Change-Id: I4df27993c0905d64ab19f630ebbc42213c58a614 Signed-off-by: Nicolas FAUVERGUE <nicolas.fauvergue@cea.fr>
Diffstat (limited to 'plugins/infra/nattable')
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/META-INF/MANIFEST.MF3
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/resources/PapyrusTable.custom19
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/queries/GetTableLabel.java39
3 files changed, 60 insertions, 1 deletions
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 8b10a6fef59..edeae348f85 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
@@ -18,7 +18,8 @@ Require-Bundle: org.eclipse.papyrus.infra.nattable.model;bundle-version="[2.0.0,
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.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)"
+ org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)",
+ org.eclipse.papyrus.infra.nattable.model.edit;bundle-version="[2.0.0,3.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/resources/PapyrusTable.custom b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/resources/PapyrusTable.custom
index ae104ad5fa3..38c517de42d 100755
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/resources/PapyrusTable.custom
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/resources/PapyrusTable.custom
@@ -18,6 +18,25 @@
<extendedMetaclass
href="http://www.eclipse.org/papyrus/nattable/model#//Table"/>
<facetOperations
+ name="GetDiagramLabel"
+ documentation="Return the label of the corresponding table">
+ <eType
+ xsi:type="ecore:EDataType"
+ href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eParameters
+ name="eStructuralFeature">
+ <eType
+ xsi:type="ecore:EClass"
+ href="http://www.eclipse.org/emf/2002/Ecore#//ETypedElement"/>
+ </eParameters>
+ <query
+ xsi:type="javaQuery:JavaQuery"
+ implementationClassName="org.eclipse.papyrus.infra.nattable.modelexplorer.queries.GetTableLabel"/>
+ <override
+ xsi:type="efacet:FacetOperation"
+ href="platform:/plugin/org.eclipse.papyrus.emf.facet.custom.ui/resources/customproperties.efacet#//CustomizedEObject/label"/>
+ </facetOperations>
+ <facetOperations
name="GetTableIcon"
documentation="Return the path to the icon of the corresponding table">
<eType
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/queries/GetTableLabel.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/queries/GetTableLabel.java
new file mode 100644
index 00000000000..ed3982a21f8
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable.modelexplorer/src/org/eclipse/papyrus/infra/nattable/modelexplorer/queries/GetTableLabel.java
@@ -0,0 +1,39 @@
+/**
+ * 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 (CEA LIST) nicolas.fauvergue@cea.fr - Initial API and implementation
+ *
+ */
+package org.eclipse.papyrus.infra.nattable.modelexplorer.queries;
+
+import org.eclipse.papyrus.emf.facet.efacet.core.IFacetManager;
+import org.eclipse.papyrus.emf.facet.efacet.core.exception.DerivedTypedElementException;
+import org.eclipse.papyrus.emf.facet.query.java.core.IJavaQuery2;
+import org.eclipse.papyrus.emf.facet.query.java.core.IParameterValueList2;
+import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalization;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+import org.eclipse.papyrus.infra.nattable.model.nattable.provider.NattableEditPlugin;
+import org.eclipse.papyrus.infra.ui.editorsfactory.AbstractGetEditorIconQuery;
+
+/**
+ * Return the label of the corresponding table.
+ */
+public class GetTableLabel extends AbstractGetEditorIconQuery implements IJavaQuery2<Table, String> {
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.emf.facet.query.java.core.IJavaQuery2#evaluate(org.eclipse.emf.ecore.EObject, org.eclipse.papyrus.emf.facet.query.java.core.IParameterValueList2, org.eclipse.papyrus.emf.facet.efacet.core.IFacetManager)
+ */
+ public String evaluate(final Table source, final IParameterValueList2 parameterValues, final IFacetManager facetManager) throws DerivedTypedElementException {
+ final String label = LabelInternationalization.getInstance().getTableLabel(source);
+ return label == null || label.length() == 0 ? NattableEditPlugin.INSTANCE.getString("_UI_Table_type") : //$NON-NLS-1$
+ NattableEditPlugin.INSTANCE.getString("_UI_Table_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+}

Back to the top