Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2009-10-12 23:10:04 -0400
committerspingel2009-10-12 23:10:04 -0400
commit3617b29f060a75d75a10a9dcc1d7f71f75d7a2aa (patch)
tree347c65692e8cab133cfc2a6de159ce818e7e9d8b /org.eclipse.mylyn.tasks.core
parent953366c0f4e43adc79ba8452230544663511f883 (diff)
downloadorg.eclipse.mylyn.tasks-3617b29f060a75d75a10a9dcc1d7f71f75d7a2aa.tar.gz
org.eclipse.mylyn.tasks-3617b29f060a75d75a10a9dcc1d7f71f75d7a2aa.tar.xz
org.eclipse.mylyn.tasks-3617b29f060a75d75a10a9dcc1d7f71f75d7a2aa.zip
REOPENED - bug 277254: use a single JiraClient instance per repository
https://bugs.eclipse.org/bugs/show_bug.cgi?id=277254
Diffstat (limited to 'org.eclipse.mylyn.tasks.core')
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/IRepositoryChangeListener.java21
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskRepositoryChangeEvent.java47
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskRepositoryDelta.java47
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskRepositoryManager.java12
4 files changed, 126 insertions, 1 deletions
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/IRepositoryChangeListener.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/IRepositoryChangeListener.java
new file mode 100644
index 000000000..a1e27784b
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/IRepositoryChangeListener.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.tasks.core;
+
+/**
+ * @author Steffen Pingel
+ */
+public interface IRepositoryChangeListener {
+
+ public abstract void repositoryChanged(TaskRepositoryChangeEvent event);
+
+}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskRepositoryChangeEvent.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskRepositoryChangeEvent.java
new file mode 100644
index 000000000..422e75e10
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskRepositoryChangeEvent.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.tasks.core;
+
+import java.util.EventObject;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.mylyn.tasks.core.TaskRepository;
+
+/**
+ * @author Steffen Pingel
+ */
+public class TaskRepositoryChangeEvent extends EventObject {
+
+ private static final long serialVersionUID = -8177578930986469693L;
+
+ private final TaskRepository repository;
+
+ private final TaskRepositoryDelta delta;
+
+ TaskRepositoryChangeEvent(Object source, TaskRepository repository, TaskRepositoryDelta delta) {
+ super(source);
+ Assert.isNotNull(source);
+ Assert.isNotNull(repository);
+ Assert.isNotNull(delta);
+ this.repository = repository;
+ this.delta = delta;
+ }
+
+ public TaskRepository getRepository() {
+ return repository;
+ }
+
+ public TaskRepositoryDelta getDelta() {
+ return delta;
+ }
+
+}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskRepositoryDelta.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskRepositoryDelta.java
new file mode 100644
index 000000000..bf81cd653
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskRepositoryDelta.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.tasks.core;
+
+import org.eclipse.core.runtime.Assert;
+
+/**
+ * @author Steffen Pingel
+ */
+public class TaskRepositoryDelta {
+
+ public enum Type {
+ ALL, CREDENTIALS, PROPERTY, PROYX, OFFLINE
+ };
+
+ private final Type type;
+
+ private final Object key;
+
+ public TaskRepositoryDelta(Type type, Object key) {
+ Assert.isNotNull(type);
+ this.type = type;
+ this.key = key;
+ }
+
+ public TaskRepositoryDelta(Type type) {
+ this(type, null);
+ }
+
+ public Type getType() {
+ return type;
+ }
+
+ public Object getKey() {
+ return key;
+ }
+
+}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskRepositoryManager.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskRepositoryManager.java
index 19258768d..9daef6acf 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskRepositoryManager.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskRepositoryManager.java
@@ -31,6 +31,7 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.core.runtime.Status;
import org.eclipse.mylyn.commons.core.StatusHandler;
+import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryDelta.Type;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylyn.tasks.core.IRepositoryListener;
import org.eclipse.mylyn.tasks.core.IRepositoryManager;
@@ -68,7 +69,8 @@ public class TaskRepositoryManager implements IRepositoryManager {
private final PropertyChangeListener PROPERTY_CHANGE_LISTENER = new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
- TaskRepositoryManager.this.notifyRepositorySettingsChanged((TaskRepository) evt.getSource());
+ TaskRepositoryManager.this.notifyRepositorySettingsChanged((TaskRepository) evt.getSource(),
+ new TaskRepositoryDelta(Type.PROPERTY, evt.getPropertyName()));
}
};
@@ -361,6 +363,11 @@ public class TaskRepositoryManager implements IRepositoryManager {
}
public void notifyRepositorySettingsChanged(final TaskRepository repository) {
+ notifyRepositorySettingsChanged(repository, new TaskRepositoryDelta(Type.ALL));
+ }
+
+ public void notifyRepositorySettingsChanged(final TaskRepository repository, TaskRepositoryDelta delta) {
+ final TaskRepositoryChangeEvent event = new TaskRepositoryChangeEvent(this, repository, delta);
for (final IRepositoryListener listener : listeners) {
SafeRunner.run(new ISafeRunnable() {
public void handleException(Throwable e) {
@@ -369,6 +376,9 @@ public class TaskRepositoryManager implements IRepositoryManager {
}
public void run() throws Exception {
+ if (listener instanceof IRepositoryChangeListener) {
+ ((IRepositoryChangeListener) listener).repositoryChanged(event);
+ }
listener.repositorySettingsChanged(repository);
}
});

Back to the top