diff options
11 files changed, 87 insertions, 51 deletions
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 2dadb20ed..fcf6a919d 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 @@ -19,7 +19,6 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.SubMonitor; import org.eclipse.core.runtime.jobs.IJobChangeEvent; import org.eclipse.core.runtime.jobs.Job; import org.eclipse.core.runtime.jobs.JobChangeAdapter; @@ -27,6 +26,7 @@ import org.eclipse.mylyn.internal.tasks.core.IRepositoryChangeListener; import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryChangeEvent; import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryDelta; import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryDelta.Type; +import org.eclipse.mylyn.internal.tasks.core.sync.UpdateRepositoryConfigurationJob; import org.eclipse.mylyn.tasks.core.IRepositoryListener; import org.eclipse.mylyn.tasks.core.TaskRepository; import org.eclipse.mylyn.tasks.core.sync.TaskJob; @@ -105,35 +105,8 @@ public class BugzillaClientManager implements IRepositoryListener, IRepositoryCh if (IBugzillaConstants.BUGZILLA_USE_XMLRPC.equals(key) || IBugzillaConstants.BUGZILLA_DESCRIPTOR_FILE.equals(key)) { final TaskRepository repository = event.getRepository(); - TaskJob updateJob = new TaskJob(Messages.BugzillaClientManager_Refreshing_repository_configuration) { - private IStatus error; - - @Override - protected IStatus run(IProgressMonitor monitor) { - monitor = SubMonitor.convert(monitor); - monitor.beginTask(Messages.BugzillaClientManager_Receiving_configuration, IProgressMonitor.UNKNOWN); - try { - try { - connector.updateRepositoryConfiguration(repository, null, monitor); - } catch (CoreException e) { - error = e.getStatus(); - } - } finally { - monitor.done(); - } - return Status.OK_STATUS; - } - - @Override - public boolean belongsTo(Object family) { - return family == repository; - } - - @Override - public IStatus getStatus() { - return error; - } - }; + TaskJob updateJob = new UpdateRepositoryConfigurationJob( + Messages.BugzillaClientManager_Refreshing_repository_configuration, repository, connector); updateJob.setPriority(Job.INTERACTIVE); updateJob.addJobChangeListener(repositoryConfigurationUpdateJobChangeAdapter); updateJob.addJobChangeListener(new JobChangeAdapter() { diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java index e4cba9332..3518964b2 100644 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java +++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java @@ -481,7 +481,7 @@ public class BugzillaTaskDataHandler extends AbstractTaskDataHandler { boolean shortLogin = Boolean.parseBoolean(repository.getProperty(IBugzillaConstants.REPOSITORY_SETTING_SHORT_LOGIN)); repositoryConfiguration.configureTaskData(taskData, shortLogin, connector); } - boolean updateConfig = false; +// boolean updateConfig = false; for (TaskAttribute taskAttribute : taskData.getRoot().getAttributes().values()) { Map<String, String> opt = taskAttribute.getOptions(); if (opt != null && !opt.isEmpty()) { @@ -489,7 +489,7 @@ public class BugzillaTaskDataHandler extends AbstractTaskDataHandler { for (String value : values) { if (!opt.containsKey(value)) { taskAttribute.putOption(value, value); - updateConfig = true; +// updateConfig = true; } } } diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/Messages.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/Messages.java index 8e6f5e2b1..88d53bcfd 100644 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/Messages.java +++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/Messages.java @@ -219,8 +219,6 @@ public class Messages extends NLS { public static String BugzillaClient_Unable_to_retrieve_new_task; - public static String BugzillaClientManager_Receiving_configuration; - public static String BugzillaClientManager_Refreshing_repository_configuration; public static String BugzillaOperation_Accept_to_ASSIGNED; diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java index c912bc3b0..70f7b1d2e 100644 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java +++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java @@ -141,7 +141,7 @@ public class SaxMultiBugReportContentHandler extends DefaultHandler { token = null; break; case LONG_DESC: - String is_private = attributes.getValue("isprivate"); + String is_private = attributes.getValue("isprivate"); //$NON-NLS-1$ taskComment = new TaskComment(is_private); break; case WHO: @@ -318,7 +318,7 @@ public class SaxMultiBugReportContentHandler extends DefaultHandler { break; } - // Comment attributes + // Comment attributes case WHO: if (taskComment != null) { taskComment.author = parsedText; @@ -693,8 +693,6 @@ public class SaxMultiBugReportContentHandler extends DefaultHandler { if (comment.id != 0) { TaskAttribute commentID = BugzillaTaskDataHandler.createAttribute(attribute, BugzillaAttribute.COMMENTID); commentID.setValue(Integer.toString(comment.id)); - int i = 9; - i++; } parseAttachment(taskComment); diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/messages.properties b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/messages.properties index 8639b84af..15c127dc2 100644 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/messages.properties +++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/messages.properties @@ -107,7 +107,6 @@ BugzillaClient_anonymous_user_not_allowed=Anonymous user not allowed for this op BugzillaClient_could_not_post_form_null_returned=Could not post form, client returned null method. BugzillaClient_description_required_when_submitting_attachments=A description is required when submitting attachments. BugzillaClient_Unable_to_retrieve_new_task=Unable to retrieve new task. -BugzillaClientManager_Receiving_configuration=Receiving configuration BugzillaClientManager_Refreshing_repository_configuration=Refreshing repository configuration BugzillaOperation_Accept_to_ASSIGNED=Accept (change status to ASSIGNED) diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/service/BugzillaXmlRpcClient.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/service/BugzillaXmlRpcClient.java index 7819ba520..3074541fc 100644 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/service/BugzillaXmlRpcClient.java +++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/service/BugzillaXmlRpcClient.java @@ -167,7 +167,7 @@ public class BugzillaXmlRpcClient extends CommonXmlRpcClient { if (credentials != null) { String user = credentials.getUserName(); String password = credentials.getPassword(); - if ("".equals(user) || "".equals(password)) { + if ("".equals(user) || "".equals(password)) { //$NON-NLS-1$//$NON-NLS-2$ return userID; } userID = (new BugzillaXmlRpcOperation<Integer>(this) { @@ -427,22 +427,22 @@ public class BugzillaXmlRpcClient extends CommonXmlRpcClient { List<BugHistory> result = new ArrayList<BugHistory>(ids.length); for (Object item : (Object[]) response.get("bugs")) { //$NON-NLS-1$ Map<?, ?> map = (Map<?, ?>) item; - Integer id = (Integer) map.get("id"); + Integer id = (Integer) map.get("id"); //$NON-NLS-1$ BugHistory history = new BugHistory(id); - Object[] historyItems = (Object[]) map.get("history"); + Object[] historyItems = (Object[]) map.get("history"); //$NON-NLS-1$ for (Object historyItem : historyItems) { Map<?, ?> historyItemMap = (Map<?, ?>) historyItem; - Revision revision = history.createRevision((Date) historyItemMap.get("when"), - (String) historyItemMap.get("who")); - Object[] changeItems = (Object[]) historyItemMap.get("changes"); + Revision revision = history.createRevision((Date) historyItemMap.get("when"), //$NON-NLS-1$ + (String) historyItemMap.get("who")); //$NON-NLS-1$ + Object[] changeItems = (Object[]) historyItemMap.get("changes"); //$NON-NLS-1$ if (changeItems != null) { for (Object changeItem : changeItems) { Map<?, ?> changeItemMap = (Map<?, ?>) changeItem; - int attachmentId = (changeItemMap.get("attachment_id") != null) - ? Integer.parseInt((String) changeItemMap.get("attachment_id")) + int attachmentId = (changeItemMap.get("attachment_id") != null) //$NON-NLS-1$ + ? Integer.parseInt((String) changeItemMap.get("attachment_id")) //$NON-NLS-1$ : -1; - revision.addChange((String) changeItemMap.get("field_name"), - (String) changeItemMap.get("added"), (String) changeItemMap.get("removed"), + revision.addChange((String) changeItemMap.get("field_name"), //$NON-NLS-1$ + (String) changeItemMap.get("added"), (String) changeItemMap.get("removed"), //$NON-NLS-1$ //$NON-NLS-2$ attachmentId); } } diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/ui/BugzillaTaskHyperlinkDetectorTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/ui/BugzillaTaskHyperlinkDetectorTest.java index e63b47f56..d58cd86c4 100644 --- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/ui/BugzillaTaskHyperlinkDetectorTest.java +++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/ui/BugzillaTaskHyperlinkDetectorTest.java @@ -175,7 +175,7 @@ public class BugzillaTaskHyperlinkDetectorTest extends TestCase { repositoryManager = TasksUiPlugin.getRepositoryManager(); repositoryManager.clearRepositories(TasksUiPlugin.getDefault().getRepositoriesFilePath()); - commentFormats = new String[] { COMMENT_1, COMMENT_2, COMMENT_3, COMMENT_4 }; + commentFormats = new String[] { COMMENT_1, COMMENT_2, COMMENT_3, COMMENT_4, COMMENT_5 }; bugFormats = new String[] { TASK_FORMAT_1, TASK_FORMAT_2, TASK_FORMAT_3, TASK_FORMAT_4, BUG_FORMAT_1, BUG_FORMAT_2, BUG_FORMAT_3, BUG_FORMAT_4 }; bugCommentFormats = new String[] { TASK_FORMAT_1_COMMENT_2, TASK_FORMAT_2_COMMENT_2, TASK_FORMAT_3_COMMENT_2, diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/BugzillaAttachmentWizardPage.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/BugzillaAttachmentWizardPage.java index 8fd6365a8..6dd564d17 100644 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/BugzillaAttachmentWizardPage.java +++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/BugzillaAttachmentWizardPage.java @@ -233,7 +233,6 @@ public class BugzillaAttachmentWizardPage extends WizardPage { String type = commentAttribute.getMetaData().getType(); if (type != null) { commentEditor = factory.createEditor(type, commentAttribute); - String labelString = commentEditor.getLabel(); if (commentEditor.hasLabel()) { commentEditor.createLabelControl(attributeArea, toolkit); if (commentEditor.getLabelControl() != null) { diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/Messages.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/Messages.java index ebb007134..293556b10 100644 --- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/Messages.java +++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/Messages.java @@ -25,6 +25,8 @@ public class Messages extends NLS { NLS.initializeMessages(BUNDLE_NAME, Messages.class); } + public static String GetTaskHistoryJob_Retrieving_History; + public static String SubmitTaskAttachmentJob_Sending_data; public static String SubmitTaskAttachmentJob_Submitting_attachment; @@ -68,4 +70,6 @@ public class Messages extends NLS { public static String SynchronizeTasksJob_Synchronizing_Tasks__X_; public static String SynchronizeTasksJob_Receiving_X_tasks_from_X; + + public static String UpdateRepositoryConfigurationJob_Receiving_configuration; } diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/UpdateRepositoryConfigurationJob.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/UpdateRepositoryConfigurationJob.java new file mode 100644 index 000000000..c1bd5068a --- /dev/null +++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/UpdateRepositoryConfigurationJob.java @@ -0,0 +1,63 @@ +/******************************************************************************* + * Copyright (c) 2011 Frank Becker 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: + * Frank Becker - initial API and implementation + *******************************************************************************/ + +package org.eclipse.mylyn.internal.tasks.core.sync; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.SubMonitor; +import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector; +import org.eclipse.mylyn.tasks.core.TaskRepository; +import org.eclipse.mylyn.tasks.core.sync.TaskJob; + +public class UpdateRepositoryConfigurationJob extends TaskJob { + AbstractRepositoryConnector connector; + + TaskRepository repository; + + private IStatus error; + + public UpdateRepositoryConfigurationJob(String name, TaskRepository repository, + AbstractRepositoryConnector connector) { + super(name); + this.connector = connector; + this.repository = repository; + } + + @Override + public IStatus getStatus() { + return error; + } + + @Override + protected IStatus run(IProgressMonitor monitor) { + monitor = SubMonitor.convert(monitor); + monitor.beginTask(Messages.UpdateRepositoryConfigurationJob_Receiving_configuration, IProgressMonitor.UNKNOWN); + try { + try { + connector.updateRepositoryConfiguration(repository, null, monitor); + } catch (CoreException e) { + error = e.getStatus(); + } + } finally { + monitor.done(); + } + return Status.OK_STATUS; + } + + @Override + public boolean belongsTo(Object family) { + return family == repository; + } + +} diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/messages.properties b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/messages.properties index 6f00cf2f7..efab6b6e0 100644 --- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/messages.properties +++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/sync/messages.properties @@ -8,6 +8,7 @@ # Contributors: # Tasktop Technologies - initial API and implementation ############################################################################### +GetTaskHistoryJob_Retrieving_History=Retrieving History SubmitTaskAttachmentJob_Sending_data=Sending data SubmitTaskAttachmentJob_Submitting_attachment=Submitting attachment SubmitTaskAttachmentJob_Updating_task=Updating task @@ -33,3 +34,4 @@ SynchronizeTasksJob_Receiving_task_X=Receiving task {0} SynchronizeTasksJob_Synchronization_of_task_ID_REPOSITORY_failed=Synchronization of task {0} [{1}] failed SynchronizeTasksJob_Synchronizing_Tasks__X_=Synchronizing Tasks ({0}) SynchronizeTasksJob_Receiving_X_tasks_from_X=Receiving {0} tasks from {1} +UpdateRepositoryConfigurationJob_Receiving_configuration=Receiving configuration |