aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlav Lenz2013-01-03 04:02:41 (EST)
committerOlav Lenz2013-01-11 14:08:49 (EST)
commitf36c6955f75bd375d2f956b4d62d6fb9f379278e (patch)
tree95f05b9a9908d5fe4a44d2479e5f867fbb3eaff7
parent0a998d0a95c1c350495c790c72b27ef9f8b48559 (diff)
downloadorg.eclipse.recommenders-f36c6955f75bd375d2f956b4d62d6fb9f379278e.zip
org.eclipse.recommenders-f36c6955f75bd375d2f956b4d62d6fb9f379278e.tar.gz
org.eclipse.recommenders-f36c6955f75bd375d2f956b4d62d6fb9f379278e.tar.bz2
[i18n] externalize strings in plugin *.completion.rcp.callsrefs/changes/27/9427/5
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.calls/META-INF/MANIFEST.MF4
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.calls/OSGI-INF/l10n/bundle.properties5
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.calls/build.properties3
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.calls/plugin.xml4
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/completion/rcp/calls/l10n/Messages.java52
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/completion/rcp/calls/l10n/messages.properties27
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/extdoc/CallsProvider.java63
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/preferences/CallPreferencePage.java47
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/preferences/ModelLabelProvider.java17
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/preferences/VersionLabelProvider.java18
-rw-r--r--tests/org.eclipse.recommenders.tests.completion.rcp/src/org/eclipse/recommenders/tests/completion/rcp/calls/preferences/LabelProviderTest.java6
-rw-r--r--tests/org.eclipse.recommenders.tests.completion.rcp/src/org/eclipse/recommenders/tests/completion/rcp/calls/preferences/VersionLabelProviderTest.java6
12 files changed, 179 insertions, 73 deletions
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.calls/META-INF/MANIFEST.MF b/plugins/org.eclipse.recommenders.completion.rcp.calls/META-INF/MANIFEST.MF
index ae36ce0..0e920df 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.calls/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.recommenders.completion.rcp.calls/META-INF/MANIFEST.MF
@@ -1,10 +1,10 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
-Bundle-Name: Code Recommenders: Intelligent Call Completion
+Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.eclipse.recommenders.completion.rcp.calls;singleton:=true
Bundle-Version: 1.0.2.qualifier
Bundle-Activator: org.eclipse.recommenders.internal.completion.rcp.calls.wiring.CallsCompletionPlugin
-Bundle-Vendor: Eclipse Code Recommenders
+Bundle-Vendor: %Bundle-Vendor
Export-Package: org.eclipse.recommenders.internal.completion.rcp.calls.engine,
org.eclipse.recommenders.internal.completion.rcp.calls.extdoc,
org.eclipse.recommenders.internal.completion.rcp.calls.net,
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.calls/OSGI-INF/l10n/bundle.properties b/plugins/org.eclipse.recommenders.completion.rcp.calls/OSGI-INF/l10n/bundle.properties
new file mode 100644
index 0000000..0d45f83
--- /dev/null
+++ b/plugins/org.eclipse.recommenders.completion.rcp.calls/OSGI-INF/l10n/bundle.properties
@@ -0,0 +1,5 @@
+#Properties file for org.eclipse.recommenders.completion.rcp.calls
+Bundle-Name = Code Recommenders: Intelligent Call Completion
+Bundle-Vendor = Eclipse Code Recommenders
+extension.name = Code Recommenders Calls Proposals
+page.name = Calls \ No newline at end of file
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.calls/build.properties b/plugins/org.eclipse.recommenders.completion.rcp.calls/build.properties
index 17b5fd1..d3009b8 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.calls/build.properties
+++ b/plugins/org.eclipse.recommenders.completion.rcp.calls/build.properties
@@ -3,7 +3,8 @@ bin.includes = META-INF/,\
.,\
plugin.xml,\
icons/,\
- about.html
+ about.html,\
+ OSGI-INF/l10n/bundle.properties
source.. = src/
src.includes = about.html,\
pom.xml,\
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.calls/plugin.xml b/plugins/org.eclipse.recommenders.completion.rcp.calls/plugin.xml
index 76fc4c0..1e3c0bc 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.calls/plugin.xml
+++ b/plugins/org.eclipse.recommenders.completion.rcp.calls/plugin.xml
@@ -9,7 +9,7 @@
</extension>
<extension
id="org.eclipse.recommenders"
- name="Code Recommenders Calls Proposals"
+ name="%extension.name"
point="org.eclipse.jdt.ui.javaCompletionProposalComputer">
<javaCompletionProposalComputer
activate="false"
@@ -23,7 +23,7 @@
category="org.eclipse.recommenders.rcp.category.preferences"
class="org.eclipse.recommenders.injection.ExtensionFactory:org.eclipse.recommenders.internal.completion.rcp.calls.preferences.CallPreferencePage"
id="org.eclipse.recommenders.calls.rcp.dependencies"
- name="Calls">
+ name="%page.name">
</page>
</extension>
<extension
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/completion/rcp/calls/l10n/Messages.java b/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/completion/rcp/calls/l10n/Messages.java
new file mode 100644
index 0000000..6668fb5
--- /dev/null
+++ b/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/completion/rcp/calls/l10n/Messages.java
@@ -0,0 +1,52 @@
+/**
+ * Copyright (c) 2010, 2012 Darmstadt University of Technology.
+ * 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:
+ * Patrick Gottschaemmer, Olav Lenz - initial API and implementation.
+ */
+package org.eclipse.recommenders.completion.rcp.calls.l10n;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.recommenders.completion.rcp.calls.l10n.messages"; //$NON-NLS-1$
+ public static String PREFPAGE_DESCRIPTION;
+ public static String PREFPAGE_ENABLE_CALL_COMPLETION;
+ public static String PREFPAGE_MAX_NUMBER_OF_PROPOSALS;
+ public static String PREFPAGE_MIN_PROBABILITY_OF_PROPOSAL;
+ public static String PREFPAGE_TABLE_DESCRIPTION;
+ public static String PREFPAGE_TABLE_COLUMN_FILE;
+ public static String PREFPAGE_MODLE_NOT_AVAILABLE;
+ public static String PREFPAGE_MODEL_AVAILABLE;
+ public static String PREFPAGE_DEPENDENCY_DETAILS_UNKNOWN;
+ public static String PREFPAGE_DEPENDENCY_DETAILS_KNOWN;
+ public static String PREFPAGE_PACKAGE_ROOT_INFO;
+ public static String PREFPAGE_PACKAGE_ROOT_NAME;
+ public static String PREFPAGE_PACKAGE_ROOT_VERSION;
+ public static String PREFPAGE_PACKAGE_ROOT_FINGERPRINT;
+ public static String PREFPAGE_MODEL_INFO;
+ public static String PREFPAGE_MODEL_CCORDINATE;
+ public static String PREFPAGE_MODEL_RESOLUTION_STATUS;
+
+ public static String EXTDOC_RECOMMENDATIONS_ARE_NOT_MADE;
+ public static String EXTDOC_RECOMMENDATIONS_ARE_MADE;
+ public static String EXTDOC_PECOMMENDATION_PERCENTAGE;
+ public static String EXTDOC_DEFINED_BY;
+ public static String EXTDOC_UNDEFINED;
+ public static String EXTDOC_OBSERVED;
+ public static String EXTDOC_CALL;
+ public static String EXTDOC_PROPOSAL_COMPUTED_UNTRAINED;
+ public static String EXTDOC_PROPOSAL_COMPUTED;
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/completion/rcp/calls/l10n/messages.properties b/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/completion/rcp/calls/l10n/messages.properties
new file mode 100644
index 0000000..117deb0
--- /dev/null
+++ b/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/completion/rcp/calls/l10n/messages.properties
@@ -0,0 +1,27 @@
+PREFPAGE_DESCRIPTION=Recommenders' intelligent call completion proposes likely method calls based on previously collected usage statistics.
+PREFPAGE_ENABLE_CALL_COMPLETION=Enable intelligent call completion
+PREFPAGE_MAX_NUMBER_OF_PROPOSALS=Maximum number of proposals:
+PREFPAGE_MIN_PROBABILITY_OF_PROPOSAL=Minimum proposal probability (%):
+PREFPAGE_TABLE_DESCRIPTION=Lists all known class-path dependencies and their associated recommendation models if any. Select models to view detail information.
+PREFPAGE_TABLE_COLUMN_FILE=File
+PREFPAGE_MODLE_NOT_AVAILABLE=No model for this dependency
+PREFPAGE_MODEL_AVAILABLE=Model for this dependency is available
+PREFPAGE_DEPENDENCY_DETAILS_UNKNOWN=Some details are unknown for this dependency
+PREFPAGE_DEPENDENCY_DETAILS_KNOWN=Name and version of dependency is known
+PREFPAGE_PACKAGE_ROOT_INFO=Package Root Info:
+PREFPAGE_PACKAGE_ROOT_NAME=Name:
+PREFPAGE_PACKAGE_ROOT_VERSION=Version:
+PREFPAGE_PACKAGE_ROOT_FINGERPRINT=Fingerprint:
+PREFPAGE_MODEL_INFO=Model Info:
+PREFPAGE_MODEL_CCORDINATE=Model Coordinate:
+PREFPAGE_MODEL_RESOLUTION_STATUS=Resolution Status:
+
+EXTDOC_RECOMMENDATIONS_ARE_NOT_MADE=For %1$s %2$s no recommendations are made.
+EXTDOC_RECOMMENDATIONS_ARE_MADE=For %1$s %2$s the following recommendations are made. If you want to invoke a method on %2$s, then you...
+EXTDOC_PECOMMENDATION_PERCENTAGE=%d %%
+EXTDOC_DEFINED_BY=defined by
+EXTDOC_UNDEFINED=untrained definition
+EXTDOC_OBSERVED=observed
+EXTDOC_CALL=call
+EXTDOC_PROPOSAL_COMPUTED_UNTRAINED=Proposals were computed based on variable type '%1$s' in untrained context.
+EXTDOC_PROPOSAL_COMPUTED=Proposals were computed based on variable type '%1$s' in '%2$s'.
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/extdoc/CallsProvider.java b/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/extdoc/CallsProvider.java
index 5af5a11..67eb863 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/extdoc/CallsProvider.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/extdoc/CallsProvider.java
@@ -7,6 +7,7 @@
*
* Contributors:
* Stefan Henss - initial API and implementation.
+ * Patrick Gottschaemmer, Olav Lenz - externalize Strings.
*/
package org.eclipse.recommenders.internal.completion.rcp.calls.extdoc;
@@ -33,6 +34,7 @@ import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.dom.ASTNode;
import org.eclipse.jdt.core.dom.MethodDeclaration;
import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.recommenders.completion.rcp.calls.l10n.Messages;
import org.eclipse.recommenders.extdoc.rcp.providers.ExtdocProvider;
import org.eclipse.recommenders.extdoc.rcp.providers.JavaSelectionSubscriber;
import org.eclipse.recommenders.internal.completion.rcp.calls.engine.AstBasedObjectUsageResolver;
@@ -82,7 +84,8 @@ public final class CallsProvider extends ExtdocProvider {
}
@JavaSelectionSubscriber(METHOD_BODY)
- public Status onFieldSelection(final IField var, final JavaSelectionEvent event, final Composite parent) throws JavaModelException {
+ public Status onFieldSelection(final IField var, final JavaSelectionEvent event, final Composite parent)
+ throws JavaModelException {
return handle(var, var.getElementName(), var.getTypeSignature(), event, parent);
}
@@ -190,73 +193,67 @@ public final class CallsProvider extends ExtdocProvider {
setInfoBackgroundColor(preamble2);
preamble2.setLayoutData(GridDataFactory.swtDefaults().span(4, 1).indent(0, 0).create());
if (methodCalls.isEmpty()) {
- preamble2.setText(format("For %s %s no recommendations are made.",
- receiverType.getElementName(),
+ preamble2.setText(format(Messages.EXTDOC_RECOMMENDATIONS_ARE_NOT_MADE, receiverType.getElementName(),
varName));
} else {
- preamble2
- .setText(format("For %s %s the following recommendations are made.\nIf you want to invoke a method on %s, then you...",
- receiverType.getElementName(),
- varName,
- varName));
+ preamble2.setText(format(Messages.EXTDOC_RECOMMENDATIONS_ARE_MADE, receiverType.getElementName(),
+ varName));
}
new Label(container, SWT.NONE).setLayoutData(GridDataFactory.swtDefaults().span(4, 1).indent(0, 0)
.hint(SWT.DEFAULT, 1).create());
for (final Tuple<IMethodName, Double> rec : methodCalls) {
final int percentage = (int) Math.rint(rec.getSecond() * 100);
- createLabel(container,
- ExtdocUtils.percentageToRecommendationPhrase(percentage),
- true,
- false,
- COLOR_INFO_FOREGROUND,
- false);
-
- createLabel(container, "call", false);
+ createLabel(container, ExtdocUtils.percentageToRecommendationPhrase(percentage), true, false,
+ COLOR_INFO_FOREGROUND, false);
+
+ createLabel(container, Messages.EXTDOC_CALL + " ", false);//$NON-NLS-2$
createMethodLink(container, rec.getFirst());
- createLabel(container, " - " + percentage + "%", false);
+ createLabel(container, " - " + format(Messages.EXTDOC_PECOMMENDATION_PERCENTAGE, percentage), false);//$NON-NLS-1$
}
new Label(container, SWT.SEPARATOR | SWT.HORIZONTAL);
- createLabel(container, "", false);
- createLabel(container, "", false);
- createLabel(container, "", false);
+ createLabel(container, "", false); //$NON-NLS-1$
+ createLabel(container, "", false); //$NON-NLS-1$
+ createLabel(container, "", false); //$NON-NLS-1$
final Label preamble = new Label(container, SWT.NONE);
preamble.setLayoutData(GridDataFactory.swtDefaults().span(4, 1).indent(0, 5).create());
setInfoForegroundColor(preamble);
setInfoBackgroundColor(preamble);
- final String text =
- format("Proposals were computed based on variable type '%s' in '%s'.",
- receiverType.getElementName(),
- ctx == VmMethodName.NULL ? "untrained context" : Names.vm2srcSimpleTypeName(ctx
- .getDeclaringType()) + "." + Names.vm2srcSimpleMethod(ctx));
+ final String text;
+ if (ctx == VmMethodName.NULL) {
+ text = format(Messages.EXTDOC_PROPOSAL_COMPUTED_UNTRAINED, receiverType.getElementName());
+ } else {
+ text = format(Messages.EXTDOC_PROPOSAL_COMPUTED, receiverType.getElementName(),
+ Names.vm2srcSimpleTypeName(ctx.getDeclaringType()) + "." + Names.vm2srcSimpleMethod(ctx));
+ }
preamble.setText(text);
new Label(container, SWT.NONE).setLayoutData(GridDataFactory.swtDefaults().span(4, 1).indent(0, 5)
.hint(SWT.DEFAULT, 1).create());
if (def != null) {
- createLabel(container, "defined by", true, false, SWT.COLOR_DARK_GRAY, false);
- createLabel(container, "", false, false, SWT.COLOR_DARK_GRAY, false);
+ createLabel(container, Messages.EXTDOC_DEFINED_BY, true, false, SWT.COLOR_DARK_GRAY, false);
+ createLabel(container, "", false, false, SWT.COLOR_DARK_GRAY, false); //$NON-NLS-1$
if (def == VmMethodName.NULL) {
- createLabel(container, "untrained definition", false, false, SWT.COLOR_DARK_GRAY, false);
+ createLabel(container, Messages.EXTDOC_UNDEFINED, false, false, SWT.COLOR_DARK_GRAY, false);
} else {
createMethodLink(container, def);
}
- createLabel(container, "- " + kind.toString().toLowerCase(), true, false, SWT.COLOR_DARK_GRAY, false);
+ createLabel(container, "- " + kind.toString().toLowerCase(), true, false, SWT.COLOR_DARK_GRAY, false); //$NON-NLS-1$
}
for (final IMethodName observedCall : calls) {
- createLabel(container, "observed", true, false, SWT.COLOR_DARK_GRAY, false);
+ createLabel(container, Messages.EXTDOC_OBSERVED, true, false, SWT.COLOR_DARK_GRAY, false);
- createLabel(container, " call", false, false, SWT.COLOR_DARK_GRAY, false);
+ createLabel(container, Messages.EXTDOC_CALL + " ", false, false, SWT.COLOR_DARK_GRAY, false);//$NON-NLS-2$
createMethodLink(container, observedCall);
- createLabel(container, "", true, false, SWT.COLOR_DARK_GRAY, false);
+ createLabel(container, "", true, false, SWT.COLOR_DARK_GRAY, false); //$NON-NLS-1$
}
}
Link createMethodLink(final Composite parent, final IMethodName method) {
- final String text = "<a>" + (method.isInit() ? "new " : "") + Names.vm2srcSimpleMethod(method) + "</a>";
+ final String text = "<a>" + (method.isInit() ? "new " : "") + Names.vm2srcSimpleMethod(method) + "</a>"; // $NON-NLS$
final String tooltip = Names.vm2srcQualifiedMethod(method);
final Link link = new Link(parent, SWT.NONE);
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/preferences/CallPreferencePage.java b/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/preferences/CallPreferencePage.java
index 8bb73b8..383c00b 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/preferences/CallPreferencePage.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/preferences/CallPreferencePage.java
@@ -8,6 +8,7 @@
* Contributors:
* Johannes Lerch - initial API and implementation.
* Marcel Bruch - adapted UI for latest model archive store.
+ * Patrick Gottschaemmer, Olav Lenz - externalize Strings.
*/
package org.eclipse.recommenders.internal.completion.rcp.calls.preferences;
@@ -49,6 +50,7 @@ import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TableViewerColumn;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerComparator;
+import org.eclipse.recommenders.completion.rcp.calls.l10n.Messages;
import org.eclipse.recommenders.internal.completion.rcp.calls.engine.CallsCompletionProposalComputer;
import org.eclipse.recommenders.internal.completion.rcp.calls.net.IObjectMethodCallsNet;
import org.eclipse.recommenders.internal.completion.rcp.calls.wiring.CallsCompletionPlugin;
@@ -85,8 +87,8 @@ import com.google.common.collect.Lists;
public class CallPreferencePage extends PreferencePage implements IWorkbenchPreferencePage, IPropertyChangeListener {
- public static final String ID_MAX_PROPOSALS = "recommenders.calls.max_proposals";
- public static final String ID_MIN_PROBABILITY = "recommenders.calls.min_probability";
+ public static final String ID_MAX_PROPOSALS = "recommenders.calls.max_proposals"; //$NON-NLS-1$
+ public static final String ID_MIN_PROBABILITY = "recommenders.calls.min_probability"; //$NON-NLS-1$
private final IClasspathEntryInfoProvider cpeInfoProvider;
private final IModelArchiveStore<IType, IObjectMethodCallsNet> modelStore;
@@ -117,7 +119,7 @@ public class CallPreferencePage extends PreferencePage implements IWorkbenchPref
@Override
public void init(final IWorkbench workbench) {
setPreferenceStore(CallsCompletionPlugin.getDefault().getPreferenceStore());
- setDescription("Recommenders' intelligent call completion proposes likely method calls based on previously collected usage statistics.");
+ setDescription(Messages.PREFPAGE_DESCRIPTION);
}
@Override
@@ -130,13 +132,14 @@ public class CallPreferencePage extends PreferencePage implements IWorkbenchPref
}
private void createConfigurationBlock(final Composite composite) {
- enablement = new ContentAssistEnablementBlock(composite, "Enable intelligent call completion",
+ enablement = new ContentAssistEnablementBlock(composite, Messages.PREFPAGE_ENABLE_CALL_COMPLETION,
CallsCompletionProposalComputer.CATEGORY_ID);
final Composite group = new Composite(composite, SWT.NONE);
group.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).create());
group.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
- maxProposals = createIntegerField(group, ID_MAX_PROPOSALS, "Maximum number of proposals:", 1, 100);
- minProbability = createIntegerField(group, ID_MIN_PROBABILITY, "Minimum proposal probability (%):", 1, 100);
+ maxProposals = createIntegerField(group, ID_MAX_PROPOSALS, Messages.PREFPAGE_MAX_NUMBER_OF_PROPOSALS, 1, 100);
+ minProbability = createIntegerField(group, ID_MIN_PROBABILITY, Messages.PREFPAGE_MIN_PROBABILITY_OF_PROPOSAL,
+ 1, 100);
}
private IntegerFieldEditor createIntegerField(final Composite parent, final String name, final String text,
@@ -151,9 +154,7 @@ public class CallPreferencePage extends PreferencePage implements IWorkbenchPref
}
private void createModelInformationBlock(final Composite composite) {
- new Label(composite, SWT.NONE)
- .setText("Lists all known class-path dependencies and their associated recommendation models if any. "
- + "Select\nmodels to view detail information.");
+ new Label(composite, SWT.NONE).setText(Messages.PREFPAGE_TABLE_DESCRIPTION);
computeMappings();
final SashForm form = new SashForm(composite, SWT.HORIZONTAL);
form.setLayout(new FillLayout());
@@ -210,29 +211,29 @@ public class CallPreferencePage extends PreferencePage implements IWorkbenchPref
final GridDataFactory f = GridDataFactory.fillDefaults().grab(true, false);
{
final Group rootContainer = new Group(parent, SWT.SHADOW_ETCHED_IN);
- rootContainer.setText("Package Root Info:");
+ rootContainer.setText(Messages.PREFPAGE_PACKAGE_ROOT_INFO);
rootContainer.setLayout(new GridLayout(2, false));
rootContainer.setLayoutData(f.create());
- createLabel(rootContainer, "Name:");
+ createLabel(rootContainer, Messages.PREFPAGE_PACKAGE_ROOT_NAME);
rootName = createText(rootContainer, READ_ONLY | BORDER);
- createLabel(rootContainer, "Version:");
+ createLabel(rootContainer, Messages.PREFPAGE_PACKAGE_ROOT_VERSION);
rootVersion = createText(rootContainer, READ_ONLY | BORDER);
- createLabel(rootContainer, "Fingerprint:");
+ createLabel(rootContainer, Messages.PREFPAGE_PACKAGE_ROOT_FINGERPRINT);
rootFingerprint = createText(rootContainer, READ_ONLY | BORDER);
}
{
final Group modelContainer = new Group(parent, SWT.SHADOW_ETCHED_IN);
- modelContainer.setText("Model Info:");
+ modelContainer.setText(Messages.PREFPAGE_MODEL_INFO);
modelContainer.setLayout(new GridLayout(2, false));
modelContainer.setLayoutData(f.create());
- createLabel(modelContainer, "Model Coordinate:");
+ createLabel(modelContainer, Messages.PREFPAGE_MODEL_CCORDINATE);
modelCoordinate = createText(modelContainer, SWT.BORDER);
- createLabel(modelContainer, "Resolution Status:");
+ createLabel(modelContainer, Messages.PREFPAGE_MODEL_RESOLUTION_STATUS);
modelStatus = new ComboViewer(modelContainer, SWT.BORDER);
modelStatus.setContentProvider(new ArrayContentProvider());
modelStatus.setInput(ModelArchiveResolutionStatus.values());
@@ -271,21 +272,21 @@ public class CallPreferencePage extends PreferencePage implements IWorkbenchPref
});
final TableColumnLayout tableColumnLayout = new TableColumnLayout();
- final Image versionImage = loadImage("/icons/obj16/file_version.png");
- final Image versionUnknownImage = loadImage("/icons/obj16/file_version_unknown.png");
- final Image modelImage = loadImage("/icons/obj16/model.png");
- final Image modelUnknownImage = loadImage("/icons/obj16/model_unknown.png");
+ final Image versionImage = loadImage("/icons/obj16/file_version.png"); //$NON-NLS-1$
+ final Image versionUnknownImage = loadImage("/icons/obj16/file_version_unknown.png"); //$NON-NLS-1$
+ final Image modelImage = loadImage("/icons/obj16/model.png"); //$NON-NLS-1$
+ final Image modelUnknownImage = loadImage("/icons/obj16/model_unknown.png"); //$NON-NLS-1$
ColumnViewerToolTipSupport.enableFor(tableViewer);
- TableViewerColumn column = createTableViewerColumn(tableViewer, "File", 200, 0);
+ TableViewerColumn column = createTableViewerColumn(tableViewer, Messages.PREFPAGE_TABLE_COLUMN_FILE, 200, 0);
tableColumnLayout.setColumnData(column.getColumn(), new ColumnWeightData(100));
column.setLabelProvider(new PackageFragmentRootLabelProvider());
- column = createTableViewerColumn(tableViewer, "", 20, 1);
+ column = createTableViewerColumn(tableViewer, "", 20, 1); //$NON-NLS-1$
tableColumnLayout.setColumnData(column.getColumn(), new ColumnPixelData(20));
column.setLabelProvider(new VersionLabelProvider(versionUnknownImage, versionImage));
- column = createTableViewerColumn(tableViewer, "", 20, 2);
+ column = createTableViewerColumn(tableViewer, "", 20, 2); //$NON-NLS-1$
tableColumnLayout.setColumnData(column.getColumn(), new ColumnPixelData(20));
column.setLabelProvider(new ModelLabelProvider(repository, modelImage, modelUnknownImage));
tContainer.setLayout(tableColumnLayout);
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/preferences/ModelLabelProvider.java b/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/preferences/ModelLabelProvider.java
index 9f3136c..87ce14e 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/preferences/ModelLabelProvider.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/preferences/ModelLabelProvider.java
@@ -7,6 +7,7 @@
*
* Contributors:
* Marcel Bruch- initial API and implementation.
+ * Patrick Gottschaemmer, Olav Lenz - externalize Strings.
*/
package org.eclipse.recommenders.internal.completion.rcp.calls.preferences;
@@ -15,6 +16,7 @@ import static org.eclipse.recommenders.utils.Checks.cast;
import java.io.File;
import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.recommenders.completion.rcp.calls.l10n.Messages;
import org.eclipse.recommenders.internal.rcp.models.ModelArchiveMetadata;
import org.eclipse.recommenders.rcp.ClasspathEntryInfo;
import org.eclipse.recommenders.rcp.repo.IModelRepository;
@@ -22,11 +24,16 @@ import org.eclipse.recommenders.utils.Tuple;
import org.eclipse.swt.graphics.Image;
import org.sonatype.aether.artifact.Artifact;
+import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Optional;
public class ModelLabelProvider extends ColumnLabelProvider {
- public static final String NLS_UNKNOWN = "No model for this dependency";
- public static final String NLS_KNOWN = "Model for this dependency is available";
+
+ @VisibleForTesting
+ public static final String MODEL_NOT_AVAILABLE = Messages.PREFPAGE_MODLE_NOT_AVAILABLE;
+ @VisibleForTesting
+ public static final String MODEL_AVAILABLE = Messages.PREFPAGE_MODEL_AVAILABLE;
+
private final Image modelImage;
private final Image modelUnknownImage;
private final IModelRepository repository;
@@ -44,7 +51,11 @@ public class ModelLabelProvider extends ColumnLabelProvider {
@Override
public String getToolTipText(final Object element) {
- return hasModel(element) ? NLS_KNOWN : NLS_UNKNOWN;
+ if (hasModel(element)) {
+ return MODEL_AVAILABLE;
+ } else {
+ return MODEL_NOT_AVAILABLE;
+ }
}
private boolean hasModel(final Object element) {
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/preferences/VersionLabelProvider.java b/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/preferences/VersionLabelProvider.java
index 399bdff..fe9f266 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/preferences/VersionLabelProvider.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/preferences/VersionLabelProvider.java
@@ -7,6 +7,7 @@
*
* Contributors:
* Marcel Bruch - initial API and implementation.
+ * Patrick Gottschaemmer, Olav Lenz - externalize Strings.
*/
package org.eclipse.recommenders.internal.completion.rcp.calls.preferences;
@@ -14,14 +15,21 @@ import static org.apache.commons.lang3.StringUtils.isEmpty;
import static org.eclipse.recommenders.utils.Checks.cast;
import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.recommenders.completion.rcp.calls.l10n.Messages;
import org.eclipse.recommenders.internal.rcp.models.ModelArchiveMetadata;
import org.eclipse.recommenders.rcp.ClasspathEntryInfo;
import org.eclipse.recommenders.utils.Tuple;
import org.eclipse.swt.graphics.Image;
+import com.google.common.annotations.VisibleForTesting;
+
public class VersionLabelProvider extends ColumnLabelProvider {
- public static final String NLS_UNKNOWN = "Some details are unknown for this dependency";
- public static final String NLS_KNOWN = "Name and version of dependency is known";
+
+ @VisibleForTesting
+ public static final String DEPENDENCY_DETAILS_UNKNOWN = Messages.PREFPAGE_DEPENDENCY_DETAILS_UNKNOWN;
+ @VisibleForTesting
+ public static final String DEPENDENCY_DETAILS_KNOWN = Messages.PREFPAGE_DEPENDENCY_DETAILS_KNOWN;
+
private final Image versionUnknownImage;
private final Image versionImage;
@@ -37,7 +45,11 @@ public class VersionLabelProvider extends ColumnLabelProvider {
@Override
public String getToolTipText(final Object element) {
- return hasDependencyInformation(element) ? NLS_KNOWN : NLS_UNKNOWN;
+ if (hasDependencyInformation(element)) {
+ return DEPENDENCY_DETAILS_KNOWN;
+ } else {
+ return DEPENDENCY_DETAILS_UNKNOWN;
+ }
}
private boolean hasDependencyInformation(final Object element) {
diff --git a/tests/org.eclipse.recommenders.tests.completion.rcp/src/org/eclipse/recommenders/tests/completion/rcp/calls/preferences/LabelProviderTest.java b/tests/org.eclipse.recommenders.tests.completion.rcp/src/org/eclipse/recommenders/tests/completion/rcp/calls/preferences/LabelProviderTest.java
index 053d421..2c01dd3 100644
--- a/tests/org.eclipse.recommenders.tests.completion.rcp/src/org/eclipse/recommenders/tests/completion/rcp/calls/preferences/LabelProviderTest.java
+++ b/tests/org.eclipse.recommenders.tests.completion.rcp/src/org/eclipse/recommenders/tests/completion/rcp/calls/preferences/LabelProviderTest.java
@@ -71,7 +71,7 @@ public class LabelProviderTest {
public void testModelTooltip01() {
when(meta.getArtifact()).thenReturn(Optional.<Artifact> absent());
assertSame(IMG_NOT_FOUND, modelSut.getImage(data));
- assertSame(modelSut.NLS_UNKNOWN, modelSut.getToolTipText(data));
+ assertSame(ModelLabelProvider.MODEL_NOT_AVAILABLE, modelSut.getToolTipText(data));
}
@Test
@@ -79,7 +79,7 @@ public class LabelProviderTest {
when(meta.getArtifact()).thenReturn(of(someArtifact));
when(repository.location(someArtifact)).thenReturn(new File("non-exist"));
assertSame(IMG_NOT_FOUND, modelSut.getImage(data));
- assertSame(modelSut.NLS_UNKNOWN, modelSut.getToolTipText(data));
+ assertSame(ModelLabelProvider.MODEL_NOT_AVAILABLE, modelSut.getToolTipText(data));
}
@Test
@@ -87,7 +87,7 @@ public class LabelProviderTest {
when(meta.getArtifact()).thenReturn(of(someArtifact));
when(repository.location(someArtifact)).thenReturn(SystemUtils.getUserDir());
assertSame(IMG_FOUND, modelSut.getImage(data));
- assertSame(modelSut.NLS_KNOWN, modelSut.getToolTipText(data));
+ assertSame(ModelLabelProvider.MODEL_AVAILABLE, modelSut.getToolTipText(data));
}
}
diff --git a/tests/org.eclipse.recommenders.tests.completion.rcp/src/org/eclipse/recommenders/tests/completion/rcp/calls/preferences/VersionLabelProviderTest.java b/tests/org.eclipse.recommenders.tests.completion.rcp/src/org/eclipse/recommenders/tests/completion/rcp/calls/preferences/VersionLabelProviderTest.java
index 4388b59..b374dd0 100644
--- a/tests/org.eclipse.recommenders.tests.completion.rcp/src/org/eclipse/recommenders/tests/completion/rcp/calls/preferences/VersionLabelProviderTest.java
+++ b/tests/org.eclipse.recommenders.tests.completion.rcp/src/org/eclipse/recommenders/tests/completion/rcp/calls/preferences/VersionLabelProviderTest.java
@@ -34,7 +34,7 @@ public class VersionLabelProviderTest {
@Test
public void test01() {
assertSame(IMG_NOT_FOUND, sut.getImage(data));
- assertSame(sut.NLS_UNKNOWN, sut.getToolTipText(data));
+ assertSame(VersionLabelProvider.DEPENDENCY_DETAILS_UNKNOWN, sut.getToolTipText(data));
}
@Test
@@ -42,7 +42,7 @@ public class VersionLabelProviderTest {
when(info.getSymbolicName()).thenReturn("some");
when(info.getVersion()).thenReturn(UNKNOWN);
assertSame(IMG_NOT_FOUND, sut.getImage(data));
- assertSame(sut.NLS_UNKNOWN, sut.getToolTipText(data));
+ assertSame(VersionLabelProvider.DEPENDENCY_DETAILS_UNKNOWN, sut.getToolTipText(data));
}
@Test
@@ -50,6 +50,6 @@ public class VersionLabelProviderTest {
when(info.getSymbolicName()).thenReturn("some");
when(info.getVersion()).thenReturn(Version.valueOf("1"));
assertSame(IMG_FOUND, sut.getImage(data));
- assertSame(sut.NLS_KNOWN, sut.getToolTipText(data));
+ assertSame(VersionLabelProvider.DEPENDENCY_DETAILS_KNOWN, sut.getToolTipText(data));
}
}