Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Redor2015-09-01 15:59:11 +0000
committerLaurent Redor2015-09-02 14:49:15 +0000
commit4013fcf79c5309d0328e55e521774c91e62048df (patch)
tree0c35c6b832fe0c1094695c7834a4b6fc8c659f6e
parentb4041f118575e0da4a1b37c6ed75c77265d0f30e (diff)
downloadorg.eclipse.sirius-4013fcf79c5309d0328e55e521774c91e62048df.tar.gz
org.eclipse.sirius-4013fcf79c5309d0328e55e521774c91e62048df.tar.xz
org.eclipse.sirius-4013fcf79c5309d0328e55e521774c91e62048df.zip
[472057] Externalize translatable strings from org.eclipse.sirius.table
Bug: 472057 Change-Id: I97fc70fb891c80092b470445018fc846181fcd18 Signed-off-by: Laurent Redor <laurent.redor@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.doc/doc/Release_Notes.html3
-rw-r--r--plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile1
-rw-r--r--plugins/org.eclipse.sirius.table/.settings/org.eclipse.jdt.core.prefs2
-rw-r--r--plugins/org.eclipse.sirius.table/plugin.properties25
-rw-r--r--plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/api/query/DCellQuery.java23
-rw-r--r--plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/dialect/ContributionTrakingIdentifier.java12
-rw-r--r--plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/dialect/TableDialectServices.java29
-rw-r--r--plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/metamodel/TableToolVariables.java37
-rw-r--r--plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/metamodel/operations/DColumnOperations.java16
-rw-r--r--plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/metamodel/spec/DLineSpec.java5
-rw-r--r--plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/refresh/DTableSynchronizerImpl.java57
-rw-r--r--plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/refresh/StyleWithDefaultStatus.java31
-rw-r--r--plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/tools/internal/Messages.java99
-rw-r--r--plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/tools/internal/command/TableCommandFactory.java54
-rw-r--r--plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/tools/internal/export/TableExportHelperImpl.java21
15 files changed, 282 insertions, 133 deletions
diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html
index e0103886b9..d84ff80e69 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.table</code>
+ </li>
+ <li>
<code>org.eclipse.sirius.tree</code>
</li>
<li>
diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile
index 5949410ae4..410a397713 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 @@ Additional non-breaking changes:
** @org.eclipse.sirius.common.ui@
** @org.eclipse.sirius.eef.adapters@
** @org.eclipse.sirius.interpreter@
+** @org.eclipse.sirius.table@
** @org.eclipse.sirius.tree@
** @org.eclipse.sirius.tree.ui@
diff --git a/plugins/org.eclipse.sirius.table/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.sirius.table/.settings/org.eclipse.jdt.core.prefs
index fc8c7f3ddc..39e1d0d4d4 100644
--- a/plugins/org.eclipse.sirius.table/.settings/org.eclipse.jdt.core.prefs
+++ b/plugins/org.eclipse.sirius.table/.settings/org.eclipse.jdt.core.prefs
@@ -32,7 +32,7 @@ org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
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.table/plugin.properties b/plugins/org.eclipse.sirius.table/plugin.properties
index 941d0f4a31..fe415b7559 100644
--- a/plugins/org.eclipse.sirius.table/plugin.properties
+++ b/plugins/org.eclipse.sirius.table/plugin.properties
@@ -1,5 +1,5 @@
# ====================================================================
-# Copyright (c) 2007, 2008 THALES GLOBAL SERVICES
+# Copyright (c) 2007, 2015 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
@@ -11,3 +11,26 @@
pluginName = Sirius Table Model
providerName = Eclipse Modeling Project
+
+ContributionTrakingIdentifier_ElementWithoutMatchingData = Internal error: contributed element has no matching contribution data.
+DTableSynchronizerImpl_refreshColumnMapping = Refresh column mapping
+DTableSynchronizerImpl_refreshCrossTabel = Refresh cross table
+DTableSynchronizerImpl_refreshEditionTabel = Refresh edition table
+DTableSynchronizerImpl_refreshIntersectionMapping = Refresh intersection mapping
+DTableSynchronizerImpl_refreshLineMapping = Refresh line mapping
+TableCommandFactory_addValue = Add {0} value
+TableCommandFactory_clearValue = Clear {0}
+TableCommandFactory_setCellContent = Set cell content
+TableCommandFactory_setValue = Set {0} value
+TableDialectServices_CreateTable = Create table : {0}
+TableDialectServices_InitializeTable = Initialize table of type {0}
+TableDialectServices_RefreshImpactedElements = Refresh impacted elements
+TableDialectServices_RefreshTable = Refresh table
+TableExportHelper_ExceptionOnSave = Error while saving the exported content.
+TableToolVariables_CurrentSemanticElement = The semantic currently edited element.
+TableToolVariables_SemanticColumnElement = The semantic element corresponding to the column.
+TableToolVariables_SemanticElementOfContainerView = The semantic element corresponding to the view container.
+TableToolVariables_SemanticLineElement = The semantic element corresponding to the line.
+TableToolVariables_SemanticRootElement = The semantic root element of the table.
+Table_WrongStyleAttribute = The style attribute must be a ForegroundStyleDescription or a BackgroundStyleDescription.
+Table_UnexpectedExceptionMessage = Should not happen.
diff --git a/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/api/query/DCellQuery.java b/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/api/query/DCellQuery.java
index 334c64ca11..e760372caf 100644
--- a/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/api/query/DCellQuery.java
+++ b/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/api/query/DCellQuery.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2012 THALES GLOBAL SERVICES.
+ * Copyright (c) 2011, 2015 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
@@ -30,6 +30,7 @@ import org.eclipse.sirius.table.metamodel.table.description.ColumnMapping;
import org.eclipse.sirius.table.metamodel.table.description.FeatureColumnMapping;
import org.eclipse.sirius.table.metamodel.table.description.ForegroundStyleDescription;
import org.eclipse.sirius.table.metamodel.table.description.IntersectionMapping;
+import org.eclipse.sirius.table.tools.internal.Messages;
import org.eclipse.sirius.viewpoint.SiriusPlugin;
import com.google.common.base.Preconditions;
@@ -37,9 +38,9 @@ import com.google.common.base.Preconditions;
/**
* A class aggregating all the queries (read-only!) having a {@link DCell} as a
* starting point.
- *
+ *
* @author <a href="mailto:laurent.redor@obeo.fr">Laurent Redor</a>
- *
+ *
*/
public class DCellQuery {
@@ -50,7 +51,7 @@ public class DCellQuery {
/**
* Creates a new query.
- *
+ *
* @param cell
* the cell to query.
*/
@@ -69,7 +70,7 @@ public class DCellQuery {
* Otherwise, we use the default cell style if it exists Otherwise, we use
* the default line style if it exists <BR>
* Otherwise, we use the default column style if it exists.
- *
+ *
* @return an optional DTableElementStyle to use for the foreground of this
* cell (one of cell, line or column).
*/
@@ -180,7 +181,7 @@ public class DCellQuery {
* Otherwise, we use the default cell style if it exists Otherwise, we use
* the default line style if it exists <BR>
* Otherwise, we use the default column style if it exists.
- *
+ *
* @return an optional DTableElementStyle to use for the foreground of this
* cell (one of cell, line or column).
*/
@@ -260,7 +261,7 @@ public class DCellQuery {
* Check if the <code>style</code> ({@link ForegroundStyleDescription} or
* {@link BackgroundStyleDescription}) is the style of the
* intersectionMapping of the current <code>cell</code>.
- *
+ *
* @param style
* The style to check ({@link ForegroundStyleDescription} or
* {@link BackgroundStyleDescription})
@@ -269,7 +270,7 @@ public class DCellQuery {
*/
public boolean isStyleDescriptionInIntersectionMapping(EObject style) {
if (!(style instanceof ForegroundStyleDescription || style instanceof BackgroundStyleDescription)) {
- throw new IllegalArgumentException("The style attribute must be a ForegroundStyleDescription or a BackgroundStyleDescription.");
+ throw new IllegalArgumentException(Messages.Table_WrongStyleAttribute);
}
if (cell.getIntersectionMapping() != null) {
if (cell.getIntersectionMapping().equals(style.eContainer()) || (style.eContainer() != null && cell.getIntersectionMapping().equals(style.eContainer().eContainer()))) {
@@ -281,7 +282,7 @@ public class DCellQuery {
/**
* Return the column index of this cell in the table.
- *
+ *
* @return the column index of this cell in the table.
*/
public int getColumnIndex() {
@@ -296,9 +297,9 @@ public class DCellQuery {
* .convert(EDataType, Object) crops the obtained value at the first found
* char on which Character.isISOControl return true, the "..." is added to
* the label.
- *
+ *
* This method return the label value before the crop.
- *
+ *
* @return the complete label of the cell.
*/
public String getExportableLabel() {
diff --git a/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/dialect/ContributionTrakingIdentifier.java b/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/dialect/ContributionTrakingIdentifier.java
index fdb04649e3..45882a693e 100644
--- a/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/dialect/ContributionTrakingIdentifier.java
+++ b/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/dialect/ContributionTrakingIdentifier.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 THALES GLOBAL SERVICES.
+ * Copyright (c) 2011, 2015 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
@@ -13,6 +13,7 @@ package org.eclipse.sirius.table.business.internal.dialect;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.sirius.description.contribution.ContributionPoint;
+import org.eclipse.sirius.table.tools.internal.Messages;
import com.google.common.base.Function;
import com.google.common.base.Preconditions;
@@ -22,7 +23,7 @@ import com.google.common.base.Supplier;
* A function which identifies elements from a representation's effective
* description according to the VSM origin of the elements, as recorded in the
* table's contribution points.
- *
+ *
* @author pierre-charles.david@obeo.fr
*/
public class ContributionTrakingIdentifier implements Function<EObject, Object> {
@@ -34,13 +35,13 @@ public class ContributionTrakingIdentifier implements Function<EObject, Object>
/**
* Constructor.
- *
+ *
* @param edSupplier
* a supplier for the effective representations description to
* use.
* @param cpSupplier
* a supplier for the contribution points to use.
- *
+ *
* @param pathFunction
* the function to use to get the intrinsic identifiers of the
* elements.
@@ -54,6 +55,7 @@ public class ContributionTrakingIdentifier implements Function<EObject, Object>
/**
* {@inheritDoc}
*/
+ @Override
public Object apply(EObject from) {
String currentURI = pathFunction.apply(from);
if (isInContributionScope(from)) {
@@ -63,7 +65,7 @@ public class ContributionTrakingIdentifier implements Function<EObject, Object>
String relativeURI = currentURI.replace(parentURI, ""); //$NON-NLS-1$
return cp.getOrigin() + relativeURI;
} else {
- throw new RuntimeException("Internal error: contributed element has no matching contribution data.");
+ throw new RuntimeException(Messages.ContributionTrakingIdentifier_ElementWithoutMatchingData);
}
} else {
return currentURI;
diff --git a/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/dialect/TableDialectServices.java b/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/dialect/TableDialectServices.java
index 2f9a02c42e..5c3c021470 100644
--- a/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/dialect/TableDialectServices.java
+++ b/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/dialect/TableDialectServices.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.sirius.table.business.internal.dialect;
+import java.text.MessageFormat;
import java.util.Collection;
import java.util.List;
import java.util.Map;
@@ -57,6 +58,7 @@ import org.eclipse.sirius.table.metamodel.table.DTableElement;
import org.eclipse.sirius.table.metamodel.table.TableFactory;
import org.eclipse.sirius.table.metamodel.table.description.EditionTableDescription;
import org.eclipse.sirius.table.metamodel.table.description.TableDescription;
+import org.eclipse.sirius.table.tools.internal.Messages;
import org.eclipse.sirius.table.tools.internal.command.TableCommandFactory;
import org.eclipse.sirius.tools.api.command.DCommand;
import org.eclipse.sirius.tools.api.interpreter.InterpreterUtil;
@@ -76,7 +78,7 @@ import com.google.common.collect.Sets;
/**
* Services for the table dialect.
- *
+ *
* @author cbrun
*/
public class TableDialectServices extends AbstractRepresentationDialectServices {
@@ -85,12 +87,12 @@ public class TableDialectServices extends AbstractRepresentationDialectServices
* Tests whether a representation should be handled by the Movida-specific
* code which handles contributions and effective representation
* descriptions.
- *
+ *
* @param representation
* the representation to test.
* @return <code>true</code> if it should be handled by Movida-specific
* logic.
- *
+ *
*/
public static boolean isHandledByMovida(DRepresentation representation) {
return Movida.isEnabled() && (representation instanceof DTable) && (((DTable) representation).getDescription() instanceof EditionTableDescription);
@@ -124,8 +126,8 @@ public class TableDialectServices extends AbstractRepresentationDialectServices
public DRepresentation createRepresentation(String name, EObject semantic, RepresentationDescription description, IProgressMonitor monitor) {
DTable table = null;
try {
- monitor.beginTask("Create table : " + name, 11);
- monitor.subTask("Create table : " + name);
+ monitor.beginTask(MessageFormat.format(Messages.TableDialectServices_CreateTable, name), 11);
+ monitor.subTask(MessageFormat.format(Messages.TableDialectServices_CreateTable, name));
table = TableFactory.eINSTANCE.createDTable();
table.setName(name);
table.setTarget(semantic);
@@ -171,11 +173,13 @@ public class TableDialectServices extends AbstractRepresentationDialectServices
imc.apply(table.getDescription(), new RepresentationExtensionsFinder(table.getDescription()).findAllRelevantViewpoints(session));
Supplier<EObject> efSupplier = new Supplier<EObject>() {
+ @Override
public EObject get() {
return null;
}
};
Supplier<EList<ContributionPoint>> cpSupplier = new Supplier<EList<ContributionPoint>>() {
+ @Override
public EList<ContributionPoint> get() {
return null;
}
@@ -193,11 +197,13 @@ public class TableDialectServices extends AbstractRepresentationDialectServices
private IncrementalModelContributor createModelContributor(Session session, final DTable table) {
Supplier<EObject> efSupplier = new Supplier<EObject>() {
+ @Override
public EObject get() {
return null;
}
};
Supplier<Iterable<ContributionPoint>> cpSupplier = new Supplier<Iterable<ContributionPoint>>() {
+ @Override
public Iterable<ContributionPoint> get() {
return null;
}
@@ -230,17 +236,19 @@ public class TableDialectServices extends AbstractRepresentationDialectServices
/**
* The <code>fullRefresh</code> is not taken into account for table dialect.
- *
+ *
* {@inheritDoc}
*/
+ @Override
public void refresh(final DRepresentation representation, final boolean fullRefresh, final IProgressMonitor monitor) {
try {
- monitor.beginTask("Refresh table", 1);
+ monitor.beginTask(Messages.TableDialectServices_RefreshTable, 1);
DTable table = (DTable) representation;
IInterpreter interpreter = SiriusPlugin.getDefault().getInterpreterRegistry().getInterpreter(table.getTarget());
ModelAccessor accessor = SiriusPlugin.getDefault().getModelAccessorRegistry().getModelAccessor(representation);
Supplier<EObject> efSupplier = new Supplier<EObject>() {
+ @Override
public EObject get() {
// return table.getEffectiveDescription();
return null;
@@ -263,7 +271,7 @@ public class TableDialectServices extends AbstractRepresentationDialectServices
@Override
public void refreshImpactedElements(DRepresentation representation, Collection<Notification> notifications, IProgressMonitor monitor) {
try {
- monitor.beginTask("Refresh table", 10);
+ monitor.beginTask(Messages.TableDialectServices_RefreshTable, 10);
DTable table = (DTable) representation;
IInterpreter interpreter = SiriusPlugin.getDefault().getInterpreterRegistry().getInterpreter(table.getTarget());
ModelAccessor accessor = SiriusPlugin.getDefault().getModelAccessorRegistry().getModelAccessor(representation);
@@ -273,7 +281,7 @@ public class TableDialectServices extends AbstractRepresentationDialectServices
DTableElementSynchronizerSpec synchronizer = new DTableElementSynchronizerSpec(accessor, interpreter);
IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 8);
try {
- subMonitor.beginTask("Refresh impacted elements", dTableElements.size());
+ subMonitor.beginTask(Messages.TableDialectServices_RefreshImpactedElements, dTableElements.size());
for (DTableElement dTableElement : dTableElements) {
if (dTableElement instanceof DCell) {
synchronizer.refresh((DCell) dTableElement);
@@ -335,6 +343,7 @@ public class TableDialectServices extends AbstractRepresentationDialectServices
/**
* {@inheritDoc}
*/
+ @Override
public RepresentationDescription getDescription(DRepresentation representation) {
if (isSupported(representation)) {
return ((DTable) representation).getDescription();
@@ -368,7 +377,7 @@ public class TableDialectServices extends AbstractRepresentationDialectServices
}
if (canCreate) {
try {
- monitor.beginTask("Initialize table of type " + new IdentifiedElementQuery(representationDescription).getLabel(), 1);
+ monitor.beginTask(MessageFormat.format(Messages.TableDialectServices_InitializeTable, new IdentifiedElementQuery(representationDescription).getLabel()), 1);
final TableCommandFactory tableCommandFactory = new TableCommandFactory(domain);
tableCommandFactory.setModelAccessor(modelAccessor);
DCommand command = tableCommandFactory.buildCreateTableFromDescription(tableDescription, semanticElement, new SubProgressMonitor(monitor, 1));
diff --git a/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/metamodel/TableToolVariables.java b/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/metamodel/TableToolVariables.java
index 7e6b96034c..a9e97d151a 100644
--- a/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/metamodel/TableToolVariables.java
+++ b/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/metamodel/TableToolVariables.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2008, 2009 THALES GLOBAL SERVICES.
+ * Copyright (c) 2007, 2015 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
@@ -23,6 +23,7 @@ import org.eclipse.sirius.table.metamodel.table.description.TableTool;
import org.eclipse.sirius.table.metamodel.table.description.TableVariable;
import org.eclipse.sirius.table.metamodel.table.description.util.DescriptionSwitch;
import org.eclipse.sirius.table.tools.api.interpreter.IInterpreterSiriusTableVariables;
+import org.eclipse.sirius.table.tools.internal.Messages;
import org.eclipse.sirius.viewpoint.description.tool.ContainerViewVariable;
import org.eclipse.sirius.viewpoint.description.tool.ElementSelectVariable;
import org.eclipse.sirius.viewpoint.description.tool.InitialOperation;
@@ -33,7 +34,7 @@ import org.eclipse.sirius.viewpoint.description.tool.ToolFactory;
/**
* This processing switch will add the needed variable description in the table
* tools.
- *
+ *
* @author cbrun
*/
public class TableToolVariables extends DescriptionSwitch<Object> {
@@ -42,9 +43,9 @@ public class TableToolVariables extends DescriptionSwitch<Object> {
*/
@Override
public Object caseCreateCellTool(CreateCellTool object) {
- addVariableDescriptor(object, IInterpreterSiriusTableVariables.LINE_SEMANTIC, "The semantic element corresponding to the line.");
- addVariableDescriptor(object, IInterpreterSiriusTableVariables.COLUMN_SEMANTIC, "The semantic element corresponding to the column.");
- addVariableDescriptor(object, IInterpreterSiriusVariables.ROOT, "The semantic root element of the table.");
+ addVariableDescriptor(object, IInterpreterSiriusTableVariables.LINE_SEMANTIC, Messages.TableToolVariables_SemanticLineElement);
+ addVariableDescriptor(object, IInterpreterSiriusTableVariables.COLUMN_SEMANTIC, Messages.TableToolVariables_SemanticColumnElement);
+ addVariableDescriptor(object, IInterpreterSiriusVariables.ROOT, Messages.TableToolVariables_SemanticRootElement);
return super.caseCreateCellTool(object);
}
@@ -53,9 +54,9 @@ public class TableToolVariables extends DescriptionSwitch<Object> {
*/
@Override
public Object caseCreateTool(CreateTool object) {
- addVariableDescriptor(object, IInterpreterSiriusVariables.ROOT, "The semantic element of the table.");
- 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.TableToolVariables_SemanticRootElement);
+ addVariableDescriptor(object, IInterpreterSiriusVariables.ELEMENT, Messages.TableToolVariables_CurrentSemanticElement);
+ addVariableDescriptor(object, IInterpreterSiriusVariables.CONTAINER, Messages.TableToolVariables_SemanticElementOfContainerView);
return super.caseCreateTool(object);
}
@@ -64,10 +65,10 @@ public class TableToolVariables extends DescriptionSwitch<Object> {
*/
@Override
public Object caseLabelEditTool(LabelEditTool object) {
- addVariableDescriptor(object, IInterpreterSiriusVariables.ELEMENT, "The currently edited element.");
- addVariableDescriptor(object, IInterpreterSiriusTableVariables.LINE_SEMANTIC, "The semantic element corresponding to the line.");
- addVariableDescriptor(object, IInterpreterSiriusTableVariables.COLUMN_SEMANTIC, "The semantic element corresponding to the column.");
- addVariableDescriptor(object, IInterpreterSiriusVariables.ROOT, "The semantic element of the table.");
+ addVariableDescriptor(object, IInterpreterSiriusVariables.ELEMENT, Messages.TableToolVariables_CurrentSemanticElement);
+ addVariableDescriptor(object, IInterpreterSiriusTableVariables.LINE_SEMANTIC, Messages.TableToolVariables_SemanticLineElement);
+ addVariableDescriptor(object, IInterpreterSiriusTableVariables.COLUMN_SEMANTIC, Messages.TableToolVariables_SemanticColumnElement);
+ addVariableDescriptor(object, IInterpreterSiriusVariables.ROOT, Messages.TableToolVariables_SemanticRootElement);
return super.caseLabelEditTool(object);
}
@@ -76,15 +77,15 @@ public class TableToolVariables extends DescriptionSwitch<Object> {
*/
@Override
public Object caseDeleteTool(DeleteTool object) {
- addVariableDescriptor(object, IInterpreterSiriusVariables.ELEMENT, "The currently edited element.");
- addVariableDescriptor(object, IInterpreterSiriusVariables.ROOT, "The semantic element corresponding to the current table.");
+ addVariableDescriptor(object, IInterpreterSiriusVariables.ELEMENT, Messages.TableToolVariables_CurrentSemanticElement);
+ addVariableDescriptor(object, IInterpreterSiriusVariables.ROOT, Messages.TableToolVariables_SemanticRootElement);
return super.caseDeleteTool(object);
}
/**
- *
+ *
* {@inheritDoc}
- *
+ *
* @see org.eclipse.sirius.table.metamodel.table.description.util.DescriptionSwitch#caseTableCreationDescription(org.eclipse.sirius.table.metamodel.table.description.TableCreationDescription)
*/
@Override
@@ -101,9 +102,9 @@ public class TableToolVariables extends DescriptionSwitch<Object> {
}
/**
- *
+ *
* {@inheritDoc}
- *
+ *
* @see org.eclipse.sirius.table.metamodel.table.description.util.DescriptionSwitch#caseTableNavigationDescription(org.eclipse.sirius.table.metamodel.table.description.TableNavigationDescription)
*/
@Override
diff --git a/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/metamodel/operations/DColumnOperations.java b/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/metamodel/operations/DColumnOperations.java
index 5a7e20e787..a064260a83 100644
--- a/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/metamodel/operations/DColumnOperations.java
+++ b/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/metamodel/operations/DColumnOperations.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2008, 2009 THALES GLOBAL SERVICES.
+ * Copyright (c) 2007, 2015 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
@@ -15,17 +15,18 @@ import java.util.Comparator;
import java.util.List;
import java.util.Map;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Ordering;
-
import org.eclipse.sirius.table.metamodel.table.DCell;
import org.eclipse.sirius.table.metamodel.table.DColumn;
import org.eclipse.sirius.table.metamodel.table.DLine;
import org.eclipse.sirius.table.metamodel.table.LineContainer;
+import org.eclipse.sirius.table.tools.internal.Messages;
+
+import com.google.common.collect.Maps;
+import com.google.common.collect.Ordering;
/**
* Common operations for DColumn subclasses.
- *
+ *
* @author cbrun
*/
public final class DColumnOperations {
@@ -36,7 +37,7 @@ public final class DColumnOperations {
/**
* Sort the column cells considering their index and return them.
- *
+ *
* @param column
* column.
* @return a sorted set of cells.
@@ -45,6 +46,7 @@ public final class DColumnOperations {
final Map<DLine, Integer> lineIndices = Maps.newHashMap();
fillIndices(column.getTable(), lineIndices, 0);
Ordering<DCell> ordering = Ordering.from(new Comparator<DCell>() {
+ @Override
public int compare(DCell a, DCell b) {
int result = 0;
DLine lineA = a.getLine();
@@ -57,7 +59,7 @@ public final class DColumnOperations {
Integer aIndex = lineIndices.get(lineA);
Integer bIndex = lineIndices.get(lineB);
if (aIndex == null || bIndex == null) {
- throw new RuntimeException("Should not happen.");
+ throw new RuntimeException(Messages.Table_UnexpectedExceptionMessage);
}
return aIndex - bIndex;
}
diff --git a/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/metamodel/spec/DLineSpec.java b/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/metamodel/spec/DLineSpec.java
index 87183524de..e624f540a7 100644
--- a/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/metamodel/spec/DLineSpec.java
+++ b/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/metamodel/spec/DLineSpec.java
@@ -22,6 +22,7 @@ import org.eclipse.sirius.table.metamodel.table.DColumn;
import org.eclipse.sirius.table.metamodel.table.TablePackage;
import org.eclipse.sirius.table.metamodel.table.description.TableMapping;
import org.eclipse.sirius.table.metamodel.table.impl.DLineImpl;
+import org.eclipse.sirius.table.tools.internal.Messages;
import org.eclipse.sirius.viewpoint.description.RepresentationElementMapping;
import com.google.common.collect.Maps;
@@ -29,7 +30,7 @@ import com.google.common.collect.Ordering;
/**
* Specialization of DLine.
- *
+ *
* @author cbrun
*/
public class DLineSpec extends DLineImpl {
@@ -60,7 +61,7 @@ public class DLineSpec extends DLineImpl {
Integer aIndex = columnIndices.get(columnA);
Integer bIndex = columnIndices.get(columnB);
if (aIndex == null || bIndex == null) {
- throw new RuntimeException("Should not happen.");
+ throw new RuntimeException(Messages.Table_UnexpectedExceptionMessage);
}
return aIndex - bIndex;
}
diff --git a/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/refresh/DTableSynchronizerImpl.java b/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/refresh/DTableSynchronizerImpl.java
index e523372f67..fd8750b245 100644
--- a/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/refresh/DTableSynchronizerImpl.java
+++ b/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/refresh/DTableSynchronizerImpl.java
@@ -61,6 +61,7 @@ import org.eclipse.sirius.table.metamodel.table.description.LineMapping;
import org.eclipse.sirius.table.metamodel.table.description.TableDescription;
import org.eclipse.sirius.table.metamodel.table.description.TableMapping;
import org.eclipse.sirius.table.tools.api.interpreter.IInterpreterSiriusTableVariables;
+import org.eclipse.sirius.table.tools.internal.Messages;
import org.eclipse.sirius.tools.api.profiler.SiriusTasksKey;
import org.eclipse.sirius.viewpoint.DSemanticDecorator;
@@ -69,7 +70,7 @@ import com.google.common.collect.Sets;
/**
* The synchronizer for tables.
- *
+ *
* @author cbrun
*/
public class DTableSynchronizerImpl implements DTableSynchronizer {
@@ -90,7 +91,7 @@ public class DTableSynchronizerImpl implements DTableSynchronizer {
/**
* Create a new {@link DTableSynchronizer} for an EditionTable.
- *
+ *
* @param description
* EditionTable description.
* @param accessor
@@ -108,15 +109,16 @@ public class DTableSynchronizerImpl implements DTableSynchronizer {
}
/**
- *
+ *
* {@inheritDoc}
*/
+ @Override
public void refresh(final IProgressMonitor monitor) {
try {
if (description instanceof CrossTableDescription) {
- monitor.beginTask("Refresh cross table", 3);
+ monitor.beginTask(Messages.DTableSynchronizerImpl_refreshCrossTabel, 3);
} else {
- monitor.beginTask("Refresh edition table", 2);
+ monitor.beginTask(Messages.DTableSynchronizerImpl_refreshEditionTabel, 2);
}
KeyCache.DEFAULT.clear();
DslCommonPlugin.PROFILER.startWork(SiriusTasksKey.REFRESH_TABLE_KEY);
@@ -143,7 +145,7 @@ public class DTableSynchronizerImpl implements DTableSynchronizer {
if (description != null) {
lMappings = description.getAllLineMappings();
}
- monitor.beginTask("Refresh line mapping", lMappings.size());
+ monitor.beginTask(Messages.DTableSynchronizerImpl_refreshLineMapping, lMappings.size());
int currentLineIndex = 0;
for (final LineMapping lMapping : lMappings) {
@@ -171,7 +173,7 @@ public class DTableSynchronizerImpl implements DTableSynchronizer {
} else if (description instanceof CrossTableDescription) {
cMappings = ((CrossTableDescription) description).getOwnedColumnMappings();
}
- monitor.beginTask("Refresh column mapping", cMappings.size());
+ monitor.beginTask(Messages.DTableSynchronizerImpl_refreshColumnMapping, cMappings.size());
int currentColumnIndex = 0;
for (final ColumnMapping cMapping : cMappings) {
@@ -212,11 +214,12 @@ public class DTableSynchronizerImpl implements DTableSynchronizer {
/**
* Refresh all the cells of a crossTable :
* <UL>
- * <LI>Remove the cells that have no corresponding intersection mapping,</LI>
+ * <LI>Remove the cells that have no corresponding intersection mapping,
+ * </LI>
* <LI>Refresh the existing one</LI>
* <LI>Create the new one</LI>
* <UL>
- *
+ *
* @param monitor
* The progress monitor
* @param mappingToElements
@@ -227,7 +230,7 @@ public class DTableSynchronizerImpl implements DTableSynchronizer {
*/
private void refreshCellsOfCrossTable(final IProgressMonitor monitor, final Map<TableMapping, Collection<DTableElement>> mappingToElements, ECrossReferenceAdapter xref) {
try {
- monitor.beginTask("Refresh intersection mapping", ((CrossTableDescription) description).getIntersection().size());
+ monitor.beginTask(Messages.DTableSynchronizerImpl_refreshIntersectionMapping, ((CrossTableDescription) description).getIntersection().size());
if (((CrossTableDescription) description).getIntersection().isEmpty()) {
// If there is no intersection mapping we must clean all the
// invalid
@@ -389,7 +392,7 @@ public class DTableSynchronizerImpl implements DTableSynchronizer {
/**
* Refresh a column mapping adding the columns.
- *
+ *
* @param mapping
* mapping to refresh.
* @param mappingToElements
@@ -575,7 +578,7 @@ public class DTableSynchronizerImpl implements DTableSynchronizer {
/**
* ; Refresh a line mapping for a given container.
- *
+ *
* @param container
* the line container.
* @param mapping
@@ -658,7 +661,7 @@ public class DTableSynchronizerImpl implements DTableSynchronizer {
/**
* Refresh all cells corresponding to the <code>iMapping</code>.
- *
+ *
* @param iMapping
* The intersection mapping for which we want to refresh the
* corresponding cells.
@@ -678,7 +681,7 @@ public class DTableSynchronizerImpl implements DTableSynchronizer {
/**
* Refresh all cells corresponding to the <code>iMapping</code>.
- *
+ *
* @param iMapping
* The intersection mapping with domain class for which we want
* to refresh the corresponding cells.
@@ -774,7 +777,7 @@ public class DTableSynchronizerImpl implements DTableSynchronizer {
/**
* Creates the new cells, update the kept ones and remove the old ones.
- *
+ *
* @param iMapping
* the intersection mapping that is being refreshed
* @param cellsToUpdate
@@ -838,7 +841,7 @@ public class DTableSynchronizerImpl implements DTableSynchronizer {
/**
* Refresh all cells corresponding to the <code>iMapping</code>.
- *
+ *
* @param iMapping
* The intersection mapping without domain class for which we
* want to refresh the corresponding cells.
@@ -921,7 +924,7 @@ public class DTableSynchronizerImpl implements DTableSynchronizer {
/**
* Put or add the given nodes in the Map.
- *
+ *
* @param map
* the map to update.
* @param mapping
@@ -941,7 +944,7 @@ public class DTableSynchronizerImpl implements DTableSynchronizer {
/**
* Create a new line corresponding to the mapping.
- *
+ *
* @param mapping
* the line mapping.
* @param semantic
@@ -957,7 +960,7 @@ public class DTableSynchronizerImpl implements DTableSynchronizer {
/**
* Create a new column corresponding to the mapping.
- *
+ *
* @param mapping
* the column mapping.
* @param featureName
@@ -973,7 +976,7 @@ public class DTableSynchronizerImpl implements DTableSynchronizer {
/**
* Create a new column corresponding to the mapping.
- *
+ *
* @param mapping
* the column mapping.
* @param semantic
@@ -990,7 +993,7 @@ public class DTableSynchronizerImpl implements DTableSynchronizer {
/**
* Deletes the given lines, the contained subLines and cells and removes all
* references to deleted elements.
- *
+ *
* @param lineToDelete
* the line to delete
* @param xref
@@ -1017,7 +1020,7 @@ public class DTableSynchronizerImpl implements DTableSynchronizer {
/**
* Deletes the given column, and the contained cells and removes all
* references to deleted elements.
- *
+ *
* @param columnToDelete
* the column to delete
* @param xref
@@ -1039,7 +1042,7 @@ public class DTableSynchronizerImpl implements DTableSynchronizer {
/**
* Deletes the given cell, and removes all references to deleted elements.
- *
+ *
* @param cell
* the cell to delete
* @param xref
@@ -1055,7 +1058,7 @@ public class DTableSynchronizerImpl implements DTableSynchronizer {
/**
* Compute the current status of a given line container for a given
* LineMapping.
- *
+ *
* @param container
* current line container.
* @param mapping
@@ -1120,18 +1123,20 @@ public class DTableSynchronizerImpl implements DTableSynchronizer {
}
/**
- *
+ *
* {@inheritDoc}
*/
+ @Override
public void setTable(final DTable newTable) {
this.table = newTable;
this.ids = RefreshIdsHolder.getOrCreateHolder(table);
}
/**
- *
+ *
* {@inheritDoc}
*/
+ @Override
public DTable getTable() {
return table;
}
diff --git a/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/refresh/StyleWithDefaultStatus.java b/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/refresh/StyleWithDefaultStatus.java
index 1e1488376f..a71067e890 100644
--- a/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/refresh/StyleWithDefaultStatus.java
+++ b/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/refresh/StyleWithDefaultStatus.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 THALES GLOBAL SERVICES.
+ * Copyright (c) 2011, 2015 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
@@ -11,15 +11,15 @@
package org.eclipse.sirius.table.business.internal.refresh;
import org.eclipse.emf.ecore.EObject;
-
import org.eclipse.sirius.table.metamodel.table.description.BackgroundStyleDescription;
import org.eclipse.sirius.table.metamodel.table.description.ForegroundStyleDescription;
+import org.eclipse.sirius.table.tools.internal.Messages;
/**
* A specific class to group a style ({@link ForegroundStyleDescription} or
* {@link BackgroundStyleDescription}) and a boolean status to indicate if the
* style is the default one.
- *
+ *
* @author <a href="mailto:laurent.redor@obeo.fr">Laurent Redor</a>
*/
public class StyleWithDefaultStatus {
@@ -30,7 +30,7 @@ public class StyleWithDefaultStatus {
/**
* Default constructor.
- *
+ *
* @param style
* the style
* @param isDefaultStyle
@@ -38,7 +38,7 @@ public class StyleWithDefaultStatus {
*/
public StyleWithDefaultStatus(EObject style, Boolean isDefaultStyle) {
if (!(style instanceof ForegroundStyleDescription || style instanceof BackgroundStyleDescription)) {
- throw new IllegalArgumentException("The style attribute must be a ForegroundStyleDescription or a BackgroundStyleDescription.");
+ throw new IllegalArgumentException(Messages.Table_WrongStyleAttribute);
}
this.style = style;
this.isDefaultStyle = isDefaultStyle;
@@ -46,7 +46,7 @@ public class StyleWithDefaultStatus {
/**
* Get the style.
- *
+ *
* @return the style
*/
protected EObject getStyle() {
@@ -55,7 +55,7 @@ public class StyleWithDefaultStatus {
/**
* Set the style.
- *
+ *
* @param style
* the style to set
*/
@@ -65,7 +65,7 @@ public class StyleWithDefaultStatus {
/**
* Tells if the style is the default one.
- *
+ *
* @return the isDefaultStyle
*/
protected Boolean isDefaultStyle() {
@@ -74,7 +74,7 @@ public class StyleWithDefaultStatus {
/**
* Set the if the style is the default one.
- *
+ *
* @param isDefaultStyle
* the isDefaultStyle to set
*/
@@ -84,7 +84,7 @@ public class StyleWithDefaultStatus {
/**
* {@inheritDoc}
- *
+ *
* @see java.lang.Object#toString()
*/
@Override
@@ -94,7 +94,7 @@ public class StyleWithDefaultStatus {
/**
* {@inheritDoc}
- *
+ *
* @see java.lang.Object#hashCode()
*/
@Override
@@ -107,17 +107,16 @@ public class StyleWithDefaultStatus {
/**
* {@inheritDoc}
- *
+ *
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(java.lang.Object other) {
if (other instanceof StyleWithDefaultStatus) {
StyleWithDefaultStatus otherStyleWithDefaultStatus = (StyleWithDefaultStatus) other;
- return this.style == otherStyleWithDefaultStatus.style
- || (this.style != null && otherStyleWithDefaultStatus.style != null && this.style.equals(otherStyleWithDefaultStatus.style))
- && (this.isDefaultStyle == otherStyleWithDefaultStatus.isDefaultStyle || (this.isDefaultStyle != null && otherStyleWithDefaultStatus.isDefaultStyle != null && this.isDefaultStyle
- .equals(otherStyleWithDefaultStatus.isDefaultStyle)));
+ return this.style == otherStyleWithDefaultStatus.style || (this.style != null && otherStyleWithDefaultStatus.style != null && this.style.equals(otherStyleWithDefaultStatus.style))
+ && (this.isDefaultStyle == otherStyleWithDefaultStatus.isDefaultStyle
+ || (this.isDefaultStyle != null && otherStyleWithDefaultStatus.isDefaultStyle != null && this.isDefaultStyle.equals(otherStyleWithDefaultStatus.isDefaultStyle)));
}
return false;
}
diff --git a/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/tools/internal/Messages.java b/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/tools/internal/Messages.java
new file mode 100644
index 0000000000..44cd4826ca
--- /dev/null
+++ b/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/tools/internal/Messages.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * 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.table.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:laurent.redor@obeo.fr">Laurent Redor</a>
+ */
+public final class Messages {
+
+ static {
+ I18N.initializeMessages(Messages.class, TablePlugin.INSTANCE);
+ }
+
+ // CHECKSTYLE:OFF
+ @TranslatableMessage
+ public static String ContributionTrakingIdentifier_ElementWithoutMatchingData;
+
+ @TranslatableMessage
+ public static String DTableSynchronizerImpl_refreshColumnMapping;
+
+ @TranslatableMessage
+ public static String DTableSynchronizerImpl_refreshCrossTabel;
+
+ @TranslatableMessage
+ public static String DTableSynchronizerImpl_refreshEditionTabel;
+
+ @TranslatableMessage
+ public static String DTableSynchronizerImpl_refreshIntersectionMapping;
+
+ @TranslatableMessage
+ public static String DTableSynchronizerImpl_refreshLineMapping;
+
+ @TranslatableMessage
+ public static String TableCommandFactory_addValue;
+
+ @TranslatableMessage
+ public static String TableCommandFactory_clearValue;
+
+ @TranslatableMessage
+ public static String TableCommandFactory_setCellContent;
+
+ @TranslatableMessage
+ public static String TableCommandFactory_setValue;
+
+ @TranslatableMessage
+ public static String TableDialectServices_CreateTable;
+
+ @TranslatableMessage
+ public static String TableDialectServices_InitializeTable;
+
+ @TranslatableMessage
+ public static String TableDialectServices_RefreshImpactedElements;
+
+ @TranslatableMessage
+ public static String TableDialectServices_RefreshTable;
+
+ @TranslatableMessage
+ public static String TableExportHelper_ExceptionOnSave;
+
+ @TranslatableMessage
+ public static String TableToolVariables_CurrentSemanticElement;
+
+ @TranslatableMessage
+ public static String TableToolVariables_SemanticColumnElement;
+
+ @TranslatableMessage
+ public static String TableToolVariables_SemanticElementOfContainerView;
+
+ @TranslatableMessage
+ public static String TableToolVariables_SemanticLineElement;
+
+ @TranslatableMessage
+ public static String TableToolVariables_SemanticRootElement;
+
+ @TranslatableMessage
+ public static String Table_UnexpectedExceptionMessage;
+
+ @TranslatableMessage
+ public static String Table_WrongStyleAttribute;
+
+ // CHECKSTYLE:ON
+
+ private Messages() {
+ // Prevents instanciation.
+ }
+}
diff --git a/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/tools/internal/command/TableCommandFactory.java b/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/tools/internal/command/TableCommandFactory.java
index 7a439831e2..aa39f12988 100644
--- a/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/tools/internal/command/TableCommandFactory.java
+++ b/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/tools/internal/command/TableCommandFactory.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.sirius.table.tools.internal.command;
+import java.text.MessageFormat;
import java.util.HashMap;
import java.util.Map;
@@ -57,6 +58,7 @@ import org.eclipse.sirius.table.metamodel.table.description.TableTool;
import org.eclipse.sirius.table.metamodel.table.description.TableVariable;
import org.eclipse.sirius.table.tools.api.command.ITableCommandFactory;
import org.eclipse.sirius.table.tools.api.interpreter.IInterpreterSiriusTableVariables;
+import org.eclipse.sirius.table.tools.internal.Messages;
import org.eclipse.sirius.tools.api.command.AbstractCommandFactory;
import org.eclipse.sirius.tools.api.command.DCommand;
import org.eclipse.sirius.tools.api.command.InvalidPermissionCommand;
@@ -75,7 +77,7 @@ import org.eclipse.sirius.viewpoint.description.tool.ToolPackage;
/**
* A command factory that creates commands that can be undone.
- *
+ *
* @author lredor
*/
public class TableCommandFactory extends AbstractCommandFactory implements ITableCommandFactory {
@@ -83,7 +85,7 @@ public class TableCommandFactory extends AbstractCommandFactory implements ITabl
/**
* Create a new Factory. the autoRefresh is by default deactivated
- *
+ *
* @param domain
* : current editing domain.
*/
@@ -93,7 +95,7 @@ public class TableCommandFactory extends AbstractCommandFactory implements ITabl
/**
* Create a new Factory. the autoRefresh is by default deactivated
- *
+ *
* @param domain
* : current editing domain.
* @param modelAccessor
@@ -109,7 +111,7 @@ public class TableCommandFactory extends AbstractCommandFactory implements ITabl
/**
* Returns a command that can delete the specified element.
- *
+ *
* @param element
* the element to delete (a {@link DLine} or a
* {@link DTargetColumn}).
@@ -146,7 +148,7 @@ public class TableCommandFactory extends AbstractCommandFactory implements ITabl
/**
* Create a command that creates a line.
- *
+ *
* @param lineContainer
* container element in which the command should put the created
* line.
@@ -176,7 +178,7 @@ public class TableCommandFactory extends AbstractCommandFactory implements ITabl
/**
* Create a command that creates a column.
- *
+ *
* @param containerView
* container element in which the command should put the created
* line.
@@ -250,7 +252,7 @@ public class TableCommandFactory extends AbstractCommandFactory implements ITabl
* Build a command that covers all the model operations corresponding to a
* the semantic container and a
* {@link org.eclipse.sirius.viewpoint.description.tool.ToolDescription}.
- *
+ *
* @param semanticCurrentElement
* the semantic current Element.
* @param tool
@@ -316,7 +318,7 @@ public class TableCommandFactory extends AbstractCommandFactory implements ITabl
* directEdit tool} or
* {@link org.eclipse.sirius.table.metamodel.table.description.CreateCellTool
* createCell tool}.
- *
+ *
* @param currentCell
* the current edited cell.
* @param tool
@@ -326,7 +328,7 @@ public class TableCommandFactory extends AbstractCommandFactory implements ITabl
* @return a command able to execute the direct Edit Tool.
*/
private SiriusCommand buildCommandFromCell(final DCell currentCell, final TableTool tool, final Object newValue) {
- SiriusCommand result = new SiriusCommand(domain, "Set cell content");
+ SiriusCommand result = new SiriusCommand(domain, Messages.TableCommandFactory_setCellContent);
if (!getPermissionAuthority().canEditInstance(currentCell)) {
result = new InvalidPermissionCommand(domain, currentCell);
} else {
@@ -377,7 +379,7 @@ public class TableCommandFactory extends AbstractCommandFactory implements ITabl
* {@link org.eclipse.sirius.table.metamodel.table.description.CreateCellTool
* createCell tool} for the current {@link DLine line} and
* {@link org.eclipse.sirius.table.metamodel.table.DColumn column}.
- *
+ *
* @param currentLine
* the line corresponding to the intersection that need a
* creation of a new cell.
@@ -391,7 +393,7 @@ public class TableCommandFactory extends AbstractCommandFactory implements ITabl
* @return a command able to execute the create Tool.
*/
private SiriusCommand buildCommandFromIntersection(final DLine currentLine, final DTargetColumn currentColumn, final CreateCellTool tool, final Object newValue) {
- SiriusCommand result = new SiriusCommand(domain, "Set cell content");
+ SiriusCommand result = new SiriusCommand(domain, Messages.TableCommandFactory_setCellContent);
if (!getPermissionAuthority().canEditInstance(currentLine)) {
result = new InvalidPermissionCommand(domain, currentLine);
} else {
@@ -423,7 +425,7 @@ public class TableCommandFactory extends AbstractCommandFactory implements ITabl
/**
* Return the commandTaskHelper.
- *
+ *
* @return the commandTaskHelper
*/
public TaskHelper getCommandTaskHelper() {
@@ -439,7 +441,7 @@ public class TableCommandFactory extends AbstractCommandFactory implements ITabl
/**
* Set the model accessor.
- *
+ *
* @param modelAccessor
* the modelAccessor to set
*/
@@ -451,7 +453,7 @@ public class TableCommandFactory extends AbstractCommandFactory implements ITabl
/**
* Create a command that set the content of a crossTable cell.
- *
+ *
* @param editedCell
* The cell to set
* @param newValue
@@ -480,7 +482,7 @@ public class TableCommandFactory extends AbstractCommandFactory implements ITabl
/**
* {@inheritDoc}
- *
+ *
* @see org.eclipse.sirius.table.tools.api.command.ITableCommandFactory#buildCreateCellFromTool(org.eclipse.sirius.table.metamodel.table.DLine,
* org.eclipse.sirius.table.metamodel.table.DTargetColumn,
* java.lang.Object)
@@ -499,8 +501,8 @@ public class TableCommandFactory extends AbstractCommandFactory implements ITabl
result = buildCommandFromIntersection(line, column, optionalCreateCellTool.get(), newValue);
addRefreshTask(TableHelper.getTable(line), (SiriusCommand) result, optionalCreateCellTool.get());
Option<DRepresentation> dRepresentation = new EObjectQuery(line).getRepresentation();
- ((SiriusCommand) result).getTasks().add(
- new ElementsToSelectTask(optionalCreateCellTool.get(), InterpreterUtil.getInterpreter(line.getTarget()), line.getTarget(), dRepresentation.get()));
+ ((SiriusCommand) result).getTasks()
+ .add(new ElementsToSelectTask(optionalCreateCellTool.get(), InterpreterUtil.getInterpreter(line.getTarget()), line.getTarget(), dRepresentation.get()));
}
}
}
@@ -509,7 +511,7 @@ public class TableCommandFactory extends AbstractCommandFactory implements ITabl
/**
* Create a command that is able to create a table.
- *
+ *
* @param description
* the tool that describes how to create the table.
* @param semanticElement
@@ -524,7 +526,7 @@ public class TableCommandFactory extends AbstractCommandFactory implements ITabl
/**
* Creation of a table must not be undoable ! <BR>
* {@inheritDoc}
- *
+ *
* @see org.eclipse.emf.transaction.RecordingCommand#canUndo()
*/
@Override
@@ -540,7 +542,7 @@ public class TableCommandFactory extends AbstractCommandFactory implements ITabl
/**
* {@inheritDoc}
- *
+ *
* @see org.eclipse.sirius.table.tools.api.command.ITableCommandFactory#buildSetValue(org.eclipse.emf.ecore.EObject,
* java.lang.String, java.lang.Object)
*/
@@ -554,7 +556,7 @@ public class TableCommandFactory extends AbstractCommandFactory implements ITabl
@Override
public String getLabel() {
- return "Set " + name + " value";
+ return MessageFormat.format(Messages.TableCommandFactory_setValue, name);
}
@Override
@@ -579,7 +581,7 @@ public class TableCommandFactory extends AbstractCommandFactory implements ITabl
/**
* {@inheritDoc}
- *
+ *
* @see org.eclipse.sirius.table.tools.api.command.ITableCommandFactory#buildAddValue(org.eclipse.emf.ecore.EObject,
* java.lang.String, java.lang.Object)
*/
@@ -591,7 +593,7 @@ public class TableCommandFactory extends AbstractCommandFactory implements ITabl
@Override
public String getLabel() {
- return "Add " + name + " value";
+ return MessageFormat.format(Messages.TableCommandFactory_addValue, name);
}
@Override
@@ -613,7 +615,7 @@ public class TableCommandFactory extends AbstractCommandFactory implements ITabl
/**
* {@inheritDoc}
- *
+ *
* @see org.eclipse.sirius.table.tools.api.command.ITableCommandFactory#buildClearValue(org.eclipse.emf.ecore.EObject,
* java.lang.String, java.lang.Object)
*/
@@ -626,7 +628,7 @@ public class TableCommandFactory extends AbstractCommandFactory implements ITabl
@Override
public String getLabel() {
- return "Clear " + name;
+ return MessageFormat.format(Messages.TableCommandFactory_clearValue, name);
}
@Override
@@ -646,7 +648,7 @@ public class TableCommandFactory extends AbstractCommandFactory implements ITabl
/**
* {@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)
diff --git a/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/tools/internal/export/TableExportHelperImpl.java b/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/tools/internal/export/TableExportHelperImpl.java
index 948365969c..0162f579e3 100644
--- a/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/tools/internal/export/TableExportHelperImpl.java
+++ b/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/tools/internal/export/TableExportHelperImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 THALES GLOBAL SERVICES.
+ * Copyright (c) 2010,2015 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
@@ -17,25 +17,24 @@ import java.io.IOException;
import org.eclipse.sirius.table.metamodel.table.DTable;
import org.eclipse.sirius.table.tools.api.export.TableExportHelper;
+import org.eclipse.sirius.table.tools.internal.Messages;
import org.eclipse.sirius.table.tools.internal.TablePlugin;
import org.eclipse.sirius.table.tools.internal.export.csv.TableCsvHelper;
/**
* Helper to export table.
- *
+ *
* @author mchauvin
* @since 0.9.0
*/
public final class TableExportHelperImpl implements TableExportHelper {
- private static final String EXCEPTION_ON_SAVE_CONTENT = "Error while saving the exported content."; //$NON-NLS-1$
-
private TableExportHelperImpl() {
}
/**
* Create a new instance.
- *
+ *
* @return a new instance
*/
public static TableExportHelper init() {
@@ -44,10 +43,11 @@ public final class TableExportHelperImpl implements TableExportHelper {
/**
* {@inheritDoc}
- *
+ *
* @see org.eclipse.sirius.table.tools.api.export.TableExportHelper#saveContent(java.lang.String,
* java.lang.String)
*/
+ @Override
public void saveContent(final String content, final String fileName) {
final File file = new File(fileName);
FileOutputStream outputStream = null;
@@ -55,25 +55,26 @@ public final class TableExportHelperImpl implements TableExportHelper {
outputStream = new FileOutputStream(file);
outputStream.write(content.getBytes());
} catch (final FileNotFoundException exception) {
- TablePlugin.getPlugin().error(EXCEPTION_ON_SAVE_CONTENT, exception);
+ TablePlugin.getPlugin().error(Messages.TableExportHelper_ExceptionOnSave, exception);
} catch (final IOException exception) {
- TablePlugin.getPlugin().error(EXCEPTION_ON_SAVE_CONTENT, exception);
+ TablePlugin.getPlugin().error(Messages.TableExportHelper_ExceptionOnSave, exception);
} finally {
try {
if (outputStream != null) {
outputStream.close();
}
} catch (final IOException exception) {
- TablePlugin.getPlugin().error(EXCEPTION_ON_SAVE_CONTENT, exception);
+ TablePlugin.getPlugin().error(Messages.TableExportHelper_ExceptionOnSave, exception);
}
}
}
/**
* {@inheritDoc}
- *
+ *
* @see org.eclipse.sirius.table.tools.api.export.TableExportHelper#exportToCsv(org.eclipse.sirius.table.metamodel.table.DTable)
*/
+ @Override
public String exportToCsv(final DTable table) {
final Iterable<Iterable<String>> tableDescriptors = TableCsvHelper.getTableDescriptor(table);
final StringBuilder contentBuilder = new StringBuilder();

Back to the top