summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Pingel2012-09-09 20:10:50 (EDT)
committerSteffen Pingel2012-09-10 14:03:19 (EDT)
commit6fd180ca8ac0895713f59853d3535c8b05dfeb62 (patch)
treed15a5f409c6bbfd0fa94bf48d5bb633537a59ccf
parent20106d443eb21949e571a3da5a0c8ee9f28a3b99 (diff)
downloadorg.eclipse.mylyn.tasks-6fd180ca8ac0895713f59853d3535c8b05dfeb62.zip
org.eclipse.mylyn.tasks-6fd180ca8ac0895713f59853d3535c8b05dfeb62.tar.gz
org.eclipse.mylyn.tasks-6fd180ca8ac0895713f59853d3535c8b05dfeb62.tar.bz2
380773: fix ConcurrentModificationException when changing repositoryrefs/changes/07/7107/5
settings Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=380773 Change-Id: I255d39f10eb37461b7f1f056b1d204f4a2069ba0
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClientManager.java43
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaUiPlugin.java13
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositorySettingsPage.java43
3 files changed, 5 insertions, 94 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 fcf6a91..2ff8345 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,30 +19,19 @@ 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.jobs.IJobChangeEvent;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.core.runtime.jobs.JobChangeAdapter;
-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;
/**
* @author Steffen Pingel
* @author Robert Elves (adaption for Bugzilla)
*/
-public class BugzillaClientManager implements IRepositoryListener, IRepositoryChangeListener {
+public class BugzillaClientManager implements IRepositoryListener {
private final Map<String, BugzillaClient> clientByUrl = new HashMap<String, BugzillaClient>();
private final BugzillaRepositoryConnector connector;
- private JobChangeAdapter repositoryConfigurationUpdateJobChangeAdapter;
-
public BugzillaClientManager(BugzillaRepositoryConnector connector) {
this.connector = connector;
}
@@ -97,34 +86,4 @@ public class BugzillaClientManager implements IRepositoryListener, IRepositoryCh
// ignore
}
- @SuppressWarnings("restriction")
- public void repositoryChanged(TaskRepositoryChangeEvent event) {
- Type type = event.getDelta().getType();
- if (type == TaskRepositoryDelta.Type.PROPERTY) {
- Object key = event.getDelta().getKey();
- if (IBugzillaConstants.BUGZILLA_USE_XMLRPC.equals(key)
- || IBugzillaConstants.BUGZILLA_DESCRIPTOR_FILE.equals(key)) {
- final TaskRepository repository = event.getRepository();
- TaskJob updateJob = new UpdateRepositoryConfigurationJob(
- Messages.BugzillaClientManager_Refreshing_repository_configuration, repository, connector);
- updateJob.setPriority(Job.INTERACTIVE);
- updateJob.addJobChangeListener(repositoryConfigurationUpdateJobChangeAdapter);
- updateJob.addJobChangeListener(new JobChangeAdapter() {
- @Override
- public void done(IJobChangeEvent event) {
- synchronized (repository) {
- repository.setUpdating(false);
- }
- }
- });
- updateJob.schedule();
- }
- }
- }
-
- public void setRepositoryConfigurationUpdateJobChangeAdapter(
- JobChangeAdapter repositoryConfigurationUpdateJobChangeAdapter) {
- this.repositoryConfigurationUpdateJobChangeAdapter = repositoryConfigurationUpdateJobChangeAdapter;
- }
-
}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaUiPlugin.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaUiPlugin.java
index bd30cfe..a3bbecd 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaUiPlugin.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaUiPlugin.java
@@ -14,8 +14,6 @@ package org.eclipse.mylyn.internal.bugzilla.ui;
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.core.runtime.jobs.IJobChangeEvent;
-import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaClient;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaClientManager;
@@ -23,8 +21,6 @@ import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaRepositoryConnector;
import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants;
import org.eclipse.mylyn.internal.bugzilla.core.RepositoryConfiguration;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.tasks.core.sync.TaskJob;
import org.eclipse.mylyn.tasks.ui.TasksUi;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
@@ -96,15 +92,6 @@ public class BugzillaUiPlugin extends AbstractUIPlugin {
BugzillaRepositoryConnector bugzillaConnector = (BugzillaRepositoryConnector) TasksUi.getRepositoryManager()
.getRepositoryConnector(BugzillaCorePlugin.CONNECTOR_KIND);
BugzillaClientManager clientManager = bugzillaConnector.getClientManager();
- clientManager.setRepositoryConfigurationUpdateJobChangeAdapter(new JobChangeAdapter() {
- @Override
- public void done(IJobChangeEvent event) {
- TaskJob taskJob = ((TaskJob) (event.getJob()));
- if (taskJob.getStatus() != null) {
- TasksUiInternal.asyncLogAndDisplayStatus(Messages.BugzillaUiPlugin_Configuration_Refresh_Failed, taskJob.getStatus());
- }
- }
- });
TasksUi.getRepositoryManager().addListener(clientManager);
// NOTE: initializing extensions in start(..) has caused race
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositorySettingsPage.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositorySettingsPage.java
index 57a7116..611426d 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositorySettingsPage.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositorySettingsPage.java
@@ -25,14 +25,11 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.mylyn.commons.net.AuthenticationCredentials;
import org.eclipse.mylyn.commons.net.AuthenticationType;
-import org.eclipse.mylyn.commons.workbench.WorkbenchUtil;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaClient;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaClientFactory;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin;
@@ -45,10 +42,10 @@ import org.eclipse.mylyn.internal.tasks.core.IRepositoryConstants;
import org.eclipse.mylyn.internal.tasks.core.RepositoryTemplateManager;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylyn.tasks.core.RepositoryStatus;
import org.eclipse.mylyn.tasks.core.RepositoryTemplate;
import org.eclipse.mylyn.tasks.core.TaskRepository;
+import org.eclipse.mylyn.tasks.core.sync.TaskJob;
import org.eclipse.mylyn.tasks.ui.TasksUi;
import org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositorySettingsPage;
import org.eclipse.swt.SWT;
@@ -558,26 +555,9 @@ public class BugzillaRepositorySettingsPage extends AbstractRepositorySettingsPa
}
applyToInternal(repository);
if (changed) {
- final String jobName = MessageFormat.format(
- Messages.BugzillaRepositorySettingsPage_Updating_repository_configuration_for_X,
- repository.getRepositoryUrl());
- Job updateJob = new Job(jobName) {
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- monitor.beginTask(jobName, IProgressMonitor.UNKNOWN);
- try {
- performUpdate(repository, connector, monitor);
- } finally {
- monitor.done();
- }
- return Status.OK_STATUS;
- }
- };
- // show the progress in the system task bar if this is a user job (i.e. forced)
- updateJob.setProperty(WorkbenchUtil.SHOW_IN_TASKBAR_ICON_PROPERTY, Boolean.TRUE);
- updateJob.setUser(true);
- updateJob.schedule();
-
+ TaskJob job = TasksUiInternal.getJobFactory().createUpdateRepositoryConfigurationJob(connector, repository,
+ null);
+ job.schedule();
}
}
@@ -594,21 +574,6 @@ public class BugzillaRepositorySettingsPage extends AbstractRepositorySettingsPa
return s1.equals(s2);
}
- public void performUpdate(final TaskRepository repository, final AbstractRepositoryConnector connector,
- IProgressMonitor monitor) {
- try {
- connector.updateRepositoryConfiguration(repository, monitor);
- } catch (final CoreException e) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- TasksUiInternal.displayStatus(
- Messages.BugzillaRepositorySettingsPage_Error_updating_repository_configuration,
- e.getStatus());
- }
- });
- }
- }
-
@Override
protected Validator getValidator(TaskRepository repository) {
return new BugzillaValidator(repository);