[526887] Makes possible to internationalize tool documentation

* The Documentation field in tool description was not interpreted as a
possible internationalized value.
* Update the corresponding test.

Bug: 526887
Change-Id: I2d1930cc113a1f75a45cbd661441ec9638b68383
Signed-off-by: Florian Barbin <florian.barbin@obeo.fr>
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/palette/PaletteManagerImpl.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/palette/PaletteManagerImpl.java
index cc3a495..e1d5868 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/palette/PaletteManagerImpl.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/palette/PaletteManagerImpl.java
@@ -803,7 +803,7 @@
                 final AbstractToolDescription toolDescription = (AbstractToolDescription) toolEntry;
                 final ImageDescriptor imageEntry = paletteImageProvider.getImageDescriptor(toolDescription);
                 final String nameEntry = MessageTranslator.INSTANCE.getMessage(toolDescription, new IdentifiedElementQuery(toolDescription).getLabel());
-                final String descriptionEntry = toolDescription.getDocumentation();
+                final String descriptionEntry = MessageTranslator.INSTANCE.getMessage(toolDescription, toolDescription.getDocumentation());
                 final CreationFactory creationFactory = new PaletteToolBasedCreationFactory(toolDescription);
                 CreationToolEntry paletteEntry = null;
                 if (toolDescription instanceof EdgeCreationDescription) {
diff --git a/plugins/org.eclipse.sirius.table.ui/src/org/eclipse/sirius/table/ui/tools/internal/editor/action/DeleteLinesAction.java b/plugins/org.eclipse.sirius.table.ui/src/org/eclipse/sirius/table/ui/tools/internal/editor/action/DeleteLinesAction.java
index 4ef21bd..5cdfc12 100644
--- a/plugins/org.eclipse.sirius.table.ui/src/org/eclipse/sirius/table/ui/tools/internal/editor/action/DeleteLinesAction.java
+++ b/plugins/org.eclipse.sirius.table.ui/src/org/eclipse/sirius/table/ui/tools/internal/editor/action/DeleteLinesAction.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2007, 2016 THALES GLOBAL SERVICES and others.
+ * Copyright (c) 2007, 2017 THALES GLOBAL SERVICES 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
@@ -16,6 +16,7 @@
 import org.eclipse.emf.transaction.TransactionalEditingDomain;
 import org.eclipse.jface.action.Action;
 import org.eclipse.sirius.business.api.query.IdentifiedElementQuery;
+import org.eclipse.sirius.common.tools.api.util.MessageTranslator;
 import org.eclipse.sirius.table.business.api.query.DLineQuery;
 import org.eclipse.sirius.table.metamodel.table.DLine;
 import org.eclipse.sirius.table.metamodel.table.description.DeleteTool;
@@ -89,7 +90,7 @@
                 DeleteTool deleteTool = getDeleteTool(linesToDelete.iterator().next());
                 if (deleteTool != null) {
                     setText(new IdentifiedElementQuery(deleteTool).getLabel());
-                    setToolTipText(deleteTool.getDocumentation());
+                    setToolTipText(MessageTranslator.INSTANCE.getMessage(deleteTool, deleteTool.getDocumentation()));
                 }
             } else if (linesToDelete.size() > 1) {
                 setText(Messages.DeleteLinesAction_labelMany);
diff --git a/plugins/org.eclipse.sirius.table.ui/src/org/eclipse/sirius/table/ui/tools/internal/editor/action/DeleteTargetColumnAction.java b/plugins/org.eclipse.sirius.table.ui/src/org/eclipse/sirius/table/ui/tools/internal/editor/action/DeleteTargetColumnAction.java
index dc47b6b..f171c57 100644
--- a/plugins/org.eclipse.sirius.table.ui/src/org/eclipse/sirius/table/ui/tools/internal/editor/action/DeleteTargetColumnAction.java
+++ b/plugins/org.eclipse.sirius.table.ui/src/org/eclipse/sirius/table/ui/tools/internal/editor/action/DeleteTargetColumnAction.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2007, 2015 THALES GLOBAL SERVICES.
+ * Copyright (c) 2007, 2017 THALES GLOBAL SERVICES.
  * 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
@@ -18,6 +18,7 @@
 import org.eclipse.sirius.common.tools.api.interpreter.EvaluationException;
 import org.eclipse.sirius.common.tools.api.interpreter.IInterpreter;
 import org.eclipse.sirius.common.tools.api.interpreter.IInterpreterSiriusVariables;
+import org.eclipse.sirius.common.tools.api.util.MessageTranslator;
 import org.eclipse.sirius.common.tools.api.util.StringUtil;
 import org.eclipse.sirius.table.business.api.helper.TableHelper;
 import org.eclipse.sirius.table.metamodel.table.DTable;
@@ -37,8 +38,7 @@
 public class DeleteTargetColumnAction extends AbstractTargetColumnAction {
 
     /**
-     * Constructor. The deleteTool can be null if there is nothing specific to
-     * do.
+     * Constructor. The deleteTool can be null if there is nothing specific to do.
      *
      * @param deleteTool
      *            The tool to do some other actions
@@ -50,9 +50,10 @@
     public DeleteTargetColumnAction(final DeleteTool deleteTool, final TransactionalEditingDomain editingDomain, final ITableCommandFactory tableCommandFactory) {
         super(Messages.DeleteTargetColumnAction_label, DTableViewerManager.getImageRegistry().getDescriptor(DTableViewerManager.DELETE_IMG), editingDomain, tableCommandFactory, deleteTool);
         setToolTipText(Messages.DeleteTargetColumnAction_tooltip);
-        if (getDeleteTool() != null) {
-            setText(new IdentifiedElementQuery(getDeleteTool()).getLabel());
-            setToolTipText(getDeleteTool().getDocumentation());
+        DeleteTool tool = getDeleteTool();
+        if (tool != null) {
+            setText(new IdentifiedElementQuery(tool).getLabel());
+            setToolTipText(MessageTranslator.INSTANCE.getMessage(tool, tool.getDocumentation()));
         }
     }
 
@@ -94,8 +95,7 @@
     /**
      * The tool of this action or null if there is no specific delete action.
      *
-     * @return The tool of this action or null if there is no specific delete
-     *         action
+     * @return The tool of this action or null if there is no specific delete action
      */
     public DeleteTool getDeleteTool() {
         DeleteTool tool = null;
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/internationalization/bugzilla459993.odesign b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/internationalization/bugzilla459993.odesign
index e4c1233..5be67b6 100644
--- a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/internationalization/bugzilla459993.odesign
+++ b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/internationalization/bugzilla459993.odesign
@@ -13,7 +13,7 @@
           </style>
         </containerMappings>
         <toolSections name="toolsSection" label="%toolsSectionLabel">
-          <ownedTools xsi:type="tool:ContainerCreationDescription" name="EPackageCreationTool" label="%EPackageCreationTool" containerMappings="//@ownedViewpoints[name='bugzilla459993']/@ownedRepresentations[name='bugzilla459993Diag']/@defaultLayer/@containerMappings[name='EPackage']">
+          <ownedTools xsi:type="tool:ContainerCreationDescription" documentation="%toolDocumentation" name="EPackageCreationTool" label="%EPackageCreationTool" containerMappings="//@ownedViewpoints[name='bugzilla459993']/@ownedRepresentations[name='bugzilla459993Diag']/@defaultLayer/@containerMappings[name='EPackage']">
             <variable name="container"/>
             <viewVariable name="containerView"/>
             <initialOperation>
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/plugin.properties b/plugins/org.eclipse.sirius.tests.swtbot/plugin.properties
index 325f012..b1d3a94 100644
--- a/plugins/org.eclipse.sirius.tests.swtbot/plugin.properties
+++ b/plugins/org.eclipse.sirius.tests.swtbot/plugin.properties
@@ -1,5 +1,5 @@
 # ====================================================================
-# Copyright (c) 2010, 2016 THALES GLOBAL SERVICES
+# Copyright (c) 2010, 2017 THALES GLOBAL SERVICES
 # 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
@@ -25,4 +25,5 @@
 popupMenu=Bugzilla 459993 Popup menu
 operationAction1=Bugzilla 459993 Operation 1
 operationAction2=Bugzilla 459993 Operation 2
-nameFeature=Name
\ No newline at end of file
+nameFeature=Name
+toolDocumentation=Tool documentation
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/plugin_fr.properties b/plugins/org.eclipse.sirius.tests.swtbot/plugin_fr.properties
index ee2816c..ce75f9b 100644
--- a/plugins/org.eclipse.sirius.tests.swtbot/plugin_fr.properties
+++ b/plugins/org.eclipse.sirius.tests.swtbot/plugin_fr.properties
@@ -1,5 +1,5 @@
 # ====================================================================
-# Copyright (c) 2016 Obeo
+# Copyright (c) 2016, 2017 Obeo
 # 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
@@ -23,4 +23,5 @@
 popupMenu=Bugzilla 459993 Menu popup
 operationAction1=Bugzilla 459993 Opération 1
 operationAction2=Bugzilla 459993 Opération 2
-nameFeature=Nom
\ No newline at end of file
+nameFeature=Nom
+toolDocumentation=Documentation de l'outil
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/SiriusInternationalizationTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/SiriusInternationalizationTest.java
index adc8be3..06a3a98 100644
--- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/SiriusInternationalizationTest.java
+++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/SiriusInternationalizationTest.java
@@ -28,9 +28,11 @@
 import org.eclipse.emf.ecore.resource.Resource;
 import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
 import org.eclipse.gef.palette.PaletteRoot;
+import org.eclipse.gmf.runtime.diagram.ui.internal.services.palette.PaletteToolEntry;
 import org.eclipse.sirius.business.api.componentization.ViewpointRegistry;
 import org.eclipse.sirius.common.tools.api.util.MessageTranslator;
 import org.eclipse.sirius.common.tools.internal.resource.ResourceSyncClientNotifier;
+import org.eclipse.sirius.diagram.ui.tools.internal.palette.SectionPaletteDrawer;
 import org.eclipse.sirius.diagram.ui.tools.internal.palette.SiriusPaletteViewer;
 import org.eclipse.sirius.tests.swtbot.support.api.AbstractSiriusSwtBotGefTestCase;
 import org.eclipse.sirius.tests.swtbot.support.api.business.UILocalSession;
@@ -138,6 +140,10 @@
 
     private static final String FILE_DIR = "/";
 
+    private static final String TOOL_DOCUMENTATION_TOOLTIP_ENG = "Tool documentation";
+
+    private static final String TOOL_DOCUMENTATION_TOOLTIP_FR = "Documentation de l'outil";
+
     private UIResource sessionAirdResource;
 
     private UILocalSession localSession;
@@ -345,6 +351,10 @@
         SWTBotUtils.waitAllUiEvents();
         int after = paletteRoot.getChildren().size();
         assertEquals("The number of elements in the palette should be the same after a refresh following an external modification.", before, after);
+
+        String description = ((PaletteToolEntry) ((SectionPaletteDrawer) paletteRoot.getChildren().get(1)).getChildren().get(0)).getDescription();
+        assertEquals("The tool documentation tooltip is not the expected one.", description, getToolDocumentationTooltip());
+
     }
 
     /**
@@ -674,4 +684,11 @@
         }
         return OPERATION_ACTION2_LABEL_FR;
     }
+
+    private String getToolDocumentationTooltip() {
+        if ("en".equals(selected_language)) {
+            return TOOL_DOCUMENTATION_TOOLTIP_ENG;
+        }
+        return TOOL_DOCUMENTATION_TOOLTIP_FR;
+    }
 }
diff --git a/plugins/org.eclipse.sirius.tree.ui/src/org/eclipse/sirius/tree/ui/tools/internal/editor/actions/DeleteTreeItemsAction.java b/plugins/org.eclipse.sirius.tree.ui/src/org/eclipse/sirius/tree/ui/tools/internal/editor/actions/DeleteTreeItemsAction.java
index 7898356..4a9427c 100644
--- a/plugins/org.eclipse.sirius.tree.ui/src/org/eclipse/sirius/tree/ui/tools/internal/editor/actions/DeleteTreeItemsAction.java
+++ b/plugins/org.eclipse.sirius.tree.ui/src/org/eclipse/sirius/tree/ui/tools/internal/editor/actions/DeleteTreeItemsAction.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2010, 2016 THALES GLOBAL SERVICES and others.
+ * Copyright (c) 2010, 2017 THALES GLOBAL SERVICES 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
@@ -16,6 +16,7 @@
 import org.eclipse.emf.transaction.TransactionalEditingDomain;
 import org.eclipse.jface.action.Action;
 import org.eclipse.sirius.business.api.query.IdentifiedElementQuery;
+import org.eclipse.sirius.common.tools.api.util.MessageTranslator;
 import org.eclipse.sirius.tree.DTreeItem;
 import org.eclipse.sirius.tree.business.api.command.ITreeCommandFactory;
 import org.eclipse.sirius.tree.business.internal.metamodel.query.DTreeItemInternalQuery;
@@ -39,8 +40,7 @@
     private final Collection<DTreeItem> items = Lists.newArrayList();
 
     /**
-     * Constructor. The deleteTool can be null if there is nothing specific to
-     * do (only the delete of the line). <BR>
+     * Constructor. The deleteTool can be null if there is nothing specific to do (only the delete of the line). <BR>
      * When a {@link DeleteTool} is specified the normal delete is not done.
      * 
      * @param editingDomain
@@ -102,7 +102,7 @@
             TreeItemDeletionTool deleteTool = getDeleteTool(items.iterator().next());
             if (deleteTool != null) {
                 setText(new IdentifiedElementQuery(deleteTool).getLabel());
-                setToolTipText(deleteTool.getDocumentation());
+                setToolTipText(MessageTranslator.INSTANCE.getMessage(deleteTool, deleteTool.getDocumentation()));
             }
         } else if (items.size() > 1) {
             setText(Messages.DeleteTreeItemsAction_deleteTreeItems);