aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlav Lenz2013-01-17 05:51:17 (EST)
committerGerrit Code Review @ Eclipse.org2013-01-26 10:42:27 (EST)
commit49dd1462d7a0069c193cb252cb8d56344aa0ffcb (patch)
tree4798da191520d0f12ce082f276858150cc3dc113
parent6da034301b1f54351336c66fabf570c069a5bc66 (diff)
downloadorg.eclipse.recommenders-49dd1462d7a0069c193cb252cb8d56344aa0ffcb.zip
org.eclipse.recommenders-49dd1462d7a0069c193cb252cb8d56344aa0ffcb.tar.gz
org.eclipse.recommenders-49dd1462d7a0069c193cb252cb8d56344aa0ffcb.tar.bz2
[l10n] externalize strings in plugin *.completion.rcp.chainrefs/changes/23/9723/3
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.chain/META-INF/MANIFEST.MF4
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.chain/OSGI-INF/l10n/bundle.properties7
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.chain/build.properties3
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.chain/plugin.xml8
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/completion/rcp/chain/l10n/Messages.java32
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/completion/rcp/chain/l10n/messages.properties8
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/ChainCompletionProposal.java2
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/ChainCompletionProposalComputer.java14
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/ChainElement.java2
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/ChainFinder.java2
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/CompletionTemplateBuilder.java30
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/ScopeAccessWorkaround.java4
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/TypeBindingAnalyzer.java4
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/ui/ChainPreferenceInitializer.java6
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/ui/ChainPreferencePage.java40
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/ui/CompletionKeyShortcutHandler.java4
16 files changed, 110 insertions, 60 deletions
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.chain/META-INF/MANIFEST.MF b/plugins/org.eclipse.recommenders.completion.rcp.chain/META-INF/MANIFEST.MF
index f906238..baba9d9 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.chain/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.recommenders.completion.rcp.chain/META-INF/MANIFEST.MF
@@ -1,10 +1,10 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
-Bundle-Name: Code Recommenders: Chain Completion
+Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.eclipse.recommenders.completion.rcp.chain;singleton:=true
Bundle-Version: 1.0.3.qualifier
Bundle-Activator: org.eclipse.recommenders.internal.completion.rcp.chain.ChainCompletionPlugin
-Bundle-Vendor: Eclipse Code Recommenders
+Bundle-Vendor: %Bundle-Vendor
Export-Package: org.eclipse.recommenders.internal.completion.rcp.chain,
org.eclipse.recommenders.internal.completion.rcp.chain.ui
Require-Bundle: com.google.guava;bundle-version="[10.0.0,11.0.0)",
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.chain/OSGI-INF/l10n/bundle.properties b/plugins/org.eclipse.recommenders.completion.rcp.chain/OSGI-INF/l10n/bundle.properties
new file mode 100644
index 0000000..04e0993
--- /dev/null
+++ b/plugins/org.eclipse.recommenders.completion.rcp.chain/OSGI-INF/l10n/bundle.properties
@@ -0,0 +1,7 @@
+#Properties file for org.eclipse.recommenders.completion.rcp.chain
+Bundle-Name = Code Recommenders: Chain Completion
+Bundle-Vendor = Eclipse Code Recommenders
+extension.name = Chain Proposals (Recommenders)
+category.name = Chain Completion Category
+command.name = Trigger Chain Completion Command
+page.name = Chains \ No newline at end of file
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.chain/build.properties b/plugins/org.eclipse.recommenders.completion.rcp.chain/build.properties
index 4ba0a0c..e51a124 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.chain/build.properties
+++ b/plugins/org.eclipse.recommenders.completion.rcp.chain/build.properties
@@ -4,4 +4,5 @@ bin.includes = META-INF/,\
.,\
plugin.xml,\
icons/,\
- about.html
+ about.html,\
+ OSGI-INF/l10n/bundle.properties
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.chain/plugin.xml b/plugins/org.eclipse.recommenders.completion.rcp.chain/plugin.xml
index 5311314..f52bdcc 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.chain/plugin.xml
+++ b/plugins/org.eclipse.recommenders.completion.rcp.chain/plugin.xml
@@ -12,7 +12,7 @@
</extension>
<extension
id="org.eclipse.recommenders.completion.rcp.chain.category"
- name="Chain Proposals (Recommenders)"
+ name="%extension.name"
point="org.eclipse.jdt.ui.javaCompletionProposalComputer">
<proposalCategory
icon="icons/view16/chain.gif">
@@ -22,12 +22,12 @@
point="org.eclipse.ui.commands">
<category
id="org.eclipse.recommenders.completion.rcp.chain.commands.category"
- name="Chain Completion Category">
+ name="%category.name">
</category>
<command
categoryId="org.eclipse.recommenders.completion.rcp.chain.commands.category"
id="org.eclipse.recommenders.completion.rcp.chain.commands.TriggerCompletion"
- name="Trigger Chain Completion Command">
+ name="%command.name">
</command>
</extension>
<extension
@@ -58,7 +58,7 @@
category="org.eclipse.recommenders.rcp.category.preferences"
class="org.eclipse.recommenders.internal.completion.rcp.chain.ui.ChainPreferencePage"
id="org.eclipse.recommenders.internal.completion.rcp.chain.ChainPreferencePage"
- name="Chains">
+ name="%page.name">
</page>
</extension>
<extension
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/completion/rcp/chain/l10n/Messages.java b/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/completion/rcp/chain/l10n/Messages.java
new file mode 100644
index 0000000..f772058
--- /dev/null
+++ b/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/completion/rcp/chain/l10n/Messages.java
@@ -0,0 +1,32 @@
+/**
+ * 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:
+ * Olav Lenz - initial API and implementation.
+ */
+package org.eclipse.recommenders.completion.rcp.chain.l10n;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.recommenders.completion.rcp.chain.l10n.messages"; //$NON-NLS-1$
+ public static String COMPLETION_TEMPLATE_ELEMENTS;
+ public static String PREFPAGE_DESCRIPTION;
+ public static String PREFPAGE_IGNORE_CONSEQUENCES;
+ public static String PREFPAGE_IGNORED_OBJECT_TYPES;
+ public static String PREFPAGE_MAX_CHAIN_DEPTH;
+ public static String PREFPAGE_MIN_CHAIN_DEPTH;
+ public static String PREFPAGE_MAX_CHAINS;
+ public static String PREFPAGE_SEARCH_TIMEOUT;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/completion/rcp/chain/l10n/messages.properties b/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/completion/rcp/chain/l10n/messages.properties
new file mode 100644
index 0000000..bd6b652
--- /dev/null
+++ b/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/completion/rcp/chain/l10n/messages.properties
@@ -0,0 +1,8 @@
+COMPLETION_TEMPLATE_ELEMENTS=element(s)
+PREFPAGE_DESCRIPTION=Call chains offer ways to obtain objects of the requested type by calling multiple methods in a row. Since those chains can become long and time-consuming to search for, the following options allow to limit the proposals.
+PREFPAGE_IGNORE_CONSEQUENCES=Ignored object types will not have chain proposals displayed for. \nAlso, no chains through methods from ignored types will be found.
+PREFPAGE_IGNORED_OBJECT_TYPES=Object types to ignore:
+PREFPAGE_MAX_CHAIN_DEPTH=Maximum chain depth:
+PREFPAGE_MIN_CHAIN_DEPTH=Minimum chain depth:
+PREFPAGE_MAX_CHAINS=Maximum number of chains:
+PREFPAGE_SEARCH_TIMEOUT=Chain search timeout (sec):
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/ChainCompletionProposal.java b/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/ChainCompletionProposal.java
index 9469c28..321f4c4 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/ChainCompletionProposal.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/ChainCompletionProposal.java
@@ -61,7 +61,7 @@ public class ChainCompletionProposal implements IJavaCompletionProposal, IComple
@Override
public void apply(final IDocument document) {
- throw new IllegalStateException("Applying proposals to documents is deprecated");
+ throw new IllegalStateException("Applying proposals to documents is deprecated"); //$NON-NLS-1$
}
@Override
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/ChainCompletionProposalComputer.java b/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/ChainCompletionProposalComputer.java
index 7c81e5c..3fb1e55 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/ChainCompletionProposalComputer.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/ChainCompletionProposalComputer.java
@@ -63,7 +63,7 @@ import com.google.inject.Inject;
@SuppressWarnings("restriction")
public class ChainCompletionProposalComputer implements IJavaCompletionProposalComputer {
- static final String CATEGORY_ID = "org.eclipse.recommenders.completion.rcp.chain.category";
+ static final String CATEGORY_ID = "org.eclipse.recommenders.completion.rcp.chain.category"; //$NON-NLS-1$
private IRecommendersCompletionContext ctx;
private List<ChainElement> entrypoints;
@@ -166,7 +166,7 @@ public class ChainCompletionProposalComputer implements IJavaCompletionProposalC
addPublicInstanceMembersToEntrypoints(((VariableBinding) b).type);
break;
default:
- RecommendersUtilsPlugin.logWarning("Can't handle %s as source for finding entrypoints.", b);
+ RecommendersUtilsPlugin.logWarning("Can't handle %s as source for finding entrypoints.", b); //$NON-NLS-1$
}
}
@@ -203,7 +203,7 @@ public class ChainCompletionProposalComputer implements IJavaCompletionProposalC
addPublicInstanceMembersToEntrypoints(((VariableBinding) b).type);
break;
default:
- RecommendersUtilsPlugin.logWarning("Can't handle %s as class member.", b);
+ RecommendersUtilsPlugin.logWarning("Can't handle %s as class member.", b); //$NON-NLS-1$
}
}
@@ -232,7 +232,7 @@ public class ChainCompletionProposalComputer implements IJavaCompletionProposalC
continue;
}
final String key = String.valueOf(decl.computeUniqueKey());
- if (key.startsWith("Ljava/lang/Object;")) {
+ if (key.startsWith("Ljava/lang/Object;")) { //$NON-NLS-1$
continue;
}
boolean requiresThis = false;
@@ -254,9 +254,9 @@ public class ChainCompletionProposalComputer implements IJavaCompletionProposalC
final int maxChains = prefStore.getInt(ChainPreferencePage.ID_MAX_CHAINS);
final int minDepth = prefStore.getInt(ChainPreferencePage.ID_MIN_DEPTH);
final int maxDepth = prefStore.getInt(ChainPreferencePage.ID_MAX_DEPTH);
- final String[] excludedTypes = prefStore.getString(ChainPreferencePage.ID_IGNORE_TYPES).split("\\|");
+ final String[] excludedTypes = prefStore.getString(ChainPreferencePage.ID_IGNORE_TYPES).split("\\|"); //$NON-NLS-1$
for (int i = 0; i < excludedTypes.length; ++i) {
- excludedTypes[i] = "L" + excludedTypes[i].replace('.', '/');
+ excludedTypes[i] = "L" + excludedTypes[i].replace('.', '/'); //$NON-NLS-1$
}
final List<Optional<TypeBinding>> expectedTypes = TypeBindingAnalyzer.resolveBindingsForExpectedTypes(ctx,
@@ -271,7 +271,7 @@ public class ChainCompletionProposalComputer implements IJavaCompletionProposalC
}
}, prefStore.getInt(ChainPreferencePage.ID_TIMEOUT), TimeUnit.SECONDS, true);
} catch (final Exception e) {
- setError("Timeout limit hit during call chain computation.");
+ setError("Timeout limit hit during call chain computation."); //$NON-NLS-1$
}
return buildCompletionProposals(finder.getChains());
}
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/ChainElement.java b/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/ChainElement.java
index 08d44e6..68c4267 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/ChainElement.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/ChainElement.java
@@ -63,7 +63,7 @@ public class ChainElement {
elementType = ElementType.METHOD;
break;
default:
- RecommendersUtilsPlugin.logWarning("Can't handle %s as return type.", element);
+ RecommendersUtilsPlugin.logWarning("Can't handle %s as return type.", element); //$NON-NLS-1$
}
dimension = returnType.dimensions();
}
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/ChainFinder.java b/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/ChainFinder.java
index 44318e2..5ca2f37 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/ChainFinder.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/ChainFinder.java
@@ -111,7 +111,7 @@ public class ChainFinder {
}
private boolean isFromExcludedType(final Binding binding) {
- final String key = StringUtils.substringBefore(String.valueOf(binding.computeUniqueKey()), ";");
+ final String key = StringUtils.substringBefore(String.valueOf(binding.computeUniqueKey()), ";"); //$NON-NLS-1$
return excludedTypes.contains(key);
}
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/CompletionTemplateBuilder.java b/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/CompletionTemplateBuilder.java
index 4941bc9..5675359 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/CompletionTemplateBuilder.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/CompletionTemplateBuilder.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2010, 2011 Darmstadt University of Technology.
+ * 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Marcel Bruch - initial API and implementation.
+ * Olav Lenz - externalize Strings.
*/
package org.eclipse.recommenders.internal.completion.rcp.chain;
@@ -25,6 +26,7 @@ import org.eclipse.jface.text.templates.ContextTypeRegistry;
import org.eclipse.jface.text.templates.DocumentTemplateContext;
import org.eclipse.jface.text.templates.Template;
import org.eclipse.jface.text.templates.TemplateContextType;
+import org.eclipse.recommenders.completion.rcp.chain.l10n.Messages;
import org.eclipse.recommenders.utils.HashBag;
import org.eclipse.recommenders.utils.rcp.internal.RecommendersUtilsPlugin;
import org.eclipse.swt.graphics.Image;
@@ -42,7 +44,7 @@ public final class CompletionTemplateBuilder {
final String title = createChainCode(chain, true, 0);
final String body = createChainCode(chain, false, chain.getExpectedDimensions());
- final Template template = new Template(title, chain.getElements().size() + " elements", "java", body, false);
+ final Template template = new Template(title, chain.getElements().size() + " " + Messages.COMPLETION_TEMPLATE_ELEMENTS, "java", body, false); //$NON-NLS-1$ //$NON-NLS-3$
return createTemplateProposal(template, context);
}
@@ -65,11 +67,11 @@ public final class CompletionTemplateBuilder {
}
break;
default:
- RecommendersUtilsPlugin.logWarning("Can't handle %s's element type.", edge);
+ RecommendersUtilsPlugin.logWarning("Can't handle %s's element type.", edge); //$NON-NLS-1$
}
final boolean appendVariables = !createAsTitle;
appendArrayDimensions(sb, edge.getReturnTypeDimension(), expectedDimension, appendVariables, varNames);
- sb.append(".");
+ sb.append("."); //$NON-NLS-1$
}
deleteLastChar(sb);
return sb.toString();
@@ -77,46 +79,46 @@ public final class CompletionTemplateBuilder {
private static void appendVariableString(final ChainElement edge, final StringBuilder sb) {
if (edge.requiresThisForQualification() && sb.length() == 0) {
- sb.append("this.");
+ sb.append("this."); //$NON-NLS-1$
}
sb.append(((VariableBinding) edge.getElementBinding()).name);
}
private static void appendParameters(final StringBuilder sb, final MethodBinding method,
final HashBag<String> varNames) {
- sb.append("(");
+ sb.append("("); //$NON-NLS-1$
for (final TypeBinding parameter : method.parameters) {
String parameterName = StringUtils.uncapitalize(String.valueOf(parameter.shortReadableName()));
- parameterName = StringUtils.substringBefore(parameterName, "<");
+ parameterName = StringUtils.substringBefore(parameterName, "<"); //$NON-NLS-1$
appendTemplateVariable(sb, parameterName, varNames);
- sb.append(", ");
+ sb.append(", "); //$NON-NLS-1$
}
if (method.parameters.length > 0) {
deleteLastChar(sb);
deleteLastChar(sb);
}
- sb.append(")");
+ sb.append(")"); //$NON-NLS-1$
}
private static void appendTemplateVariable(final StringBuilder sb, final String varname,
final HashBag<String> varNames) {
varNames.add(varname);
- sb.append("${").append(varname);
+ sb.append("${").append(varname); //$NON-NLS-1$
final int count = varNames.count(varname);
if (count > 1) {
sb.append(count);
}
- sb.append("}");
+ sb.append("}"); //$NON-NLS-1$
}
private static void appendArrayDimensions(final StringBuilder sb, final int dimension, final int expectedDimension,
final boolean appendVariables, final HashBag<String> varNames) {
for (int i = dimension; i-- > expectedDimension;) {
- sb.append("[");
+ sb.append("["); //$NON-NLS-1$
if (appendVariables) {
- appendTemplateVariable(sb, "i", varNames);
+ appendTemplateVariable(sb, "i", varNames); //$NON-NLS-1$
}
- sb.append("]");
+ sb.append("]"); //$NON-NLS-1$
}
}
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/ScopeAccessWorkaround.java b/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/ScopeAccessWorkaround.java
index bfc2fc1..4b1ec2b 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/ScopeAccessWorkaround.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/ScopeAccessWorkaround.java
@@ -34,9 +34,9 @@ public final class ScopeAccessWorkaround {
static {
try {
- extendedContextField = InternalCompletionContext.class.getDeclaredField("extendedContext");
+ extendedContextField = InternalCompletionContext.class.getDeclaredField("extendedContext"); //$NON-NLS-1$
extendedContextField.setAccessible(true);
- assistScopeField = InternalExtendedCompletionContext.class.getDeclaredField("assistScope");
+ assistScopeField = InternalExtendedCompletionContext.class.getDeclaredField("assistScope"); //$NON-NLS-1$
assistScopeField.setAccessible(true);
} catch (final Exception e) {
throw new IllegalStateException(e);
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/TypeBindingAnalyzer.java b/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/TypeBindingAnalyzer.java
index ec6970f..889c0a3 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/TypeBindingAnalyzer.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/TypeBindingAnalyzer.java
@@ -159,7 +159,7 @@ public final class TypeBindingAnalyzer {
private static String createMethodKey(final MethodBinding method) {
final String signature = String.valueOf(method.signature());
- final String signatureWithoutReturnType = StringUtils.substringBeforeLast(signature, ")");
+ final String signatureWithoutReturnType = StringUtils.substringBeforeLast(signature, ")"); //$NON-NLS-1$
return new StringBuilder().append(method.readableName()).append(signatureWithoutReturnType).toString();
}
@@ -219,7 +219,7 @@ public final class TypeBindingAnalyzer {
bindings.add(Optional.of(scope.getType(type.getClassName().toCharArray())));
}
} else {
- RecommendersUtilsPlugin.logWarning("Can't handle %s as parent of completion location.", parent.getClass());
+ RecommendersUtilsPlugin.logWarning("Can't handle %s as parent of completion location.", parent.getClass()); //$NON-NLS-1$
}
return bindings;
}
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/ui/ChainPreferenceInitializer.java b/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/ui/ChainPreferenceInitializer.java
index bc0ba66..328eb2c 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/ui/ChainPreferenceInitializer.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/ui/ChainPreferenceInitializer.java
@@ -23,8 +23,8 @@ public final class ChainPreferenceInitializer extends AbstractPreferenceInitiali
store.setDefault(ChainPreferencePage.ID_MIN_DEPTH, 2);
store.setDefault(ChainPreferencePage.ID_MAX_DEPTH, 4);
store.setDefault(ChainPreferencePage.ID_TIMEOUT, 3);
- store.setDefault(ChainPreferencePage.ID_IGNORE_TYPES, "java.lang.Object"
- + ChainPreferencePage.IGNORE_TYPES_SEPARATOR + "java.lang.Class"
- + ChainPreferencePage.IGNORE_TYPES_SEPARATOR + "java.lang.String");
+ store.setDefault(ChainPreferencePage.ID_IGNORE_TYPES, "java.lang.Object" //$NON-NLS-1$
+ + ChainPreferencePage.IGNORE_TYPES_SEPARATOR + "java.lang.Class" //$NON-NLS-1$
+ + ChainPreferencePage.IGNORE_TYPES_SEPARATOR + "java.lang.String"); //$NON-NLS-1$
}
}
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/ui/ChainPreferencePage.java b/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/ui/ChainPreferencePage.java
index 8cb1ab2..d5f367b 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/ui/ChainPreferencePage.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/ui/ChainPreferencePage.java
@@ -7,6 +7,7 @@
*
* Contributors:
* Stefan Henß - initial API and implementation.
+ * Olav Lenz - externalize Strings.
*/
package org.eclipse.recommenders.internal.completion.rcp.chain.ui;
@@ -20,9 +21,10 @@ import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.preference.IntegerFieldEditor;
import org.eclipse.jface.preference.ListEditor;
+import org.eclipse.recommenders.completion.rcp.chain.l10n.Messages;
import org.eclipse.recommenders.internal.completion.rcp.chain.ChainCompletionPlugin;
import org.eclipse.recommenders.utils.Throws;
-import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.IWorkbench;
@@ -34,30 +36,29 @@ import com.google.common.base.Joiner;
public class ChainPreferencePage extends org.eclipse.jface.preference.FieldEditorPreferencePage implements
IWorkbenchPreferencePage {
- public static final String ID_MAX_CHAINS = "recommenders.chain.max_chains";
- public static final String ID_MIN_DEPTH = "recommenders.chain.min_chain_length";
- public static final String ID_MAX_DEPTH = "recommenders.chain.max_chain_length";
- public static final String ID_TIMEOUT = "recommenders.chain.timeout";
- public static final String ID_IGNORE_TYPES = "recommenders.chain.ignore_types";
+ public static final String ID_MAX_CHAINS = "recommenders.chain.max_chains"; //$NON-NLS-1$
+ public static final String ID_MIN_DEPTH = "recommenders.chain.min_chain_length"; //$NON-NLS-1$
+ public static final String ID_MAX_DEPTH = "recommenders.chain.max_chain_length"; //$NON-NLS-1$
+ public static final String ID_TIMEOUT = "recommenders.chain.timeout"; //$NON-NLS-1$
+ public static final String ID_IGNORE_TYPES = "recommenders.chain.ignore_types"; //$NON-NLS-1$
public static final char IGNORE_TYPES_SEPARATOR = '|';
public ChainPreferencePage() {
super(GRID);
setPreferenceStore(ChainCompletionPlugin.getDefault().getPreferenceStore());
- setDescription("Call chains offer ways to obtain objects of the requested type by calling multiple methods in a row. "
- + "Since those chains can become long and time-consuming to search, the following options allow to limit the proposals.");
+ setDescription(Messages.PREFPAGE_DESCRIPTION);
}
@Override
protected void createFieldEditors() {
- addField(ID_MAX_CHAINS, "Maximum number of chains:", 1, 99);
- addField(ID_MIN_DEPTH, "Minimum chain depth:", 1, 10);
- addField(ID_MAX_DEPTH, "Maximum chain depth:", 1, 10);
- addField(ID_TIMEOUT, "Chain search timeout (sec):", 1, 99);
-
- addField(new IgnoredTypesEditor("Object types to ignore:", getFieldEditorParent()));
- addText("Ignored object types will not have chain proposals displayed for.");
- addText("Also, no chains through methods from ignored types will be found.");
+ addField(ID_MAX_CHAINS, Messages.PREFPAGE_MAX_CHAINS, 1, 99);
+ addField(ID_MIN_DEPTH, Messages.PREFPAGE_MIN_CHAIN_DEPTH, 1, 10);
+ addField(ID_MAX_DEPTH, Messages.PREFPAGE_MAX_CHAIN_DEPTH, 1, 10);
+ addField(ID_TIMEOUT, Messages.PREFPAGE_SEARCH_TIMEOUT, 1, 99);
+
+ addField(new IgnoredTypesEditor(Messages.PREFPAGE_IGNORED_OBJECT_TYPES, getFieldEditorParent()));
+
+ addText(Messages.PREFPAGE_IGNORE_CONSEQUENCES);
}
private void addField(final String name, final String labeltext, final int min, final int max) {
@@ -67,10 +68,9 @@ public class ChainPreferencePage extends org.eclipse.jface.preference.FieldEdito
}
private void addText(final String text) {
- final Label label = new Label(getFieldEditorParent(), NONE);
+ final Label label = new Label(getFieldEditorParent(), SWT.WRAP);
label.setText(text);
- final GridData layoutData = GridDataFactory.fillDefaults().span(2, 1).create();
- label.setLayoutData(layoutData);
+ label.setLayoutData(GridDataFactory.fillDefaults().span(2, 1).create());
}
@Override
@@ -92,7 +92,7 @@ public class ChainPreferencePage extends org.eclipse.jface.preference.FieldEdito
protected String[] parseString(final String stringList) {
getUpButton().setVisible(false);
getDownButton().setVisible(false);
- return stringList.split("\\" + IGNORE_TYPES_SEPARATOR);
+ return stringList.split("\\" + IGNORE_TYPES_SEPARATOR); //$NON-NLS-1$
}
@Override
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/ui/CompletionKeyShortcutHandler.java b/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/ui/CompletionKeyShortcutHandler.java
index 2807d91..75e8133 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/ui/CompletionKeyShortcutHandler.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/ui/CompletionKeyShortcutHandler.java
@@ -30,7 +30,7 @@ import com.google.common.base.Optional;
*/
@SuppressWarnings("restriction")
public final class CompletionKeyShortcutHandler extends AbstractHandler {
- private static final String CHAIN_COMPLETION_CATEGORY = "org.eclipse.recommenders.completion.rcp.chain.category";
+ private static final String CHAIN_COMPLETION_CATEGORY = "org.eclipse.recommenders.completion.rcp.chain.category"; //$NON-NLS-1$
private final CompletionProposalComputerRegistry registry = CompletionProposalComputerRegistry.getDefault();
private final SpecificContentAssistExecutor executor = new SpecificContentAssistExecutor(registry);
@@ -45,7 +45,7 @@ public final class CompletionKeyShortcutHandler extends AbstractHandler {
return;
}
}
- Throws.throwIllegalStateException("Chain proposal engine category '%s' no found. Report this as bug.",
+ Throws.throwIllegalStateException("Chain proposal engine category '%s' no found. Report this as bug.", //$NON-NLS-1$
CHAIN_COMPLETION_CATEGORY);
}