Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Barbin2017-11-20 04:15:06 -0500
committerFlorian Barbin2017-11-28 05:58:42 -0500
commitc85201c57bb9e92ad259f083a37e90528c63f96e (patch)
treeb9629cc863823395418e6984c6d191be6661f0e7
parent467a61c65a6a04fb01bd3ddd603aa664737cf627 (diff)
downloadorg.eclipse.sirius-effcbaee33cc6cf33e5b8cc4964e474c16a7409e.tar.gz
org.eclipse.sirius-effcbaee33cc6cf33e5b8cc4964e474c16a7409e.tar.xz
org.eclipse.sirius-effcbaee33cc6cf33e5b8cc4964e474c16a7409e.zip
[526887] Makes possible to internationalize tool documentationv4.1.8
* 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>
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/palette/PaletteManagerImpl.java2
-rw-r--r--plugins/org.eclipse.sirius.table.ui/src/org/eclipse/sirius/table/ui/tools/internal/editor/action/DeleteLinesAction.java5
-rw-r--r--plugins/org.eclipse.sirius.table.ui/src/org/eclipse/sirius/table/ui/tools/internal/editor/action/DeleteTargetColumnAction.java16
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/data/unit/internationalization/bugzilla459993.odesign2
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/plugin.properties5
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/plugin_fr.properties5
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/SiriusInternationalizationTest.java17
-rw-r--r--plugins/org.eclipse.sirius.tree.ui/src/org/eclipse/sirius/tree/ui/tools/internal/editor/actions/DeleteTreeItemsAction.java8
8 files changed, 40 insertions, 20 deletions
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 cc3a495765..e1d5868f32 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 @@ public class PaletteManagerImpl implements PaletteManager {
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 4ef21bd0a2..5cdfc1262c 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.common.command.CompoundCommand;
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 @@ public class DeleteLinesAction extends Action {
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 dc47b6b048..f171c57ef4 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.business.api.query.IdentifiedElementQuery;
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 @@ import org.eclipse.sirius.viewpoint.description.tool.ToolPackage;
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 class DeleteTargetColumnAction extends AbstractTargetColumnAction {
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 @@ public class DeleteTargetColumnAction extends AbstractTargetColumnAction {
/**
* 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 e4c1233b93..5be67b6c7f 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 325f0122e7..b1d3a94e73 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 @@ SelectedValues=This is the selected values!
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 ee2816c763..ce75f9bc5e 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 @@ SelectedValues=Voici les valeurs sélectionnées!
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 adc8be392d..06a3a98a07 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.EcoreFactory;
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 @@ public class SiriusInternationalizationTest extends AbstractSiriusSwtBotGefTestC
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 @@ public class SiriusInternationalizationTest extends AbstractSiriusSwtBotGefTestC
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 @@ public class SiriusInternationalizationTest extends AbstractSiriusSwtBotGefTestC
}
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 7898356a66..4a9427cd15 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.common.command.CompoundCommand;
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 @@ public class DeleteTreeItemsAction extends Action {
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 @@ public class DeleteTreeItemsAction extends Action {
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);

Back to the top