[472057] Externalize translatable strings from org.eclipse.sirius.tree
Bug: 472057
Change-Id: I7890c5054256784c1c3fdc1747e2313cb51c6b7a
Signed-off-by: Pierre-Charles David <pierre-charles.david@obeo.fr>
diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html
index a632d82..e010388 100644
--- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html
+++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html
@@ -299,6 +299,9 @@
<code>org.eclipse.sirius.interpreter</code>
</li>
<li>
+ <code>org.eclipse.sirius.tree</code>
+ </li>
+ <li>
<code>org.eclipse.sirius.tree.ui</code>
</li>
</ul>
diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile
index 6579e34..5949410 100644
--- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile
+++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile
@@ -71,6 +71,7 @@
** @org.eclipse.sirius.common.ui@
** @org.eclipse.sirius.eef.adapters@
** @org.eclipse.sirius.interpreter@
+** @org.eclipse.sirius.tree@
** @org.eclipse.sirius.tree.ui@
h4. Changes in @org.eclipse.sirius.common@
diff --git a/plugins/org.eclipse.sirius.tree/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.sirius.tree/.settings/org.eclipse.jdt.core.prefs
index fc8c7f3..39e1d0d 100644
--- a/plugins/org.eclipse.sirius.tree/.settings/org.eclipse.jdt.core.prefs
+++ b/plugins/org.eclipse.sirius.tree/.settings/org.eclipse.jdt.core.prefs
@@ -32,7 +32,7 @@
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=error
org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
diff --git a/plugins/org.eclipse.sirius.tree/plugin.properties b/plugins/org.eclipse.sirius.tree/plugin.properties
index 9acf7f1..007787b 100644
--- a/plugins/org.eclipse.sirius.tree/plugin.properties
+++ b/plugins/org.eclipse.sirius.tree/plugin.properties
@@ -1,5 +1,5 @@
# ====================================================================
-# Copyright (c) 2013 THALES GLOBAL SERVICES
+# Copyright (c) 2013, 2015 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
@@ -11,3 +11,27 @@
pluginName = Sirius Tree Model
providerName = Eclipse Modeling Project
+
+DTreeItemExpansionChangeCommand_collapseItem = Collapse \"{0}\" tree item
+DTreeItemExpansionChangeCommand_expandItem = Expand \"{0}\" tree item
+DTreeItemLocalRefreshCommand_refreshLocally = Refresh locally tree
+DTreeItemUserInteraction_treeItemExpanding = Tree item expanding
+DTreeRefresh_noMapping = no mapping to set
+DTreeRefresh_nonsense = It has no sense
+DTreeRefresh_unknownDescriptor=Unknown descriptor: {0}
+DTreeRefresh_unknownRepresentationContainer = Unkown representation container instance
+DTreeUserInteraction_treeRefresh = Refresh tree
+MappingBasedPartition_semanticCandidateEvaluationError = Error while evaluating semantic candidate expression
+RefreshTreeElementTask_label = Refresh element task
+TreeCommandFactory_directEdit = Direct Edit on {0}
+TreeCommandFactory_dropItem = Drop the item {0}
+TreeCommandFactory_operationAction= {0} on {1}
+TreeDialectServices_createTree = Create tree : {0}
+TreeDialectServices_initializeTree = Initialize tree of type {0}
+TreeDialectServices_refreshImpactedElements = Refresh impacted elements
+TreeDialectServices_treeRefresh = Tree refresh
+TreeItemMappingExpression_preconditionEvaluationError=the following Tree Item mapping precondition could not be correctly evaluated : {0}
+TreeToolVariables_container = The semantic element corresponding to the view container.
+TreeToolVariables_element = The currently edited element.
+TreeToolVariables_precedingSiblings=The list of all the preceding siblings in a Drag and Drop operation
+TreeToolVariables_root = The semantic element of the tree.
diff --git a/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/api/command/DTreeItemExpansionChangeCommand.java b/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/api/command/DTreeItemExpansionChangeCommand.java
index 94522b2..6e70a42 100644
--- a/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/api/command/DTreeItemExpansionChangeCommand.java
+++ b/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/api/command/DTreeItemExpansionChangeCommand.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 THALES GLOBAL SERVICES.
+ * Copyright (c) 2011, 2015 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
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.sirius.tree.business.api.command;
+import java.text.MessageFormat;
+
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.emf.transaction.RecordingCommand;
@@ -17,6 +19,7 @@
import org.eclipse.sirius.tree.DTreeItem;
import org.eclipse.sirius.tree.business.api.interaction.DTreeItemUserInteraction;
import org.eclipse.sirius.tree.business.internal.dialect.common.viewpoint.GlobalContext;
+import org.eclipse.sirius.tree.tools.internal.Messages;
/**
* EMF Command to expand/collapse a {@link DTreeItem}.
@@ -47,7 +50,7 @@
* true to expand, false to collapse
*/
public DTreeItemExpansionChangeCommand(GlobalContext globalContext, TransactionalEditingDomain domain, DTreeItem dTreeItem, boolean expand) {
- super(domain, (expand ? "Expand" : "Collapse") + " \"" + dTreeItem.getName() + "\" tree item");
+ super(domain, MessageFormat.format(expand ? Messages.DTreeItemExpansionChangeCommand_expandItem : Messages.DTreeItemExpansionChangeCommand_collapseItem, dTreeItem.getName()));
this.globalContext = globalContext;
this.dTreeItem = dTreeItem;
this.expand = expand;
@@ -70,7 +73,7 @@
* a {@link IProgressMonitor} to give progression
*/
public DTreeItemExpansionChangeCommand(GlobalContext globalContext, TransactionalEditingDomain domain, DTreeItem dTreeItem, IProgressMonitor monitor, boolean expand) {
- super(domain, (expand ? "Expand" : "Collapse") + " \"" + dTreeItem.getName() + "\" tree item");
+ super(domain, MessageFormat.format(expand ? Messages.DTreeItemExpansionChangeCommand_expandItem : Messages.DTreeItemExpansionChangeCommand_collapseItem, dTreeItem.getName()));
this.globalContext = globalContext;
this.dTreeItem = dTreeItem;
this.expand = expand;
diff --git a/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/api/command/DTreeItemLocalRefreshCommand.java b/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/api/command/DTreeItemLocalRefreshCommand.java
index 3417280..3562a2d 100644
--- a/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/api/command/DTreeItemLocalRefreshCommand.java
+++ b/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/api/command/DTreeItemLocalRefreshCommand.java
@@ -16,6 +16,7 @@
import org.eclipse.sirius.tree.DTreeItem;
import org.eclipse.sirius.tree.business.api.interaction.DTreeItemUserInteraction;
import org.eclipse.sirius.tree.business.internal.dialect.common.viewpoint.GlobalContext;
+import org.eclipse.sirius.tree.tools.internal.Messages;
/**
* EMF Command to do a local refresh of a set of {@link DTreeItem}.
@@ -44,7 +45,7 @@
* children recursively
*/
public DTreeItemLocalRefreshCommand(TransactionalEditingDomain domain, GlobalContext globalContext, Collection<DTreeItem> dTreeItems, boolean fullRefresh) {
- super(domain, "Refresh locally tree");
+ super(domain, Messages.DTreeItemLocalRefreshCommand_refreshLocally);
this.globalContext = globalContext;
this.dTreeItems = dTreeItems;
this.fullRefresh = fullRefresh;
diff --git a/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/api/interaction/DTreeItemUserInteraction.java b/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/api/interaction/DTreeItemUserInteraction.java
index b7f3132..90513be 100644
--- a/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/api/interaction/DTreeItemUserInteraction.java
+++ b/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/api/interaction/DTreeItemUserInteraction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 THALES GLOBAL SERVICES.
+ * Copyright (c) 2011, 2015 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
@@ -21,6 +21,7 @@
import org.eclipse.sirius.tree.business.api.query.TreeDescriptionQuery;
import org.eclipse.sirius.tree.business.internal.dialect.common.tree.DTreeRefresh;
import org.eclipse.sirius.tree.business.internal.dialect.common.viewpoint.GlobalContext;
+import org.eclipse.sirius.tree.tools.internal.Messages;
/**
* Class allowing to synchronizer a {@link DTreeItem} model according to its
@@ -73,7 +74,7 @@
*/
public void expandAll(IProgressMonitor monitor) {
try {
- monitor.beginTask("Tree item expandion", item.getOwnedTreeItems().size() + 1);
+ monitor.beginTask(Messages.DTreeItemUserInteraction_treeItemExpanding, item.getOwnedTreeItems().size() + 1);
expand(new SubProgressMonitor(monitor, 1));
for (DTreeItem child : item.getOwnedTreeItems()) {
new DTreeItemUserInteraction(child, ctx).expandAll(new SubProgressMonitor(monitor, 1));
diff --git a/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/api/interaction/DTreeUserInteraction.java b/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/api/interaction/DTreeUserInteraction.java
index 5343484..cf28aab 100644
--- a/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/api/interaction/DTreeUserInteraction.java
+++ b/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/api/interaction/DTreeUserInteraction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 THALES GLOBAL SERVICES.
+ * Copyright (c) 2011, 2015 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
@@ -21,6 +21,7 @@
import org.eclipse.sirius.tree.business.api.query.TreeDescriptionQuery;
import org.eclipse.sirius.tree.business.internal.dialect.common.tree.DTreeRefresh;
import org.eclipse.sirius.tree.business.internal.dialect.common.viewpoint.GlobalContext;
+import org.eclipse.sirius.tree.tools.internal.Messages;
/**
* This class is responsible for providing an entry point to all the user
@@ -74,7 +75,7 @@
*/
public DTreeUserInteraction refreshContent(boolean fullRefresh, IProgressMonitor monitor) {
try {
- monitor.beginTask("Refresh tree", 1);
+ monitor.beginTask(Messages.DTreeUserInteraction_treeRefresh, 1);
DslCommonPlugin.PROFILER.startWork(SiriusTasksKey.REFRESH_TREE_KEY);
SemanticPartitionInvalidator invalidator = new SemanticPartitionInvalidator();
DTreeRefresh refresher = new DTreeRefresh(tree, new TreeDescriptionQuery(tree.getDescription()).getAllDescendantMappings(), invalidator, ctx);
@@ -105,7 +106,7 @@
*/
public DTreeUserInteraction expandAll(IProgressMonitor monitor) {
try {
- monitor.beginTask("Tree item expandion", tree.getOwnedTreeItems().size());
+ monitor.beginTask(Messages.DTreeItemUserInteraction_treeItemExpanding, tree.getOwnedTreeItems().size());
for (DTreeItem child : tree.getOwnedTreeItems()) {
new DTreeItemUserInteraction(child, ctx).expandAll(new SubProgressMonitor(monitor, 1));
}
@@ -135,7 +136,7 @@
*/
public DTreeUserInteraction expand(IProgressMonitor monitor) {
try {
- monitor.beginTask("Tree item expanding", tree.getOwnedTreeItems().size());
+ monitor.beginTask(Messages.DTreeItemUserInteraction_treeItemExpanding, tree.getOwnedTreeItems().size());
for (DTreeItem child : tree.getOwnedTreeItems()) {
if (!child.isExpanded()) {
new DTreeItemUserInteraction(child, ctx).expand(new SubProgressMonitor(monitor, 1));
diff --git a/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/internal/dialect/TreeDialectServices.java b/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/internal/dialect/TreeDialectServices.java
index 81c39f4..f5d3340 100644
--- a/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/internal/dialect/TreeDialectServices.java
+++ b/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/internal/dialect/TreeDialectServices.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.sirius.tree.business.internal.dialect;
+import java.text.MessageFormat;
import java.util.Collection;
import java.util.Set;
@@ -48,6 +49,7 @@
import org.eclipse.sirius.tree.business.internal.dialect.description.TreeInterpretedExpressionQuery;
import org.eclipse.sirius.tree.business.internal.refresh.DTreeElementSynchronizerSpec;
import org.eclipse.sirius.tree.description.TreeDescription;
+import org.eclipse.sirius.tree.tools.internal.Messages;
import org.eclipse.sirius.tree.tools.internal.command.TreeCommandFactory;
import org.eclipse.sirius.viewpoint.DRepresentation;
import org.eclipse.sirius.viewpoint.DSemanticDecorator;
@@ -65,30 +67,22 @@
* @author pcdavid
*/
public class TreeDialectServices extends AbstractRepresentationDialectServices {
- /**
- * {@inheritDoc}
- */
@Override
protected boolean isSupported(RepresentationDescription description) {
return description instanceof TreeDescription;
}
- /**
- * {@inheritDoc}
- */
@Override
protected boolean isSupported(DRepresentation representation) {
return representation instanceof DTree;
}
- /**
- * {@inheritDoc}
- */
+ @Override
public DRepresentation createRepresentation(String name, EObject semantic, RepresentationDescription description, IProgressMonitor monitor) {
DTree tree = null;
try {
- monitor.beginTask("Create tree : " + name, 11);
- monitor.subTask("Create tree : " + name);
+ monitor.beginTask(MessageFormat.format(Messages.TreeDialectServices_createTree, name), 11);
+ monitor.subTask(MessageFormat.format(Messages.TreeDialectServices_createTree, name));
final Session session = SessionManager.INSTANCE.getSession(semantic);
final EditingDomain domain = session.getTransactionalEditingDomain();
/*
@@ -125,16 +119,12 @@
super.initRepresentations(semantic, vp, TreeDescription.class);
}
- /**
- * {@inheritDoc}
- */
+ @Override
public void initRepresentations(Viewpoint vp, EObject semantic, IProgressMonitor monitor) {
super.initRepresentations(semantic, vp, TreeDescription.class, monitor);
}
- /**
- * {@inheritDoc}
- */
+ @Override
protected <T extends RepresentationDescription> void initRepresentationForElement(T representationDescription, EObject semanticElement, IProgressMonitor monitor) {
if (representationDescription instanceof TreeDescription) {
TreeDescription treeDescription = (TreeDescription) representationDescription;
@@ -154,7 +144,7 @@
}
if (canCreate) {
try {
- monitor.beginTask("Initialize tree of type " + new IdentifiedElementQuery(representationDescription).getLabel(), 1);
+ monitor.beginTask(MessageFormat.format(Messages.TreeDialectServices_initializeTree, new IdentifiedElementQuery(representationDescription).getLabel()), 1);
final TreeCommandFactory treeCommandFactory = new TreeCommandFactory(domain);
treeCommandFactory.setModelAccessor(modelAccessor);
DCommand command = treeCommandFactory.buildCreateTreeFromDescription(treeDescription, semanticElement, new SubProgressMonitor(monitor, 1));
@@ -168,9 +158,6 @@
}
}
- /**
- * {@inheritDoc}
- */
@Override
public DRepresentation copyRepresentation(final DRepresentation representation, final String name, final Session session, final IProgressMonitor monitor) {
DRepresentation newRepresentation = super.copyRepresentation(representation, name, session, monitor);
@@ -193,12 +180,10 @@
// TODO
}
- /**
- * {@inheritDoc}
- */
+ @Override
public void refresh(DRepresentation representation, boolean fullRefresh, IProgressMonitor monitor) {
try {
- monitor.beginTask("Tree refresh", 1);
+ monitor.beginTask(Messages.TreeDialectServices_treeRefresh, 1);
if (canRefresh(representation)) {
refreshTree((DTree) representation, fullRefresh, monitor);
}
@@ -207,9 +192,7 @@
}
}
- /**
- * {@inheritDoc}
- */
+ @Override
public RepresentationDescription getDescription(DRepresentation representation) {
if (isSupported(representation)) {
return ((DTree) representation).getDescription();
@@ -229,9 +212,7 @@
}
- /**
- * {@inheritDoc}
- */
+ @Override
public boolean canCreate(EObject semantic, RepresentationDescription desc) {
boolean result = false;
if (semantic != null && isSupported(desc)) {
@@ -245,32 +226,16 @@
return result;
}
- /**
- *
- * {@inheritDoc}
- *
- * @see org.eclipse.sirius.business.api.dialect.DialectServices#createInterpretedExpressionQuery(org.eclipse.emf.ecore.EObject,
- * org.eclipse.emf.ecore.EStructuralFeature)
- */
+ @Override
public IInterpretedExpressionQuery createInterpretedExpressionQuery(EObject target, EStructuralFeature feature) {
return new TreeInterpretedExpressionQuery(target, feature);
}
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.sirius.business.api.dialect.DialectServices#handles(org.eclipse.sirius.viewpoint.description.RepresentationDescription)
- */
@Override
public boolean handles(RepresentationDescription representationDescription) {
return representationDescription instanceof TreeDescription;
}
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.sirius.business.api.dialect.DialectServices#handles(org.eclipse.sirius.viewpoint.description.RepresentationExtensionDescription)
- */
@Override
public boolean handles(RepresentationExtensionDescription representationExtensionDescription) {
return false;
@@ -279,7 +244,7 @@
@Override
public void refreshImpactedElements(DRepresentation representation, Collection<Notification> notifications, IProgressMonitor monitor) {
try {
- monitor.beginTask("Refresh tree", 10);
+ monitor.beginTask(Messages.DTreeUserInteraction_treeRefresh, 10);
DTree tree = (DTree) representation;
IInterpreter interpreter = SiriusPlugin.getDefault().getInterpreterRegistry().getInterpreter(tree.getTarget());
ModelAccessor accessor = SiriusPlugin.getDefault().getModelAccessorRegistry().getModelAccessor(representation);
@@ -289,7 +254,7 @@
DTreeElementSynchronizer synchronizer = new DTreeElementSynchronizerSpec(interpreter, accessor);
IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 8);
try {
- subMonitor.beginTask("Refresh impacted elements", dTreeElements.size());
+ subMonitor.beginTask(Messages.TreeDialectServices_refreshImpactedElements, dTreeElements.size());
for (DTreeElement dTreeElement : dTreeElements) {
if (dTreeElement instanceof DTreeItem) {
synchronizer.refresh((DTreeItem) dTreeElement);
diff --git a/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/internal/dialect/common/tree/DTreeRefresh.java b/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/internal/dialect/common/tree/DTreeRefresh.java
index 75445ef..2d33c23 100644
--- a/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/internal/dialect/common/tree/DTreeRefresh.java
+++ b/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/internal/dialect/common/tree/DTreeRefresh.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.sirius.tree.business.internal.dialect.common.tree;
+import java.text.MessageFormat;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
@@ -52,6 +53,7 @@
import org.eclipse.sirius.tree.business.internal.refresh.DTreeElementSynchronizerSpec;
import org.eclipse.sirius.tree.description.TreeDescription;
import org.eclipse.sirius.tree.description.TreeItemMapping;
+import org.eclipse.sirius.tree.tools.internal.Messages;
import org.eclipse.sirius.viewpoint.RGBValues;
import com.google.common.base.Function;
@@ -124,7 +126,7 @@
*/
public void refresh(boolean fullRefresh, IProgressMonitor monitor) {
try {
- monitor.beginTask("Refresh tree", 8);
+ monitor.beginTask(Messages.DTreeUserInteraction_treeRefresh, 8);
if (ctx.getModelAccessor().getPermissionAuthority().canEditInstance(container)) {
MappingHiearchyTable hierarchy = new MappingHiearchyTable();
SignatureProvider signProvider = new TreeSignatureProvider(hierarchy);
@@ -133,6 +135,7 @@
final TreeMappingProvider provider = new TreeMappingProvider(semProvider);
Iterable<Mapping> providedMappings = Iterables.transform(mappings, new Function<TreeItemMapping, Mapping>() {
+ @Override
public Mapping apply(TreeItemMapping from) {
return provider.getOrCreate(from);
}
@@ -177,7 +180,7 @@
CreatedTreeItem created = new CreatedTreeItem(ctx, item, descriptor);
return created;
}
- throw new RuntimeException("Unkown representation container instance");
+ throw new RuntimeException(Messages.DTreeRefresh_unknownRepresentationContainer);
}
}
@@ -195,6 +198,7 @@
this.ctx = ctx;
}
+ @Override
public Iterable<CreatedOutput> getExistingOutputs() {
if (computedOutputs.some()) {
return computedOutputs.get();
@@ -202,6 +206,7 @@
return Lists.newArrayList();
}
+ @Override
public void computeStatus(CreatedOutput container, Collection<? extends Mapping> childMappings) {
List<CreatedOutput> result = Lists.newArrayList();
int i = 0;
@@ -283,10 +288,12 @@
this.semPartition = SemanticPartitions.eAllContents(description.getDomainClass());
}
+ @Override
public Option<Mapping> getSuper() {
return Options.newNone();
}
+ @Override
public SemanticPartition getSemanticPartition() {
return semPartition;
}
@@ -300,10 +307,12 @@
return result;
}
+ @Override
public boolean isEnabled() {
return true;
}
+ @Override
public Option<AutomaticCreator> getCreator() {
return Options.newNone();
}
@@ -327,41 +336,49 @@
this.newIndex = descriptor.getIndex();
}
+ @Override
public OutputTreeItemDescriptor getDescriptor() {
return descriptor;
}
+ @Override
public void setNewIndex(int nextIndex) {
this.newIndex = nextIndex;
}
+ @Override
public int getNewIndex() {
return this.newIndex;
}
+ @Override
public EObject getCreatedElement() {
return tItem;
}
+ @Override
public void updateMapping() {
if (newMapping.some()) {
tItem.setActualMapping(((RTreeItemMapping) newMapping.get()).getDescription());
} else {
- throw new RuntimeException("no mapping to set");
+ throw new RuntimeException(Messages.DTreeRefresh_noMapping);
}
}
+ @Override
public void refresh() {
DTreeElementSynchronizerSpec sync = new DTreeElementSynchronizerSpec(getGlobalContext().getInterpreter(), getGlobalContext().getModelAccessor());
sync.refresh(tItem);
}
+ @Override
public void setNewMapping(Mapping map) {
newMapping = Options.newSome(map);
}
+ @Override
public Option<? extends ChildCreationSupport> getChildSupport() {
return Options.newSome(new TreeItemContainerChildSupport(getGlobalContext(), tItem));
}
@@ -370,10 +387,12 @@
* Synchronize direct children only if the current {@link DTreeItem} is
* expanded.
*/
+ @Override
public boolean synchronizeChildren() {
return tItem.isExpanded();
}
+ @Override
public List<Mapping> getChildMappings() {
return getDescriptor().getMapping().getChildMappings();
}
@@ -390,6 +409,7 @@
this.ctx = ctx;
}
+ @Override
public void reorderChilds(Iterable<CreatedOutput> outDesc) {
final Multiset<TreeItemMapping> subMappings = LinkedHashMultiset.create();
Set<TreeItemMapping> mappings = new HashSet<TreeItemMapping>();
@@ -421,6 +441,7 @@
Function<DTreeItem, Integer> getNewIndex = new Function<DTreeItem, Integer>() {
+ @Override
public Integer apply(DTreeItem from) {
// init with element count : elements with unknown mapping
// will
@@ -444,6 +465,7 @@
}
}
+ @Override
public void deleteChild(CreatedOutput outDesc) {
/*
* The cross referencer is actually optional for the eDelete method of
@@ -453,6 +475,7 @@
ctx.getModelAccessor().eDelete(outDesc.getCreatedElement(), xRef);
}
+ @Override
public CreatedOutput createChild(OutputDescriptor outDesc) {
OutputTreeItemDescriptor descriptor = (OutputTreeItemDescriptor) outDesc;
DTreeItem dTreeItem = TreeFactory.eINSTANCE.createDTreeItem();
@@ -486,8 +509,6 @@
class CreatedDTree extends AbstractCreatedDTreeItemContainer {
- private static final String ILLEGAL_ARGUMENT_MESSAGE = "It has no sense";
-
private DTree dnode;
private OutputDescriptor descriptor;
@@ -501,23 +522,28 @@
this.newIndex = descriptor.getIndex();
}
+ @Override
public OutputDescriptor getDescriptor() {
return descriptor;
}
+ @Override
public void setNewIndex(int nextIndex) {
- throw new IllegalArgumentException(ILLEGAL_ARGUMENT_MESSAGE);
+ throw new IllegalArgumentException(Messages.DTreeRefresh_nonsense);
}
+ @Override
public EObject getCreatedElement() {
return dnode;
}
+ @Override
public void updateMapping() {
- throw new IllegalArgumentException(ILLEGAL_ARGUMENT_MESSAGE);
+ throw new IllegalArgumentException(Messages.DTreeRefresh_nonsense);
}
+ @Override
public void refresh() {
/*
* here we should update any DTree info computed from semantic elements.
@@ -525,10 +551,12 @@
*/
}
+ @Override
public void setNewMapping(Mapping map) {
- throw new IllegalArgumentException(ILLEGAL_ARGUMENT_MESSAGE);
+ throw new IllegalArgumentException(Messages.DTreeRefresh_nonsense);
}
+ @Override
public Option<? extends ChildCreationSupport> getChildSupport() {
return Options.newSome(new TreeItemContainerChildSupport(getGlobalContext(), dnode));
}
@@ -537,14 +565,17 @@
* Always synchronize direct children of a {@link DTree} as it has not the
* capability of collapse as {@link fr.obeo.dsl.viewpoint.tree.DTreeItem}.
*/
+ @Override
public boolean synchronizeChildren() {
return true;
}
+ @Override
public List<Mapping> getChildMappings() {
return ((RTreeMapping) getDescriptor().getMapping()).getChildMappings();
}
+ @Override
public int getNewIndex() {
return newIndex;
}
@@ -561,10 +592,12 @@
this.provider = provider;
}
+ @Override
public Collection<? extends OutputDescriptor> computeDescriptors(final CreatedOutput context, Iterator<EObject> it) {
final AbstractCreatedDTreeItemContainer castedContext = (AbstractCreatedDTreeItemContainer) context;
Predicate<OutputTreeItemDescriptor> filterPredicates = new Predicate<OutputTreeItemDescriptor>() {
+ @Override
public boolean apply(OutputTreeItemDescriptor input) {
return new TreeItemMappingExpression(castedContext.getGlobalContext(), input.getMapping().getDescription()).checkPrecondition(input.getSourceElement(), input.getViewContainer());
}
@@ -595,6 +628,7 @@
this.creator = new TreeItemCreator(nm, provider);
}
+ @Override
public Option<? extends Mapping> getSuper() {
if (nm.getSpecialize() != null) {
return Options.newSome(provider.getOrCreate(nm.getSpecialize()));
@@ -602,6 +636,7 @@
return Options.newNone();
}
+ @Override
public SemanticPartition getSemanticPartition() {
return provider.getSemanticProvider().getSemanticPartition(nm);
}
@@ -610,6 +645,7 @@
List<Mapping> result = Lists.newArrayList();
result.addAll(Collections2.transform(nm.getAllSubMappings(), new Function<TreeItemMapping, RTreeItemMapping>() {
+ @Override
public RTreeItemMapping apply(TreeItemMapping from) {
return provider.getOrCreate(from);
}
@@ -617,6 +653,7 @@
return result;
}
+ @Override
public boolean isEnabled() {
return true;
}
@@ -625,6 +662,7 @@
return nm;
}
+ @Override
public Option<AutomaticCreator> getCreator() {
return Options.newSome(creator);
}
@@ -640,18 +678,19 @@
this.hierarchyTable = hierarchyTable;
}
+ @Override
public Signature getSignature(OutputDescriptor descriptor) {
if (descriptor instanceof OutputTreeItemDescriptor) {
return doGetSignature((OutputTreeItemDescriptor) descriptor);
} else if (descriptor instanceof OutputDTreeDescriptor) {
return doGetSignature((OutputDTreeDescriptor) descriptor);
}
- throw new RuntimeException("Unkown descriptor:" + descriptor);
+ throw new RuntimeException(MessageFormat.format(Messages.DTreeRefresh_unknownDescriptor, descriptor));
}
private Signature doGetSignature(OutputDTreeDescriptor desc) {
- return getOrCreate("tree " + getURI(desc.getSourceElement()) + desc.getMapping().toString());
+ return getOrCreate("tree " + getURI(desc.getSourceElement()) + desc.getMapping().toString()); //$NON-NLS-1$
}
private Signature getOrCreate(String string) {
@@ -691,14 +730,17 @@
}
+ @Override
public int getIndex() {
return 0;
}
+ @Override
public EObject getSourceElement() {
return from;
}
+ @Override
public Mapping getMapping() {
return provider.getOrCreate(mapping);
}
@@ -735,14 +777,17 @@
return container;
}
+ @Override
public int getIndex() {
return position;
}
+ @Override
public EObject getSourceElement() {
return from;
}
+ @Override
public RTreeItemMapping getMapping() {
return provider.getOrCreate(mapping);
}
diff --git a/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/internal/dialect/common/tree/TreeItemMappingExpression.java b/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/internal/dialect/common/tree/TreeItemMappingExpression.java
index d7f5d7d..0dd0e98 100644
--- a/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/internal/dialect/common/tree/TreeItemMappingExpression.java
+++ b/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/internal/dialect/common/tree/TreeItemMappingExpression.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 THALES GLOBAL SERVICES.
+ * Copyright (c) 2011, 2015 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
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.sirius.tree.business.internal.dialect.common.tree;
+import java.text.MessageFormat;
+
import org.eclipse.emf.ecore.EObject;
import org.eclipse.sirius.common.tools.DslCommonPlugin;
import org.eclipse.sirius.common.tools.api.interpreter.EvaluationException;
@@ -21,6 +23,7 @@
import org.eclipse.sirius.tree.business.internal.dialect.common.viewpoint.GlobalContext;
import org.eclipse.sirius.tree.business.internal.helper.TreeHelper;
import org.eclipse.sirius.tree.description.TreeItemMapping;
+import org.eclipse.sirius.tree.tools.internal.Messages;
import org.eclipse.sirius.viewpoint.SiriusPlugin;
/**
@@ -72,7 +75,7 @@
try {
result = interpreter.evaluateBoolean(semantic, mapping.getPreconditionExpression());
} catch (final EvaluationException e) {
- SiriusPlugin.getDefault().warning("the following Tree Item mapping precondition could not be correctly evaluated : " + mapping.getPreconditionExpression(), e);
+ SiriusPlugin.getDefault().warning(MessageFormat.format(Messages.TreeItemMappingExpression_preconditionEvaluationError, mapping.getPreconditionExpression()), e);
}
interpreter.unSetVariable(IInterpreterSiriusVariables.CONTAINER);
interpreter.unSetVariable(IInterpreterSiriusVariables.CONTAINER_VIEW);
diff --git a/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/internal/dialect/common/viewpoint/MappingBasedPartition.java b/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/internal/dialect/common/viewpoint/MappingBasedPartition.java
index ca1459f..03d15b2 100644
--- a/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/internal/dialect/common/viewpoint/MappingBasedPartition.java
+++ b/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/internal/dialect/common/viewpoint/MappingBasedPartition.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 THALES GLOBAL SERVICES.
+ * Copyright (c) 2010, 2015 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
@@ -25,6 +25,7 @@
import org.eclipse.sirius.synchronizer.SemanticPartition;
import org.eclipse.sirius.synchronizer.SemanticPartitions;
import org.eclipse.sirius.tree.business.internal.helper.TreeHelper;
+import org.eclipse.sirius.tree.tools.internal.Messages;
import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableList;
@@ -76,7 +77,7 @@
try {
elements = ctx.getInterpreter().evaluateCollection(root, semanticCandidate.get()).iterator();
} catch (EvaluationException e) {
- ctx.getSpecifierFeedBack().warning("Error while evaluating semantic candidate expression", e, specificationAttachment);
+ ctx.getSpecifierFeedBack().warning(Messages.MappingBasedPartition_semanticCandidateEvaluationError, e, specificationAttachment);
}
} else {
elements = allEObjectsOfTheSession();
@@ -84,6 +85,7 @@
unSetTreeElementVariables();
return SemanticPartitions.eObjectList(ImmutableList.copyOf(Iterators.filter(elements, new Predicate<EObject>() {
+ @Override
public boolean apply(EObject input) {
return ctx.getModelAccessor().eInstanceOf(input, domainClass);
}
diff --git a/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/internal/helper/RefreshTreeElementTask.java b/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/internal/helper/RefreshTreeElementTask.java
index bcdd773..b307387 100644
--- a/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/internal/helper/RefreshTreeElementTask.java
+++ b/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/internal/helper/RefreshTreeElementTask.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 THALES GLOBAL SERVICES.
+ * Copyright (c) 2010, 2015 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
@@ -24,6 +24,7 @@
import org.eclipse.sirius.tree.DTreeElement;
import org.eclipse.sirius.tree.DTreeItem;
import org.eclipse.sirius.tree.business.internal.refresh.DTreeElementSynchronizerSpec;
+import org.eclipse.sirius.tree.tools.internal.Messages;
import org.eclipse.sirius.viewpoint.SiriusPlugin;
/**
@@ -117,6 +118,6 @@
@Override
public String getLabel() {
- return "Refresh element task";
+ return Messages.RefreshTreeElementTask_label;
}
}
diff --git a/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/internal/metamodel/TreeToolVariables.java b/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/internal/metamodel/TreeToolVariables.java
index 4aa22ec..245bc81 100644
--- a/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/internal/metamodel/TreeToolVariables.java
+++ b/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/internal/metamodel/TreeToolVariables.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 THALES GLOBAL SERVICES.
+ * Copyright (c) 2010, 2015 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
@@ -24,6 +24,7 @@
import org.eclipse.sirius.tree.description.TreeVariable;
import org.eclipse.sirius.tree.description.util.DescriptionSwitch;
import org.eclipse.sirius.tree.tools.api.interpreter.IInterpreterSiriusTreeVariables;
+import org.eclipse.sirius.tree.tools.internal.Messages;
import org.eclipse.sirius.viewpoint.description.tool.ContainerViewVariable;
import org.eclipse.sirius.viewpoint.description.tool.DropContainerVariable;
import org.eclipse.sirius.viewpoint.description.tool.ElementDropVariable;
@@ -53,36 +54,21 @@
}
}
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.sirius.tree.description.util.DescriptionSwitch#caseTreeItemDeletionTool(org.eclipse.sirius.tree.description.TreeItemDeletionTool)
- */
@Override
public Object caseTreeItemDeletionTool(TreeItemDeletionTool object) {
- addVariableDescriptor(object, IInterpreterSiriusVariables.ELEMENT, "The currently edited element.");
- addVariableDescriptor(object, IInterpreterSiriusVariables.ROOT, "The semantic element corresponding to the current tree.");
+ addVariableDescriptor(object, IInterpreterSiriusVariables.ROOT, Messages.TreeToolVariables_root);
+ addVariableDescriptor(object, IInterpreterSiriusVariables.ELEMENT, Messages.TreeToolVariables_element);
return super.caseTreeItemDeletionTool(object);
}
- /**
- *
- * {@inheritDoc}
- */
@Override
public Object caseTreeItemCreationTool(final TreeItemCreationTool object) {
- addVariableDescriptor(object, IInterpreterSiriusVariables.ROOT, "The semantic element of the tree.");
- addVariableDescriptor(object, IInterpreterSiriusVariables.ELEMENT, "The semantic currently edited element.");
- addVariableDescriptor(object, IInterpreterSiriusVariables.CONTAINER, "The semantic element corresponding to the view container.");
+ addVariableDescriptor(object, IInterpreterSiriusVariables.ROOT, Messages.TreeToolVariables_root);
+ addVariableDescriptor(object, IInterpreterSiriusVariables.ELEMENT, Messages.TreeToolVariables_element);
+ addVariableDescriptor(object, IInterpreterSiriusVariables.CONTAINER, Messages.TreeToolVariables_container);
return super.caseTreeItemCreationTool(object);
}
- /**
- *
- * {@inheritDoc}
- *
- * @see org.eclipse.sirius.tree.description.util.DescriptionSwitch#caseTreeItemEditionTool(org.eclipse.sirius.tree.description.TreeItemEditionTool)
- */
@Override
public Object caseTreeItemEditionTool(final TreeItemEditionTool object) {
object.setMask(ToolFactory.eINSTANCE.createEditMaskVariables());
@@ -97,12 +83,6 @@
return super.caseTreeItemEditionTool(object);
}
- /**
- *
- * {@inheritDoc}
- *
- * @see org.eclipse.sirius.tree.description.util.DescriptionSwitch#caseTreeItemContainerDropTool(org.eclipse.sirius.tree.description.TreeItemContainerDropTool)
- */
@Override
public Object caseTreeItemContainerDropTool(final TreeItemContainerDropTool object) {
DropContainerVariable oldContainerVariable = ToolFactory.eINSTANCE.createDropContainerVariable();
@@ -123,18 +103,12 @@
PrecedingSiblingsVariables precedingSiblings = DescriptionFactory.eINSTANCE.createPrecedingSiblingsVariables();
precedingSiblings.setName(IInterpreterSiriusTreeVariables.PRECEDING_SIBLINGS);
- precedingSiblings.setDocumentation("The list of all the preceding siblings in a Drag and Drop operation");
+ precedingSiblings.setDocumentation(Messages.TreeToolVariables_precedingSiblings);
object.setPrecedingSiblings(precedingSiblings);
return super.caseTreeItemContainerDropTool(object);
}
- /**
- *
- * {@inheritDoc}
- *
- * @see org.eclipse.sirius.tree.description.util.DescriptionSwitch#caseTreeCreationDescription(org.eclipse.sirius.tree.description.TreeCreationDescription)
- */
@Override
public Object caseTreeCreationDescription(final TreeCreationDescription object) {
final ContainerViewVariable containerViewVariable = ToolFactory.eINSTANCE.createContainerViewVariable();
@@ -148,12 +122,6 @@
return super.caseTreeCreationDescription(object);
}
- /**
- *
- * {@inheritDoc}
- *
- * @see org.eclipse.sirius.tree.description.util.DescriptionSwitch#caseTreeNavigationDescription(org.eclipse.sirius.tree.description.TreeNavigationDescription)
- */
@Override
public Object caseTreeNavigationDescription(final TreeNavigationDescription object) {
final ContainerViewVariable containerViewVariable = ToolFactory.eINSTANCE.createContainerViewVariable();
diff --git a/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/tools/internal/Messages.java b/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/tools/internal/Messages.java
new file mode 100644
index 0000000..98b887a
--- /dev/null
+++ b/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/tools/internal/Messages.java
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Copyright (c) 2015 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.sirius.tree.tools.internal;
+
+import org.eclipse.sirius.ext.base.I18N;
+import org.eclipse.sirius.ext.base.I18N.TranslatableMessage;
+
+/**
+ * Helper class to obtains translated strings.
+ *
+ * @author <a href="mailto:esteban.dugueperoux@obeo.fr">Esteban Dugueperoux</a>
+ */
+public final class Messages {
+
+ static {
+ I18N.initializeMessages(Messages.class, TreePlugin.INSTANCE);
+ }
+
+ // CHECKSTYLE:OFF
+
+ @TranslatableMessage
+ public static String DTreeItemExpansionChangeCommand_collapseItem;
+
+ @TranslatableMessage
+ public static String DTreeItemExpansionChangeCommand_expandItem;
+
+ @TranslatableMessage
+ public static String DTreeItemLocalRefreshCommand_refreshLocally;
+
+ @TranslatableMessage
+ public static String DTreeItemUserInteraction_treeItemExpanding;
+
+ @TranslatableMessage
+ public static String DTreeRefresh_noMapping;
+
+ @TranslatableMessage
+ public static String DTreeRefresh_nonsense;
+
+ @TranslatableMessage
+ public static String DTreeRefresh_unknownDescriptor;
+
+ @TranslatableMessage
+ public static String DTreeRefresh_unknownRepresentationContainer;
+
+ @TranslatableMessage
+ public static String DTreeUserInteraction_treeRefresh;
+
+ @TranslatableMessage
+ public static String MappingBasedPartition_semanticCandidateEvaluationError;
+
+ @TranslatableMessage
+ public static String RefreshTreeElementTask_label;
+
+ @TranslatableMessage
+ public static String TreeCommandFactory_directEdit;
+
+ @TranslatableMessage
+ public static String TreeCommandFactory_dropItem;
+
+ @TranslatableMessage
+ public static String TreeCommandFactory_operationAction;
+
+ @TranslatableMessage
+ public static String TreeDialectServices_createTree;
+
+ @TranslatableMessage
+ public static String TreeDialectServices_initializeTree;
+
+ @TranslatableMessage
+ public static String TreeDialectServices_refreshImpactedElements;
+
+ @TranslatableMessage
+ public static String TreeDialectServices_treeRefresh;
+
+ @TranslatableMessage
+ public static String TreeItemMappingExpression_preconditionEvaluationError;
+
+ @TranslatableMessage
+ public static String TreeToolVariables_container;
+
+ @TranslatableMessage
+ public static String TreeToolVariables_element;
+
+ @TranslatableMessage
+ public static String TreeToolVariables_precedingSiblings;
+
+ @TranslatableMessage
+ public static String TreeToolVariables_root;
+
+ // CHECKSTYLE:ON
+
+ private Messages() {
+ // Prevents instanciation.
+ }
+}
diff --git a/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/tools/internal/command/TreeCommandFactory.java b/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/tools/internal/command/TreeCommandFactory.java
index aa35e39..0e5242b 100644
--- a/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/tools/internal/command/TreeCommandFactory.java
+++ b/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/tools/internal/command/TreeCommandFactory.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.sirius.tree.tools.internal.command;
+import java.text.MessageFormat;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
@@ -61,6 +62,7 @@
import org.eclipse.sirius.tree.description.TreeItemCreationTool;
import org.eclipse.sirius.tree.description.TreeItemDeletionTool;
import org.eclipse.sirius.tree.description.TreeItemEditionTool;
+import org.eclipse.sirius.tree.tools.internal.Messages;
import org.eclipse.sirius.viewpoint.DRepresentation;
import org.eclipse.sirius.viewpoint.DSemanticDecorator;
import org.eclipse.sirius.viewpoint.description.tool.AbstractToolDescription;
@@ -303,13 +305,6 @@
return command;
}
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.sirius.table.tools.api.command.ITableCommandFactory#buildDoExecuteDetailsOperation(org.eclipse.sirius.viewpoint.DSemanticDecorator,
- * org.eclipse.sirius.viewpoint.description.tool.RepresentationCreationDescription,
- * java.lang.String)
- */
@Override
public AbstractCommand buildDoExecuteDetailsOperation(final DSemanticDecorator target, final RepresentationCreationDescription desc, final String newRepresentationName) {
final SiriusCommand cmd = new SiriusCommand(domain);
@@ -323,16 +318,9 @@
return cmd;
}
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.sirius.tree.business.api.command.ITreeCommandFactory#buildDirectEditLabelFromTool(org.eclipse.sirius.tree.DTreeItem,
- * org.eclipse.sirius.tree.description.TreeItemEditionTool,
- * java.lang.String)
- */
@Override
public Command buildDirectEditLabelFromTool(final DTreeItem editedTreeItem, TreeItemEditionTool directEditTool, String newValue) {
- SiriusCommand result = new SiriusCommand(domain, "Direct Edit on " + editedTreeItem.getName());
+ SiriusCommand result = new SiriusCommand(domain, MessageFormat.format(Messages.TreeCommandFactory_directEdit, editedTreeItem.getName()));
if (!getPermissionAuthority().canEditInstance(editedTreeItem)) {
result = new InvalidPermissionCommand(domain, editedTreeItem);
} else {
@@ -370,16 +358,9 @@
return result;
}
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.sirius.tree.business.api.command.ITreeCommandFactory#buildDragAndDropItemFromTool(org.eclipse.sirius.tree.DTreeItem,
- * org.eclipse.sirius.tree.DTreeItem,
- * org.eclipse.sirius.tree.description.TreeItemDragTool)
- */
@Override
public Command buildDropItemFromTool(EObject dropped, DTreeItemContainer dropTarget, Collection<DTreeItem> precedingSiblings, TreeItemContainerDropTool dropTool) {
- final SiriusCommand result = new SiriusCommand(domain, "Drop the item " + dropped);
+ final SiriusCommand result = new SiriusCommand(domain, MessageFormat.format(Messages.TreeCommandFactory_dropItem, dropped));
EObject dropSem = dropped;
DSemanticDecorator dropDec = null;
@@ -438,15 +419,9 @@
return oldContainer;
}
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.sirius.tree.business.api.command.ITreeCommandFactory#buildOperationActionFromTool(org.eclipse.sirius.viewpoint.description.tool.OperationAction,
- * org.eclipse.sirius.tree.DTreeItem)
- */
@Override
public Command buildOperationActionFromTool(OperationAction operationAction, final DTreeItem selectedItem) {
- final SiriusCommand result = new SiriusCommand(domain, operationAction.getName() + " on " + selectedItem.getName());
+ final SiriusCommand result = new SiriusCommand(domain, MessageFormat.format(Messages.TreeCommandFactory_operationAction, operationAction.getName(), selectedItem.getName()));
// Step 1 : variables initialization
final Map<AbstractVariable, Object> variables = new HashMap<AbstractVariable, Object>();
EObject interpreterContext = selectedItem.getTarget();
@@ -471,13 +446,6 @@
});
}
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.sirius.tree.business.api.command.ITreeCommandFactory#buildJavaActionFromTool(org.eclipse.sirius.viewpoint.description.tool.ExternalJavaAction,
- * org.eclipse.sirius.tree.DTreeItem,
- * org.eclipse.sirius.tools.api.ui.IExternalJavaAction)
- */
@Override
public Command buildJavaActionFromTool(ExternalJavaAction javaActionItem, DTreeItem selectedItem, IExternalJavaAction javaAction) {
final CompoundCommand compoundCommand = new CompoundCommand();