diff options
author | relves | 2007-11-30 19:06:30 +0000 |
---|---|---|
committer | relves | 2007-11-30 19:06:30 +0000 |
commit | 30a57c3a4996a49da1f26163d8cfe32d3cab7f44 (patch) | |
tree | 608485b0d590fab3f70a8a01b2be4ff0ef26c148 /org.eclipse.mylyn.bugzilla.core | |
parent | 59976e060ae16a60ad51f732d8ea8e2a5a75630e (diff) | |
download | org.eclipse.mylyn.tasks-30a57c3a4996a49da1f26163d8cfe32d3cab7f44.tar.gz org.eclipse.mylyn.tasks-30a57c3a4996a49da1f26163d8cfe32d3cab7f44.tar.xz org.eclipse.mylyn.tasks-30a57c3a4996a49da1f26163d8cfe32d3cab7f44.zip |
ASSIGNED - bug 206510: [patch] enable contribution/configuration of language settings
https://bugs.eclipse.org/bugs/show_bug.cgi?id=206510
Diffstat (limited to 'org.eclipse.mylyn.bugzilla.core')
10 files changed, 229 insertions, 240 deletions
diff --git a/org.eclipse.mylyn.bugzilla.core/META-INF/MANIFEST.MF b/org.eclipse.mylyn.bugzilla.core/META-INF/MANIFEST.MF index a53b7798a..e3bf94f96 100644 --- a/org.eclipse.mylyn.bugzilla.core/META-INF/MANIFEST.MF +++ b/org.eclipse.mylyn.bugzilla.core/META-INF/MANIFEST.MF @@ -1,7 +1,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Mylyn Bugzilla Connector Core -Bundle-SymbolicName: org.eclipse.mylyn.bugzilla.core; singleton:=true +Bundle-SymbolicName: org.eclipse.mylyn.bugzilla.core;singleton:=true Bundle-Version: 2.2.0.qualifier Bundle-Activator: org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin Require-Bundle: org.eclipse.core.runtime, diff --git a/org.eclipse.mylyn.bugzilla.core/plugin.xml b/org.eclipse.mylyn.bugzilla.core/plugin.xml index 33ca93ceb..12c42ad81 100644 --- a/org.eclipse.mylyn.bugzilla.core/plugin.xml +++ b/org.eclipse.mylyn.bugzilla.core/plugin.xml @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <?eclipse version="3.2"?> <plugin> + <extension-point id="languages" name="languages" schema="schema/languages.exsd"/> </plugin> diff --git a/org.eclipse.mylyn.bugzilla.core/schema/languages.exsd b/org.eclipse.mylyn.bugzilla.core/schema/languages.exsd new file mode 100644 index 000000000..d175012e6 --- /dev/null +++ b/org.eclipse.mylyn.bugzilla.core/schema/languages.exsd @@ -0,0 +1,116 @@ +<?xml version='1.0' encoding='UTF-8'?> +<!-- Schema file written by PDE --> +<schema targetNamespace="org.eclipse.mylyn.bugzilla.core"> +<annotation> + <appInfo> + <meta.schema plugin="org.eclipse.mylyn.bugzilla.core" id="languages" name="languages"/> + </appInfo> + <documentation> + [Enter description of this extension point.] + </documentation> + </annotation> + + <element name="extension"> + <complexType> + <sequence> + <element ref="language" minOccurs="1" maxOccurs="unbounded"/> + </sequence> + <attribute name="point" type="string" use="required"> + <annotation> + <documentation> + + </documentation> + </annotation> + </attribute> + <attribute name="id" type="string"> + <annotation> + <documentation> + + </documentation> + </annotation> + </attribute> + <attribute name="name" type="string"> + <annotation> + <documentation> + + </documentation> + <appInfo> + <meta.attribute translatable="true"/> + </appInfo> + </annotation> + </attribute> + </complexType> + </element> + + <element name="language"> + <complexType> + <sequence> + <element ref="languageAttribute" minOccurs="1" maxOccurs="unbounded"/> + </sequence> + <attribute name="name" type="string" use="required"> + <annotation> + <documentation> + + </documentation> + </annotation> + </attribute> + </complexType> + </element> + + <element name="languageAttribute"> + <complexType> + <attribute name="command" type="string" use="required"> + <annotation> + <documentation> + + </documentation> + </annotation> + </attribute> + <attribute name="response" type="string" use="required"> + <annotation> + <documentation> + + </documentation> + </annotation> + </attribute> + </complexType> + </element> + + <annotation> + <appInfo> + <meta.section type="since"/> + </appInfo> + <documentation> + [Enter the first release in which this extension point appears.] + </documentation> + </annotation> + + <annotation> + <appInfo> + <meta.section type="examples"/> + </appInfo> + <documentation> + [Enter extension point usage example here.] + </documentation> + </annotation> + + <annotation> + <appInfo> + <meta.section type="apiInfo"/> + </appInfo> + <documentation> + [Enter API information here.] + </documentation> + </annotation> + + <annotation> + <appInfo> + <meta.section type="implementation"/> + </appInfo> + <documentation> + [Enter information about supplied implementation of this extension point.] + </documentation> + </annotation> + + +</schema> diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java index db28f7a2c..24e6404da 100644 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java +++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java @@ -160,7 +160,7 @@ public class BugzillaClient { private boolean lastModifiedSupported = true; - private BugzillaLanguageSettings languageSettings; + private BugzillaLanguageSettings bugzillaLanguageSettings; private class BugzillaRetryHandler extends DefaultHttpMethodRetryHandler { public BugzillaRetryHandler() { @@ -183,7 +183,7 @@ public class BugzillaClient { public BugzillaClient(URL url, String username, String password, String htAuthUser, String htAuthPass, String characterEncoding) { this(url, username, password, htAuthUser, htAuthPass, characterEncoding, new HashMap<String, String>(), - BugzillaCorePlugin.getLanguageSettings("en")); + BugzillaCorePlugin.getDefault().getLanguageSetting("en")); } public BugzillaClient(URL url, String username, String password, String htAuthUser, String htAuthPass, @@ -195,7 +195,7 @@ public class BugzillaClient { this.htAuthPass = htAuthPass; this.characterEncoding = characterEncoding; this.configParameters = configParameters; - this.languageSettings = languageSettings; + this.bugzillaLanguageSettings = languageSettings; } public void validate() throws IOException, CoreException { @@ -835,8 +835,13 @@ public class BugzillaClient { && ((HtmlTag) token.getValue()).getTagType() == HtmlTag.Type.TITLE && ((HtmlTag) token.getValue()).isEndTag()) { - if (!taskData.isNew() - && (title.toLowerCase(Locale.ENGLISH).indexOf(languageSettings.getProcessed()) != -1)) { + boolean found = false; + for (Iterator<String> iterator = bugzillaLanguageSettings.getResponseForCommand(BugzillaLanguageSettings.COMMAND_PROCESSED).iterator(); iterator.hasNext() + && !found;) { + String value = iterator.next().toLowerCase(Locale.ENGLISH); + found = found || title.indexOf(value) != -1; + } + if (!taskData.isNew() && found) { existingBugPosted = true; } else if (taskData.isNew() && prefix != null && prefix2 != null && postfix != null && postfix2 != null) { @@ -1064,29 +1069,61 @@ public class BugzillaClient { && ((HtmlTag) token.getValue()).getTagType() == HtmlTag.Type.TITLE && ((HtmlTag) token.getValue()).isEndTag()) { - if (title.indexOf(languageSettings.getLogin()) != -1 - || (title.indexOf(languageSettings.getInvalid()) != -1 && title.indexOf(languageSettings.getPassword()) != -1) - || title.indexOf(languageSettings.getCheckEmail()) != -1 - || (languageSettings.getLogin2() != null && title.indexOf(languageSettings.getLogin2()) != -1)) { + boolean found = false; + for (Iterator<String> iterator = bugzillaLanguageSettings.getResponseForCommand(BugzillaLanguageSettings.COMMAND_ERROR_LOGIN).iterator(); iterator.hasNext() + && !found;) { + String value = iterator.next().toLowerCase(Locale.ENGLISH); + found = found || title.indexOf(value) != -1; + } + if (found) { authenticated = false; throw new CoreException(new BugzillaStatus(Status.ERROR, BugzillaCorePlugin.PLUGIN_ID, RepositoryStatus.ERROR_REPOSITORY_LOGIN, repositoryUrl.toString(), title)); - } else if (title.indexOf(languageSettings.getMidairCollision()) != -1) { + } + found = false; + for (Iterator<String> iterator = bugzillaLanguageSettings.getResponseForCommand(BugzillaLanguageSettings.COMMAND_ERROR_COLLISION).iterator(); iterator.hasNext() + && !found;) { + String value = iterator.next().toLowerCase(Locale.ENGLISH); + found = found || title.indexOf(value) != -1; + } + if (found) { throw new CoreException(new BugzillaStatus(Status.ERROR, BugzillaCorePlugin.PLUGIN_ID, RepositoryStatus.REPOSITORY_COLLISION, repositoryUrl.toString())); - } else if (title.indexOf(languageSettings.getCommentRequired()) != -1) { + } + found = false; + for (Iterator<String> iterator = bugzillaLanguageSettings.getResponseForCommand(BugzillaLanguageSettings.COMMAND_ERROR_COMMENT_REQUIRED).iterator(); iterator.hasNext() + && !found;) { + String value = iterator.next().toLowerCase(Locale.ENGLISH); + found = found || title.indexOf(value) != -1; + } + if (found) { throw new CoreException(new BugzillaStatus(Status.INFO, BugzillaCorePlugin.PLUGIN_ID, RepositoryStatus.REPOSITORY_COMMENT_REQUIRED)); - } else if (title.indexOf(languageSettings.getLoggedOut()) != -1) { + } + found = false; + for (Iterator<String> iterator = bugzillaLanguageSettings.getResponseForCommand(BugzillaLanguageSettings.COMMAND_ERROR_LOGGED_OUT).iterator(); iterator.hasNext() + && !found;) { + String value = iterator.next().toLowerCase(Locale.ENGLISH); + found = found || title.indexOf(value) != -1; + } + if (found) { authenticated = false; // throw new // BugzillaException(IBugzillaConstants.LOGGED_OUT); throw new CoreException(new BugzillaStatus(Status.INFO, BugzillaCorePlugin.PLUGIN_ID, RepositoryStatus.REPOSITORY_LOGGED_OUT, "You have been logged out. Please retry operation.")); - } else if (title.indexOf(IBugzillaConstants.CHANGES_SUBMITTED) != -1) { + } + found = false; + for (Iterator<String> iterator = bugzillaLanguageSettings.getResponseForCommand(BugzillaLanguageSettings.COMMAND_CHANGES_SUBMITTED).iterator(); iterator.hasNext() + && !found;) { + String value = iterator.next().toLowerCase(Locale.ENGLISH); + found = found || title.indexOf(value) != -1; + } + if (found) { return; } + isTitle = false; } } } diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClientFactory.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClientFactory.java index f98d0e250..74cad71dd 100644 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClientFactory.java +++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClientFactory.java @@ -21,7 +21,7 @@ public class BugzillaClientFactory { public static BugzillaClient createClient(String hostUrl, String username, String password, String htAuthUser, String htAuthPass, Proxy proxy, String encoding) throws MalformedURLException { - BugzillaLanguageSettings languageSettings = BugzillaCorePlugin.getLanguageSettings("en"); + BugzillaLanguageSettings languageSettings = BugzillaCorePlugin.getDefault().getLanguageSetting("en"); return createClient(hostUrl, username, password, htAuthUser, htAuthPass, proxy, encoding, new HashMap<String, String>(), languageSettings); } diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClientManager.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClientManager.java index 4d4f32ad0..cf6c78665 100644 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClientManager.java +++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClientManager.java @@ -37,7 +37,7 @@ public class BugzillaClientManager implements ITaskRepositoryListener { if (language == null || language.equals("")) { language = "en"; } - BugzillaLanguageSettings languageSettings = BugzillaCorePlugin.getLanguageSettings(language); + BugzillaLanguageSettings languageSettings = BugzillaCorePlugin.getDefault().getLanguageSetting(language); client = BugzillaClientFactory.createClient(taskRepository.getUrl(), taskRepository.getUserName(), diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaCorePlugin.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaCorePlugin.java index 6319f690d..02fb74b43 100644 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaCorePlugin.java +++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaCorePlugin.java @@ -15,6 +15,7 @@ import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.HashMap; import java.util.Map; +import java.util.Set; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; @@ -56,13 +57,6 @@ public class BugzillaCorePlugin extends Plugin { /** Product configuration for the current server */ private static Map<String, RepositoryConfiguration> repositoryConfigurations = new HashMap<String, RepositoryConfiguration>(); - private static boolean cacheLanguageSettingsFileRead = false; - - @SuppressWarnings("unused") - private static File languageSettingsFile = null; - - private static Map<String, BugzillaLanguageSettings> bugzillaLanguageSettings = new HashMap<String, BugzillaLanguageSettings>(); - public BugzillaCorePlugin() { super(); java2buzillaPlatformMap.put("x86", "PC"); // can be PC or Macintosh! @@ -90,10 +84,6 @@ public class BugzillaCorePlugin extends Plugin { writeRepositoryConfigFile(); } - if (!bugzillaLanguageSettings.isEmpty()) { - writeBugzillaLanguageSettingsFile(); - } - INSTANCE = null; super.stop(context); } @@ -114,10 +104,6 @@ public class BugzillaCorePlugin extends Plugin { repositoryConfigurationFile = file; } - public static void setLanguagesFile(File file) { - languageSettingsFile = file; - } - /** * @since 2.1 * @return cached repository configuration. If not already cached, null is returned. @@ -379,103 +365,11 @@ public class BugzillaCorePlugin extends Plugin { } } - private static void setDefaultBugzillaLanguageSettings() { - bugzillaLanguageSettings.clear(); - BugzillaLanguageSettings english = new BugzillaLanguageSettings("en", "check e-mail", "comment required", - "invalid", "logged out", "login", "collision", "password", "processed"); - english.setLogin2("log in"); - - bugzillaLanguageSettings.put("en", english); - - bugzillaLanguageSettings.put("de", new BugzillaLanguageSettings("de", "check e-mail", "Kommentar erforderlich", - "UngŸltig", "logged out", "login", "Kollision", "password", "bearbeitet")); - - } - - private static void readBugzillaLanguageSettingsFile() { - setDefaultBugzillaLanguageSettings(); -// -// if (!languageSettingsFile.exists()) { -// setDefaultBugzillaLanguageSettings(); -// return; -// } -// ObjectInputStream in = null; -// try { -// in = new ObjectInputStream(new FileInputStream(languageSettingsFile)); -// int size = in.readInt(); -// for (int nX = 0; nX < size; nX++) { -// BugzillaLanguageSettings item = (BugzillaLanguageSettings) in.readObject(); -// if (item != null) { -// bugzillaLanguageSettings.put(item.getLanguageName(), item); -// } -// } -// } catch (Exception e) { -// log(e); -// try { -// if (in != null) { -// in.close(); -// } -// if (languageSettingsFile != null && languageSettingsFile.exists()) { -// if (languageSettingsFile.delete()) { -// // successfully deleted -// } else { -// log(new Status(Status.ERROR, BugzillaCorePlugin.PLUGIN_ID, 0, ERROR_DELETING_CONFIGURATION, e)); -// } -// } -// -// } catch (Exception ex) { -// log(new Status(Status.ERROR, BugzillaCorePlugin.PLUGIN_ID, 0, ERROR_DELETING_CONFIGURATION, e)); -// } -// } finally { -// if (in != null) { -// try { -// in.close(); -// } catch (IOException e) { -// // ignore -// } -// } -// } - } - - private static void writeBugzillaLanguageSettingsFile() { -// if (languageSettingsFile != null) { -// ObjectOutputStream out = null; -// try { -// out = new ObjectOutputStream(new FileOutputStream(languageSettingsFile)); -// out.writeInt(bugzillaLanguageSettings.size()); -// for (String key : bugzillaLanguageSettings.keySet()) { -// BugzillaLanguageSettings item = bugzillaLanguageSettings.get(key); -// if (item != null) { -// out.writeObject(item); -// } -// } -// } catch (IOException e) { -// log(e); -// } finally { -// if (out != null) { -// try { -// out.close(); -// } catch (IOException e) { -// // ignore -// } -// } -// } -// } + public Set<BugzillaLanguageSettings> getLanguageSettings() { + return connector.getLanguageSettings(); } - public static Map<String, BugzillaLanguageSettings> getLanguageSettings() { - if (!cacheLanguageSettingsFileRead) { - readBugzillaLanguageSettingsFile(); - cacheLanguageSettingsFileRead = true; - } - return bugzillaLanguageSettings; - } - - public static BugzillaLanguageSettings getLanguageSettings(String language) { - if (!cacheLanguageSettingsFileRead) { - readBugzillaLanguageSettingsFile(); - cacheLanguageSettingsFileRead = true; - } - return bugzillaLanguageSettings.get(language); + public BugzillaLanguageSettings getLanguageSetting(String language) { + return connector.getLanguageSetting(language); } } diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaLanguageSettings.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaLanguageSettings.java index 2d6e5a588..f7205c524 100644 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaLanguageSettings.java +++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaLanguageSettings.java @@ -8,7 +8,10 @@ package org.eclipse.mylyn.internal.bugzilla.core; -import java.io.Serializable; +import java.util.LinkedHashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; /** * Class describing the html response of Bugzilla requests which are used within Mylyn. @@ -18,42 +21,21 @@ import java.io.Serializable; * @author Frank Becker */ -public class BugzillaLanguageSettings implements Serializable { - - private static final long serialVersionUID = 5181964115189805498L; - +public class BugzillaLanguageSettings { private String languageName = "<unknown>"; - - private String login; - - private String login2; - - private String invalid; - - private String password; - - private String checkEmail; - - private String midairCollision; - - private String commentRequired; - - private String loggedOut; - - private String processed; - - public BugzillaLanguageSettings(String languageName, String checkEmail, String commentRequired, String invalid, - String loggedOut, String login, String midairCollision, String password, String processed) { + public static final String COMMAND_ERROR_LOGIN = "error_login"; + public static final String COMMAND_ERROR_COLLISION = "error_collision"; + public static final String COMMAND_ERROR_COMMENT_REQUIRED = "error_comment_required" ; + public static final String COMMAND_ERROR_LOGGED_OUT = "error_logged_out"; + public static final String COMMAND_BAD_LOGIN = "bad_login"; + public static final String COMMAND_PROCESSED = "processed"; + public static final String COMMAND_CHANGES_SUBMITTED = "changes_submitted"; + + private Map<String , List<String>> languageAttributes = new LinkedHashMap<String, List<String>>(); + + public BugzillaLanguageSettings(String languageName) { super(); - this.checkEmail = checkEmail; - this.commentRequired = commentRequired; - this.invalid = invalid; - this.languageName = languageName; - this.loggedOut = loggedOut; - this.login = login; - this.midairCollision = midairCollision; - this.password = password; - this.processed = processed; + this.languageName = languageName; } public String getLanguageName() { @@ -64,75 +46,16 @@ public class BugzillaLanguageSettings implements Serializable { this.languageName = languageName; } - public String getLogin() { - return login; - } - - public void setLogin(String login) { - this.login = login; - } - - public String getInvalid() { - return invalid; - } - - public void setInvalid(String invalid) { - this.invalid = invalid; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getCheckEmail() { - return checkEmail; - } - - public void setCheckEmail(String checkEmail) { - this.checkEmail = checkEmail; - } - - public String getMidairCollision() { - return midairCollision; - } - - public void setMidairCollision(String midairCollision) { - this.midairCollision = midairCollision; - } - - public String getCommentRequired() { - return commentRequired; - } - - public void setCommentRequired(String commentRequired) { - this.commentRequired = commentRequired; - } - - public String getLoggedOut() { - return loggedOut; - } - - public void setLoggedOut(String loggedOut) { - this.loggedOut = loggedOut; - } - - public String getProcessed() { - return processed; - } - - public void setProcessed(String processed) { - this.processed = processed; - } - - public String getLogin2() { - return login2; - } - - public void setLogin2(String login2) { - this.login2 = login2; + public void addLanguageAttribute(String command, String response) { + List<String> commandList = languageAttributes.get(command); + if (commandList==null) { + commandList = new LinkedList<String>(); + languageAttributes.put(command.toLowerCase(), commandList); + } + commandList.add(response); } + + public List<String> getResponseForCommand(String command) { + return languageAttributes.get(command); + } } diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java index 691b0322c..0e85a0264 100644 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java +++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java @@ -17,6 +17,7 @@ import java.util.Collections; import java.util.Date; import java.util.HashSet; import java.util.Iterator; +import java.util.LinkedHashSet; import java.util.List; import java.util.Locale; import java.util.Set; @@ -65,6 +66,8 @@ public class BugzillaRepositoryConnector extends AbstractRepositoryConnector { private BugzillaTaskDataHandler taskDataHandler; private BugzillaClientManager clientManager; + + private Set<BugzillaLanguageSettings> languages = new LinkedHashSet<BugzillaLanguageSettings>(); @Override public void init(TaskList taskList) { @@ -273,8 +276,8 @@ public class BugzillaRepositoryConnector extends AbstractRepositoryConnector { dateString = ""; } - String urlQueryBase = repository.getUrl() + CHANGED_BUGS_CGI_QUERY - + URLEncoder.encode(dateString, repository.getCharacterEncoding()) + CHANGED_BUGS_CGI_ENDDATE; + String urlQueryBase = repository.getUrl() + CHANGED_BUGS_CGI_QUERY + + URLEncoder.encode(dateString, repository.getCharacterEncoding()) + CHANGED_BUGS_CGI_ENDDATE; String urlQueryString = urlQueryBase + BUG_ID; @@ -315,8 +318,8 @@ public class BugzillaRepositoryConnector extends AbstractRepositoryConnector { return true; } catch (UnsupportedEncodingException e) { // XXX throw CoreException instead? - StatusHandler.fail(e, "Repository configured with unsupported encoding: " - + repository.getCharacterEncoding() + "\n\n Unable to determine changed tasks.", true); + StatusHandler.fail(e, "Repository configured with unsupported encoding: " + + repository.getCharacterEncoding() + "\n\n Unable to determine changed tasks.", true); return false; } finally { monitor.done(); @@ -691,9 +694,26 @@ public class BugzillaRepositoryConnector extends AbstractRepositoryConnector { try { return Integer.parseInt(taskId); } catch (NumberFormatException e) { - throw new CoreException(new Status(IStatus.ERROR, BugzillaCorePlugin.PLUGIN_ID, 0, "Invalid bug id: " - + taskId, e)); + throw new CoreException(new Status(IStatus.ERROR, BugzillaCorePlugin.PLUGIN_ID, 0, "Invalid bug id: " + + taskId, e)); } } + public void addLanguageSetting(BugzillaLanguageSettings language) { + this.languages.add(language); + } + + public Set<BugzillaLanguageSettings> getLanguageSettings() { + return languages; + } + + /** returns null if language not found */ + public BugzillaLanguageSettings getLanguageSetting(String label) { + for (BugzillaLanguageSettings language : getLanguageSettings()) { + if (language.getLanguageName().equals(label)) { + return language; + } + } + return null; + } } diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java index 928ceda07..39cf0ebea 100644 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java +++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java @@ -256,8 +256,6 @@ public interface IBugzillaConstants { public static final String INVALID_CREDENTIALS = "Invalid repository credentials."; - public static final String CHANGES_SUBMITTED = "changes submitted"; - public static final String SHOW_ACTIVITY = "/show_activity.cgi?id="; public static final String REPOSITORY_SETTING_SHORT_LOGIN = "bugzilla.shortLoginEnabled"; |