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
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')
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/META-INF/MANIFEST.MF3
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/papyrus/emf/facet/custom/ui/internal/query/LabelQuery.java2
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/META-INF/MANIFEST.MF3
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/resources/PapyrusDiagram.custom19
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/queries/GetDiagramLabel.java39
-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
8 files changed, 121 insertions, 6 deletions
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/META-INF/MANIFEST.MF b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/META-INF/MANIFEST.MF
index ebb63f5503d..95629903d82 100644
--- a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/META-INF/MANIFEST.MF
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/META-INF/MANIFEST.MF
@@ -14,8 +14,7 @@ Require-Bundle: org.eclipse.papyrus.emf.facet.custom.core;bundle-version="[2.0.0
org.eclipse.emf.edit.ui;bundle-version="[2.12.0,3.0.0)",
org.eclipse.papyrus.emf.facet.util.swt;bundle-version="[1.2.0,2.0.0)",
org.eclipse.papyrus.emf.facet.util.jface.ui;bundle-version="[1.2.0,2.0.0)",
- org.eclipse.papyrus.emf.facet.common.ui;bundle-version="[1.2.0,2.0.0)",
- org.eclipse.papyrus.infra.internationalization.edit;bundle-version="[1.0.0,2.0.0)"
+ org.eclipse.papyrus.emf.facet.common.ui;bundle-version="[1.2.0,2.0.0)"
Bundle-Vendor: %Bundle-Vendor
Bundle-ActivationPolicy: lazy
Bundle-Version: 2.0.0.qualifier
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/papyrus/emf/facet/custom/ui/internal/query/LabelQuery.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/papyrus/emf/facet/custom/ui/internal/query/LabelQuery.java
index 156d2ceab6a..b8e0a92290b 100644
--- a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/papyrus/emf/facet/custom/ui/internal/query/LabelQuery.java
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.ui/src/org/eclipse/papyrus/emf/facet/custom/ui/internal/query/LabelQuery.java
@@ -31,7 +31,6 @@ import org.eclipse.papyrus.emf.facet.efacet.core.exception.DerivedTypedElementEx
import org.eclipse.papyrus.emf.facet.query.java.core.IJavaQuery2;
import org.eclipse.papyrus.emf.facet.query.java.core.IParameterValueList2;
import org.eclipse.papyrus.emf.facet.util.emf.core.ModelUtils;
-import org.eclipse.papyrus.infra.internationalization.edit.provider.InternationalizationNotationItemProviderAdapterFactory;
public class LabelQuery implements IJavaQuery2<EObject, String> {
@@ -50,7 +49,6 @@ public class LabelQuery implements IJavaQuery2<EObject, String> {
if (sfParam == null) {
final ComposedAdapterFactory adapterFactory = new ComposedAdapterFactory(
ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
- adapterFactory.insertAdapterFactory(new InternationalizationNotationItemProviderAdapterFactory());
try {
final IItemLabelProvider itemLabelProvider = (IItemLabelProvider) adapterFactory.adapt(source, IItemLabelProvider.class);
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/META-INF/MANIFEST.MF
index 6c76cfaf435..f1a1f366938 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/META-INF/MANIFEST.MF
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/META-INF/MANIFEST.MF
@@ -4,7 +4,8 @@ Require-Bundle: org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[3.0.0,
org.eclipse.papyrus.infra.emf;bundle-version="[2.0.0,3.0.0)",
org.eclipse.papyrus.infra.gmfdiag.common;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)"
+ org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)",
+ org.eclipse.papyrus.infra.internationalization.edit;bundle-version="[1.0.0,2.0.0)"
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
Bundle-Version: 1.2.0.qualifier
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/resources/PapyrusDiagram.custom b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/resources/PapyrusDiagram.custom
index c6446db5d4b..3926b555773 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/resources/PapyrusDiagram.custom
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/resources/PapyrusDiagram.custom
@@ -19,6 +19,25 @@
<extendedMetaclass
href="http://www.eclipse.org/gmf/runtime/1.0.2/notation#//Diagram"/>
<facetOperations
+ name="GetDiagramLabel"
+ documentation="Return the label of the corresponding diagram">
+ <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.gmfdiag.modelexplorer.queries.GetDiagramLabel"/>
+ <override
+ xsi:type="efacet:FacetOperation"
+ href=".platform:/plugin/org.eclipse.papyrus.emf.facet.custom.ui/resources/customproperties.efacet#//CustomizedEObject/label"/>
+ </facetOperations>
+ <facetOperations
name="GetDiagramIcon"
documentation="Return the path to the icon of the corresponding diagram">
<eType
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/queries/GetDiagramLabel.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/queries/GetDiagramLabel.java
new file mode 100644
index 00000000000..79bbc1eb8b1
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/queries/GetDiagramLabel.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.gmfdiag.modelexplorer.queries;
+
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.NotationEditPlugin;
+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.ui.editorsfactory.AbstractGetEditorIconQuery;
+
+/**
+ * Return the label of the corresponding diagram.
+ */
+public class GetDiagramLabel extends AbstractGetEditorIconQuery implements IJavaQuery2<Diagram, 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 Diagram source, final IParameterValueList2 parameterValues, final IFacetManager facetManager) throws DerivedTypedElementException {
+ final String label = LabelInternationalization.getInstance().getDiagramLabel(source);
+ return label == null || label.length() == 0 ? NotationEditPlugin.INSTANCE.getString("_UI_Diagram_type", true) : //$NON-NLS-1$
+ NotationEditPlugin.INSTANCE.getString("_UI_Diagram_type", true) + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+}
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