diff options
author | spingel | 2008-12-03 04:39:16 +0000 |
---|---|---|
committer | spingel | 2008-12-03 04:39:16 +0000 |
commit | c01b999e6db2841004b0bd2a9db7e7b776ccb09a (patch) | |
tree | 740a999f6dd3c689d6983eb6b7a770e5bf34fc66 | |
parent | eb59fb995c975c5ce370d3690f528235eb37ad8b (diff) | |
download | org.eclipse.mylyn.tasks-c01b999e6db2841004b0bd2a9db7e7b776ccb09a.tar.gz org.eclipse.mylyn.tasks-c01b999e6db2841004b0bd2a9db7e7b776ccb09a.tar.xz org.eclipse.mylyn.tasks-c01b999e6db2841004b0bd2a9db7e7b776ccb09a.zip |
NEW - bug 253130: externalize strings for org.eclipse.mylyn.trac.* in Extras
https://bugs.eclipse.org/bugs/show_bug.cgi?id=253130
31 files changed, 592 insertions, 403 deletions
diff --git a/org.eclipse.mylyn.trac.core/META-INF/MANIFEST.MF b/org.eclipse.mylyn.trac.core/META-INF/MANIFEST.MF index 6e47c16b7..befdabc93 100644 --- a/org.eclipse.mylyn.trac.core/META-INF/MANIFEST.MF +++ b/org.eclipse.mylyn.trac.core/META-INF/MANIFEST.MF @@ -1,9 +1,9 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 -Bundle-Name: Mylyn Trac Connector Core +Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.eclipse.mylyn.trac.core;singleton:=true Bundle-Version: 3.1.0.qualifier -Bundle-Vendor: Eclipse.org +Bundle-Vendor: %Bundle-Vendor Require-Bundle: org.eclipse.core.runtime, org.eclipse.mylyn.context.core;bundle-version="[3.0.0,4.0.0)", org.eclipse.mylyn.tasks.core;bundle-version="[3.0.0,4.0.0)", @@ -17,3 +17,4 @@ Export-Package: org.eclipse.mylyn.internal.trac.core;x-friends:="org.eclipse.myl org.eclipse.mylyn.internal.trac.core.util;x-friends:="org.eclipse.mylyn.trac.ui" Bundle-Activator: org.eclipse.mylyn.internal.trac.core.TracCorePlugin Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-Localization: plugin diff --git a/org.eclipse.mylyn.trac.core/build.properties b/org.eclipse.mylyn.trac.core/build.properties index 185839e9f..96bc39e03 100644 --- a/org.eclipse.mylyn.trac.core/build.properties +++ b/org.eclipse.mylyn.trac.core/build.properties @@ -10,5 +10,6 @@ source.. = src/ output.. = bin/ bin.includes = META-INF/,\ .,\ - about.html + about.html,\ + plugin.properties src.includes = about.html diff --git a/org.eclipse.mylyn.trac.core/plugin.properties b/org.eclipse.mylyn.trac.core/plugin.properties new file mode 100644 index 000000000..5062864aa --- /dev/null +++ b/org.eclipse.mylyn.trac.core/plugin.properties @@ -0,0 +1,3 @@ +#Properties file for org.eclipse.mylyn.trac.core +Bundle-Vendor = Eclipse.org +Bundle-Name = Mylyn Trac Connector Core diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/Messages.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/Messages.java new file mode 100644 index 000000000..b1269dce0 --- /dev/null +++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/Messages.java @@ -0,0 +1,87 @@ +/******************************************************************************* + * Copyright (c) 2004, 2008 Tasktop Technologies and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tasktop Technologies - initial API and implementation + *******************************************************************************/ + +package org.eclipse.mylyn.internal.trac.core; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.mylyn.internal.trac.core.messages"; //$NON-NLS-1$ + + static { + // load message values from bundle file + reloadMessages(); + } + + public static void reloadMessages() { + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + public static String TracAttachmentHandler_Uploading_attachment; + + public static String TracAttribute_Assigned_to; + + public static String TracAttribute_CC; + + public static String TracAttribute_Component; + + public static String TracAttribute_Created; + + public static String TracAttribute_Description; + + public static String TracAttribute_ID; + + public static String TracAttribute_Keywords; + + public static String TracAttribute_Last_Modification; + + public static String TracAttribute_Milestone; + + public static String TracAttribute_Priority; + + public static String TracAttribute_Reporter; + + public static String TracAttribute_Resolution; + + public static String TracAttribute_Severity; + + public static String TracAttribute_Status; + + public static String TracAttribute_Summary; + + public static String TracAttribute_Type; + + public static String TracAttribute_Version; + + public static String TracCorePlugin_I_O_error_has_occured; + + public static String TracCorePlugin_Repository_URL_is_invalid; + + public static String TracCorePlugin_the_SERVER_RETURNED_an_UNEXPECTED_RESOPNSE; + + public static String TracCorePlugin_Unexpected_error; + + public static String TracCorePlugin_Unexpected_server_response_; + + public static String TracRepositoryConnector_Getting_changed_tasks; + + public static String TracRepositoryConnector_Querying_repository; + + public static String TracRepositoryConnector_TRAC_SUPPORTS_0_9_OR_0_10_THROUGH_WEB_AND_XML_RPC; + + public static String TracWikiHandler_Download_Wiki_Page; + + public static String TracWikiHandler_Download_Wiki_Page_Names; + + public static String TracWikiHandler_Retrieve_Wiki_Page_History; + + public static String TracWikiHandler_Upload_Wiki_Page; +} diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracAttachmentHandler.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracAttachmentHandler.java index f789230a5..ac6c674cf 100644 --- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracAttachmentHandler.java +++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracAttachmentHandler.java @@ -46,8 +46,8 @@ public class TracAttachmentHandler extends AbstractTaskAttachmentHandler { String filename = mapper.getFileName(); if (filename == null || filename.length() == 0) { throw new CoreException(new RepositoryStatus(repository.getRepositoryUrl(), IStatus.ERROR, - TracCorePlugin.ID_PLUGIN, RepositoryStatus.ERROR_REPOSITORY, "Attachment download from " - + repository.getRepositoryUrl() + " failed, missing attachment filename.")); + TracCorePlugin.ID_PLUGIN, RepositoryStatus.ERROR_REPOSITORY, "Attachment download from " //$NON-NLS-1$ + + repository.getRepositoryUrl() + " failed, missing attachment filename.")); //$NON-NLS-1$ } try { @@ -67,7 +67,7 @@ public class TracAttachmentHandler extends AbstractTaskAttachmentHandler { if (!TracRepositoryConnector.hasAttachmentSupport(repository, task)) { throw new CoreException(new RepositoryStatus(repository.getRepositoryUrl(), IStatus.INFO, TracCorePlugin.ID_PLUGIN, RepositoryStatus.ERROR_REPOSITORY, - "Attachments are not supported by this repository access type")); + "Attachments are not supported by this repository access type")); //$NON-NLS-1$ } String filename = source.getName(); @@ -82,12 +82,12 @@ public class TracAttachmentHandler extends AbstractTaskAttachmentHandler { } } if (description == null) { - description = ""; + description = ""; //$NON-NLS-1$ } monitor = Policy.monitorFor(monitor); try { - monitor.beginTask("Uploading attachment", IProgressMonitor.UNKNOWN); + monitor.beginTask(Messages.TracAttachmentHandler_Uploading_attachment, IProgressMonitor.UNKNOWN); try { ITracClient client = connector.getClientManager().getTracClient(repository); int id = Integer.parseInt(task.getTaskId()); diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracAttribute.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracAttribute.java index 75720e652..23f2c84b2 100644 --- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracAttribute.java +++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracAttribute.java @@ -24,40 +24,40 @@ import org.eclipse.mylyn.tasks.core.data.TaskAttribute; */ public enum TracAttribute { - CC(Key.CC, "CC:", TaskAttribute.USER_CC, TaskAttribute.TYPE_SHORT_TEXT, Flag.PEOPLE), + CC(Key.CC, Messages.TracAttribute_CC, TaskAttribute.USER_CC, TaskAttribute.TYPE_SHORT_TEXT, Flag.PEOPLE), - CHANGE_TIME(Key.CHANGE_TIME, "Last Modification:", TaskAttribute.DATE_MODIFICATION, TaskAttribute.TYPE_DATE, + CHANGE_TIME(Key.CHANGE_TIME, Messages.TracAttribute_Last_Modification, TaskAttribute.DATE_MODIFICATION, TaskAttribute.TYPE_DATE, Flag.READ_ONLY), - COMPONENT(Key.COMPONENT, "Component:", TaskAttribute.PRODUCT, TaskAttribute.TYPE_SINGLE_SELECT, Flag.ATTRIBUTE), + COMPONENT(Key.COMPONENT, Messages.TracAttribute_Component, TaskAttribute.PRODUCT, TaskAttribute.TYPE_SINGLE_SELECT, Flag.ATTRIBUTE), - DESCRIPTION(Key.DESCRIPTION, "Description:", TaskAttribute.DESCRIPTION, TaskAttribute.TYPE_LONG_RICH_TEXT), + DESCRIPTION(Key.DESCRIPTION, Messages.TracAttribute_Description, TaskAttribute.DESCRIPTION, TaskAttribute.TYPE_LONG_RICH_TEXT), - ID(Key.ID, "ID:", TaskAttribute.TASK_KEY, TaskAttribute.TYPE_SHORT_TEXT, Flag.PEOPLE), + ID(Key.ID, Messages.TracAttribute_ID, TaskAttribute.TASK_KEY, TaskAttribute.TYPE_SHORT_TEXT, Flag.PEOPLE), - KEYWORDS(Key.KEYWORDS, "Keywords:", TaskAttribute.KEYWORDS, TaskAttribute.TYPE_SHORT_TEXT, Flag.ATTRIBUTE), + KEYWORDS(Key.KEYWORDS, Messages.TracAttribute_Keywords, TaskAttribute.KEYWORDS, TaskAttribute.TYPE_SHORT_TEXT, Flag.ATTRIBUTE), - MILESTONE(Key.MILESTONE, "Milestone:", null, TaskAttribute.TYPE_SINGLE_SELECT, Flag.ATTRIBUTE), + MILESTONE(Key.MILESTONE, Messages.TracAttribute_Milestone, null, TaskAttribute.TYPE_SINGLE_SELECT, Flag.ATTRIBUTE), - OWNER(Key.OWNER, "Assigned to:", TaskAttribute.USER_ASSIGNED, TaskAttribute.TYPE_PERSON, Flag.PEOPLE), + OWNER(Key.OWNER, Messages.TracAttribute_Assigned_to, TaskAttribute.USER_ASSIGNED, TaskAttribute.TYPE_PERSON, Flag.PEOPLE), - PRIORITY(Key.PRIORITY, "Priority:", TaskAttribute.PRIORITY, TaskAttribute.TYPE_SINGLE_SELECT, Flag.ATTRIBUTE), + PRIORITY(Key.PRIORITY, Messages.TracAttribute_Priority, TaskAttribute.PRIORITY, TaskAttribute.TYPE_SINGLE_SELECT, Flag.ATTRIBUTE), - REPORTER(Key.REPORTER, "Reporter:", TaskAttribute.USER_REPORTER, TaskAttribute.TYPE_PERSON, Flag.READ_ONLY), + REPORTER(Key.REPORTER, Messages.TracAttribute_Reporter, TaskAttribute.USER_REPORTER, TaskAttribute.TYPE_PERSON, Flag.READ_ONLY), - RESOLUTION(Key.RESOLUTION, "Resolution:", TaskAttribute.RESOLUTION, TaskAttribute.TYPE_SINGLE_SELECT), + RESOLUTION(Key.RESOLUTION, Messages.TracAttribute_Resolution, TaskAttribute.RESOLUTION, TaskAttribute.TYPE_SINGLE_SELECT), - SEVERITY(Key.SEVERITY, "Severity:", null, TaskAttribute.TYPE_SINGLE_SELECT, Flag.ATTRIBUTE), + SEVERITY(Key.SEVERITY, Messages.TracAttribute_Severity, null, TaskAttribute.TYPE_SINGLE_SELECT, Flag.ATTRIBUTE), - STATUS(Key.STATUS, "Status:", TaskAttribute.STATUS, TaskAttribute.TYPE_SHORT_TEXT), + STATUS(Key.STATUS, Messages.TracAttribute_Status, TaskAttribute.STATUS, TaskAttribute.TYPE_SHORT_TEXT), - SUMMARY(Key.SUMMARY, "Summary:", TaskAttribute.SUMMARY, TaskAttribute.TYPE_SHORT_RICH_TEXT), + SUMMARY(Key.SUMMARY, Messages.TracAttribute_Summary, TaskAttribute.SUMMARY, TaskAttribute.TYPE_SHORT_RICH_TEXT), - TIME(Key.TIME, "Created:", TaskAttribute.DATE_CREATION, TaskAttribute.TYPE_DATE, Flag.READ_ONLY), + TIME(Key.TIME, Messages.TracAttribute_Created, TaskAttribute.DATE_CREATION, TaskAttribute.TYPE_DATE, Flag.READ_ONLY), - TYPE(Key.TYPE, "Type:", TaskAttribute.TASK_KIND, TaskAttribute.TYPE_SINGLE_SELECT, Flag.ATTRIBUTE), + TYPE(Key.TYPE, Messages.TracAttribute_Type, TaskAttribute.TASK_KIND, TaskAttribute.TYPE_SINGLE_SELECT, Flag.ATTRIBUTE), - VERSION(Key.VERSION, "Version:", null, TaskAttribute.TYPE_SINGLE_SELECT, Flag.ATTRIBUTE); + VERSION(Key.VERSION, Messages.TracAttribute_Version, null, TaskAttribute.TYPE_SINGLE_SELECT, Flag.ATTRIBUTE); static Map<String, TracAttribute> attributeByTracKey = new HashMap<String, TracAttribute>(); diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracAttributeMapper.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracAttributeMapper.java index c77de7018..f32b57d41 100644 --- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracAttributeMapper.java +++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracAttributeMapper.java @@ -30,9 +30,9 @@ public class TracAttributeMapper extends TaskAttributeMapper { READ_ONLY, ATTRIBUTE, PEOPLE }; - public static final String NEW_CC = "task.common.newcc"; + public static final String NEW_CC = "task.common.newcc"; //$NON-NLS-1$ - public static final String REMOVE_CC = "task.common.removecc"; + public static final String REMOVE_CC = "task.common.removecc"; //$NON-NLS-1$ public static final EnumSet<Flag> NO_FLAGS = EnumSet.noneOf(Flag.class); @@ -67,7 +67,7 @@ public class TracAttributeMapper extends TaskAttributeMapper { if (date == null) { attribute.clearValues(); } else { - attribute.setValue(TracUtil.toTracTime(date) + ""); + attribute.setValue(TracUtil.toTracTime(date) + ""); //$NON-NLS-1$ } } diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracClientFactory.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracClientFactory.java index 4556e7b02..cb4adf67d 100644 --- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracClientFactory.java +++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracClientFactory.java @@ -34,7 +34,7 @@ public class TracClientFactory { return new TracXmlRpcClient(location, version); } - throw new RuntimeException("Invalid repository version: " + version); + throw new RuntimeException("Invalid repository version: " + version); //$NON-NLS-1$ } /** diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracClientManager.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracClientManager.java index 003852d1f..7887ed77c 100644 --- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracClientManager.java +++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracClientManager.java @@ -113,7 +113,7 @@ public class TracClientManager implements IRepositoryListener { } } catch (Throwable e) { StatusHandler.log(new Status(IStatus.WARNING, TracCorePlugin.ID_PLUGIN, - "The Trac respository configuration cache could not be read", e)); + "The Trac respository configuration cache could not be read", e)); //$NON-NLS-1$ } finally { if (in != null) { try { @@ -141,7 +141,7 @@ public class TracClientManager implements IRepositoryListener { } } catch (IOException e) { StatusHandler.log(new Status(IStatus.WARNING, TracCorePlugin.ID_PLUGIN, - "The Trac respository configuration cache could not be written", e)); + "The Trac respository configuration cache could not be written", e)); //$NON-NLS-1$ } finally { if (out != null) { try { diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracCorePlugin.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracCorePlugin.java index 121b8c92f..7a6f94c63 100644 --- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracCorePlugin.java +++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracCorePlugin.java @@ -33,13 +33,13 @@ import org.osgi.framework.BundleContext; */ public class TracCorePlugin extends Plugin { - public static final String ID_PLUGIN = "org.eclipse.mylyn.trac.core"; + public static final String ID_PLUGIN = "org.eclipse.mylyn.trac.core"; //$NON-NLS-1$ - public static final String ENCODING_UTF_8 = "UTF-8"; + public static final String ENCODING_UTF_8 = "UTF-8"; //$NON-NLS-1$ private static TracCorePlugin plugin; - public final static String CONNECTOR_KIND = "trac"; + public final static String CONNECTOR_KIND = "trac"; //$NON-NLS-1$ private TracRepositoryConnector connector; @@ -80,7 +80,7 @@ public class TracCorePlugin extends Plugin { */ protected IPath getRepostioryAttributeCachePath() { IPath stateLocation = Platform.getStateLocation(getBundle()); - IPath cacheFile = stateLocation.append("repositoryConfigurations"); + IPath cacheFile = stateLocation.append("repositoryConfigurations"); //$NON-NLS-1$ return cacheFile; } @@ -91,22 +91,22 @@ public class TracCorePlugin extends Plugin { return TracUtil.createPermissionDeniedError(repository.getRepositoryUrl(), ID_PLUGIN); } else if (e instanceof InvalidTicketException) { return new RepositoryStatus(repository.getRepositoryUrl(), IStatus.ERROR, ID_PLUGIN, - RepositoryStatus.ERROR_IO, "The server returned an unexpected response", e); + RepositoryStatus.ERROR_IO, Messages.TracCorePlugin_the_SERVER_RETURNED_an_UNEXPECTED_RESOPNSE, e); } else if (e instanceof TracException) { String message = e.getMessage(); if (message == null) { - message = "I/O error has occured"; + message = Messages.TracCorePlugin_I_O_error_has_occured; } return new RepositoryStatus(repository.getRepositoryUrl(), IStatus.ERROR, ID_PLUGIN, RepositoryStatus.ERROR_IO, message, e); } else if (e instanceof ClassCastException) { return new RepositoryStatus(IStatus.ERROR, ID_PLUGIN, RepositoryStatus.ERROR_IO, - "Unexpected server response: " + e.getMessage(), e); + Messages.TracCorePlugin_Unexpected_server_response_ + e.getMessage(), e); } else if (e instanceof MalformedURLException) { return new RepositoryStatus(IStatus.ERROR, ID_PLUGIN, RepositoryStatus.ERROR_IO, - "Repository URL is invalid", e); + Messages.TracCorePlugin_Repository_URL_is_invalid, e); } else { - return new RepositoryStatus(IStatus.ERROR, ID_PLUGIN, RepositoryStatus.ERROR_INTERNAL, "Unexpected error", + return new RepositoryStatus(IStatus.ERROR, ID_PLUGIN, RepositoryStatus.ERROR_INTERNAL, Messages.TracCorePlugin_Unexpected_error, e); } } diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracRepositoryConnector.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracRepositoryConnector.java index a3ba6d167..03012f9f1 100644 --- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracRepositoryConnector.java +++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracRepositoryConnector.java @@ -65,13 +65,13 @@ public class TracRepositoryConnector extends AbstractRepositoryConnector { if (type == null) { return null; } - if (type.equals("Defect")) { + if (type.equals("Defect")) { //$NON-NLS-1$ return DEFECT; } - if (type.equals("Enhancement")) { + if (type.equals("Enhancement")) { //$NON-NLS-1$ return ENHANCEMENT; } - if (type.equals("Task")) { + if (type.equals("Task")) { //$NON-NLS-1$ return TASK; } return null; @@ -81,13 +81,13 @@ public class TracRepositoryConnector extends AbstractRepositoryConnector { if (type == null) { return null; } - if (type.equals("defect")) { + if (type.equals("defect")) { //$NON-NLS-1$ return DEFECT; } - if (type.equals("enhancement")) { + if (type.equals("enhancement")) { //$NON-NLS-1$ return ENHANCEMENT; } - if (type.equals("task")) { + if (type.equals("task")) { //$NON-NLS-1$ return TASK; } return null; @@ -97,13 +97,13 @@ public class TracRepositoryConnector extends AbstractRepositoryConnector { public String toString() { switch (this) { case DEFECT: - return "Defect"; + return "Defect"; //$NON-NLS-1$ case ENHANCEMENT: - return "Enhancement"; + return "Enhancement"; //$NON-NLS-1$ case TASK: - return "Task"; + return "Task"; //$NON-NLS-1$ default: - return ""; + return ""; //$NON-NLS-1$ } } @@ -116,16 +116,16 @@ public class TracRepositoryConnector extends AbstractRepositoryConnector { if (status == null) { return null; } - if (status.equals("new")) { + if (status.equals("new")) { //$NON-NLS-1$ return NEW; } - if (status.equals("assigned")) { + if (status.equals("assigned")) { //$NON-NLS-1$ return ASSIGNED; } - if (status.equals("reopened")) { + if (status.equals("reopened")) { //$NON-NLS-1$ return REOPENED; } - if (status.equals("closed")) { + if (status.equals("closed")) { //$NON-NLS-1$ return CLOSED; } return null; @@ -134,15 +134,15 @@ public class TracRepositoryConnector extends AbstractRepositoryConnector { public String toStatusString() { switch (this) { case NEW: - return "new"; + return "new"; //$NON-NLS-1$ case ASSIGNED: - return "assigned"; + return "assigned"; //$NON-NLS-1$ case REOPENED: - return "reopened"; + return "reopened"; //$NON-NLS-1$ case CLOSED: - return "closed"; + return "closed"; //$NON-NLS-1$ default: - return ""; + return ""; //$NON-NLS-1$ } } @@ -150,15 +150,15 @@ public class TracRepositoryConnector extends AbstractRepositoryConnector { public String toString() { switch (this) { case NEW: - return "New"; + return "New"; //$NON-NLS-1$ case ASSIGNED: - return "Assigned"; + return "Assigned"; //$NON-NLS-1$ case REOPENED: - return "Reopened"; + return "Reopened"; //$NON-NLS-1$ case CLOSED: - return "Closed"; + return "Closed"; //$NON-NLS-1$ default: - return ""; + return ""; //$NON-NLS-1$ } } @@ -171,19 +171,19 @@ public class TracRepositoryConnector extends AbstractRepositoryConnector { if (priority == null) { return null; } - if (priority.equals("blocker")) { + if (priority.equals("blocker")) { //$NON-NLS-1$ return BLOCKER; } - if (priority.equals("critical")) { + if (priority.equals("critical")) { //$NON-NLS-1$ return CRITICAL; } - if (priority.equals("major")) { + if (priority.equals("major")) { //$NON-NLS-1$ return MAJOR; } - if (priority.equals("minor")) { + if (priority.equals("minor")) { //$NON-NLS-1$ return MINOR; } - if (priority.equals("trivial")) { + if (priority.equals("trivial")) { //$NON-NLS-1$ return TRIVIAL; } return null; @@ -210,30 +210,30 @@ public class TracRepositoryConnector extends AbstractRepositoryConnector { public String toString() { switch (this) { case BLOCKER: - return "blocker"; + return "blocker"; //$NON-NLS-1$ case CRITICAL: - return "critical"; + return "critical"; //$NON-NLS-1$ case MAJOR: - return "major"; + return "major"; //$NON-NLS-1$ case MINOR: - return "minor"; + return "minor"; //$NON-NLS-1$ case TRIVIAL: - return "trivial"; + return "trivial"; //$NON-NLS-1$ default: return null; } } } - private final static String CLIENT_LABEL = "Trac (supports 0.9 or 0.10 through Web and XML-RPC)"; + private final static String CLIENT_LABEL = Messages.TracRepositoryConnector_TRAC_SUPPORTS_0_9_OR_0_10_THROUGH_WEB_AND_XML_RPC; private final static Date DEFAULT_COMPLETION_DATE = new Date(0); private static int TASK_PRIORITY_LEVELS = 5; - public static final String TASK_KEY_SUPPORTS_SUBTASKS = "SupportsSubtasks"; + public static final String TASK_KEY_SUPPORTS_SUBTASKS = "SupportsSubtasks"; //$NON-NLS-1$ - public static final String TASK_KEY_UPDATE_DATE = "UpdateDate"; + public static final String TASK_KEY_UPDATE_DATE = "UpdateDate"; //$NON-NLS-1$ public static String getDisplayUsername(TaskRepository repository) { AuthenticationCredentials credentials = repository.getCredentials(AuthenticationType.REPOSITORY); @@ -273,7 +273,7 @@ public class TracRepositoryConnector extends AbstractRepositoryConnector { return Integer.parseInt(taskId); } catch (NumberFormatException e) { throw new CoreException(new Status(IStatus.ERROR, TracCorePlugin.ID_PLUGIN, IStatus.OK, - "Invalid ticket id: " + taskId, e)); + "Invalid ticket id: " + taskId, e)); //$NON-NLS-1$ } } @@ -291,7 +291,7 @@ public class TracRepositoryConnector extends AbstractRepositoryConnector { if (attribute != null) { return attribute.getValue(); } else { - return ""; + return ""; //$NON-NLS-1$ } } @@ -408,7 +408,7 @@ public class TracRepositoryConnector extends AbstractRepositoryConnector { @Override public String getTaskIdPrefix() { - return "#"; + return "#"; //$NON-NLS-1$ } public TaskRepositoryLocationFactory getTaskRepositoryLocationFactory() { @@ -437,12 +437,12 @@ public class TracRepositoryConnector extends AbstractRepositoryConnector { public IStatus performQuery(TaskRepository repository, IRepositoryQuery query, TaskDataCollector resultCollector, ISynchronizationSession session, IProgressMonitor monitor) { try { - monitor.beginTask("Querying repository", IProgressMonitor.UNKNOWN); + monitor.beginTask(Messages.TracRepositoryConnector_Querying_repository, IProgressMonitor.UNKNOWN); TracSearch search = TracUtil.toTracSearch(query); if (search == null) { return new RepositoryStatus(repository.getRepositoryUrl(), IStatus.ERROR, TracCorePlugin.ID_PLUGIN, - RepositoryStatus.ERROR_REPOSITORY, "The query is invalid: \"" + query.getUrl() + "\""); + RepositoryStatus.ERROR_REPOSITORY, "The query is invalid: \"" + query.getUrl() + "\""); //$NON-NLS-1$ //$NON-NLS-2$ } ITracClient client; @@ -463,7 +463,7 @@ public class TracRepositoryConnector extends AbstractRepositoryConnector { taskById.put(task.getTaskId(), task); } } - ITask task = taskById.get(ticket.getId() + ""); + ITask task = taskById.get(ticket.getId() + ""); //$NON-NLS-1$ if (task != null && hasTaskChanged(repository, task, taskData)) { session.markStale(task); } @@ -483,11 +483,11 @@ public class TracRepositoryConnector extends AbstractRepositoryConnector { @Override public void postSynchronization(ISynchronizationSession event, IProgressMonitor monitor) throws CoreException { try { - monitor.beginTask("", 1); + monitor.beginTask("", 1); //$NON-NLS-1$ if (event.isFullSynchronization() && event.getStatus() == null) { Date date = getSynchronizationTimestamp(event); if (date != null) { - event.getTaskRepository().setSynchronizationTimeStamp(TracUtil.toTracTime(date) + ""); + event.getTaskRepository().setSynchronizationTimeStamp(TracUtil.toTracTime(date) + ""); //$NON-NLS-1$ } } } finally { @@ -512,7 +512,7 @@ public class TracRepositoryConnector extends AbstractRepositoryConnector { public void preSynchronization(ISynchronizationSession session, IProgressMonitor monitor) throws CoreException { monitor = Policy.monitorFor(monitor); try { - monitor.beginTask("Getting changed tasks", IProgressMonitor.UNKNOWN); + monitor.beginTask(Messages.TracRepositoryConnector_Getting_changed_tasks, IProgressMonitor.UNKNOWN); if (!session.isFullSynchronization()) { return; @@ -604,7 +604,7 @@ public class TracRepositoryConnector extends AbstractRepositoryConnector { client.updateAttributes(monitor, true); } catch (Exception e) { throw new CoreException(RepositoryStatus.createStatus(repository.getRepositoryUrl(), IStatus.WARNING, - TracCorePlugin.ID_PLUGIN, "Could not update attributes")); + TracCorePlugin.ID_PLUGIN, "Could not update attributes")); //$NON-NLS-1$ } } @@ -626,7 +626,7 @@ public class TracRepositoryConnector extends AbstractRepositoryConnector { task.setAttribute(TASK_KEY_SUPPORTS_SUBTASKS, Boolean.toString(taskDataHandler.supportsSubtasks(taskData))); if (!taskData.isPartial()) { Date date = task.getModificationDate(); - task.setAttribute(TASK_KEY_UPDATE_DATE, (date != null) ? TracUtil.toTracTime(date) + "" : null); + task.setAttribute(TASK_KEY_UPDATE_DATE, (date != null) ? TracUtil.toTracTime(date) + "" : null); //$NON-NLS-1$ } } @@ -650,7 +650,7 @@ public class TracRepositoryConnector extends AbstractRepositoryConnector { TaskAttribute attribute = taskData.getRoot().getAttribute(TracTaskDataHandler.ATTRIBUTE_BLOCKED_BY); if (attribute != null) { List<TaskRelation> result = new ArrayList<TaskRelation>(); - StringTokenizer t = new StringTokenizer(attribute.getValue(), ", "); + StringTokenizer t = new StringTokenizer(attribute.getValue(), ", "); //$NON-NLS-1$ while (t.hasMoreTokens()) { result.add(TaskRelation.subtask(t.nextToken())); } @@ -666,4 +666,4 @@ public class TracRepositoryConnector extends AbstractRepositoryConnector { return new TracTaskMapper(taskData, client); } -}
\ No newline at end of file +} diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracTaskDataHandler.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracTaskDataHandler.java index 293a0858a..f05055fa0 100644 --- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracTaskDataHandler.java +++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracTaskDataHandler.java @@ -55,15 +55,15 @@ import org.eclipse.mylyn.tasks.core.data.TaskOperation; */ public class TracTaskDataHandler extends AbstractTaskDataHandler { - private static final String TASK_DATA_VERSION = "2"; + private static final String TASK_DATA_VERSION = "2"; //$NON-NLS-1$ - public static final String ATTRIBUTE_BLOCKED_BY = "blockedby"; + public static final String ATTRIBUTE_BLOCKED_BY = "blockedby"; //$NON-NLS-1$ - public static final String ATTRIBUTE_BLOCKING = "blocking"; + public static final String ATTRIBUTE_BLOCKING = "blocking"; //$NON-NLS-1$ - private static final String CC_DELIMETER = ", "; + private static final String CC_DELIMETER = ", "; //$NON-NLS-1$ - private static final String TRAC_KEY = "tracKey"; + private static final String TRAC_KEY = "tracKey"; //$NON-NLS-1$ private final TracRepositoryConnector connector; @@ -75,7 +75,7 @@ public class TracTaskDataHandler extends AbstractTaskDataHandler { throws CoreException { monitor = Policy.monitorFor(monitor); try { - monitor.beginTask("Task Download", IProgressMonitor.UNKNOWN); + monitor.beginTask("Task Download", IProgressMonitor.UNKNOWN); //$NON-NLS-1$ return downloadTaskData(repository, TracRepositoryConnector.getTicketId(taskId), monitor); } finally { monitor.done(); @@ -101,7 +101,7 @@ public class TracTaskDataHandler extends AbstractTaskDataHandler { public TaskData createTaskDataFromTicket(ITracClient client, TaskRepository repository, TracTicket ticket, IProgressMonitor monitor) throws CoreException { TaskData taskData = new TaskData(getAttributeMapper(repository), TracCorePlugin.CONNECTOR_KIND, - repository.getRepositoryUrl(), ticket.getId() + ""); + repository.getRepositoryUrl(), ticket.getId() + ""); //$NON-NLS-1$ taskData.setVersion(TASK_DATA_VERSION); try { if (!TracRepositoryConnector.hasRichEditor(repository)) { @@ -136,13 +136,13 @@ public class TracTaskDataHandler extends AbstractTaskDataHandler { Date lastChanged = ticket.getLastChanged(); if (lastChanged != null) { TaskAttribute taskAttribute = data.getRoot().getAttribute(TracAttribute.CHANGE_TIME.getTracKey()); - taskAttribute.setValue(TracUtil.toTracTime(lastChanged) + ""); + taskAttribute.setValue(TracUtil.toTracTime(lastChanged) + ""); //$NON-NLS-1$ changedAttributes.add(taskAttribute); } if (ticket.getCreated() != null) { TaskAttribute taskAttribute = data.getRoot().getAttribute(TracAttribute.TIME.getTracKey()); - taskAttribute.setValue(TracUtil.toTracTime(ticket.getCreated()) + ""); + taskAttribute.setValue(TracUtil.toTracTime(ticket.getCreated()) + ""); //$NON-NLS-1$ changedAttributes.add(taskAttribute); } @@ -168,7 +168,7 @@ public class TracTaskDataHandler extends AbstractTaskDataHandler { if (comments != null) { int count = 1; for (int i = 0; i < comments.length; i++) { - if (!"comment".equals(comments[i].getField()) || "".equals(comments[i].getNewValue())) { + if (!"comment".equals(comments[i].getField()) || "".equals(comments[i].getNewValue())) { //$NON-NLS-1$ //$NON-NLS-2$ continue; } @@ -212,10 +212,10 @@ public class TracTaskDataHandler extends AbstractTaskDataHandler { if (actions != null) { // add operations in a defined order List<String> actionList = new ArrayList<String>(Arrays.asList(actions)); - addOperation(repository, data, ticket, actionList, "leave"); - addOperation(repository, data, ticket, actionList, "accept"); - addOperation(repository, data, ticket, actionList, "resolve"); - addOperation(repository, data, ticket, actionList, "reopen"); + addOperation(repository, data, ticket, actionList, "leave"); //$NON-NLS-1$ + addOperation(repository, data, ticket, actionList, "accept"); //$NON-NLS-1$ + addOperation(repository, data, ticket, actionList, "resolve"); //$NON-NLS-1$ + addOperation(repository, data, ticket, actionList, "reopen"); //$NON-NLS-1$ } return changedAttributes; @@ -228,22 +228,22 @@ public class TracTaskDataHandler extends AbstractTaskDataHandler { } String label = null; - if ("leave".equals(action)) { + if ("leave".equals(action)) { //$NON-NLS-1$ // TODO provide better label for Leave action //label = "Leave as " + data.getStatus() + " " + data.getResolution(); - label = "Leave"; - } else if ("accept".equals(action)) { - label = "Accept"; - } else if ("resolve".equals(action)) { - label = "Resolve as"; - } else if ("reopen".equals(action)) { - label = "Reopen"; + label = "Leave"; //$NON-NLS-1$ + } else if ("accept".equals(action)) { //$NON-NLS-1$ + label = "Accept"; //$NON-NLS-1$ + } else if ("resolve".equals(action)) { //$NON-NLS-1$ + label = "Resolve as"; //$NON-NLS-1$ + } else if ("reopen".equals(action)) { //$NON-NLS-1$ + label = "Reopen"; //$NON-NLS-1$ } if (label != null) { TaskAttribute attribute = data.getRoot().createAttribute(TaskAttribute.PREFIX_OPERATION + action); TaskOperation.applyTo(attribute, action, label); - if ("resolve".equals(action)) { + if ("resolve".equals(action)) { //$NON-NLS-1$ attribute.getMetaData().putValue(TaskAttribute.META_ASSOCIATED_ATTRIBUTE_ID, TracAttribute.RESOLUTION.getTracKey()); } @@ -305,8 +305,8 @@ public class TracTaskDataHandler extends AbstractTaskDataHandler { // attr.addOption("True", "1"); // attr.addOption("False", "0"); metaData.setType(TaskAttribute.TYPE_BOOLEAN); - attr.putOption("1", "1"); - attr.putOption("0", "0"); + attr.putOption("1", "1"); //$NON-NLS-1$ //$NON-NLS-2$ + attr.putOption("0", "0"); //$NON-NLS-1$ //$NON-NLS-2$ if (field.getDefaultValue() != null) { attr.setValue(field.getDefaultValue()); } @@ -315,7 +315,7 @@ public class TracTaskDataHandler extends AbstractTaskDataHandler { String[] values = field.getOptions(); if (values != null && values.length > 0) { if (field.isOptional()) { - attr.putOption("", ""); + attr.putOption("", ""); //$NON-NLS-1$ //$NON-NLS-2$ } for (String value : values) { attr.putOption(value, value); @@ -365,7 +365,7 @@ public class TracTaskDataHandler extends AbstractTaskDataHandler { TaskAttribute attr = createAttribute(data, tracAttribute); if (values != null && values.length > 0) { if (allowEmtpy) { - attr.putOption("", ""); + attr.putOption("", ""); //$NON-NLS-1$ //$NON-NLS-2$ } for (Object value : values) { attr.putOption(value.toString(), value.toString()); @@ -388,15 +388,15 @@ public class TracTaskDataHandler extends AbstractTaskDataHandler { ITracClient server = connector.getClientManager().getTracClient(repository); if (taskData.isNew()) { int id = server.createTicket(ticket, monitor); - return new RepositoryResponse(ResponseKind.TASK_CREATED, id + ""); + return new RepositoryResponse(ResponseKind.TASK_CREATED, id + ""); //$NON-NLS-1$ } else { - String newComment = ""; + String newComment = ""; //$NON-NLS-1$ TaskAttribute newCommentAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.COMMENT_NEW); if (newCommentAttribute != null) { newComment = newCommentAttribute.getValue(); } server.updateTicket(ticket, newComment, monitor); - return new RepositoryResponse(ResponseKind.TASK_UPDATED, ticket.getId() + ""); + return new RepositoryResponse(ResponseKind.TASK_UPDATED, ticket.getId() + ""); //$NON-NLS-1$ } } catch (OperationCanceledException e) { throw e; @@ -429,13 +429,13 @@ public class TracTaskDataHandler extends AbstractTaskDataHandler { TaskAttribute blockingAttribute = taskData.getRoot().getMappedAttribute(ATTRIBUTE_BLOCKING); if (blockingAttribute == null) { throw new CoreException(new RepositoryStatus(repository, IStatus.ERROR, TracCorePlugin.ID_PLUGIN, - RepositoryStatus.ERROR_REPOSITORY, "The repository does not support subtasks")); + RepositoryStatus.ERROR_REPOSITORY, "The repository does not support subtasks")); //$NON-NLS-1$ } TaskMapper mapper = new TaskMapper(taskData); mapper.merge(new TaskMapper(parentTaskData)); - mapper.setDescription(""); - mapper.setSummary(""); + mapper.setDescription(""); //$NON-NLS-1$ + mapper.setSummary(""); //$NON-NLS-1$ blockingAttribute.setValue(parentTaskData.getTaskId()); TaskAttribute blockedByAttribute = taskData.getRoot().getMappedAttribute(ATTRIBUTE_BLOCKED_BY); if (blockedByAttribute != null) { @@ -512,43 +512,43 @@ public class TracTaskDataHandler extends AbstractTaskDataHandler { for (String user : values) { if (!removeValues.contains(user)) { if (sb.length() > 0) { - sb.append(","); + sb.append(","); //$NON-NLS-1$ } sb.append(user); } } if (TracRepositoryConnector.getAttributeValue(data, TracAttributeMapper.NEW_CC).length() > 0) { if (sb.length() > 0) { - sb.append(","); + sb.append(","); //$NON-NLS-1$ } sb.append(TracRepositoryConnector.getAttributeValue(data, TracAttributeMapper.NEW_CC)); } if (Boolean.TRUE.equals(TracRepositoryConnector.getAttributeValue(data, TaskAttribute.ADD_SELF_CC))) { if (sb.length() > 0) { - sb.append(","); + sb.append(","); //$NON-NLS-1$ } sb.append(repository.getUserName()); } ticket.putBuiltinValue(Key.CC, sb.toString()); - ticket.putValue("owner", TracRepositoryConnector.getAttributeValue(data, TaskAttribute.USER_ASSIGNED)); + ticket.putValue("owner", TracRepositoryConnector.getAttributeValue(data, TaskAttribute.USER_ASSIGNED)); //$NON-NLS-1$ TaskAttribute operationAttribute = data.getRoot().getMappedAttribute(TaskAttribute.OPERATION); if (operationAttribute != null) { TaskOperation operation = TaskOperation.createFrom(operationAttribute); String action = operation.getOperationId(); - if (!"leave".equals(action)) { - if ("accept".equals(action)) { - ticket.putValue("status", TracRepositoryConnector.TaskStatus.ASSIGNED.toStatusString()); - } else if ("resolve".equals(action)) { - ticket.putValue("status", TracRepositoryConnector.TaskStatus.CLOSED.toStatusString()); - ticket.putValue("resolution", TracRepositoryConnector.getAttributeValue(data, + if (!"leave".equals(action)) { //$NON-NLS-1$ + if ("accept".equals(action)) { //$NON-NLS-1$ + ticket.putValue("status", TracRepositoryConnector.TaskStatus.ASSIGNED.toStatusString()); //$NON-NLS-1$ + } else if ("resolve".equals(action)) { //$NON-NLS-1$ + ticket.putValue("status", TracRepositoryConnector.TaskStatus.CLOSED.toStatusString()); //$NON-NLS-1$ + ticket.putValue("resolution", TracRepositoryConnector.getAttributeValue(data, //$NON-NLS-1$ TaskAttribute.RESOLUTION)); - } else if ("reopen".equals(action)) { - ticket.putValue("status", TracRepositoryConnector.TaskStatus.REOPENED.toStatusString()); - ticket.putValue("resolution", ""); - } else if ("reassign".equals(action)) { - ticket.putValue("status", TracRepositoryConnector.TaskStatus.NEW.toStatusString()); + } else if ("reopen".equals(action)) { //$NON-NLS-1$ + ticket.putValue("status", TracRepositoryConnector.TaskStatus.REOPENED.toStatusString()); //$NON-NLS-1$ + ticket.putValue("resolution", ""); //$NON-NLS-1$ //$NON-NLS-2$ + } else if ("reassign".equals(action)) { //$NON-NLS-1$ + ticket.putValue("status", TracRepositoryConnector.TaskStatus.NEW.toStatusString()); //$NON-NLS-1$ } } } @@ -572,7 +572,7 @@ public class TracTaskDataHandler extends AbstractTaskDataHandler { List<TaskAttribute> attributes = new ArrayList<TaskAttribute>(root.getAttributes().values()); for (TaskAttribute attribute : attributes) { if (TaskAttribute.TYPE_OPERATION.equals(attribute.getMetaData().getType()) - && "reassign".equals(attribute.getValue())) { + && "reassign".equals(attribute.getValue())) { //$NON-NLS-1$ root.removeAttribute(attribute.getId()); } else if (TaskAttribute.OPERATION.equals(attribute.getId())) { attribute.getMetaData().setType(TaskAttribute.TYPE_OPERATION); diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracWikiHandler.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracWikiHandler.java index c5b5b1c6b..35c6ef18f 100644 --- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracWikiHandler.java +++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracWikiHandler.java @@ -37,7 +37,7 @@ public class TracWikiHandler extends AbstractWikiHandler { @Override public String[] downloadAllPageNames(TaskRepository repository, IProgressMonitor monitor) throws CoreException { - monitor.beginTask("Download Wiki Page Names", IProgressMonitor.UNKNOWN); + monitor.beginTask(Messages.TracWikiHandler_Download_Wiki_Page_Names, IProgressMonitor.UNKNOWN); try { String[] names = getTracWikiClient(repository).getAllWikiPageNames(monitor); return names; @@ -51,7 +51,7 @@ public class TracWikiHandler extends AbstractWikiHandler { @Override public TracWikiPage getWikiPage(TaskRepository repository, String pageName, IProgressMonitor monitor) throws CoreException { - monitor.beginTask("Download Wiki Page", IProgressMonitor.UNKNOWN); + monitor.beginTask(Messages.TracWikiHandler_Download_Wiki_Page, IProgressMonitor.UNKNOWN); try { TracWikiPage page = getTracWikiClient(repository).getWikiPage(pageName, monitor); return page; @@ -65,19 +65,19 @@ public class TracWikiHandler extends AbstractWikiHandler { @Override public void postWikiPage(TaskRepository repository, TracWikiPage newPage, IProgressMonitor monitor) throws CoreException { - monitor.beginTask("Upload Wiki Page", IProgressMonitor.UNKNOWN); + monitor.beginTask(Messages.TracWikiHandler_Upload_Wiki_Page, IProgressMonitor.UNKNOWN); try { String pageName = newPage.getPageInfo().getPageName(); String content = newPage.getContent(); Map<String, Object> attributes = new HashMap<String, Object>(); - attributes.put("comment", newPage.getPageInfo().getComment()); - attributes.put("author", newPage.getPageInfo().getAuthor()); + attributes.put("comment", newPage.getPageInfo().getComment()); //$NON-NLS-1$ + attributes.put("author", newPage.getPageInfo().getAuthor()); //$NON-NLS-1$ boolean success = getTracWikiClient(repository).putWikipage(pageName, content, attributes, monitor); if (success) { return; } else { throw new CoreException(TracCorePlugin.toStatus(new TracException( - "Failed to upload wiki page. No further information available."), repository)); + "Failed to upload wiki page. No further information available."), repository)); //$NON-NLS-1$ } } catch (TracException e) { throw new CoreException(TracCorePlugin.toStatus(e, repository)); @@ -89,7 +89,7 @@ public class TracWikiHandler extends AbstractWikiHandler { @Override public TracWikiPageInfo[] getPageHistory(TaskRepository repository, String pageName, IProgressMonitor monitor) throws CoreException { - monitor.beginTask("Retrieve Wiki Page History", IProgressMonitor.UNKNOWN); + monitor.beginTask(Messages.TracWikiHandler_Retrieve_Wiki_Page_History, IProgressMonitor.UNKNOWN); try { TracWikiPageInfo[] versions = getTracWikiClient(repository).getWikiPageInfoAllVersions(pageName, monitor); return versions; @@ -105,8 +105,8 @@ public class TracWikiHandler extends AbstractWikiHandler { if (client instanceof ITracWikiClient) { return (ITracWikiClient) client; } else { - throw new TracException("The access mode of " + repository.toString() - + " does not support Wiki page editting."); + throw new TracException("The access mode of " + repository.toString() //$NON-NLS-1$ + + " does not support Wiki page editting."); //$NON-NLS-1$ } } diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/AbstractTracClient.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/AbstractTracClient.java index f39206118..ae16865db 100644 --- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/AbstractTracClient.java +++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/AbstractTracClient.java @@ -91,9 +91,9 @@ public abstract class AbstractTracClient implements ITracClient { PostMethod post = new PostMethod(WebUtil.getRequestPath(repositoryUrl + LOGIN_URL)); post.setFollowRedirects(false); String formToken = getFormToken(httpClient); - NameValuePair[] data = { new NameValuePair("referer", ""), - new NameValuePair("user", credentials.getUserName()), - new NameValuePair("password", credentials.getPassword()), new NameValuePair("__FORM_TOKEN", formToken) }; + NameValuePair[] data = { new NameValuePair("referer", ""), //$NON-NLS-1$ //$NON-NLS-2$ + new NameValuePair("user", credentials.getUserName()), //$NON-NLS-1$ + new NameValuePair("password", credentials.getPassword()), new NameValuePair("__FORM_TOKEN", formToken) }; //$NON-NLS-1$ //$NON-NLS-2$ post.setRequestBody(data); try { @@ -110,11 +110,11 @@ public abstract class AbstractTracClient implements ITracClient { private String getFormToken(HttpClient httpClient) { Cookie[] cookies = httpClient.getState().getCookies(); for (Cookie cookie : cookies) { - if ("trac_form_token".equals(cookie.getName())) { + if ("trac_form_token".equals(cookie.getName())) { //$NON-NLS-1$ return cookie.getValue(); } } - return ""; + return ""; //$NON-NLS-1$ } /** @@ -188,18 +188,18 @@ public abstract class AbstractTracClient implements ITracClient { } public String[] getDefaultTicketResolutions() { - return new String[] { "fixed", "invalid", "wontfix", "duplicate", "worksforme" }; + return new String[] { "fixed", "invalid", "wontfix", "duplicate", "worksforme" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ } public String[] getDefaultTicketActions(String status) { - if ("new".equals(status)) { - return new String[] { "leave", "resolve", "reassign", "accept" }; - } else if ("assigned".equals(status)) { - return new String[] { "leave", "resolve", "reassign" }; - } else if ("reopened".equals(status)) { - return new String[] { "leave", "resolve", "reassign" }; - } else if ("closed".equals(status)) { - return new String[] { "leave", "reopen" }; + if ("new".equals(status)) { //$NON-NLS-1$ + return new String[] { "leave", "resolve", "reassign", "accept" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + } else if ("assigned".equals(status)) { //$NON-NLS-1$ + return new String[] { "leave", "resolve", "reassign" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } else if ("reopened".equals(status)) { //$NON-NLS-1$ + return new String[] { "leave", "resolve", "reassign" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } else if ("closed".equals(status)) { //$NON-NLS-1$ + return new String[] { "leave", "reopen" }; //$NON-NLS-1$ //$NON-NLS-2$ } return null; } diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/ITracClient.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/ITracClient.java index 4c96531eb..32a19f691 100644 --- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/ITracClient.java +++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/ITracClient.java @@ -51,9 +51,9 @@ public interface ITracClient { public String toString() { switch (this) { case TRAC_0_9: - return "Web (Trac 0.9 or 0.10)"; + return "Web (Trac 0.9 or 0.10)"; //$NON-NLS-1$ case XML_RPC: - return "XML-RPC Plugin (Rev. " + TracXmlRpcClient.REQUIRED_REVISION + ")"; + return "XML-RPC Plugin (Rev. " + TracXmlRpcClient.REQUIRED_REVISION + ")"; //$NON-NLS-1$ //$NON-NLS-2$ default: return null; } @@ -61,37 +61,37 @@ public interface ITracClient { } - public static final String CHARSET = "UTF-8"; + public static final String CHARSET = "UTF-8"; //$NON-NLS-1$ - public static final String TIME_ZONE = "UTC"; + public static final String TIME_ZONE = "UTC"; //$NON-NLS-1$ - public static final String LOGIN_URL = "/login"; + public static final String LOGIN_URL = "/login"; //$NON-NLS-1$ - public static final String QUERY_URL = "/query?format=tab"; + public static final String QUERY_URL = "/query?format=tab"; //$NON-NLS-1$ - public static final String TICKET_URL = "/ticket/"; + public static final String TICKET_URL = "/ticket/"; //$NON-NLS-1$ - public static final String NEW_TICKET_URL = "/newticket"; + public static final String NEW_TICKET_URL = "/newticket"; //$NON-NLS-1$ - public static final String CUSTOM_QUERY_URL = "/query"; + public static final String CUSTOM_QUERY_URL = "/query"; //$NON-NLS-1$ - public static final String TICKET_ATTACHMENT_URL = "/attachment/ticket/"; + public static final String TICKET_ATTACHMENT_URL = "/attachment/ticket/"; //$NON-NLS-1$ - public static final String DEFAULT_USERNAME = "anonymous"; + public static final String DEFAULT_USERNAME = "anonymous"; //$NON-NLS-1$ - public static final String WIKI_URL = "/wiki/"; + public static final String WIKI_URL = "/wiki/"; //$NON-NLS-1$ - public static final String REPORT_URL = "/report/"; + public static final String REPORT_URL = "/report/"; //$NON-NLS-1$ - public static final String CHANGESET_URL = "/changeset/"; + public static final String CHANGESET_URL = "/changeset/"; //$NON-NLS-1$ - public static final String REVISION_LOG_URL = "/log/"; + public static final String REVISION_LOG_URL = "/log/"; //$NON-NLS-1$ - public static final String MILESTONE_URL = "/milestone/"; + public static final String MILESTONE_URL = "/milestone/"; //$NON-NLS-1$ - public static final String BROWSER_URL = "/browser/"; + public static final String BROWSER_URL = "/browser/"; //$NON-NLS-1$ - public static final String ATTACHMENT_URL = "/attachment/ticket/"; + public static final String ATTACHMENT_URL = "/attachment/ticket/"; //$NON-NLS-1$ /** * Gets ticket with <code>id</code> from repository. diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/Messages.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/Messages.java new file mode 100644 index 000000000..6622f5685 --- /dev/null +++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/Messages.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * Copyright (c) 2004, 2008 Tasktop Technologies and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tasktop Technologies - initial API and implementation + *******************************************************************************/ + +package org.eclipse.mylyn.internal.trac.core.client; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.mylyn.internal.trac.core.client.messages"; //$NON-NLS-1$ + + static { + // load message values from bundle file + reloadMessages(); + } + + public static void reloadMessages() { + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + public static String TracWebClient_Updating_attributes; +} diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/TracWebClient.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/TracWebClient.java index e31f6af71..3080cf758 100644 --- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/TracWebClient.java +++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/TracWebClient.java @@ -222,35 +222,35 @@ public class TracWebClient extends AbstractTracClient { if (token.getType() == Token.TAG) { HtmlTag tag = (HtmlTag) token.getValue(); if (tag.getTagType() == Tag.TD) { - String headers = tag.getAttribute("headers"); - if ("h_component".equals(headers)) { + String headers = tag.getAttribute("headers"); //$NON-NLS-1$ + if ("h_component".equals(headers)) { //$NON-NLS-1$ ticket.putBuiltinValue(Key.COMPONENT, getText(tokenizer)); - } else if ("h_milestone".equals(headers)) { + } else if ("h_milestone".equals(headers)) { //$NON-NLS-1$ ticket.putBuiltinValue(Key.MILESTONE, getText(tokenizer)); - } else if ("h_priority".equals(headers)) { + } else if ("h_priority".equals(headers)) { //$NON-NLS-1$ ticket.putBuiltinValue(Key.PRIORITY, getText(tokenizer)); - } else if ("h_severity".equals(headers)) { + } else if ("h_severity".equals(headers)) { //$NON-NLS-1$ ticket.putBuiltinValue(Key.SEVERITY, getText(tokenizer)); - } else if ("h_version".equals(headers)) { + } else if ("h_version".equals(headers)) { //$NON-NLS-1$ ticket.putBuiltinValue(Key.VERSION, getText(tokenizer)); - } else if ("h_keywords".equals(headers)) { + } else if ("h_keywords".equals(headers)) { //$NON-NLS-1$ ticket.putBuiltinValue(Key.KEYWORDS, getText(tokenizer)); - } else if ("h_cc".equals(headers)) { + } else if ("h_cc".equals(headers)) { //$NON-NLS-1$ ticket.putBuiltinValue(Key.CC, getText(tokenizer)); - } else if ("h_owner".equals(headers)) { + } else if ("h_owner".equals(headers)) { //$NON-NLS-1$ ticket.putBuiltinValue(Key.OWNER, getText(tokenizer)); - } else if ("h_reporter".equals(headers)) { + } else if ("h_reporter".equals(headers)) { //$NON-NLS-1$ ticket.putBuiltinValue(Key.REPORTER, getText(tokenizer)); } // TODO handle custom fields } else if (tag.getTagType() == Tag.H2 - && ("summary".equals(tag.getAttribute("class")) || "summary searchable".equals(tag.getAttribute("class")))) { + && ("summary".equals(tag.getAttribute("class")) || "summary searchable".equals(tag.getAttribute("class")))) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ ticket.putBuiltinValue(Key.SUMMARY, getText(tokenizer)); - } else if (tag.getTagType() == Tag.H3 && "status".equals(tag.getAttribute("class"))) { + } else if (tag.getTagType() == Tag.H3 && "status".equals(tag.getAttribute("class"))) { //$NON-NLS-1$ //$NON-NLS-2$ String text = getStrongText(tokenizer); if (text.length() > 0) { // Trac 0.9 format: status / status (resolution) - int i = text.indexOf(" ("); + int i = text.indexOf(" ("); //$NON-NLS-1$ if (i != -1) { ticket.putBuiltinValue(Key.STATUS, text.substring(0, i)); ticket.putBuiltinValue(Key.RESOLUTION, text.substring(i + 2, text.length() - 1)); @@ -259,12 +259,12 @@ public class TracWebClient extends AbstractTracClient { } } } else if (tag.getTagType() == Tag.SPAN) { - String clazz = tag.getAttribute("class"); - if ("status".equals(clazz)) { + String clazz = tag.getAttribute("class"); //$NON-NLS-1$ + if ("status".equals(clazz)) { //$NON-NLS-1$ // Trac 0.10 format: (status type) / (status type: resolution) String text = getText(tokenizer); - if (text.startsWith("(") && text.endsWith(")")) { - StringTokenizer t = new StringTokenizer(text.substring(1, text.length() - 1), " :"); + if (text.startsWith("(") && text.endsWith(")")) { //$NON-NLS-1$ //$NON-NLS-2$ + StringTokenizer t = new StringTokenizer(text.substring(1, text.length() - 1), " :"); //$NON-NLS-1$ if (t.hasMoreTokens()) { ticket.putBuiltinValue(Key.STATUS, t.nextToken()); } @@ -313,7 +313,7 @@ public class TracWebClient extends AbstractTracClient { if (line == null) { throw new InvalidTicketException(); } - StringTokenizer t = new StringTokenizer(line, "\t"); + StringTokenizer t = new StringTokenizer(line, "\t"); //$NON-NLS-1$ Key[] fields = new Key[t.countTokens()]; for (int i = 0; i < fields.length; i++) { fields[i] = Key.fromKey(t.nextToken()); @@ -321,7 +321,7 @@ public class TracWebClient extends AbstractTracClient { // create a ticket for each following line of output while ((line = reader.readLine()) != null) { - t = new StringTokenizer(line, "\t"); + t = new StringTokenizer(line, "\t"); //$NON-NLS-1$ TracTicket ticket = new TracTicket(); for (int i = 0; i < fields.length && t.hasMoreTokens(); i++) { if (fields[i] != null) { @@ -337,7 +337,7 @@ public class TracWebClient extends AbstractTracClient { } } catch (NumberFormatException e) { StatusHandler.log(new Status(IStatus.WARNING, TracCorePlugin.ID_PLUGIN, - "Error parsing response: '" + line + "'", e)); + "Error parsing response: '" + line + "'", e)); //$NON-NLS-1$ //$NON-NLS-2$ } } } @@ -364,8 +364,8 @@ public class TracWebClient extends AbstractTracClient { * Trac has sepcial encoding rules for the returned output: None is represented by "--". */ private String parseTicketValue(String value) { - if ("--".equals(value)) { - return ""; + if ("--".equals(value)) { //$NON-NLS-1$ + return ""; //$NON-NLS-1$ } return value; } @@ -386,7 +386,7 @@ public class TracWebClient extends AbstractTracClient { } public void validate(IProgressMonitor monitor) throws TracException { - GetMethod method = connect(repositoryUrl + "/", monitor); + GetMethod method = connect(repositoryUrl + "/", monitor); //$NON-NLS-1$ try { InputStream in = WebUtil.getResponseBodyAsStream(method, monitor); try { @@ -401,26 +401,26 @@ public class TracWebClient extends AbstractTracClient { if (token.getType() == Token.TAG) { HtmlTag tag = (HtmlTag) token.getValue(); if (tag.getTagType() == Tag.DIV) { - String id = tag.getAttribute("id"); - inFooter = !tag.isEndTag() && "footer".equals(id); + String id = tag.getAttribute("id"); //$NON-NLS-1$ + inFooter = !tag.isEndTag() && "footer".equals(id); //$NON-NLS-1$ } else if (tag.getTagType() == Tag.STRONG && inFooter) { version = getText(tokenizer); } else if (tag.getTagType() == Tag.A) { - String id = tag.getAttribute("id"); - if ("tracpowered".equals(id)) { + String id = tag.getAttribute("id"); //$NON-NLS-1$ + if ("tracpowered".equals(id)) { //$NON-NLS-1$ valid = true; } } } } - if (version != null && !(version.startsWith("Trac 0.9") || version.startsWith("Trac 0.10"))) { - throw new TracException("The Trac version " + version - + " is unsupported. Please use version 0.9.x or 0.10.x."); + if (version != null && !(version.startsWith("Trac 0.9") || version.startsWith("Trac 0.10"))) { //$NON-NLS-1$ //$NON-NLS-2$ + throw new TracException("The Trac version " + version //$NON-NLS-1$ + + " is unsupported. Please use version 0.9.x or 0.10.x."); //$NON-NLS-1$ } if (!valid) { - throw new TracException("Not a valid Trac repository"); + throw new TracException("Not a valid Trac repository"); //$NON-NLS-1$ } } finally { in.close(); @@ -436,7 +436,7 @@ public class TracWebClient extends AbstractTracClient { @Override public void updateAttributes(IProgressMonitor monitor) throws TracException { - monitor.beginTask("Updating attributes", IProgressMonitor.UNKNOWN); + monitor.beginTask(Messages.TracWebClient_Updating_attributes, IProgressMonitor.UNKNOWN); GetMethod method = connect(repositoryUrl + ITracClient.CUSTOM_QUERY_URL, monitor); try { @@ -453,7 +453,7 @@ public class TracWebClient extends AbstractTracClient { HtmlTag tag = (HtmlTag) token.getValue(); if (tag.getTagType() == Tag.SCRIPT) { String text = getText(tokenizer).trim(); - if (text.startsWith("var properties=")) { + if (text.startsWith("var properties=")) { //$NON-NLS-1$ parseAttributes(text); } } @@ -493,28 +493,28 @@ public class TracWebClient extends AbstractTracClient { switch (tokenType) { case StreamTokenizer.TT_WORD: if (state == AttributeState.IN_LIST) { - if ("component".equals(t.sval)) { + if ("component".equals(t.sval)) { //$NON-NLS-1$ data.components = new ArrayList<TracComponent>(); attributeFactory = new AttributeFactory() { public void addAttribute(String value) { data.components.add(new TracComponent(value)); } }; - } else if ("milestone".equals(t.sval)) { + } else if ("milestone".equals(t.sval)) { //$NON-NLS-1$ data.milestones = new ArrayList<TracMilestone>(); attributeFactory = new AttributeFactory() { public void addAttribute(String value) { data.milestones.add(new TracMilestone(value)); } }; - } else if ("priority".equals(t.sval)) { + } else if ("priority".equals(t.sval)) { //$NON-NLS-1$ data.priorities = new ArrayList<TracPriority>(); attributeFactory = new AttributeFactory() { public void addAttribute(String value) { data.priorities.add(new TracPriority(value, data.priorities.size() + 1)); } }; - } else if ("resolution".equals(t.sval)) { + } else if ("resolution".equals(t.sval)) { //$NON-NLS-1$ data.ticketResolutions = new ArrayList<TracTicketResolution>(); attributeFactory = new AttributeFactory() { public void addAttribute(String value) { @@ -522,28 +522,28 @@ public class TracWebClient extends AbstractTracClient { data.ticketResolutions.size() + 1)); } }; - } else if ("severity".equals(t.sval)) { + } else if ("severity".equals(t.sval)) { //$NON-NLS-1$ data.severities = new ArrayList<TracSeverity>(); attributeFactory = new AttributeFactory() { public void addAttribute(String value) { data.severities.add(new TracSeverity(value, data.severities.size() + 1)); } }; - } else if ("status".equals(t.sval)) { + } else if ("status".equals(t.sval)) { //$NON-NLS-1$ data.ticketStatus = new ArrayList<TracTicketStatus>(); attributeFactory = new AttributeFactory() { public void addAttribute(String value) { data.ticketStatus.add(new TracTicketStatus(value, data.ticketStatus.size() + 1)); } }; - } else if ("type".equals(t.sval)) { + } else if ("type".equals(t.sval)) { //$NON-NLS-1$ data.ticketTypes = new ArrayList<TracTicketType>(); attributeFactory = new AttributeFactory() { public void addAttribute(String value) { data.ticketTypes.add(new TracTicketType(value, data.ticketTypes.size() + 1)); } }; - } else if ("version".equals(t.sval)) { + } else if ("version".equals(t.sval)) { //$NON-NLS-1$ data.versions = new ArrayList<TracVersion>(); attributeFactory = new AttributeFactory() { public void addAttribute(String value) { @@ -558,7 +558,7 @@ public class TracWebClient extends AbstractTracClient { } break; case '"': - if (state == AttributeState.IN_ATTRIBUTE_VALUE_LIST && "options".equals(attributeType)) { + if (state == AttributeState.IN_ATTRIBUTE_VALUE_LIST && "options".equals(attributeType)) { //$NON-NLS-1$ if (attributeFactory != null) { attributeFactory.addAttribute(t.sval); } @@ -590,7 +590,7 @@ public class TracWebClient extends AbstractTracClient { } else if (state == AttributeState.IN_LIST) { state = AttributeState.IN_ATTRIBUTE_KEY; } else { - throw new IOException("Error parsing attributes: unexpected token '{'"); + throw new IOException("Error parsing attributes: unexpected token '{'"); //$NON-NLS-1$ } break; case '}': @@ -599,7 +599,7 @@ public class TracWebClient extends AbstractTracClient { } else if (state == AttributeState.IN_LIST) { state = AttributeState.INIT; } else { - throw new IOException("Error parsing attributes: unexpected token '}'"); + throw new IOException("Error parsing attributes: unexpected token '}'"); //$NON-NLS-1$ } break; } @@ -607,7 +607,7 @@ public class TracWebClient extends AbstractTracClient { } public void updateAttributesNewTicketPage(IProgressMonitor monitor) throws TracException { - monitor.beginTask("Updating attributes", IProgressMonitor.UNKNOWN); + monitor.beginTask(Messages.TracWebClient_Updating_attributes, IProgressMonitor.UNKNOWN); GetMethod method = connect(repositoryUrl + ITracClient.NEW_TICKET_URL, monitor); try { @@ -623,38 +623,38 @@ public class TracWebClient extends AbstractTracClient { if (token.getType() == Token.TAG) { HtmlTag tag = (HtmlTag) token.getValue(); if (tag.getTagType() == Tag.SELECT) { - String name = tag.getAttribute("id"); - if ("component".equals(name)) { + String name = tag.getAttribute("id"); //$NON-NLS-1$ + if ("component".equals(name)) { //$NON-NLS-1$ List<String> values = getOptionValues(tokenizer); data.components = new ArrayList<TracComponent>(values.size()); for (String value : values) { data.components.add(new TracComponent(value)); } - } else if ("milestone".equals(name)) { + } else if ("milestone".equals(name)) { //$NON-NLS-1$ List<String> values = getOptionValues(tokenizer); data.milestones = new ArrayList<TracMilestone>(values.size()); for (String value : values) { data.milestones.add(new TracMilestone(value)); } - } else if ("priority".equals(name)) { + } else if ("priority".equals(name)) { //$NON-NLS-1$ List<String> values = getOptionValues(tokenizer); data.priorities = new ArrayList<TracPriority>(values.size()); for (int i = 0; i < values.size(); i++) { data.priorities.add(new TracPriority(values.get(i), i + 1)); } - } else if ("severity".equals(name)) { + } else if ("severity".equals(name)) { //$NON-NLS-1$ List<String> values = getOptionValues(tokenizer); data.severities = new ArrayList<TracSeverity>(values.size()); for (int i = 0; i < values.size(); i++) { data.severities.add(new TracSeverity(values.get(i), i + 1)); } - } else if ("type".equals(name)) { + } else if ("type".equals(name)) { //$NON-NLS-1$ List<String> values = getOptionValues(tokenizer); data.ticketTypes = new ArrayList<TracTicketType>(values.size()); for (int i = 0; i < values.size(); i++) { data.ticketTypes.add(new TracTicketType(values.get(i), i + 1)); } - } else if ("version".equals(name)) { + } else if ("version".equals(name)) { //$NON-NLS-1$ List<String> values = getOptionValues(tokenizer); data.versions = new ArrayList<TracVersion>(values.size()); for (String value : values) { @@ -680,17 +680,17 @@ public class TracWebClient extends AbstractTracClient { private void addResolutionAndStatus() { data.ticketResolutions = new ArrayList<TracTicketResolution>(5); - data.ticketResolutions.add(new TracTicketResolution("fixed", 1)); - data.ticketResolutions.add(new TracTicketResolution("invalid", 2)); - data.ticketResolutions.add(new TracTicketResolution("wontfix", 3)); - data.ticketResolutions.add(new TracTicketResolution("duplicate", 4)); - data.ticketResolutions.add(new TracTicketResolution("worksforme", 5)); + data.ticketResolutions.add(new TracTicketResolution("fixed", 1)); //$NON-NLS-1$ + data.ticketResolutions.add(new TracTicketResolution("invalid", 2)); //$NON-NLS-1$ + data.ticketResolutions.add(new TracTicketResolution("wontfix", 3)); //$NON-NLS-1$ + data.ticketResolutions.add(new TracTicketResolution("duplicate", 4)); //$NON-NLS-1$ + data.ticketResolutions.add(new TracTicketResolution("worksforme", 5)); //$NON-NLS-1$ data.ticketStatus = new ArrayList<TracTicketStatus>(4); - data.ticketStatus.add(new TracTicketStatus("new", 1)); - data.ticketStatus.add(new TracTicketStatus("assigned", 2)); - data.ticketStatus.add(new TracTicketStatus("reopened", 3)); - data.ticketStatus.add(new TracTicketStatus("closed", 4)); + data.ticketStatus.add(new TracTicketStatus("new", 1)); //$NON-NLS-1$ + data.ticketStatus.add(new TracTicketStatus("assigned", 2)); //$NON-NLS-1$ + data.ticketStatus.add(new TracTicketStatus("reopened", 3)); //$NON-NLS-1$ + data.ticketStatus.add(new TracTicketStatus("closed", 4)); //$NON-NLS-1$ } private List<String> getOptionValues(HtmlStreamTokenizer tokenizer) throws IOException, ParseException { @@ -716,7 +716,7 @@ public class TracWebClient extends AbstractTracClient { for (Token token = tokenizer.nextToken(); token.getType() != Token.EOF; token = tokenizer.nextToken()) { if (token.getType() == Token.TEXT) { sb.append(token.toString().trim()); - sb.append(" "); + sb.append(" "); //$NON-NLS-1$ } else if (token.getType() == Token.COMMENT) { // ignore } else { @@ -741,11 +741,11 @@ public class TracWebClient extends AbstractTracClient { break; } } - return ""; + return ""; //$NON-NLS-1$ } public InputStream getAttachmentData(int id, String filename, IProgressMonitor monitor) throws TracException { - GetMethod method = connect(repositoryUrl + ITracClient.ATTACHMENT_URL + id + "/" + filename + "?format=raw", + GetMethod method = connect(repositoryUrl + ITracClient.ATTACHMENT_URL + id + "/" + filename + "?format=raw", //$NON-NLS-1$ //$NON-NLS-2$ monitor); try { // the receiver is responsible for closing the stream which will @@ -759,19 +759,19 @@ public class TracWebClient extends AbstractTracClient { public void putAttachmentData(int id, String name, String description, InputStream in, IProgressMonitor monitor) throws TracException { - throw new TracException("Unsupported operation"); + throw new TracException("Unsupported operation"); //$NON-NLS-1$ } public void deleteAttachment(int ticketId, String filename, IProgressMonitor monitor) throws TracException { - throw new TracException("Unsupported operation"); + throw new TracException("Unsupported operation"); //$NON-NLS-1$ } public int createTicket(TracTicket ticket, IProgressMonitor monitor) throws TracException { - throw new TracException("Unsupported operation"); + throw new TracException("Unsupported operation"); //$NON-NLS-1$ } public void updateTicket(TracTicket ticket, String comment, IProgressMonitor monitor) throws TracException { - throw new TracException("Unsupported operation"); + throw new TracException("Unsupported operation"); //$NON-NLS-1$ } public Set<Integer> getChangedTickets(Date since, IProgressMonitor monitor) throws TracException { diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/TracXmlRpcClient.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/TracXmlRpcClient.java index bee215ddf..6392238a7 100644 --- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/TracXmlRpcClient.java +++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/TracXmlRpcClient.java @@ -178,9 +178,9 @@ public class TracXmlRpcClient extends AbstractTracClient implements ITracWikiCli } - public static final String XMLRPC_URL = "/xmlrpc"; + public static final String XMLRPC_URL = "/xmlrpc"; //$NON-NLS-1$ - public static final String REQUIRED_REVISION = "1950"; + public static final String REQUIRED_REVISION = "1950"; //$NON-NLS-1$ public static final int REQUIRED_EPOCH = 0; @@ -307,8 +307,8 @@ public class TracXmlRpcClient extends AbstractTracClient implements ITracWikiCli httpClient.getParams().setAuthenticationPreemptive(true); } - Header header = method.getResponseHeader("Server"); - isTracd = (header != null && header.getValue().startsWith("tracd")); + Header header = method.getResponseHeader("Server"); //$NON-NLS-1$ + isTracd = (header != null && header.getValue().startsWith("tracd")); //$NON-NLS-1$ // Header header = method.getResponseHeader("WWW-Authenticate"); // if (header != null) { @@ -371,7 +371,7 @@ public class TracXmlRpcClient extends AbstractTracClient implements ITracWikiCli } private Object[] multicall(IProgressMonitor monitor, Map<String, Object>... calls) throws TracException { - Object[] result = (Object[]) call(monitor, "system.multicall", new Object[] { calls }); + Object[] result = (Object[]) call(monitor, "system.multicall", new Object[] { calls }); //$NON-NLS-1$ for (Object item : result) { try { checkForException(item); @@ -387,17 +387,17 @@ public class TracXmlRpcClient extends AbstractTracClient implements ITracWikiCli private void checkForException(Object result) throws NumberFormatException, XmlRpcException { if (result instanceof Map) { Map<?, ?> exceptionData = (Map<?, ?>) result; - if (exceptionData.containsKey("faultCode") && exceptionData.containsKey("faultString")) { - throw new XmlRpcException(Integer.parseInt(exceptionData.get("faultCode").toString()), - (String) exceptionData.get("faultString")); + if (exceptionData.containsKey("faultCode") && exceptionData.containsKey("faultString")) { //$NON-NLS-1$ //$NON-NLS-2$ + throw new XmlRpcException(Integer.parseInt(exceptionData.get("faultCode").toString()), //$NON-NLS-1$ + (String) exceptionData.get("faultString")); //$NON-NLS-1$ } } } private Map<String, Object> createMultiCall(String methodName, Object... parameters) throws TracException { Map<String, Object> table = new HashMap<String, Object>(); - table.put("methodName", methodName); - table.put("params", parameters); + table.put("methodName", methodName); //$NON-NLS-1$ + table.put("params", parameters); //$NON-NLS-1$ return table; } @@ -407,7 +407,7 @@ public class TracXmlRpcClient extends AbstractTracClient implements ITracWikiCli public void validate(IProgressMonitor monitor) throws TracException { try { - Object[] result = (Object[]) call(monitor, "system.getAPIVersion"); + Object[] result = (Object[]) call(monitor, "system.getAPIVersion"); //$NON-NLS-1$ if (result.length >= 3) { epochAPIVersion = (Integer) result[0]; majorAPIVersion = (Integer) result[1]; @@ -418,19 +418,19 @@ public class TracXmlRpcClient extends AbstractTracClient implements ITracWikiCli minorAPIVersion = (Integer) result[1]; } else { throw new TracException( - "The API version is unsupported, please update your Trac XML-RPC Plugin to revision " - + REQUIRED_REVISION + " or later"); + "The API version is unsupported, please update your Trac XML-RPC Plugin to revision " //$NON-NLS-1$ + + REQUIRED_REVISION + " or later"); //$NON-NLS-1$ } } catch (TracNoSuchMethodException e) { throw new TracException( - "Required API calls are missing, please update your Trac XML-RPC Plugin to revision " - + REQUIRED_REVISION + " or later"); + "Required API calls are missing, please update your Trac XML-RPC Plugin to revision " //$NON-NLS-1$ + + REQUIRED_REVISION + " or later"); //$NON-NLS-1$ } if (!isAPIVersionOrHigher(REQUIRED_EPOCH, REQUIRED_MAJOR, REQUIRED_MINOR, monitor)) { - throw new TracException("The API version " + majorAPIVersion + "." + minorAPIVersion - + " is unsupported, please update your Trac XML-RPC Plugin to revision " + REQUIRED_REVISION - + " or later"); + throw new TracException("The API version " + majorAPIVersion + "." + minorAPIVersion //$NON-NLS-1$ //$NON-NLS-2$ + + " is unsupported, please update your Trac XML-RPC Plugin to revision " + REQUIRED_REVISION //$NON-NLS-1$ + + " or later"); //$NON-NLS-1$ } } @@ -447,15 +447,15 @@ public class TracXmlRpcClient extends AbstractTracClient implements ITracWikiCli } public TracTicket getTicket(int id, IProgressMonitor monitor) throws TracException { - Object[] result = (Object[]) call(monitor, "ticket.get", id); + Object[] result = (Object[]) call(monitor, "ticket.get", id); //$NON-NLS-1$ TracTicket ticket = parseTicket(result); - result = (Object[]) call(monitor, "ticket.changeLog", id, 0); + result = (Object[]) call(monitor, "ticket.changeLog", id, 0); //$NON-NLS-1$ for (Object item : result) { ticket.addComment(parseChangeLogEntry((Object[]) item)); } - result = (Object[]) call(monitor, "ticket.listAttachments", id); + result = (Object[]) call(monitor, "ticket.listAttachments", id); //$NON-NLS-1$ for (Object item : result) { ticket.addAttachment(parseAttachment((Object[]) item)); } @@ -502,7 +502,7 @@ public class TracXmlRpcClient extends AbstractTracClient implements ITracWikiCli public List<TracTicket> getTickets(int[] ids, IProgressMonitor monitor) throws TracException { Map<String, Object>[] calls = new Map[ids.length]; for (int i = 0; i < calls.length; i++) { - calls[i] = createMultiCall("ticket.get", ids[i]); + calls[i] = createMultiCall("ticket.get", ids[i]); //$NON-NLS-1$ } Object[] result = multicall(monitor, calls); @@ -520,11 +520,11 @@ public class TracXmlRpcClient extends AbstractTracClient implements ITracWikiCli @SuppressWarnings("unchecked") public void search(TracSearch query, List<TracTicket> tickets, IProgressMonitor monitor) throws TracException { // an empty query string is not valid, therefore prepend order - Object[] result = (Object[]) call(monitor, "ticket.query", "order=id" + query.toQuery()); + Object[] result = (Object[]) call(monitor, "ticket.query", "order=id" + query.toQuery()); //$NON-NLS-1$ //$NON-NLS-2$ Map<String, Object>[] calls = new Map[result.length]; for (int i = 0; i < calls.length; i++) { - calls[i] = createMultiCall("ticket.get", result[i]); + calls[i] = createMultiCall("ticket.get", result[i]); //$NON-NLS-1$ } result = multicall(monitor, calls); @@ -551,28 +551,28 @@ public class TracXmlRpcClient extends AbstractTracClient implements ITracWikiCli } else if (object instanceof Integer) { return TracUtil.parseDate((Integer) object); } - throw new ClassCastException("Unexpected object type for date: " + object.getClass()); + throw new ClassCastException("Unexpected object type for date: " + object.getClass()); //$NON-NLS-1$ } @Override public synchronized void updateAttributes(IProgressMonitor monitor) throws TracException { - monitor.beginTask("Updating attributes", 9); + monitor.beginTask("Updating attributes", 9); //$NON-NLS-1$ - Object[] result = getAttributes("ticket.component", monitor); + Object[] result = getAttributes("ticket.component", monitor); //$NON-NLS-1$ data.components = new ArrayList<TracComponent>(result.length); for (Object item : result) { data.components.add(parseComponent((Map<?, ?>) getMultiCallResult(item))); } advance(monitor, 1); - result = getAttributes("ticket.milestone", monitor); + result = getAttributes("ticket.milestone", monitor); //$NON-NLS-1$ data.milestones = new ArrayList<TracMilestone>(result.length); for (Object item : result) { data.milestones.add(parseMilestone((Map<?, ?>) getMultiCallResult(item))); } advance(monitor, 1); - List<TicketAttributeResult> attributes = getTicketAttributes("ticket.priority", monitor); + List<TicketAttributeResult> attributes = getTicketAttributes("ticket.priority", monitor); //$NON-NLS-1$ data.priorities = new ArrayList<TracPriority>(result.length); for (TicketAttributeResult attribute : attributes) { data.priorities.add(new TracPriority(attribute.name, attribute.value)); @@ -580,7 +580,7 @@ public class TracXmlRpcClient extends AbstractTracClient implements ITracWikiCli Collections.sort(data.priorities); advance(monitor, 1); - attributes = getTicketAttributes("ticket.resolution", monitor); + attributes = getTicketAttributes("ticket.resolution", monitor); //$NON-NLS-1$ data.ticketResolutions = new ArrayList<TracTicketResolution>(result.length); for (TicketAttributeResult attribute : attributes) { data.ticketResolutions.add(new TracTicketResolution(attribute.name, attribute.value)); @@ -588,7 +588,7 @@ public class TracXmlRpcClient extends AbstractTracClient implements ITracWikiCli Collections.sort(data.ticketResolutions); advance(monitor, 1); - attributes = getTicketAttributes("ticket.severity", monitor); + attributes = getTicketAttributes("ticket.severity", monitor); //$NON-NLS-1$ data.severities = new ArrayList<TracSeverity>(result.length); for (TicketAttributeResult attribute : attributes) { data.severities.add(new TracSeverity(attribute.name, attribute.value)); @@ -597,7 +597,7 @@ public class TracXmlRpcClient extends AbstractTracClient implements ITracWikiCli advance(monitor, 1); boolean trac011 = isAPIVersionOrHigher(1, 0, 0, monitor); - attributes = getTicketAttributes("ticket.status", trac011, monitor); + attributes = getTicketAttributes("ticket.status", trac011, monitor); //$NON-NLS-1$ data.ticketStatus = new ArrayList<TracTicketStatus>(result.length); for (TicketAttributeResult attribute : attributes) { data.ticketStatus.add(new TracTicketStatus(attribute.name, attribute.value)); @@ -605,7 +605,7 @@ public class TracXmlRpcClient extends AbstractTracClient implements ITracWikiCli Collections.sort(data.ticketStatus); advance(monitor, 1); - attributes = getTicketAttributes("ticket.type", monitor); + attributes = getTicketAttributes("ticket.type", monitor); //$NON-NLS-1$ data.ticketTypes = new ArrayList<TracTicketType>(result.length); for (TicketAttributeResult attribute : attributes) { data.ticketTypes.add(new TracTicketType(attribute.name, attribute.value)); @@ -613,14 +613,14 @@ public class TracXmlRpcClient extends AbstractTracClient implements ITracWikiCli Collections.sort(data.ticketTypes); advance(monitor, 1); - result = getAttributes("ticket.version", monitor); + result = getAttributes("ticket.version", monitor); //$NON-NLS-1$ data.versions = new ArrayList<TracVersion>(result.length); for (Object item : result) { data.versions.add(parseVersion((Map<?, ?>) getMultiCallResult(item))); } advance(monitor, 1); - result = (Object[]) call(monitor, "ticket.getTicketFields"); + result = (Object[]) call(monitor, "ticket.getTicketFields"); //$NON-NLS-1$ data.ticketFields = new ArrayList<TracTicketField>(result.length); for (Object item : result) { data.ticketFields.add(parseTicketField((Map<?, ?>) item)); @@ -637,33 +637,33 @@ public class TracXmlRpcClient extends AbstractTracClient implements ITracWikiCli } private TracComponent parseComponent(Map<?, ?> result) { - TracComponent component = new TracComponent((String) result.get("name")); - component.setOwner((String) result.get("owner")); - component.setDescription((String) result.get("description")); + TracComponent component = new TracComponent((String) result.get("name")); //$NON-NLS-1$ + component.setOwner((String) result.get("owner")); //$NON-NLS-1$ + component.setDescription((String) result.get("description")); //$NON-NLS-1$ return component; } private TracMilestone parseMilestone(Map<?, ?> result) { - TracMilestone milestone = new TracMilestone((String) result.get("name")); - milestone.setCompleted(parseDate(result.get("completed"))); - milestone.setDue(parseDate(result.get("due"))); - milestone.setDescription((String) result.get("description")); + TracMilestone milestone = new TracMilestone((String) result.get("name")); //$NON-NLS-1$ + milestone.setCompleted(parseDate(result.get("completed"))); //$NON-NLS-1$ + milestone.setDue(parseDate(result.get("due"))); //$NON-NLS-1$ + milestone.setDescription((String) result.get("description")); //$NON-NLS-1$ return milestone; } private TracVersion parseVersion(Map<?, ?> result) { - TracVersion version = new TracVersion((String) result.get("name")); - version.setTime(parseDate(result.get("time"))); - version.setDescription((String) result.get("description")); + TracVersion version = new TracVersion((String) result.get("name")); //$NON-NLS-1$ + version.setTime(parseDate(result.get("time"))); //$NON-NLS-1$ + version.setDescription((String) result.get("description")); //$NON-NLS-1$ return version; } private TracTicketField parseTicketField(Map<?, ?> result) { - TracTicketField field = new TracTicketField((String) result.get("name")); - field.setType(TracTicketField.Type.fromString((String) result.get("type"))); - field.setLabel((String) result.get("label")); - field.setDefaultValue((String) result.get("value")); - Object[] items = (Object[]) result.get("options"); + TracTicketField field = new TracTicketField((String) result.get("name")); //$NON-NLS-1$ + field.setType(TracTicketField.Type.fromString((String) result.get("type"))); //$NON-NLS-1$ + field.setLabel((String) result.get("label")); //$NON-NLS-1$ + field.setDefaultValue((String) result.get("value")); //$NON-NLS-1$ + Object[] items = (Object[]) result.get("options"); //$NON-NLS-1$ if (items != null) { String[] options = new String[items.length]; for (int i = 0; i < items.length; i++) { @@ -671,30 +671,30 @@ public class TracXmlRpcClient extends AbstractTracClient implements ITracWikiCli } field.setOptions(options); } - if (result.get("custom") != null) { - field.setCustom((Boolean) result.get("custom")); + if (result.get("custom") != null) { //$NON-NLS-1$ + field.setCustom((Boolean) result.get("custom")); //$NON-NLS-1$ } - if (result.get("order") != null) { - field.setOrder((Integer) result.get("order")); + if (result.get("order") != null) { //$NON-NLS-1$ + field.setOrder((Integer) result.get("order")); //$NON-NLS-1$ } - if (result.get("optional") != null) { - field.setOptional((Boolean) result.get("optional")); + if (result.get("optional") != null) { //$NON-NLS-1$ + field.setOptional((Boolean) result.get("optional")); //$NON-NLS-1$ } - if (result.get("width") != null) { - field.setWidth((Integer) result.get("width")); + if (result.get("width") != null) { //$NON-NLS-1$ + field.setWidth((Integer) result.get("width")); //$NON-NLS-1$ } - if (result.get("height") != null) { - field.setHeight((Integer) result.get("height")); + if (result.get("height") != null) { //$NON-NLS-1$ + field.setHeight((Integer) result.get("height")); //$NON-NLS-1$ } return field; } @SuppressWarnings("unchecked") private Object[] getAttributes(String attributeType, IProgressMonitor monitor) throws TracException { - Object[] ids = (Object[]) call(monitor, attributeType + ".getAll"); + Object[] ids = (Object[]) call(monitor, attributeType + ".getAll"); //$NON-NLS-1$ Map<String, Object>[] calls = new Map[ids.length]; for (int i = 0; i < calls.length; i++) { - calls[i] = createMultiCall(attributeType + ".get", ids[i]); + calls[i] = createMultiCall(attributeType + ".get", ids[i]); //$NON-NLS-1$ } Object[] result = multicall(monitor, calls); @@ -712,11 +712,11 @@ public class TracXmlRpcClient extends AbstractTracClient implements ITracWikiCli private List<TicketAttributeResult> getTicketAttributes(String attributeType, boolean assignValues, IProgressMonitor monitor) throws TracException { // get list of attribute ids first - Object[] ids = (Object[]) call(monitor, attributeType + ".getAll"); + Object[] ids = (Object[]) call(monitor, attributeType + ".getAll"); //$NON-NLS-1$ // fetch all attributes in a single call Map<String, Object>[] calls = new Map[ids.length]; for (int i = 0; i < calls.length; i++) { - calls[i] = createMultiCall(attributeType + ".get", ids[i]); + calls[i] = createMultiCall(attributeType + ".get", ids[i]); //$NON-NLS-1$ } Object[] result = multicall(monitor, calls); @@ -736,10 +736,10 @@ public class TracXmlRpcClient extends AbstractTracClient implements ITracWikiCli attributes.add(attribute); } catch (ClassCastException e) { StatusHandler.log(new Status(IStatus.WARNING, TracCorePlugin.ID_PLUGIN, - "Invalid response from Trac repository for attribute type: '" + attributeType + "'", e)); + "Invalid response from Trac repository for attribute type: '" + attributeType + "'", e)); //$NON-NLS-1$ //$NON-NLS-2$ } catch (NumberFormatException e) { StatusHandler.log(new Status(IStatus.WARNING, TracCorePlugin.ID_PLUGIN, - "Invalid response from Trac repository for attribute type: '" + attributeType + "'", e)); + "Invalid response from Trac repository for attribute type: '" + attributeType + "'", e)); //$NON-NLS-1$ //$NON-NLS-2$ } } @@ -747,7 +747,7 @@ public class TracXmlRpcClient extends AbstractTracClient implements ITracWikiCli } public InputStream getAttachmentData(int ticketId, String filename, IProgressMonitor monitor) throws TracException { - byte[] data = (byte[]) call(monitor, "ticket.getAttachment", ticketId, filename); + byte[] data = (byte[]) call(monitor, "ticket.getAttachment", ticketId, filename); //$NON-NLS-1$ return new ByteArrayInputStream(data); } @@ -759,7 +759,7 @@ public class TracXmlRpcClient extends AbstractTracClient implements ITracWikiCli } catch (IOException e) { throw new TracException(e); } - call(monitor, "ticket.putAttachment", ticketId, filename, description, data, false); + call(monitor, "ticket.putAttachment", ticketId, filename, description, data, false); //$NON-NLS-1$ } private byte[] readData(InputStream in, IProgressMonitor monitor) throws IOException { @@ -784,13 +784,13 @@ public class TracXmlRpcClient extends AbstractTracClient implements ITracWikiCli in.close(); } catch (IOException e) { StatusHandler.log(new Status(IStatus.ERROR, TracCorePlugin.ID_PLUGIN, - "Error closing attachment stream", e)); + "Error closing attachment stream", e)); //$NON-NLS-1$ } } } public void deleteAttachment(int ticketId, String filename, IProgressMonitor monitor) throws TracException { - call(monitor, "ticket.deleteAttachment", ticketId, filename); + call(monitor, "ticket.deleteAttachment", ticketId, filename); //$NON-NLS-1$ } private class TicketAttributeResult { @@ -809,9 +809,9 @@ public class TracXmlRpcClient extends AbstractTracClient implements ITracWikiCli throw new InvalidTicketException(); } if (isAPIVersionOrHigher(0, 0, 2, monitor)) { - return (Integer) call(monitor, "ticket.create", summary, description, attributes, true); + return (Integer) call(monitor, "ticket.create", summary, description, attributes, true); //$NON-NLS-1$ } else { - return (Integer) call(monitor, "ticket.create", summary, description, attributes); + return (Integer) call(monitor, "ticket.create", summary, description, attributes); //$NON-NLS-1$ } } @@ -820,15 +820,15 @@ public class TracXmlRpcClient extends AbstractTracClient implements ITracWikiCli Map<String, String> attributes = ticket.getValues(); if (isAPIVersionOrHigher(0, 0, 2, monitor)) { - call(monitor, "ticket.update", ticket.getId(), comment, attributes, true); + call(monitor, "ticket.update", ticket.getId(), comment, attributes, true); //$NON-NLS-1$ } else { - call(monitor, "ticket.update", ticket.getId(), comment, attributes); + call(monitor, "ticket.update", ticket.getId(), comment, attributes); //$NON-NLS-1$ } } public Set<Integer> getChangedTickets(Date since, IProgressMonitor monitor) throws TracException { Object[] ids; - ids = (Object[]) call(monitor, "ticket.getRecentChanges", since); + ids = (Object[]) call(monitor, "ticket.getRecentChanges", since); //$NON-NLS-1$ Set<Integer> result = new HashSet<Integer>(); for (Object id : ids) { result.add((Integer) id); @@ -837,7 +837,7 @@ public class TracXmlRpcClient extends AbstractTracClient implements ITracWikiCli } public String[] getActions(int id, IProgressMonitor monitor) throws TracException { - Object[] actions = (Object[]) call(monitor, "ticket.getAvailableActions", id); + Object[] actions = (Object[]) call(monitor, "ticket.getAvailableActions", id); //$NON-NLS-1$ String[] result = new String[actions.length]; for (int i = 0; i < result.length; i++) { result[i] = (String) actions[i]; @@ -846,22 +846,22 @@ public class TracXmlRpcClient extends AbstractTracClient implements ITracWikiCli } public Date getTicketLastChanged(Integer id, IProgressMonitor monitor) throws TracException { - Object[] result = (Object[]) call(monitor, "ticket.get", id); + Object[] result = (Object[]) call(monitor, "ticket.get", id); //$NON-NLS-1$ return parseDate(result[2]); } public void validateWikiRpcApi(IProgressMonitor monitor) throws TracException { - if (((Integer) call(monitor, "wiki.getRPCVersionSupported")) < 2) { + if (((Integer) call(monitor, "wiki.getRPCVersionSupported")) < 2) { //$NON-NLS-1$ validate(monitor); } } public String wikiToHtml(String sourceText, IProgressMonitor monitor) throws TracException { - return (String) call(monitor, "wiki.wikiToHtml", sourceText); + return (String) call(monitor, "wiki.wikiToHtml", sourceText); //$NON-NLS-1$ } public String[] getAllWikiPageNames(IProgressMonitor monitor) throws TracException { - Object[] result = (Object[]) call(monitor, "wiki.getAllPages"); + Object[] result = (Object[]) call(monitor, "wiki.getAllPages"); //$NON-NLS-1$ String[] wikiPageNames = new String[result.length]; for (int i = 0; i < wikiPageNames.length; i++) { wikiPageNames[i] = (String) result[i]; @@ -878,11 +878,11 @@ public class TracXmlRpcClient extends AbstractTracClient implements ITracWikiCli // Note: if an unexpected null value is passed to XmlRpcPlugin, XmlRpcClient will throw a TracRemoteException. // So, this null-parameter checking may be omitted if resorting to XmlRpcClient is more appropriate. if (pageName == null) { - throw new IllegalArgumentException("Wiki page name cannot be null"); + throw new IllegalArgumentException("Wiki page name cannot be null"); //$NON-NLS-1$ } - Object result = (version == LATEST_VERSION) ? call(monitor, "wiki.getPageInfo", pageName) // - : call(monitor, "wiki.getPageInfoVersion", pageName, version); + Object result = (version == LATEST_VERSION) ? call(monitor, "wiki.getPageInfo", pageName) // //$NON-NLS-1$ + : call(monitor, "wiki.getPageInfoVersion", pageName, version); //$NON-NLS-1$ return parseWikiPageInfo(result); } @@ -892,7 +892,7 @@ public class TracXmlRpcClient extends AbstractTracClient implements ITracWikiCli TracWikiPageInfo latestVersion = getWikiPageInfo(pageName, null); Map<String, Object>[] calls = new Map[latestVersion.getVersion() - 1]; for (int i = 0; i < calls.length; i++) { - calls[i] = createMultiCall("wiki.getPageInfoVersion", pageName, i + 1); + calls[i] = createMultiCall("wiki.getPageInfoVersion", pageName, i + 1); //$NON-NLS-1$ } Object[] result = multicall(monitor, calls); @@ -913,13 +913,13 @@ public class TracXmlRpcClient extends AbstractTracClient implements ITracWikiCli if (pageInfoResult instanceof Map<?, ?>) { TracWikiPageInfo pageInfo = new TracWikiPageInfo(); Map<?, ?> infoMap = (Map<?, ?>) pageInfoResult; - pageInfo.setPageName((String) infoMap.get("name")); - pageInfo.setAuthor((String) infoMap.get("author")); - pageInfo.setLastModified(parseDate(infoMap.get("lastModified"))); - pageInfo.setVersion((Integer) infoMap.get("version")); + pageInfo.setPageName((String) infoMap.get("name")); //$NON-NLS-1$ + pageInfo.setAuthor((String) infoMap.get("author")); //$NON-NLS-1$ + pageInfo.setLastModified(parseDate(infoMap.get("lastModified"))); //$NON-NLS-1$ + pageInfo.setVersion((Integer) infoMap.get("version")); //$NON-NLS-1$ return pageInfo; } else { - throw new InvalidWikiPageException("Wiki page name or version does not exist"); + throw new InvalidWikiPageException("Wiki page name or version does not exist"); //$NON-NLS-1$ } } @@ -931,13 +931,13 @@ public class TracXmlRpcClient extends AbstractTracClient implements ITracWikiCli // Note: if an unexpected null value is passed to XmlRpcPlugin, XmlRpcClient will throw a TracRemoteException. // So, this null-parameter checking may be omitted if resorting to XmlRpcClient is more appropriate. if (pageName == null) { - throw new IllegalArgumentException("Wiki page name cannot be null"); + throw new IllegalArgumentException("Wiki page name cannot be null"); //$NON-NLS-1$ } if (version == LATEST_VERSION) { // XmlRpcClient throws a TracRemoteException if pageName or version doesn't exist - return (String) call(monitor, "wiki.getPage", pageName); + return (String) call(monitor, "wiki.getPage", pageName); //$NON-NLS-1$ } else { - return (String) call(monitor, "wiki.getPageVersion", pageName, version); + return (String) call(monitor, "wiki.getPageVersion", pageName, version); //$NON-NLS-1$ } } @@ -947,23 +947,23 @@ public class TracXmlRpcClient extends AbstractTracClient implements ITracWikiCli public String getWikiPageHtml(String pageName, int version, IProgressMonitor monitor) throws TracException { if (pageName == null) { - throw new IllegalArgumentException("Wiki page name cannot be null"); + throw new IllegalArgumentException("Wiki page name cannot be null"); //$NON-NLS-1$ } if (version == LATEST_VERSION) { // XmlRpcClient throws a TracRemoteException if pageName or version doesn't exist - return (String) call(monitor, "wiki.getPageHTML", pageName); + return (String) call(monitor, "wiki.getPageHTML", pageName); //$NON-NLS-1$ } else { - return (String) call(monitor, "wiki.getPageHTMLVersion", pageName, version); + return (String) call(monitor, "wiki.getPageHTMLVersion", pageName, version); //$NON-NLS-1$ } } public TracWikiPageInfo[] getRecentWikiChanges(Date since, IProgressMonitor monitor) throws TracException { if (since == null) { - throw new IllegalArgumentException("Date parameter cannot be null"); + throw new IllegalArgumentException("Date parameter cannot be null"); //$NON-NLS-1$ } - Object[] result = (Object[]) call(monitor, "wiki.getRecentChanges", since); + Object[] result = (Object[]) call(monitor, "wiki.getRecentChanges", since); //$NON-NLS-1$ TracWikiPageInfo[] changes = new TracWikiPageInfo[result.length]; for (int i = 0; i < result.length; i++) { changes[i] = parseWikiPageInfo(result[i]); @@ -985,12 +985,12 @@ public class TracXmlRpcClient extends AbstractTracClient implements ITracWikiCli public boolean putWikipage(String pageName, String content, Map<String, Object> attributes, IProgressMonitor monitor) throws TracException { - Boolean result = (Boolean) call(monitor, "wiki.putPage", pageName, content, attributes); + Boolean result = (Boolean) call(monitor, "wiki.putPage", pageName, content, attributes); //$NON-NLS-1$ return result.booleanValue(); } public String[] listWikiPageAttachments(String pageName, IProgressMonitor monitor) throws TracException { - Object[] result = (Object[]) call(monitor, "wiki.listAttachments", pageName); + Object[] result = (Object[]) call(monitor, "wiki.listAttachments", pageName); //$NON-NLS-1$ String[] attachments = new String[result.length]; for (int i = 0; i < attachments.length; i++) { attachments[i] = (String) result[i]; @@ -1000,8 +1000,8 @@ public class TracXmlRpcClient extends AbstractTracClient implements ITracWikiCli public InputStream getWikiPageAttachmentData(String pageName, String fileName, IProgressMonitor monitor) throws TracException { - String attachmentName = pageName + "/" + fileName; - byte[] data = (byte[]) call(monitor, "wiki.getAttachment", attachmentName); + String attachmentName = pageName + "/" + fileName; //$NON-NLS-1$ + byte[] data = (byte[]) call(monitor, "wiki.getAttachment", attachmentName); //$NON-NLS-1$ return new ByteArrayInputStream(data); } diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/messages.properties b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/messages.properties new file mode 100644 index 000000000..039a0bf78 --- /dev/null +++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/messages.properties @@ -0,0 +1 @@ +TracWebClient_Updating_attributes=Updating attributes diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/messages.properties b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/messages.properties new file mode 100644 index 000000000..94a9caf16 --- /dev/null +++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/messages.properties @@ -0,0 +1,34 @@ +TracAttachmentHandler_Uploading_attachment=Uploading attachment + +TracAttribute_Assigned_to=Assigned to: +TracAttribute_CC=CC: +TracAttribute_Component=Component: +TracAttribute_Created=Created: +TracAttribute_Description=Description: +TracAttribute_ID=ID: +TracAttribute_Keywords=Keywords: +TracAttribute_Last_Modification=Last Modification: +TracAttribute_Milestone=Milestone: +TracAttribute_Priority=Priority: +TracAttribute_Reporter=Reporter: +TracAttribute_Resolution=Resolution: +TracAttribute_Severity=Severity: +TracAttribute_Status=Status: +TracAttribute_Summary=Summary: +TracAttribute_Type=Type: +TracAttribute_Version=Version: + +TracCorePlugin_I_O_error_has_occured=I/O error has occured +TracCorePlugin_Repository_URL_is_invalid=Repository URL is invalid +TracCorePlugin_the_SERVER_RETURNED_an_UNEXPECTED_RESOPNSE=The server returned an unexpected response +TracCorePlugin_Unexpected_error=Unexpected error +TracCorePlugin_Unexpected_server_response_=Unexpected server response: + +TracRepositoryConnector_Getting_changed_tasks=Getting changed tasks +TracRepositoryConnector_Querying_repository=Querying repository +TracRepositoryConnector_TRAC_SUPPORTS_0_9_OR_0_10_THROUGH_WEB_AND_XML_RPC=Trac (supports 0.9 or 0.10 through Web and XML-RPC) + +TracWikiHandler_Download_Wiki_Page=Download Wiki Page +TracWikiHandler_Download_Wiki_Page_Names=Download Wiki Page Names +TracWikiHandler_Retrieve_Wiki_Page_History=Retrieve Wiki Page History +TracWikiHandler_Upload_Wiki_Page=Upload Wiki Page diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracComment.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracComment.java index 109678634..840349963 100644 --- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracComment.java +++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracComment.java @@ -83,7 +83,7 @@ public class TracComment { @Override public String toString() { - return "[" + field + "] " + author + ": " + oldValue + " -> " + newValue; + return "[" + field + "] " + author + ": " + oldValue + " -> " + newValue; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ } } diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracRepositoryAttribute.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracRepositoryAttribute.java index ab09ca1c4..ca6a6ace2 100644 --- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracRepositoryAttribute.java +++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracRepositoryAttribute.java @@ -40,7 +40,7 @@ public class TracRepositoryAttribute implements Serializable { @Override public String toString() { // FIXME serialization can restore null values here - return (name != null) ? name : ""; + return (name != null) ? name : ""; //$NON-NLS-1$ } } diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracSearch.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracSearch.java index 5a815abae..c4305a415 100644 --- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracSearch.java +++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracSearch.java @@ -95,22 +95,22 @@ public class TracSearch { public String toQuery() { StringBuilder sb = new StringBuilder(); if (orderBy != null) { - sb.append("&order="); + sb.append("&order="); //$NON-NLS-1$ sb.append(orderBy); if (!ascending) { - sb.append("&desc=1"); + sb.append("&desc=1"); //$NON-NLS-1$ } } for (TracSearchFilter filter : filterByFieldName.values()) { - sb.append("&"); + sb.append("&"); //$NON-NLS-1$ sb.append(filter.getFieldName()); sb.append(filter.getOperator().getQueryValue()); - sb.append("="); + sb.append("="); //$NON-NLS-1$ List<String> values = filter.getValues(); for (Iterator<String> it = values.iterator(); it.hasNext();) { sb.append(it.next()); if (it.hasNext()) { - sb.append("|"); + sb.append("|"); //$NON-NLS-1$ } } } @@ -125,28 +125,28 @@ public class TracSearch { public String toUrl() { StringBuilder sb = new StringBuilder(); if (orderBy != null) { - sb.append("&order="); + sb.append("&order="); //$NON-NLS-1$ sb.append(orderBy); if (!ascending) { - sb.append("&desc=1"); + sb.append("&desc=1"); //$NON-NLS-1$ } } else if (filterByFieldName.isEmpty()) { // TODO figure out why search must be ordered when logged in (otherwise // no results will be returned) - sb.append("&order=id"); + sb.append("&order=id"); //$NON-NLS-1$ } for (TracSearchFilter filter : filterByFieldName.values()) { for (String value : filter.getValues()) { - sb.append("&"); + sb.append("&"); //$NON-NLS-1$ sb.append(filter.getFieldName()); - sb.append("="); + sb.append("="); //$NON-NLS-1$ try { sb.append(URLEncoder.encode(filter.getOperator().getQueryValue(), ITracClient.CHARSET)); sb.append(URLEncoder.encode(value, ITracClient.CHARSET)); } catch (UnsupportedEncodingException e) { StatusHandler.log(new Status(IStatus.WARNING, TracCorePlugin.ID_PLUGIN, - "Unexpected exception while decoding URL", e)); + "Unexpected exception while decoding URL", e)); //$NON-NLS-1$ } } } @@ -154,27 +154,27 @@ public class TracSearch { } public void fromUrl(String url) { - StringTokenizer t = new StringTokenizer(url, "&"); + StringTokenizer t = new StringTokenizer(url, "&"); //$NON-NLS-1$ while (t.hasMoreTokens()) { String token = t.nextToken(); - int i = token.indexOf("="); + int i = token.indexOf("="); //$NON-NLS-1$ if (i != -1) { try { String key = URLDecoder.decode(token.substring(0, i), ITracClient.CHARSET); String value = URLDecoder.decode(token.substring(i + 1), ITracClient.CHARSET); - if ("order".equals(key)) { + if ("order".equals(key)) { //$NON-NLS-1$ setOrderBy(value); - } else if ("desc".equals(key)) { - setAscending(!"1".equals(value)); - } else if ("group".equals(key) || "groupdesc".equals(key) || "verbose".equals(key)) { + } else if ("desc".equals(key)) { //$NON-NLS-1$ + setAscending(!"1".equals(value)); //$NON-NLS-1$ + } else if ("group".equals(key) || "groupdesc".equals(key) || "verbose".equals(key)) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ // ignore these parameters } else { addFilter(key, value); } } catch (UnsupportedEncodingException e) { StatusHandler.log(new Status(IStatus.WARNING, TracCorePlugin.ID_PLUGIN, - "Unexpected exception while decoding URL", e)); + "Unexpected exception while decoding URL", e)); //$NON-NLS-1$ } } } diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracSearchFilter.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracSearchFilter.java index f9f69a24c..160109481 100644 --- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracSearchFilter.java +++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracSearchFilter.java @@ -25,8 +25,8 @@ import java.util.List; public class TracSearchFilter { public enum CompareOperator { - CONTAINS("~"), CONTAINS_NOT("!~"), BEGINS_WITH("^"), NOT_BEGINS_WITH("!^"), ENDS_WITH("$"), NOT_ENDS_WITH("!$"), IS( - ""), IS_NOT("!"); + CONTAINS("~"), CONTAINS_NOT("!~"), BEGINS_WITH("^"), NOT_BEGINS_WITH("!^"), ENDS_WITH("$"), NOT_ENDS_WITH("!$"), IS( //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ + ""), IS_NOT("!"); //$NON-NLS-1$ //$NON-NLS-2$ public static CompareOperator fromUrl(String value) { for (CompareOperator operator : values()) { @@ -55,21 +55,21 @@ public class TracSearchFilter { public String toString() { switch (this) { case CONTAINS: - return "contains"; + return "contains"; //$NON-NLS-1$ case CONTAINS_NOT: - return "does not contain"; + return "does not contain"; //$NON-NLS-1$ case BEGINS_WITH: - return "begins with"; + return "begins with"; //$NON-NLS-1$ case NOT_BEGINS_WITH: - return "does not begin with"; + return "does not begin with"; //$NON-NLS-1$ case ENDS_WITH: - return "ends with"; + return "ends with"; //$NON-NLS-1$ case NOT_ENDS_WITH: - return "does not end with"; + return "does not end with"; //$NON-NLS-1$ case IS_NOT: - return "is not"; + return "is not"; //$NON-NLS-1$ default: - return "is"; + return "is"; //$NON-NLS-1$ } } diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracTicket.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracTicket.java index 2a91367a6..ce48adb3e 100644 --- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracTicket.java +++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracTicket.java @@ -32,10 +32,10 @@ public class TracTicket { * @author Steffen Pingel */ public enum Key { - CC("cc"), CHANGE_TIME("changetime"), COMPONENT("component"), DESCRIPTION("description"), ID("id"), KEYWORDS( - "keywords"), MILESTONE("milestone"), OWNER("owner"), PRIORITY("priority"), REPORTER("reporter"), RESOLUTION( - "resolution"), STATUS("status"), SEVERITY("severity"), SUMMARY("summary"), TIME("time"), TYPE("type"), VERSION( - "version"); + CC("cc"), CHANGE_TIME("changetime"), COMPONENT("component"), DESCRIPTION("description"), ID("id"), KEYWORDS( //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ + "keywords"), MILESTONE("milestone"), OWNER("owner"), PRIORITY("priority"), REPORTER("reporter"), RESOLUTION( //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ + "resolution"), STATUS("status"), SEVERITY("severity"), SUMMARY("summary"), TIME("time"), TYPE("type"), VERSION( //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ + "version"); //$NON-NLS-1$ public static Key fromKey(String name) { for (Key key : Key.values()) { @@ -166,8 +166,8 @@ public class TracTicket { } else if (value != null) { putCustomValue(keyName, value); } else { - throw new InvalidTicketException("Expected string value for custom key '" + keyName + "', got '" + value - + "'"); + throw new InvalidTicketException("Expected string value for custom key '" + keyName + "', got '" + value //$NON-NLS-1$ //$NON-NLS-2$ + + "'"); //$NON-NLS-1$ } return true; } diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracTicketField.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracTicketField.java index 7fc16f4b6..49d0f3747 100644 --- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracTicketField.java +++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracTicketField.java @@ -25,15 +25,15 @@ public class TracTicketField implements Serializable { public static Type fromString(String value) { value = value.toLowerCase(); - if ("text".equals(value)) { + if ("text".equals(value)) { //$NON-NLS-1$ return TEXT; - } else if ("checkbox".equals(value)) { + } else if ("checkbox".equals(value)) { //$NON-NLS-1$ return CHECKBOX; - } else if ("select".equals(value)) { + } else if ("select".equals(value)) { //$NON-NLS-1$ return SELECT; - } else if ("radio".equals(value)) { + } else if ("radio".equals(value)) { //$NON-NLS-1$ return RADIO; - } else if ("textarea".equals(value)) { + } else if ("textarea".equals(value)) { //$NON-NLS-1$ return TEXTAREA; } return TEXT; diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracWikiPageInfo.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracWikiPageInfo.java index cd082526a..c67dfb31e 100644 --- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracWikiPageInfo.java +++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/model/TracWikiPageInfo.java @@ -75,7 +75,7 @@ public class TracWikiPageInfo { @Override public String toString() { - return pageName + ": version " + version + " by " + author + " last modified at " + lastModified; + return pageName + ": version " + version + " by " + author + " last modified at " + lastModified; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } } diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/util/Messages.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/util/Messages.java new file mode 100644 index 000000000..02c9c6438 --- /dev/null +++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/util/Messages.java @@ -0,0 +1,32 @@ +/******************************************************************************* + * Copyright (c) 2004, 2008 Tasktop Technologies and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tasktop Technologies - initial API and implementation + *******************************************************************************/ + +package org.eclipse.mylyn.internal.trac.core.util; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +public class Messages { + private static final String BUNDLE_NAME = "org.eclipse.mylyn.internal.trac.core.util.messages"; //$NON-NLS-1$ + + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + private Messages() { + } + + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/util/TracHttpClientTransportFactory.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/util/TracHttpClientTransportFactory.java index 77cf85b7a..b78a68622 100644 --- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/util/TracHttpClientTransportFactory.java +++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/util/TracHttpClientTransportFactory.java @@ -71,7 +71,7 @@ public class TracHttpClientTransportFactory implements XmlRpcTransportFactory { public TracHttpClientTransport(XmlRpcClient client, HttpClient httpClient, AbstractWebLocation location, HttpMethodInterceptor interceptor) { - super(client, ""); + super(client, ""); //$NON-NLS-1$ this.httpClient = httpClient; this.location = location; this.interceptor = interceptor; @@ -96,15 +96,15 @@ public class TracHttpClientTransportFactory implements XmlRpcTransportFactory { try { return method.getResponseBodyAsStream(); } catch (HttpException e) { - throw new XmlRpcClientException("Error in HTTP transport: " + e.getMessage(), e); + throw new XmlRpcClientException("Error in HTTP transport: " + e.getMessage(), e); //$NON-NLS-1$ } catch (IOException e) { - throw new XmlRpcClientException("I/O error in server communication: " + e.getMessage(), e); + throw new XmlRpcClientException("I/O error in server communication: " + e.getMessage(), e); //$NON-NLS-1$ } } @Override protected String getUserAgent() { - return WebUtil.getUserAgent(""); + return WebUtil.getUserAgent(""); //$NON-NLS-1$ } @Override @@ -141,7 +141,7 @@ public class TracHttpClientTransportFactory implements XmlRpcTransportFactory { @Override protected boolean isResponseGzipCompressed(XmlRpcStreamRequestConfig config) { - Header header = method.getResponseHeader("Content-Encoding"); + Header header = method.getResponseHeader("Content-Encoding"); //$NON-NLS-1$ return header != null && HttpUtil.isUsingGzipEncoding(header.getValue()); } @@ -168,7 +168,7 @@ public class TracHttpClientTransportFactory implements XmlRpcTransportFactory { } public String getContentType() { - return "text/xml"; + return "text/xml"; //$NON-NLS-1$ } public boolean isRepeatable() { @@ -216,10 +216,10 @@ public class TracHttpClientTransportFactory implements XmlRpcTransportFactory { if (t instanceof XmlRpcException) { throw (XmlRpcException) t; } else { - throw new XmlRpcException("Unexpected exception: " + t.getMessage(), t); + throw new XmlRpcException("Unexpected exception: " + t.getMessage(), t); //$NON-NLS-1$ } } catch (IOException e) { - throw new XmlRpcException("I/O error while communicating with HTTP server: " + e.getMessage(), e); + throw new XmlRpcException("I/O error while communicating with HTTP server: " + e.getMessage(), e); //$NON-NLS-1$ } } @@ -230,12 +230,12 @@ public class TracHttpClientTransportFactory implements XmlRpcTransportFactory { private static final long serialVersionUID = 9032521978140685830L; public TracHttpException(int responseCode) { - super(responseCode, "HTTP Error " + responseCode); + super(responseCode, "HTTP Error " + responseCode); //$NON-NLS-1$ } } - protected static final String USER_AGENT = "TracConnector Apache XML-RPC/3.0"; + protected static final String USER_AGENT = "TracConnector Apache XML-RPC/3.0"; //$NON-NLS-1$ private final XmlRpcClient xmlRpcClient; diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/util/TracUtil.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/util/TracUtil.java index e4e9683ac..c232534a2 100644 --- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/util/TracUtil.java +++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/util/TracUtil.java @@ -80,12 +80,12 @@ public class TracUtil { public static IStatus createPermissionDeniedError(String repositoryUrl, String pluginId) { return new RepositoryStatus(repositoryUrl, IStatus.ERROR, TracCorePlugin.ID_PLUGIN, - RepositoryStatus.ERROR_PERMISSION_DENIED, "Permission denied."); + RepositoryStatus.ERROR_PERMISSION_DENIED, Messages.getString("TracUtil.Permission_denied")); //$NON-NLS-1$ } public static String encodeUrl(String string) { try { - return URLEncoder.encode(string, ITracClient.CHARSET).replaceAll("\\+", "%20"); + return URLEncoder.encode(string, ITracClient.CHARSET).replaceAll("\\+", "%20"); //$NON-NLS-1$ //$NON-NLS-2$ } catch (UnsupportedEncodingException e) { return string; } diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/util/messages.properties b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/util/messages.properties new file mode 100644 index 000000000..e0f3fdbc4 --- /dev/null +++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/util/messages.properties @@ -0,0 +1 @@ +TracUtil_Permission_denied=Permission denied. |