summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorOlav Lenz2013-01-27 06:29:28 (EST)
committer Andreas Sewe2013-01-29 11:27:27 (EST)
commit1b8616f53c0df94ffabaea4dbd08edc064ae85ab (patch)
treeca12e9510ef484c2079f10f9bb10da0dfb3720d9
parent6da034301b1f54351336c66fabf570c069a5bc66 (diff)
downloadorg.eclipse.recommenders-1b8616f53c0df94ffabaea4dbd08edc064ae85ab.zip
org.eclipse.recommenders-1b8616f53c0df94ffabaea4dbd08edc064ae85ab.tar.gz
org.eclipse.recommenders-1b8616f53c0df94ffabaea4dbd08edc064ae85ab.tar.bz2
[l10n] externalize strings in plugin *.recommenders.rcprefs/changes/49/9949/3
-rw-r--r--plugins/org.eclipse.recommenders.rcp/META-INF/MANIFEST.MF4
-rw-r--r--plugins/org.eclipse.recommenders.rcp/OSGI-INF/l10n/bundle.properties6
-rw-r--r--plugins/org.eclipse.recommenders.rcp/build.properties3
-rw-r--r--plugins/org.eclipse.recommenders.rcp/plugin.xml6
-rw-r--r--plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/models/ModelArchiveMetadata.java12
-rw-r--r--plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/models/archive/CachingModelArchive.java4
-rw-r--r--plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/models/archive/MemberGsonZipPoolableModelFactory.java4
-rw-r--r--plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/models/archive/PoolingModelArchive.java4
-rw-r--r--plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/models/archive/ZipPoolableModelFactory.java2
-rw-r--r--plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/models/store/DefaultModelArchiveStore.java4
-rw-r--r--plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/models/store/ModelArchiveResolutionJob.java16
-rw-r--r--plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/providers/ClasspathEntryInfoProvider.java22
-rw-r--r--plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/providers/JavaModelEventsProvider.java8
-rw-r--r--plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/providers/JavaSelectionProvider.java2
-rw-r--r--plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/providers/JavaSelectionUtils.java4
-rw-r--r--plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/repo/ClearModelRepositoryJob.java6
-rw-r--r--plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/repo/ManualWagonProvider.java2
-rw-r--r--plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/repo/ModelRepository.java34
-rw-r--r--plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/repo/ModelRepositoryIndex.java8
-rw-r--r--plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/repo/RepositoryUtils.java28
-rw-r--r--plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/repo/TransferListener.java17
-rw-r--r--plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/repo/UpdateModelIndexJob.java8
-rw-r--r--plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/ui/ModelsPreferencePage.java18
-rw-r--r--plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/ui/PreferenceInitializer.java2
-rw-r--r--plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/ui/RecommendersPreferencePage.java5
-rw-r--r--plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/wiring/RecommendersModule.java14
-rw-r--r--plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/rcp/ClasspathEntryInfo.java10
-rw-r--r--plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/rcp/RecommendersPlugin.java4
-rw-r--r--plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/rcp/events/JavaSelectionEvent.java2
-rw-r--r--plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/rcp/l10n/Messages.java44
-rw-r--r--plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/rcp/l10n/messages.properties20
31 files changed, 207 insertions, 116 deletions
diff --git a/plugins/org.eclipse.recommenders.rcp/META-INF/MANIFEST.MF b/plugins/org.eclipse.recommenders.rcp/META-INF/MANIFEST.MF
index 94194bb..a64cb4e 100644
--- a/plugins/org.eclipse.recommenders.rcp/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.recommenders.rcp/META-INF/MANIFEST.MF
@@ -1,10 +1,10 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
-Bundle-Name: Code Recommenders: Core Runtime
+Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.eclipse.recommenders.rcp;singleton:=true
Bundle-Version: 1.0.3.qualifier
Bundle-Activator: org.eclipse.recommenders.rcp.RecommendersPlugin
-Bundle-Vendor: Eclipse Code Recommenders
+Bundle-Vendor: %Bundle-Vendor
Export-Package: org.eclipse.recommenders.internal.rcp.models,
org.eclipse.recommenders.internal.rcp.models.archive,
org.eclipse.recommenders.internal.rcp.models.store,
diff --git a/plugins/org.eclipse.recommenders.rcp/OSGI-INF/l10n/bundle.properties b/plugins/org.eclipse.recommenders.rcp/OSGI-INF/l10n/bundle.properties
new file mode 100644
index 0000000..544bc48
--- /dev/null
+++ b/plugins/org.eclipse.recommenders.rcp/OSGI-INF/l10n/bundle.properties
@@ -0,0 +1,6 @@
+#Properties file for org.eclipse.recommenders.rcp
+Bundle-Name = Code Recommenders: Core Runtime
+Bundle-Vendor = Eclipse Code Recommenders
+category.name = Recommenders
+page.name = Code Recommenders
+page.name.models = Models \ No newline at end of file
diff --git a/plugins/org.eclipse.recommenders.rcp/build.properties b/plugins/org.eclipse.recommenders.rcp/build.properties
index 226a3d7..dbf0a10 100644
--- a/plugins/org.eclipse.recommenders.rcp/build.properties
+++ b/plugins/org.eclipse.recommenders.rcp/build.properties
@@ -16,7 +16,8 @@ bin.includes = .,\
plugin.xml,\
icons/,\
about.html,\
- about.ini
+ about.ini,\
+ OSGI-INF/l10n/bundle.properties
src.includes = pom.xml,\
icons/,\
about.html
diff --git a/plugins/org.eclipse.recommenders.rcp/plugin.xml b/plugins/org.eclipse.recommenders.rcp/plugin.xml
index e1cb357..ca0ef19 100644
--- a/plugins/org.eclipse.recommenders.rcp/plugin.xml
+++ b/plugins/org.eclipse.recommenders.rcp/plugin.xml
@@ -24,7 +24,7 @@
point="org.eclipse.ui.views">
<category
id="org.eclipse.recommenders.rcp.category.views"
- name="Recommenders">
+ name="%category.name">
</category>
</extension>
<extension
@@ -32,13 +32,13 @@
<page
class="org.eclipse.recommenders.internal.rcp.ui.RecommendersPreferencePage"
id="org.eclipse.recommenders.rcp.category.preferences"
- name="Code Recommenders">
+ name="%page.name">
</page>
<page
category="org.eclipse.recommenders.rcp.category.preferences"
class="org.eclipse.recommenders.internal.rcp.ui.ModelsPreferencePage"
id="org.eclipse.recommenders.rcp.modelpreferences"
- name="Models">
+ name="%page.name.models">
</page>
</extension>
<extension
diff --git a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/models/ModelArchiveMetadata.java b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/models/ModelArchiveMetadata.java
index 149a137..b3deee4 100644
--- a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/models/ModelArchiveMetadata.java
+++ b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/models/ModelArchiveMetadata.java
@@ -37,17 +37,17 @@ public class ModelArchiveMetadata<K, V> {
MANUAL, DEFAULT, NEVER
}
- public static final String P_COORDINATE = "coordinate";
- public static final String P_STATUS = "status";
- public static final String P_ERROR = "error";
- public static final String P_MODEL = "model";
- public static final String P_LOCATION = "location";
+ public static final String P_COORDINATE = "coordinate"; //$NON-NLS-1$
+ public static final String P_STATUS = "status"; //$NON-NLS-1$
+ public static final String P_ERROR = "error"; //$NON-NLS-1$
+ public static final String P_MODEL = "model"; //$NON-NLS-1$
+ public static final String P_LOCATION = "location"; //$NON-NLS-1$
@SuppressWarnings("unchecked")
public static final ModelArchiveMetadata NULL = new ModelArchiveMetadata() {
{
// use fields instead of setters to bypass checks
- coordinate = "";
+ coordinate = ""; //$NON-NLS-1$
status = UNINITIALIZED;
}
};
diff --git a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/models/archive/CachingModelArchive.java b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/models/archive/CachingModelArchive.java
index 754e165..e459ebf 100644
--- a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/models/archive/CachingModelArchive.java
+++ b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/models/archive/CachingModelArchive.java
@@ -42,7 +42,7 @@ public class CachingModelArchive<K, M> implements IModelArchive<K, M> {
try {
return loader.hasModel(key);
} catch (Exception e) {
- log.debug("Exception occurred while checking model existence for key " + key, e);
+ log.debug("Exception occurred while checking model existence for key " + key, e); //$NON-NLS-1$
return false;
}
}
@@ -52,7 +52,7 @@ public class CachingModelArchive<K, M> implements IModelArchive<K, M> {
try {
return fromNullable(cache.get(key));
} catch (Exception e) {
- log.debug("Exception occurred while fetching model for key " + key, e);
+ log.debug("Exception occurred while fetching model for key " + key, e); //$NON-NLS-1$
return absent();
}
}
diff --git a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/models/archive/MemberGsonZipPoolableModelFactory.java b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/models/archive/MemberGsonZipPoolableModelFactory.java
index 4b8b7c2..60214ce 100644
--- a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/models/archive/MemberGsonZipPoolableModelFactory.java
+++ b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/models/archive/MemberGsonZipPoolableModelFactory.java
@@ -72,12 +72,12 @@ public class MemberGsonZipPoolableModelFactory<T> extends ZipPoolableModelFactor
switch (m.getElementType()) {
case IJavaElement.TYPE:
ITypeName rType = jdtResolver.toRecType((IType) m);
- name = Zips.path(rType, ".json");
+ name = Zips.path(rType, ".json"); //$NON-NLS-1$
break;
case IJavaElement.METHOD:
Optional<IMethodName> opt = jdtResolver.toRecMethod((IMethod) m);
if (opt.isPresent())
- name = Zips.path(opt.get(), ".json");
+ name = Zips.path(opt.get(), ".json"); //$NON-NLS-1$
break;
}
return zip.getEntry(name);
diff --git a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/models/archive/PoolingModelArchive.java b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/models/archive/PoolingModelArchive.java
index 0958149..f8e4560 100644
--- a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/models/archive/PoolingModelArchive.java
+++ b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/models/archive/PoolingModelArchive.java
@@ -76,7 +76,7 @@ public class PoolingModelArchive<K, M> implements IModelArchive<K, M> {
objects.put(model, key);
return fromNullable(model);
} catch (final Exception e) {
- log.error("Exception while loading model for key '" + key + "'" + e.getMessage(), e);
+ log.error("Exception while loading model for key '" + key + "'" + e.getMessage(), e); //$NON-NLS-1$ //$NON-NLS-2$
return absent();
}
}
@@ -89,7 +89,7 @@ public class PoolingModelArchive<K, M> implements IModelArchive<K, M> {
pool.returnObject(key, model);
}
} catch (final Exception e) {
- log.error("Exception while releasing model'" + model + "'", e);
+ log.error("Exception while releasing model'" + model + "'", e); //$NON-NLS-1$ //$NON-NLS-2$
}
}
diff --git a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/models/archive/ZipPoolableModelFactory.java b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/models/archive/ZipPoolableModelFactory.java
index 678ba12..c8466fe 100644
--- a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/models/archive/ZipPoolableModelFactory.java
+++ b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/models/archive/ZipPoolableModelFactory.java
@@ -55,7 +55,7 @@ public abstract class ZipPoolableModelFactory<K, M> implements IModelFactory<K,
try {
zip.close();
} catch (Exception e) {
- log.warn("Failed to close zip'" + zip + "'", e);
+ log.warn("Failed to close zip'" + zip + "'", e); //$NON-NLS-1$ //$NON-NLS-2$
}
}
}
diff --git a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/models/store/DefaultModelArchiveStore.java b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/models/store/DefaultModelArchiveStore.java
index 2d7be13..fbbb2e3 100644
--- a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/models/store/DefaultModelArchiveStore.java
+++ b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/models/store/DefaultModelArchiveStore.java
@@ -76,7 +76,7 @@ public class DefaultModelArchiveStore<K extends IMember, V> implements Closeable
try {
mappings = deserializeMapping();
} catch (final Exception e) {
- log.warn("Loading mapping from '" + store + "' failed with exception.", e);
+ log.warn("Loading mapping from '" + store + "' failed with exception.", e); //$NON-NLS-1$ //$NON-NLS-2$
}
}
// GsonUtil may return null if the file exists but is empty
@@ -117,7 +117,7 @@ public class DefaultModelArchiveStore<K extends IMember, V> implements Closeable
return of(model.get());
} catch (Exception e) {
- log.warn("Loading model for '" + getElementLabel(key, ALL_DEFAULT) + "' failed with exception.", e);
+ log.warn("Loading model for '" + getElementLabel(key, ALL_DEFAULT) + "' failed with exception.", e); //$NON-NLS-1$ //$NON-NLS-2$
return absent();
}
}
diff --git a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/models/store/ModelArchiveResolutionJob.java b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/models/store/ModelArchiveResolutionJob.java
index 04225b9..cb594fb 100644
--- a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/models/store/ModelArchiveResolutionJob.java
+++ b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/models/store/ModelArchiveResolutionJob.java
@@ -7,6 +7,7 @@
*
* Contributors:
* Marcel Bruch - initial API and implementation.
+ * Olav Lenz - externalize Strings.
*/
package org.eclipse.recommenders.internal.rcp.models.store;
@@ -28,6 +29,7 @@ import org.eclipse.recommenders.internal.rcp.models.ModelArchiveMetadata.ModelAr
import org.eclipse.recommenders.rcp.ClasspathEntryInfo;
import org.eclipse.recommenders.rcp.IClasspathEntryInfoProvider;
import org.eclipse.recommenders.rcp.RecommendersPlugin;
+import org.eclipse.recommenders.rcp.l10n.Messages;
import org.eclipse.recommenders.rcp.repo.IModelRepository;
import org.eclipse.recommenders.rcp.repo.IModelRepositoryIndex;
import org.eclipse.recommenders.utils.Version;
@@ -55,7 +57,7 @@ public class ModelArchiveResolutionJob extends Job {
public ModelArchiveResolutionJob(@Assisted ModelArchiveMetadata metadata,
IClasspathEntryInfoProvider cpeInfoProvider, IModelRepository repository, IModelRepositoryIndex index,
@Assisted String classifier) {
- super("Resolving model for " + metadata.getLocation().getName() + "...");
+ super(String.format(Messages.JOB_RESOLVING_MODEL, metadata.getLocation().getName()));
this.metadata = metadata;
this.cpeInfos = cpeInfoProvider;
this.repository = repository;
@@ -69,14 +71,14 @@ public class ModelArchiveResolutionJob extends Job {
if (!isAutoDownloadAllowed()) {
return Status.CANCEL_STATUS;
}
- monitor.beginTask(String.format("Looking for '%s' model for %s", classifier, metadata.getLocation().getName()),
+ monitor.beginTask(String.format(Messages.TASK_LOOKING_FOR_MODEL, classifier, metadata.getLocation().getName()),
5);
monitor.worked(1);
metadata.setStatus(ModelArchiveResolutionStatus.UNRESOLVED);
try {
if (!findClasspathInfo()) {
- metadata.setError(format("No class path info available for '%s'. Skipped.", pkgRoot));
+ metadata.setError(format("No class path info available for '%s'. Skipped.", pkgRoot)); //$NON-NLS-1$
// we didn't found it yet. The system is currently starting and indexing. Try again later.
metadata.setResolutionRequestedSinceStartup(false);
return CANCEL_STATUS;
@@ -84,7 +86,7 @@ public class ModelArchiveResolutionJob extends Job {
if (!findInIndex()) {
metadata.setError(format(
- "No call model found for '%s'. Neither fingerprint '%s' nor symbolic name '%s' are known.",
+ "No call model found for '%1$s'. Neither fingerprint '%2$s' nor symbolic name '%3$s' are known.", //$NON-NLS-1$
cpeInfo.getLocation(), cpeInfo.getFingerprint(), cpeInfo.getSymbolicName()));
return CANCEL_STATUS;
}
@@ -138,11 +140,11 @@ public class ModelArchiveResolutionJob extends Job {
Version version = cpeInfo.getVersion();
Artifact copy = model;
Artifact query = null;
- String upperBound = version.isUnknown() ? "10000.0" : format("%d.%d", version.major, version.minor + 1);
- query = model.setVersion("[0," + upperBound + ")");
+ String upperBound = version.isUnknown() ? "10000.0" : format("%d.%d", version.major, version.minor + 1); //$NON-NLS-1$ //$NON-NLS-2$
+ query = model.setVersion("[0," + upperBound + ")"); //$NON-NLS-1$ //$NON-NLS-2$
copy = repository.findHigestVersion(query).orNull();
if (copy == null) {
- query = model.setVersion("[" + upperBound + ",)");
+ query = model.setVersion("[" + upperBound + ",)"); //$NON-NLS-1$ //$NON-NLS-2$
copy = repository.findLowestVersion(query).orNull();
}
if (copy != null) {
diff --git a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/providers/ClasspathEntryInfoProvider.java b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/providers/ClasspathEntryInfoProvider.java
index ef5a902..b958a53 100644
--- a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/providers/ClasspathEntryInfoProvider.java
+++ b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/providers/ClasspathEntryInfoProvider.java
@@ -76,7 +76,7 @@ public class ClasspathEntryInfoProvider implements IClasspathEntryInfoProvider {
* it's an disk-IO heavy computation. More than one thread will probably not give any performance gains here.
*/
private final ExecutorService pool = coreThreadsTimoutExecutor(1, Thread.MIN_PRIORITY,
- "Recommenders-Dependency-Info-Service-");
+ "Recommenders-Dependency-Info-Service-"); //$NON-NLS-1$
private final Logger log = LoggerFactory.getLogger(getClass());
private final Map<File, ClasspathEntryInfo> cpeInfos = Maps.newHashMap();
@@ -92,7 +92,7 @@ public class ClasspathEntryInfoProvider implements IClasspathEntryInfoProvider {
@VisibleForTesting
protected void initialize(final IWorkspaceRoot workspace) {
- new Job("") {
+ new Job("") { //$NON-NLS-1$
{
setSystem(true);
setPriority(Job.LONG);
@@ -121,7 +121,7 @@ public class ClasspathEntryInfoProvider implements IClasspathEntryInfoProvider {
ensureFileInfosStillConsistent(info);
}
} catch (Exception e) {
- log.warn("Exception during deserialization of cached classpath infos. Discaring old state.", e);
+ log.warn("Exception during deserialization of cached classpath infos. Discaring old state.", e); //$NON-NLS-1$
}
}
@@ -163,7 +163,7 @@ public class ClasspathEntryInfoProvider implements IClasspathEntryInfoProvider {
Files.createParentDirs(state);
GsonUtil.serialize(cpeInfos.values(), state);
} catch (Exception e) {
- log.error("Failed to store classpath info state.", e);
+ log.error("Failed to store classpath info state.", e); //$NON-NLS-1$
}
}
@@ -175,7 +175,7 @@ public class ClasspathEntryInfoProvider implements IClasspathEntryInfoProvider {
for (IClasspathEntry entry : e.project.getRawClasspath()) {
if (entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER) {
boolean isJREContainer = entry.getPath().toString()
- .contains("org.eclipse.jdt.launching.JRE_CONTAINER");
+ .contains("org.eclipse.jdt.launching.JRE_CONTAINER"); //$NON-NLS-1$
for (IPackageFragmentRoot sub : e.project.findPackageFragmentRoots(entry)) {
final Optional<File> location = JdtUtils.getLocation(sub);
if (isInterestingPackageFragmentRoot(sub, location)) {
@@ -193,19 +193,19 @@ public class ClasspathEntryInfoProvider implements IClasspathEntryInfoProvider {
}
}
} catch (final JavaModelException x) {
- log.error("Exception occurred while resolving project dependencies for " + e.project, x);
+ log.error("Exception occurred while resolving project dependencies for " + e.project, x); //$NON-NLS-1$
}
}
private void mapSourcePluginProjects(final JavaProjectOpened e) {
try {
// XXX flight hack...
- IResource mf = e.project.getProject().findMember(new Path("META-INF/MANIFEST.MF"));
+ IResource mf = e.project.getProject().findMember(new Path("META-INF/MANIFEST.MF")); //$NON-NLS-1$
if (mf != null && mf.exists() && mf.getType() == IResource.FILE) {
Manifest mf_ = new Manifest(((IFile) mf).getContents());
final Attributes attributes = mf_.getMainAttributes();
// names may look like this: "symbolic.name;singleton=true":
- String symbolicName = substringBefore(attributes.getValue(Constants.BUNDLE_SYMBOLICNAME), ";");
+ String symbolicName = substringBefore(attributes.getValue(Constants.BUNDLE_SYMBOLICNAME), ";"); //$NON-NLS-1$
final String version = attributes.getValue(Constants.BUNDLE_VERSION);
Version osgiversion = null;
if (version != null) {
@@ -225,7 +225,7 @@ public class ClasspathEntryInfoProvider implements IClasspathEntryInfoProvider {
}
}
} catch (Exception e1) {
- log.warn("failed to read bundle manifest for project " + e.project.getElementName(), e1);
+ log.warn("failed to read bundle manifest for project " + e.project.getElementName(), e1); //$NON-NLS-1$
}
}
@@ -250,13 +250,13 @@ public class ClasspathEntryInfoProvider implements IClasspathEntryInfoProvider {
res.setJavaRuntime(isPartOfJavaRuntime);
if (isPartOfJavaRuntime) {
// XXX jre jars are hard coded to JRE 1.0.0
- res.setSymbolicName("jre");
+ res.setSymbolicName("jre"); //$NON-NLS-1$
res.setVersion(Version.create(1, 0));
}
cpeInfos.put(file, res);
bus.post(new NewClasspathEntryFound(r, file, res));
} catch (final Exception e) {
- log.error("Extracing jar information failed with exception.", e);
+ log.error("Extracing jar information failed with exception.", e); //$NON-NLS-1$
}
}
}
diff --git a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/providers/JavaModelEventsProvider.java b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/providers/JavaModelEventsProvider.java
index ed6e5f0..8b39f3e 100644
--- a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/providers/JavaModelEventsProvider.java
+++ b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/providers/JavaModelEventsProvider.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2010 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.rcp.providers;
@@ -42,6 +43,7 @@ import org.eclipse.recommenders.rcp.events.JavaModelEvents.JarPackageFragmentRoo
import org.eclipse.recommenders.rcp.events.JavaModelEvents.JarPackageFragmentRootRemoved;
import org.eclipse.recommenders.rcp.events.JavaModelEvents.JavaProjectClosed;
import org.eclipse.recommenders.rcp.events.JavaModelEvents.JavaProjectOpened;
+import org.eclipse.recommenders.rcp.l10n.Messages;
import com.google.common.collect.Sets;
import com.google.common.eventbus.EventBus;
@@ -60,7 +62,7 @@ public class JavaModelEventsProvider implements IElementChangedListener {
}
private void simulateProjectOpenEvents() {
- new SimulateOpenJavaProjectsJob("Initializing projects with recommenders nature").schedule();
+ new SimulateOpenJavaProjectsJob(Messages.JOB_INITIALIZE_PROJECTS).schedule();
}
@Override
@@ -227,7 +229,7 @@ public class JavaModelEventsProvider implements IElementChangedListener {
@Override
public IStatus runInWorkspace(final IProgressMonitor monitor) throws CoreException {
final Set<IProject> openProjects = getAllOpenProjects();
- monitor.beginTask("", openProjects.size());
+ monitor.beginTask("", openProjects.size()); //$NON-NLS-1$
for (final IProject project : openProjects) {
if (JavaProject.hasJavaNature(project)) {
final IJavaProject javaProject = toJavaProject(project);
diff --git a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/providers/JavaSelectionProvider.java b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/providers/JavaSelectionProvider.java
index 9852963..5e866f6 100644
--- a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/providers/JavaSelectionProvider.java
+++ b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/providers/JavaSelectionProvider.java
@@ -46,7 +46,7 @@ import com.google.common.util.concurrent.ThreadFactoryBuilder;
public class JavaSelectionProvider implements ISelectionListener {
ScheduledThreadPoolExecutor d = new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder().setNameFormat(
- "Recommenders-Timeout-Manager").build());
+ "Recommenders-Timeout-Manager").build()); //$NON-NLS-1$
private final EventBus bus;
private JavaSelectionEvent lastEvent = new JavaSelectionEvent(null, null);
diff --git a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/providers/JavaSelectionUtils.java b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/providers/JavaSelectionUtils.java
index 8bed82d..282685f 100644
--- a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/providers/JavaSelectionUtils.java
+++ b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/providers/JavaSelectionUtils.java
@@ -170,7 +170,7 @@ public class JavaSelectionUtils {
// actually, these can happen when using snipmatch's in-editor completion.
// fractions of seconds seem potentially to lead to this exception, thus, we swallow them here.
if (!isInvalidSelection(root, offset))
- log(e, "Failed to resolve selection in '%s' at offset %d", root.getHandleIdentifier(), offset);
+ log(e, "Failed to resolve selection in '%s' at offset %d", root.getHandleIdentifier(), offset); //$NON-NLS-1$
return absent();
}
}
@@ -181,7 +181,7 @@ public class JavaSelectionUtils {
range = root.getSourceRange();
return range == null || offset < 0 || offset > range.getLength();
} catch (Exception e) {
- log.debug("exception while checking editor offset", e);
+ log.debug("exception while checking editor offset", e); //$NON-NLS-1$
return false;
}
}
diff --git a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/repo/ClearModelRepositoryJob.java b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/repo/ClearModelRepositoryJob.java
index eec6b0d..ded1046 100644
--- a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/repo/ClearModelRepositoryJob.java
+++ b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/repo/ClearModelRepositoryJob.java
@@ -7,6 +7,7 @@
*
* Contributors:
* Marcel Bruch - initial API and implementation.
+ * Olav Lenz - externalize Strings.
*/
package org.eclipse.recommenders.internal.rcp.repo;
@@ -18,6 +19,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.recommenders.rcp.l10n.Messages;
import org.eclipse.recommenders.rcp.repo.IModelRepository;
/**
@@ -29,14 +31,14 @@ public class ClearModelRepositoryJob extends Job {
private IModelRepository repo;
public ClearModelRepositoryJob(IModelRepository repo) {
- super("Clearing model repository...");
+ super(Messages.JOB_CLEAR_MODEL_REPOSITORY);
this.repo = repo;
setPriority(Job.LONG);
}
@Override
protected IStatus run(IProgressMonitor monitor) {
- monitor.beginTask("", IProgressMonitor.UNKNOWN);
+ monitor.beginTask("", IProgressMonitor.UNKNOWN); //$NON-NLS-1$
File location = repo.getLocation();
try {
FileUtils.deleteQuietly(location);
diff --git a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/repo/ManualWagonProvider.java b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/repo/ManualWagonProvider.java
index 77aabb2..214c045 100644
--- a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/repo/ManualWagonProvider.java
+++ b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/repo/ManualWagonProvider.java
@@ -20,7 +20,7 @@ public class ManualWagonProvider implements org.sonatype.aether.connector.wagon.
@Override
public Wagon lookup(String roleHint) throws Exception {
- if ("http".equals(roleHint) || "https".equals(roleHint)) {
+ if ("http".equals(roleHint) || "https".equals(roleHint)) { //$NON-NLS-1$ //$NON-NLS-2$
AhcWagon ahcWagon = new AhcWagon();
// TODO set timeout to 300s instead of 60s to solve timeouts. experimental.
ahcWagon.setTimeout(300*1000);
diff --git a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/repo/ModelRepository.java b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/repo/ModelRepository.java
index 7a27da1..523ead7 100644
--- a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/repo/ModelRepository.java
+++ b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/repo/ModelRepository.java
@@ -8,6 +8,7 @@
* Contributors:
* Marcel Bruch - initial API and implementation.
* Patrick Gottschaemmer, Olav Lenz - Introduced ProxySelector
+ * Olav Lenz - externalize Strings.
*/
package org.eclipse.recommenders.internal.rcp.repo;
@@ -31,6 +32,7 @@ import org.apache.maven.repository.internal.MavenRepositorySystemSession;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.recommenders.internal.rcp.wiring.RecommendersModule.LocalModelRepositoryLocation;
import org.eclipse.recommenders.internal.rcp.wiring.RecommendersModule.RemoteModelRepositoryLocation;
+import org.eclipse.recommenders.rcp.l10n.Messages;
import org.eclipse.recommenders.rcp.repo.IModelRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -124,26 +126,26 @@ public class ModelRepository implements IModelRepository {
public Optional<String> remoteEtag(Artifact artifact) {
try {
- String remoteBaseurl = StringUtils.removeEnd(remote.getUrl(), "/");
- String url = String.format("%1$s/%2$s", remoteBaseurl, computePath(artifact));
- if (url.startsWith("file:")) {
+ String remoteBaseurl = StringUtils.removeEnd(remote.getUrl(), "/"); //$NON-NLS-1$
+ String url = String.format("%1$s/%2$s", remoteBaseurl, computePath(artifact)); //$NON-NLS-1$
+ if (url.startsWith("file:")) { //$NON-NLS-1$
// try file:
File file = new File(new URI(url));
if (file.exists())
- return of(file.lastModified() + "");
+ return of(file.lastModified() + ""); //$NON-NLS-1$
return absent();
}
Response r = http.prepareHead(url).execute().get();
- String header = r.getHeader("ETag");
+ String header = r.getHeader("ETag"); //$NON-NLS-1$
if (isNotEmpty(header)) {
- header = StringUtils.remove(header, "\"");
+ header = StringUtils.remove(header, "\""); //$NON-NLS-1$
return of(header);
}
} catch (Exception e) {
log.debug(e.getMessage());
}
- log.warn("'{}' did not send ETAG header for '{}'.", remote, artifact);
+ log.warn("'{}' did not send ETAG header for '{}'.", remote, artifact); //$NON-NLS-1$
return absent();
}
@@ -163,7 +165,7 @@ public class ModelRepository implements IModelRepository {
}
private File etagFile(Artifact artifact) {
- return new File(location(artifact).getAbsolutePath() + ".etag");
+ return new File(location(artifact).getAbsolutePath() + ".etag"); //$NON-NLS-1$
}
@Override
@@ -199,7 +201,7 @@ public class ModelRepository implements IModelRepository {
@Override
public synchronized File resolve(Artifact artifact, final IProgressMonitor monitor)
throws DependencyResolutionException {
- monitor.subTask("Resolving...");
+ monitor.subTask(Messages.TASK_RESOLVING);
DefaultRepositorySystemSession session = newSession();
session.setDependencySelector(new TheArtifactOnlyDependencySelector());
session.setTransferListener(new TransferListener(monitor));
@@ -207,12 +209,12 @@ public class ModelRepository implements IModelRepository {
@Override
public void artifactDownloaded(org.sonatype.aether.RepositoryEvent event) {
- monitor.subTask("downloaded " + event.getArtifact());
+ monitor.subTask(String.format(Messages.STATUS_DOWNLOAD_FINISHED, event.getArtifact()));
saveEtag(event.getArtifact());
};
});
- Dependency dependency = new Dependency(artifact, "model");
+ Dependency dependency = new Dependency(artifact, "model"); //$NON-NLS-1$
CollectRequest collectRequest = new CollectRequest();
collectRequest.setRoot(dependency);
@@ -233,7 +235,7 @@ public class ModelRepository implements IModelRepository {
try {
Files.write(remoteEtag.get(), etagFile, Charset.defaultCharset());
} catch (Exception e) {
- log.error("Failed to write etag to file " + etagFile, e);
+ log.error("Failed to write etag to file " + etagFile, e); //$NON-NLS-1$
}
}
}
@@ -244,7 +246,7 @@ public class ModelRepository implements IModelRepository {
InstallRequest r = new InstallRequest();
r.addArtifact(artifact);// .addArtifact(pom);
system.install(session, r);
- log.info("installed '{}' to {}", artifact, location);
+ log.info("installed '{}' to {}", artifact, location); //$NON-NLS-1$
}
public void deploy(Artifact artifact) throws DeploymentException {
@@ -253,7 +255,7 @@ public class ModelRepository implements IModelRepository {
r.addArtifact(artifact);
r.setRepository(remote);
system.deploy(session, r);
- log.info("deployed '{}' to {}", artifact, remote.getUrl());
+ log.info("deployed '{}' to {}", artifact, remote.getUrl()); //$NON-NLS-1$
}
@Override
@@ -285,7 +287,7 @@ public class ModelRepository implements IModelRepository {
VersionRangeResult range = system.resolveVersionRange(newSession(), rangeRequest);
return of(range);
} catch (Exception e) {
- log.error("Failed to resolve version range for artifact " + a + ".", e);
+ log.error("Failed to resolve version range for artifact " + a + ".", e); //$NON-NLS-1$ //$NON-NLS-2$
return absent();
}
}
@@ -311,7 +313,7 @@ public class ModelRepository implements IModelRepository {
*/
@Override
public synchronized void setRemote(String url) {
- remote = new RemoteRepository("remote-models", "default", url);
+ remote = new RemoteRepository("remote-models", "default", url); //$NON-NLS-1$ //$NON-NLS-2$
remote.setProxy(proxySelector.getProxy(remote));
}
diff --git a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/repo/ModelRepositoryIndex.java b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/repo/ModelRepositoryIndex.java
index b21425a..e19935c 100644
--- a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/repo/ModelRepositoryIndex.java
+++ b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/repo/ModelRepositoryIndex.java
@@ -63,7 +63,7 @@ public class ModelRepositoryIndex implements Closeable, IModelRepositoryIndex {
directory = FSDirectory.open(location);
reader = IndexReader.open(directory);
} catch (Exception e) {
- log.error("Failed to open search index.", e);
+ log.error("Failed to open search index.", e); //$NON-NLS-1$
}
}
@@ -111,7 +111,7 @@ public class ModelRepositoryIndex implements Closeable, IModelRepositoryIndex {
res.add(newArtifact(value));
}
} catch (Exception e) {
- log.error("Searching index failed with exception", e);
+ log.error("Searching index failed with exception", e); //$NON-NLS-1$
}
return res;
}
@@ -135,7 +135,7 @@ public class ModelRepositoryIndex implements Closeable, IModelRepositoryIndex {
return absent();
}
if (matches.totalHits > 1) {
- log.warn("More than one potential match for query {} found. Inconsistency in model store?", query);
+ log.warn("More than one potential match for query {} found. Inconsistency in model store?", query); //$NON-NLS-1$
}
Document doc = reader.document(matches.scoreDocs[0].doc);
String modelCoordinate = doc.get(classifier);
@@ -144,7 +144,7 @@ public class ModelRepositoryIndex implements Closeable, IModelRepositoryIndex {
}
return of(newArtifact(modelCoordinate));
} catch (Exception e) {
- log.error("Searching index failed with exception", e);
+ log.error("Searching index failed with exception", e); //$NON-NLS-1$
return absent();
}
}
diff --git a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/repo/RepositoryUtils.java b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/repo/RepositoryUtils.java
index b7e1663..18693fe 100644
--- a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/repo/RepositoryUtils.java
+++ b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/repo/RepositoryUtils.java
@@ -24,13 +24,13 @@ import com.google.common.net.InternetDomainName;
public class RepositoryUtils {
- public static String EXTENSION_MODELS = "zip";
+ public static String EXTENSION_MODELS = "zip"; //$NON-NLS-1$
- public static String CLASSIFIER_COMPLETION_CALLS = "call";
- public static String CLASSIFIER_COMPLETION_OVERRIDES = "ovrd";
- public static String CLASSIFIER_EXTDOC_OVERRIDE = "extdoc-ovrd";
- public static String CLASSIFIER_EXTDOC_OVERRIDE_PATTERNS = "extodc-ovrdp";
- public static String CLASSIFIER_EXTDOC_SELF_CALLS = "extdoc-self";
+ public static String CLASSIFIER_COMPLETION_CALLS = "call"; //$NON-NLS-1$
+ public static String CLASSIFIER_COMPLETION_OVERRIDES = "ovrd"; //$NON-NLS-1$
+ public static String CLASSIFIER_EXTDOC_OVERRIDE = "extdoc-ovrd"; //$NON-NLS-1$
+ public static String CLASSIFIER_EXTDOC_OVERRIDE_PATTERNS = "extodc-ovrdp"; //$NON-NLS-1$
+ public static String CLASSIFIER_EXTDOC_SELF_CALLS = "extdoc-self"; //$NON-NLS-1$
public static Artifact newArtifact(String coordinate) {
return new DefaultArtifact(coordinate);
@@ -41,14 +41,14 @@ public class RepositoryUtils {
// groupId:artifactId:packaging:classifier:version.
StringBuilder sb = new StringBuilder();
- sb.append(artifact.getGroupId()).append(":").append(artifact.getArtifactId()).append(":");
+ sb.append(artifact.getGroupId()).append(":").append(artifact.getArtifactId()).append(":"); //$NON-NLS-1$ //$NON-NLS-2$
if (artifact.getExtension() != null) {
- sb.append(artifact.getExtension()).append(":");
+ sb.append(artifact.getExtension()).append(":"); //$NON-NLS-1$
}
if (artifact.getClassifier() != null) {
- sb.append(artifact.getClassifier()).append(":");
+ sb.append(artifact.getClassifier()).append(":"); //$NON-NLS-1$
}
sb.append(artifact.getVersion());
@@ -57,17 +57,17 @@ public class RepositoryUtils {
}
public static String guessGroupId(String reverseDomainName) {
- String[] segments = split(reverseDomainName, ".");
+ String[] segments = split(reverseDomainName, "."); //$NON-NLS-1$
removeSlashes(segments);
String[] reverse = copyAndReverse(segments);
- InternetDomainName name = InternetDomainName.from(join(reverse, "."));
+ InternetDomainName name = InternetDomainName.from(join(reverse, ".")); //$NON-NLS-1$
if (!name.isUnderPublicSuffix()) {
return segments[0];
} else {
InternetDomainName topPrivateDomain = name.topPrivateDomain();
int size = topPrivateDomain.parts().size();
int end = Math.min(segments.length, size + 1);
- return join(subarray(segments, 0, end), ".");
+ return join(subarray(segments, 0, end), "."); //$NON-NLS-1$
}
}
@@ -79,7 +79,7 @@ public class RepositoryUtils {
private static void removeSlashes(String[] segments) {
for (int i = segments.length; i-- > 0;) {
- segments[i] = replace(segments[i], "/", "");
+ segments[i] = replace(segments[i], "/", ""); //$NON-NLS-1$ //$NON-NLS-2$
}
}
@@ -99,7 +99,7 @@ public class RepositoryUtils {
}
public static Artifact pom(Artifact a) {
- DefaultArtifact pom = new DefaultArtifact(a.getGroupId(), a.getArtifactId(), null, "pom", a.getVersion());
+ DefaultArtifact pom = new DefaultArtifact(a.getGroupId(), a.getArtifactId(), null, "pom", a.getVersion()); //$NON-NLS-1$
return pom;
}
diff --git a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/repo/TransferListener.java b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/repo/TransferListener.java
index dfdc27c..4603142 100644
--- a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/repo/TransferListener.java
+++ b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/repo/TransferListener.java
@@ -7,6 +7,7 @@
*
* Contributors:
* Marcel Bruch - initial API and implementation.
+ * Olav Lenz - externalize Strings.
*/
package org.eclipse.recommenders.internal.rcp.repo;
@@ -17,6 +18,7 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.recommenders.rcp.l10n.Messages;
import org.sonatype.aether.transfer.AbstractTransferListener;
import org.sonatype.aether.transfer.TransferEvent;
import org.sonatype.aether.transfer.TransferResource;
@@ -32,9 +34,12 @@ public class TransferListener extends AbstractTransferListener {
@Override
public void transferInitiated(TransferEvent event) {
- String mode = event.getRequestType() == TransferEvent.RequestType.PUT ? "Uploading" : "Downloading";
String resourceName = event.getResource().getRepositoryUrl() + event.getResource().getResourceName();
- monitor.subTask(format("%s: %s", mode, resourceName));
+ if (event.getRequestType() == TransferEvent.RequestType.PUT) {
+ monitor.subTask(format(Messages.TASK_UPLOADING, resourceName));
+ } else {
+ monitor.subTask(format(Messages.TASK_DOWNLOADING, resourceName));
+ }
}
@Override
@@ -56,23 +61,23 @@ public class TransferListener extends AbstractTransferListener {
public void transferSucceeded(TransferEvent event) {
TransferResource resource = event.getResource();
downloads.remove(resource);
- monitor.subTask("Finished transfer: " + resource.getResourceName());
+ monitor.subTask(String.format(Messages.STATUS_DOWNLOAD_FINISHED, resource.getResourceName()));
}
private String getStatus(long complete, long total) {
String status = byteCountToDisplaySize(complete);
if (total > 0)
- status += "/" + byteCountToDisplaySize(total);
+ status += "/" + byteCountToDisplaySize(total); //$NON-NLS-1$
return status;
}
@Override
public void transferFailed(TransferEvent event) {
- monitor.subTask("Transfer failed: " + event.getException().getLocalizedMessage());
+ monitor.subTask(String.format(Messages.STATUS_DOWNLOAD_FAILED, event.getException().getLocalizedMessage()));
}
@Override
public void transferCorrupted(TransferEvent event) {
- monitor.subTask("Transfer corrupted: " + event.getException().getLocalizedMessage());
+ monitor.subTask(String.format(Messages.STATUS_DOWNLOAD_CORRUPTED, event.getException().getLocalizedMessage()));
}
}
diff --git a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/repo/UpdateModelIndexJob.java b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/repo/UpdateModelIndexJob.java
index c0d8fc6..38062cd 100644
--- a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/repo/UpdateModelIndexJob.java
+++ b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/repo/UpdateModelIndexJob.java
@@ -7,6 +7,7 @@
*
* Contributors:
* Marcel Bruch - initial API and implementation.
+ * Olav Lenz - externalize Strings.
*/
package org.eclipse.recommenders.internal.rcp.repo;
@@ -19,6 +20,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.recommenders.rcp.l10n.Messages;
import org.eclipse.recommenders.rcp.repo.IModelRepository;
import org.eclipse.recommenders.rcp.repo.IModelRepositoryIndex;
import org.eclipse.recommenders.utils.Zips;
@@ -33,7 +35,7 @@ public class UpdateModelIndexJob extends Job {
private final IModelRepository repo;
public UpdateModelIndexJob(IModelRepositoryIndex index, IModelRepository repo) {
- super("Recommenders: Updating model index.");
+ super(Messages.JOB_UPDATE_MODEL_INDEX);
this.index = index;
this.repo = repo;
}
@@ -49,7 +51,7 @@ public class UpdateModelIndexJob extends Job {
downloadAndUnzipIndex(monitor);
}
} catch (Exception e) {
- log.warn("Updating index cancelled.", e);
+ log.warn("Updating index cancelled.", e); //$NON-NLS-1$
return Status.CANCEL_STATUS;
} finally {
index.open();
@@ -68,7 +70,7 @@ public class UpdateModelIndexJob extends Job {
repo.resolve(INDEX_ARTIFACT, monitor);
} catch (NullPointerException e) {
// we probably don't have internet... XXX this needs investigation
- log.warn("Couldn't download search index. No (direct) internet connection? Need a proxy?", e);
+ log.warn("Couldn't download search index. No (direct) internet connection? Need a proxy?", e); //$NON-NLS-1$
}
File f = repo.location(INDEX_ARTIFACT);
diff --git a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/ui/ModelsPreferencePage.java b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/ui/ModelsPreferencePage.java
index 60743c4..abe5de3 100644
--- a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/ui/ModelsPreferencePage.java
+++ b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/ui/ModelsPreferencePage.java
@@ -7,11 +7,13 @@
*
* Contributors:
* Patrick Gottschaemmer, Olav Lenz - initial API and implementation.
+ * Olav Lenz - externalize Strings.
*/
package org.eclipse.recommenders.internal.rcp.ui;
import static org.eclipse.recommenders.rcp.RecommendersPlugin.P_REPOSITORY_ENABLE_AUTO_DOWNLOAD;
import static org.eclipse.recommenders.rcp.RecommendersPlugin.P_REPOSITORY_URL;
+import static org.eclipse.recommenders.rcp.l10n.Messages.*;
import java.net.URI;
import java.net.URISyntaxException;
@@ -51,7 +53,7 @@ public class ModelsPreferencePage extends FieldEditorPreferencePage implements I
createRemoteRepositorySection();
Button clearCaches = new Button(getFieldEditorParent(), SWT.PUSH);
- clearCaches.setText("Clear Caches");
+ clearCaches.setText(PREFPAGE_CLEAR_CACHES);
GridData data = new GridData(SWT.END, SWT.CENTER, false, false);
data.horizontalSpan = 3;
clearCaches.setLayoutData(data);
@@ -68,27 +70,27 @@ public class ModelsPreferencePage extends FieldEditorPreferencePage implements I
layoutData.horizontalSpan = 3;
Label headline = new Label(getFieldEditorParent(), SWT.LEFT);
- headline.setText("Model Repository");
+ headline.setText(PREFPAGE_MODEL_REPOSITORY_HEADLINE);
headline.setLayoutData(layoutData);
headline.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
Label description = new Label(getFieldEditorParent(), SWT.LEFT);
- description.setText("All models used by Code Recommenders will be downloaded from this repository.");
+ description.setText(PREFPAGE_MODEL_REPOSITORY_INTRO);
description.setLayoutData(layoutData);
- StringButtonFieldEditor modelRepoFieldEditor = new StringButtonFieldEditor(P_REPOSITORY_URL, "URI:",
+ StringButtonFieldEditor modelRepoFieldEditor = new StringButtonFieldEditor(P_REPOSITORY_URL, PREFPAGE_URI,
getFieldEditorParent()) {
@Override
protected String changePressed() {
- InputDialog inputDialog = new InputDialog(getShell(), "Model Repository URI",
- "Please insert an URI for the Model Repository:", oldValue, new IInputValidator() {
+ InputDialog inputDialog = new InputDialog(getShell(), PREFPAGE_URI_MODEL_REPOSITORY,
+ PREFPAGE_URI_INSERT, oldValue, new IInputValidator() {
@Override
public String isValid(String newText) {
if (isValidRepoURI(newText)) {
return null;
} else {
- return "Invalid URI";
+ return PREFPAGE_URI_INVALID;
}
}
});
@@ -101,7 +103,7 @@ public class ModelsPreferencePage extends FieldEditorPreferencePage implements I
modelRepoFieldEditor.getTextControl(getFieldEditorParent()).setEnabled(false);
addField(modelRepoFieldEditor);
- addField(new BooleanFieldEditor(P_REPOSITORY_ENABLE_AUTO_DOWNLOAD, "Enable auto-download.",
+ addField(new BooleanFieldEditor(P_REPOSITORY_ENABLE_AUTO_DOWNLOAD, PREFPAGE_ENABLE_AUTO_DOWNLOAD,
getFieldEditorParent()));
}
diff --git a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/ui/PreferenceInitializer.java b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/ui/PreferenceInitializer.java
index bae24d8..8377c7c 100644
--- a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/ui/PreferenceInitializer.java
+++ b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/ui/PreferenceInitializer.java
@@ -19,7 +19,7 @@ import org.eclipse.recommenders.rcp.RecommendersPlugin;
public class PreferenceInitializer extends AbstractPreferenceInitializer {
- private static final String SERVER_URL = "http://download.eclipse.org/recommenders/models/juno/";
+ private static final String SERVER_URL = "http://download.eclipse.org/recommenders/models/juno/"; //$NON-NLS-1$
@Override
public void initializeDefaultPreferences() {
diff --git a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/ui/RecommendersPreferencePage.java b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/ui/RecommendersPreferencePage.java
index 1b41940..fdbf069 100644
--- a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/ui/RecommendersPreferencePage.java
+++ b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/ui/RecommendersPreferencePage.java
@@ -7,9 +7,12 @@
*
* Contributors:
* Marcel Bruch - initial API and implementation.
+ * Olav Lenz - externalize Strings.
*/
package org.eclipse.recommenders.internal.rcp.ui;
+import static org.eclipse.recommenders.rcp.l10n.Messages.PREFPAGE_OVERVIEW_INTRO;
+
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
@@ -21,7 +24,7 @@ public class RecommendersPreferencePage extends PreferencePage implements IWorkb
@Override
public void init(final IWorkbench workbench) {
- setDescription("Expand the tree to edit preferences for a specific feature.");
+ setDescription(PREFPAGE_OVERVIEW_INTRO);
}
@Override
diff --git a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/wiring/RecommendersModule.java b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/wiring/RecommendersModule.java
index e6c7b60..dd56ced 100644
--- a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/wiring/RecommendersModule.java
+++ b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/wiring/RecommendersModule.java
@@ -103,7 +103,7 @@ public class RecommendersModule extends AbstractModule implements Module {
protected IClasspathEntryInfoProvider configurePackageFragmentRootInfoProvider(final EventBus bus,
IWorkspaceRoot workspace) {
Bundle bundle = FrameworkUtil.getBundle(getClass());
- File stateLocation = new File(Platform.getStateLocation(bundle).toFile(), "v0.5-package-root-infos.json");
+ File stateLocation = new File(Platform.getStateLocation(bundle).toFile(), "v0.5-package-root-infos.json"); //$NON-NLS-1$
final IClasspathEntryInfoProvider cpeInfoProvider =
new ClasspathEntryInfoProvider(stateLocation, workspace, bus);
@@ -147,7 +147,7 @@ public class RecommendersModule extends AbstractModule implements Module {
Bundle bundle = FrameworkUtil.getBundle(getClass());
File stateLocation = Platform.getStateLocation(bundle).toFile();
- File repo = new File(stateLocation, "repository");
+ File repo = new File(stateLocation, "repository"); //$NON-NLS-1$
repo.mkdirs();
RecommendersPlugin plugin = RecommendersPlugin.getDefault();
IPreferenceStore store = plugin.getPreferenceStore();
@@ -159,7 +159,7 @@ public class RecommendersModule extends AbstractModule implements Module {
);
bind(IModelRepository.class).to(ModelRepository.class).in(Scopes.SINGLETON);
- File index = new File(stateLocation, "index");
+ File index = new File(stateLocation, "index"); //$NON-NLS-1$
index.mkdirs();
bind(File.class).annotatedWith(ModelRepositoryIndexLocation.class).toInstance(index);
bind(IModelRepositoryIndex.class).to(ModelRepositoryIndex.class).in(Scopes.SINGLETON);
@@ -242,10 +242,10 @@ public class RecommendersModule extends AbstractModule implements Module {
final ExecutorService pool =
coreThreadsTimoutExecutor(numberOfCores + 1,
MIN_PRIORITY,
- "Recommenders-Bus-Thread-",
+ "Recommenders-Bus-Thread-", //$NON-NLS-1$
1L,
TimeUnit.MINUTES);
- final EventBus bus = new AsyncEventBus("Code Recommenders asychronous Workspace Event Bus", pool);
+ final EventBus bus = new AsyncEventBus("Code Recommenders asychronous Workspace Event Bus", pool); //$NON-NLS-1$
return bus;
}
@@ -253,7 +253,7 @@ public class RecommendersModule extends AbstractModule implements Module {
@Singleton
protected JavaSelectionProvider provideJavaSelectionProvider(final EventBus bus) {
final JavaSelectionProvider provider = new JavaSelectionProvider(bus);
- new UIJob("Registering workbench selection listener.") {
+ new UIJob("Registering workbench selection listener.") { //$NON-NLS-1$
{
schedule();
}
@@ -324,7 +324,7 @@ public class RecommendersModule extends AbstractModule implements Module {
task.get(2, TimeUnit.SECONDS);
}
} catch (final Exception e) {
- RecommendersPlugin.logError(e, "Could not run 'active page finder' that early!");
+ RecommendersPlugin.logError(e, "Could not run 'active page finder' that early!"); //$NON-NLS-1$
}
return finder;
}
diff --git a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/rcp/ClasspathEntryInfo.java b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/rcp/ClasspathEntryInfo.java
index 904d04b..7ca45f3 100644
--- a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/rcp/ClasspathEntryInfo.java
+++ b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/rcp/ClasspathEntryInfo.java
@@ -22,11 +22,11 @@ import org.eclipse.recommenders.utils.Version;
public class ClasspathEntryInfo {
public static final ClasspathEntryInfo NULL = new ClasspathEntryInfo();
- public static final String P_LAST_MOD = "modificationDate";
- public static final String P_LOCATION = "location";
- public static final String P_FINGERPRINT = "fingerprint";
- public static final String P_VERSION = "version";
- public static final String P_SYMBOLIC_NAME = "symbolicName";
+ public static final String P_LAST_MOD = "modificationDate"; //$NON-NLS-1$
+ public static final String P_LOCATION = "location"; //$NON-NLS-1$
+ public static final String P_FINGERPRINT = "fingerprint"; //$NON-NLS-1$
+ public static final String P_VERSION = "version"; //$NON-NLS-1$
+ public static final String P_SYMBOLIC_NAME = "symbolicName"; //$NON-NLS-1$
private String symbolicName;
private Version version = Version.UNKNOWN;
diff --git a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/rcp/RecommendersPlugin.java b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/rcp/RecommendersPlugin.java
index 1a6b4e8..8217cac 100644
--- a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/rcp/RecommendersPlugin.java
+++ b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/rcp/RecommendersPlugin.java
@@ -18,8 +18,8 @@ import org.osgi.framework.BundleContext;
public class RecommendersPlugin extends AbstractUIPlugin {
private static RecommendersPlugin plugin;
- public static String P_REPOSITORY_URL = "recommenders.repository.url";
- public static String P_REPOSITORY_ENABLE_AUTO_DOWNLOAD = "recommenders.repository.auto.download";
+ public static String P_REPOSITORY_URL = "recommenders.repository.url"; //$NON-NLS-1$
+ public static String P_REPOSITORY_ENABLE_AUTO_DOWNLOAD = "recommenders.repository.auto.download"; //$NON-NLS-1$
public static RecommendersPlugin getDefault() {
return plugin;
diff --git a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/rcp/events/JavaSelectionEvent.java b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/rcp/events/JavaSelectionEvent.java
index 7a59544..0145afb 100644
--- a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/rcp/events/JavaSelectionEvent.java
+++ b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/rcp/events/JavaSelectionEvent.java
@@ -58,7 +58,7 @@ public class JavaSelectionEvent {
@Override
public boolean equals(final Object obj) {
- final boolean sameElementAndSameLocation = reflectionEquals(obj, this, "selection");
+ final boolean sameElementAndSameLocation = reflectionEquals(obj, this, "selection"); //$NON-NLS-1$
if (!sameElementAndSameLocation) {
return false;
}
diff --git a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/rcp/l10n/Messages.java b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/rcp/l10n/Messages.java
new file mode 100644
index 0000000..3adfb61
--- /dev/null
+++ b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/rcp/l10n/Messages.java
@@ -0,0 +1,44 @@
+/**
+ * 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.rcp.l10n;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.recommenders.rcp.l10n.messages"; //$NON-NLS-1$
+ public static String JOB_INITIALIZE_PROJECTS;
+ public static String JOB_UPDATE_MODEL_INDEX;
+ public static String JOB_CLEAR_MODEL_REPOSITORY;
+ public static String JOB_RESOLVING_MODEL;
+ public static String TASK_RESOLVING;
+ public static String TASK_LOOKING_FOR_MODEL;
+ public static String TASK_DOWNLOADING;
+ public static String TASK_UPLOADING;
+ public static String STATUS_DOWNLOAD_FINISHED;
+ public static String STATUS_DOWNLOAD_CORRUPTED;
+ public static String STATUS_DOWNLOAD_FAILED;
+ public static String PREFPAGE_OVERVIEW_INTRO;
+ public static String PREFPAGE_CLEAR_CACHES;
+ public static String PREFPAGE_ENABLE_AUTO_DOWNLOAD;
+ public static String PREFPAGE_MODEL_REPOSITORY_HEADLINE;
+ public static String PREFPAGE_MODEL_REPOSITORY_INTRO;
+ public static String PREFPAGE_URI;
+ public static String PREFPAGE_URI_INSERT;
+ public static String PREFPAGE_URI_INVALID;
+ public static String PREFPAGE_URI_MODEL_REPOSITORY;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/rcp/l10n/messages.properties b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/rcp/l10n/messages.properties
new file mode 100644
index 0000000..d35da6c
--- /dev/null
+++ b/plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/rcp/l10n/messages.properties
@@ -0,0 +1,20 @@
+JOB_INITIALIZE_PROJECTS=Initializing projects with recommenders nature
+JOB_UPDATE_MODEL_INDEX=Recommenders: Updating model index.
+JOB_CLEAR_MODEL_REPOSITORY=Clearing model repository...
+JOB_RESOLVING_MODEL=Resolving model for %1$s ...
+TASK_RESOLVING=Resolving...
+TASK_LOOKING_FOR_MODEL=Looking for '%1$s' model for %2$s
+TASK_DOWNLOADING=Downloading: %1$s
+TASK_UPLOADING=Uploading: %1$s
+STATUS_DOWNLOAD_FINISHED=Download finished: %1$s
+STATUS_DOWNLOAD_CORRUPTED=Download corrupted: %1$s
+STATUS_DOWNLOAD_FAILED=Download failed: %1$s
+PREFPAGE_OVERVIEW_INTRO=Expand the tree to edit preferences for a specific feature.
+PREFPAGE_CLEAR_CACHES=Clear Caches
+PREFPAGE_ENABLE_AUTO_DOWNLOAD=Enable auto-download
+PREFPAGE_MODEL_REPOSITORY_HEADLINE=Model Repository
+PREFPAGE_MODEL_REPOSITORY_INTRO=All models used by Code Recommenders will be downloaded from this repository.
+PREFPAGE_URI=URI:
+PREFPAGE_URI_INSERT=Please insert an URI for the Model Repository:
+PREFPAGE_URI_INVALID=Invalid URI
+PREFPAGE_URI_MODEL_REPOSITORY=Model Repository URI