Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten2007-06-15 18:04:59 -0400
committermkersten2007-06-15 18:04:59 -0400
commit48b245f04e3ed60817b444f519a0bffee1dc5ad3 (patch)
tree4e2e88a2687698f85d1b357bd13679e121cfd956 /org.eclipse.mylyn.tasks.core
parentb3c452a26034ddb2ddd2a9ff61f3c02c6f826c93 (diff)
downloadorg.eclipse.mylyn.tasks-48b245f04e3ed60817b444f519a0bffee1dc5ad3.tar.gz
org.eclipse.mylyn.tasks-48b245f04e3ed60817b444f519a0bffee1dc5ad3.tar.xz
org.eclipse.mylyn.tasks-48b245f04e3ed60817b444f519a0bffee1dc5ad3.zip
NEW - bug 191780: [api] Refactor MylarStatusHandler and IStatusHandler
https://bugs.eclipse.org/bugs/show_bug.cgi?id=191780
Diffstat (limited to 'org.eclipse.mylyn.tasks.core')
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/SaxRepositoriesWriter.java4
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskDataManager.java24
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskRepositoriesExternalizer.java10
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractAttachmentHandler.java4
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector.java4
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AttributeContainer.java16
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DelegatingTaskExternalizer.java6
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskList.java6
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskRepository.java8
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskRepositoryManager.java8
10 files changed, 45 insertions, 45 deletions
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/SaxRepositoriesWriter.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/SaxRepositoriesWriter.java
index 2d0ca6eac..0041b4e69 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/SaxRepositoriesWriter.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/SaxRepositoriesWriter.java
@@ -22,7 +22,7 @@ import javax.xml.transform.TransformerFactory;
import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.stream.StreamResult;
-import org.eclipse.mylyn.core.MylarStatusHandler;
+import org.eclipse.mylyn.internal.monitor.core.util.StatusManager;
import org.eclipse.mylyn.internal.monitor.core.util.XmlStringConverter;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.xml.sax.ContentHandler;
@@ -61,7 +61,7 @@ public class SaxRepositoriesWriter {
new SAXSource(new RepositoriesWriter(), new TaskRepositoriesInputSource(repositories)),
new StreamResult(outputStream));
} catch (TransformerException e) {
- MylarStatusHandler.fail(e, "could not write repositories", false);
+ StatusManager.fail(e, "could not write repositories", false);
throw new IOException(e.getMessage());
}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskDataManager.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskDataManager.java
index 2dc480340..4724695f8 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskDataManager.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskDataManager.java
@@ -31,7 +31,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.mylyn.core.MylarStatusHandler;
+import org.eclipse.mylyn.internal.monitor.core.util.StatusManager;
import org.eclipse.mylyn.tasks.core.AbstractAttributeFactory;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylyn.tasks.core.RepositoryTaskAttribute;
@@ -76,7 +76,7 @@ public class TaskDataManager {
try {
readOfflineData();
} catch (Throwable e) {
- MylarStatusHandler.fail(e, "Error loading offline task data", false);
+ StatusManager.fail(e, "Error loading offline task data", false);
if (restoreFromBackup()) {
try {
readOfflineData();
@@ -112,7 +112,7 @@ public class TaskDataManager {
if (backupFile.exists()) {
if (primaryFile.exists()) {
if (!primaryFile.delete()) {
- MylarStatusHandler.log("Unable to retire primary offline data", this);
+ StatusManager.log("Unable to retire primary offline data", this);
}
}
this.primaryFile = primaryPath.toFile();
@@ -121,7 +121,7 @@ public class TaskDataManager {
this.backupFile = backupPath.toFile();
return true;
} else {
- MylarStatusHandler.log("Unable to restore from offline backup", this);
+ StatusManager.log("Unable to restore from offline backup", this);
}
}
return false;
@@ -202,7 +202,7 @@ public class TaskDataManager {
clone = (RepositoryTaskData) ObjectCloner.deepCopy(data);
updateAttributeFactory(clone);
} catch (Exception e) {
- MylarStatusHandler.fail(e, "Error constructing modifiable task", false);
+ StatusManager.fail(e, "Error constructing modifiable task", false);
return null;
}
for (RepositoryTaskAttribute attribute : getLocalChanges(handle)) {
@@ -328,14 +328,14 @@ public class TaskDataManager {
try {
in.close();
} catch (IOException e) {
- MylarStatusHandler.fail(e, "Could not close stream", false);
+ StatusManager.fail(e, "Could not close stream", false);
}
}
if (fileInputStream != null) {
try {
fileInputStream.close();
} catch (IOException e) {
- MylarStatusHandler.fail(e, "Could not close stream", false);
+ StatusManager.fail(e, "Could not close stream", false);
}
}
}
@@ -381,13 +381,13 @@ public class TaskDataManager {
try {
if (backupFile.exists()) {
if (!backupFile.delete()) {
- MylarStatusHandler.log("Unable to retire old offline backup.", this);
+ StatusManager.log("Unable to retire old offline backup.", this);
return;
}
}
if (primaryFile.exists() && !primaryFile.renameTo(backupFile)) {
- MylarStatusHandler.log("Unable to backup offline data.", this);
+ StatusManager.log("Unable to backup offline data.", this);
return;
}
@@ -395,21 +395,21 @@ public class TaskDataManager {
out = new ObjectOutputStream(fileOuputStream);
out.writeObject(dataStore);
} catch (Exception e) {
- MylarStatusHandler.fail(e, "Error occurred during save of offline task data.", false);
+ StatusManager.fail(e, "Error occurred during save of offline task data.", false);
restoreFromBackup();
} finally {
if (out != null) {
try {
out.close();
} catch (IOException e) {
- MylarStatusHandler.fail(e, "Could not close stream", false);
+ StatusManager.fail(e, "Could not close stream", false);
}
}
if (fileOuputStream != null) {
try {
fileOuputStream.close();
} catch (IOException e) {
- MylarStatusHandler.fail(e, "Could not close stream", false);
+ StatusManager.fail(e, "Could not close stream", false);
}
}
}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskRepositoriesExternalizer.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskRepositoriesExternalizer.java
index aeefc9875..9b734dabd 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskRepositoriesExternalizer.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskRepositoriesExternalizer.java
@@ -22,7 +22,7 @@ import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;
-import org.eclipse.mylyn.core.MylarStatusHandler;
+import org.eclipse.mylyn.internal.monitor.core.util.StatusManager;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.core.TaskRepositoryManager;
import org.xml.sax.InputSource;
@@ -63,13 +63,13 @@ public class TaskRepositoriesExternalizer {
outputStream.close();
} catch (IOException e) {
- MylarStatusHandler.fail(e, "Could not write: " + file.getAbsolutePath(), true);
+ StatusManager.fail(e, "Could not write: " + file.getAbsolutePath(), true);
} finally {
if (outputStream != null) {
try {
outputStream.close();
} catch (IOException e) {
- MylarStatusHandler.fail(e, "Unable to terminate output stream to repositories file.", false);
+ StatusManager.fail(e, "Unable to terminate output stream to repositories file.", false);
}
}
}
@@ -90,14 +90,14 @@ public class TaskRepositoriesExternalizer {
return contentHandler.getRepositories();
} catch (Throwable e) {
file.renameTo(new File(file.getAbsolutePath() + "-save"));
- MylarStatusHandler.log(e, "Error while reading context file");
+ StatusManager.log(e, "Error while reading context file");
return null;
} finally {
if (inputStream != null) {
try {
inputStream.close();
} catch (IOException e) {
- MylarStatusHandler.fail(e, "Failed to close repositories input stream.", false);
+ StatusManager.fail(e, "Failed to close repositories input stream.", false);
}
}
}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractAttachmentHandler.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractAttachmentHandler.java
index 219157e68..01cd315da 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractAttachmentHandler.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractAttachmentHandler.java
@@ -18,7 +18,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.mylyn.core.MylarStatusHandler;
+import org.eclipse.mylyn.internal.monitor.core.util.StatusManager;
/**
* @author Steffen Pingel
@@ -53,7 +53,7 @@ public abstract class AbstractAttachmentHandler implements IAttachmentHandler {
try {
in.close();
} catch (IOException e) {
- MylarStatusHandler.fail(e, "Error closing attachment stream", false);
+ StatusManager.fail(e, "Error closing attachment stream", false);
}
}
} finally {
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector.java
index fad1df265..428a819d9 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector.java
@@ -27,7 +27,7 @@ import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.mylyn.context.core.ContextCorePlugin;
-import org.eclipse.mylyn.core.MylarStatusHandler;
+import org.eclipse.mylyn.internal.monitor.core.util.StatusManager;
import org.eclipse.mylyn.internal.tasks.core.TaskDataManager;
import org.eclipse.mylyn.tasks.core.AbstractTask.RepositoryTaskSyncState;
@@ -339,7 +339,7 @@ public abstract class AbstractRepositoryConnector {
try {
out.close();
} catch (IOException e) {
- MylarStatusHandler.fail(e, "Could not close context file", false);
+ StatusManager.fail(e, "Could not close context file", false);
}
}
} catch (FileNotFoundException e) {
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AttributeContainer.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AttributeContainer.java
index 6dfaf4cea..33f0ade10 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AttributeContainer.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AttributeContainer.java
@@ -17,7 +17,7 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
-import org.eclipse.mylyn.core.MylarStatusHandler;
+import org.eclipse.mylyn.internal.monitor.core.util.StatusManager;
/**
* @author Rob Elves
@@ -48,12 +48,12 @@ public class AttributeContainer implements Serializable {
public void addAttribute(String key, RepositoryTaskAttribute attribute) {
if (attributeFactory == null) {
- MylarStatusHandler.log(ERROR_NO_ATTRIBUTE_FACTORY, this);
+ StatusManager.log(ERROR_NO_ATTRIBUTE_FACTORY, this);
return;
}
String mapped = attributeFactory.mapCommonAttributeKey(key);
if(mapped == null) {
- MylarStatusHandler.log("Mylar Error: mapped value for "+key+" returned null.", this);
+ StatusManager.log("Mylar Error: mapped value for "+key+" returned null.", this);
return;
} if (!attributes.containsKey(mapped)) {
attributeKeys.add(mapped);
@@ -63,7 +63,7 @@ public class AttributeContainer implements Serializable {
public RepositoryTaskAttribute getAttribute(String key) {
if (attributeFactory == null) {
- MylarStatusHandler.log(ERROR_NO_ATTRIBUTE_FACTORY, this);
+ StatusManager.log(ERROR_NO_ATTRIBUTE_FACTORY, this);
return null;
}
String mapped = attributeFactory.mapCommonAttributeKey(key);
@@ -93,7 +93,7 @@ public class AttributeContainer implements Serializable {
public void addAttributeValue(String key, String value) {
if (attributeFactory == null) {
- MylarStatusHandler.log(ERROR_NO_ATTRIBUTE_FACTORY, this);
+ StatusManager.log(ERROR_NO_ATTRIBUTE_FACTORY, this);
return;
}
RepositoryTaskAttribute attrib = getAttribute(key);
@@ -112,7 +112,7 @@ public class AttributeContainer implements Serializable {
*/
public void setAttributeValue(String key, String value) {
if (attributeFactory == null) {
- MylarStatusHandler.log(ERROR_NO_ATTRIBUTE_FACTORY, this);
+ StatusManager.log(ERROR_NO_ATTRIBUTE_FACTORY, this);
return;
}
RepositoryTaskAttribute attrib = getAttribute(key);
@@ -125,7 +125,7 @@ public class AttributeContainer implements Serializable {
public String getAttributeValue(String key) {
if (attributeFactory == null) {
- MylarStatusHandler.log(ERROR_NO_ATTRIBUTE_FACTORY, this);
+ StatusManager.log(ERROR_NO_ATTRIBUTE_FACTORY, this);
return "";
}
String returnValue = "";
@@ -139,7 +139,7 @@ public class AttributeContainer implements Serializable {
public List<String> getAttributeValues(String key) {
List<String> returnValue = new ArrayList<String>();
if (attributeFactory == null) {
- MylarStatusHandler.log(ERROR_NO_ATTRIBUTE_FACTORY, this);
+ StatusManager.log(ERROR_NO_ATTRIBUTE_FACTORY, this);
return returnValue;
}
RepositoryTaskAttribute attrib = getAttribute(key);
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DelegatingTaskExternalizer.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DelegatingTaskExternalizer.java
index a2995d956..23e2428a4 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DelegatingTaskExternalizer.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DelegatingTaskExternalizer.java
@@ -19,7 +19,7 @@ import java.util.Date;
import java.util.List;
import java.util.Locale;
-import org.eclipse.mylyn.core.MylarStatusHandler;
+import org.eclipse.mylyn.internal.monitor.core.util.StatusManager;
import org.eclipse.mylyn.internal.tasks.core.LocalTask;
import org.eclipse.mylyn.internal.tasks.core.RepositoryTaskHandleUtil;
import org.eclipse.mylyn.internal.tasks.core.TaskArchive;
@@ -582,7 +582,7 @@ public class DelegatingTaskExternalizer implements ITaskListExternalizer {
try {
date = format.parse(dateString);
} catch (ParseException e) {
- MylarStatusHandler.fail(e, "Could not parse end date", false);
+ StatusManager.fail(e, "Could not parse end date", false);
}
return date;
}
@@ -619,7 +619,7 @@ public class DelegatingTaskExternalizer implements ITaskListExternalizer {
// if (element == null)
createQueryHitElement(hit, doc, node);
} catch (Exception e) {
- MylarStatusHandler.log(e, e.getMessage());
+ StatusManager.log(e, e.getMessage());
}
}
parent.appendChild(node);
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskList.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskList.java
index c47ef489b..96601968a 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskList.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskList.java
@@ -22,7 +22,7 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.CopyOnWriteArraySet;
-import org.eclipse.mylyn.core.MylarStatusHandler;
+import org.eclipse.mylyn.internal.monitor.core.util.StatusManager;
import org.eclipse.mylyn.internal.tasks.core.LocalTask;
import org.eclipse.mylyn.internal.tasks.core.RepositoryTaskHandleUtil;
import org.eclipse.mylyn.internal.tasks.core.TaskArchive;
@@ -620,7 +620,7 @@ public class TaskList {
delta.add(new TaskContainerDelta(task, kind));
listener.containersChanged(delta);
} catch (Throwable t) {
- MylarStatusHandler.fail(t, "Notification failed for: " + listener, false);
+ StatusManager.fail(t, "Notification failed for: " + listener, false);
}
}
}
@@ -638,7 +638,7 @@ public class TaskList {
try {
listener.containersChanged(delta);
} catch (Throwable t) {
- MylarStatusHandler.fail(t, "notification failed for: " + listener, false);
+ StatusManager.fail(t, "notification failed for: " + listener, false);
}
}
}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskRepository.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskRepository.java
index 7d81e8de3..d31b6723e 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskRepository.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskRepository.java
@@ -22,7 +22,7 @@ import java.util.TimeZone;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.mylyn.core.MylarStatusHandler;
+import org.eclipse.mylyn.internal.monitor.core.util.StatusManager;
import org.eclipse.mylyn.web.core.WebClientUtil;
/**
@@ -235,7 +235,7 @@ public class TaskRepository {
}
isCachedUserName = false;
} catch (CoreException e) {
- MylarStatusHandler.fail(e, "could not flush authorization credentials", true);
+ StatusManager.fail(e, "could not flush authorization credentials", true);
}
}
}
@@ -255,7 +255,7 @@ public class TaskRepository {
headlessCreds.putAll(map);
}
} catch (CoreException e) {
- MylarStatusHandler.fail(e, "Could not set authorization credentials", true);
+ StatusManager.fail(e, "Could not set authorization credentials", true);
}
}
}
@@ -269,7 +269,7 @@ public class TaskRepository {
} catch (MalformedURLException ex) {
return Platform.getAuthorizationInfo(DEFAULT_URL, getUrl(), AUTH_SCHEME);
} catch (Exception e) {
- MylarStatusHandler.fail(e, "Could not retrieve authentication credentials", false);
+ StatusManager.fail(e, "Could not retrieve authentication credentials", false);
}
} else {
Map<String, String> headlessCreds = credentials.get(getUrl());
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskRepositoryManager.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskRepositoryManager.java
index d2c5f4a10..3c4b7bebe 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskRepositoryManager.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskRepositoryManager.java
@@ -22,7 +22,7 @@ import java.util.Map;
import java.util.Set;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.mylyn.core.MylarStatusHandler;
+import org.eclipse.mylyn.internal.monitor.core.util.StatusManager;
import org.eclipse.mylyn.internal.tasks.core.TaskRepositoriesExternalizer;
/**
@@ -236,7 +236,7 @@ public class TaskRepositoryManager {
try {
listener.repositoriesRead();
} catch (Throwable t) {
- MylarStatusHandler.fail(t, "repository listener failed", false);
+ StatusManager.fail(t, "repository listener failed", false);
}
}
return repositoryMap;
@@ -278,7 +278,7 @@ public class TaskRepositoryManager {
}
}
} catch (Throwable t) {
- MylarStatusHandler.fail(t, "could not load repositories", false);
+ StatusManager.fail(t, "could not load repositories", false);
}
}
@@ -366,7 +366,7 @@ public class TaskRepositoryManager {
File repositoriesFile = new File(destinationPath);
externalizer.writeRepositoriesToXML(repositoriesToWrite, repositoriesFile);
} catch (Throwable t) {
- MylarStatusHandler.fail(t, "could not save repositories", false);
+ StatusManager.fail(t, "could not save repositories", false);
return false;
}
return true;

Back to the top