Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Pingel2011-12-11 01:55:30 +0000
committerSteffen Pingel2011-12-11 01:55:30 +0000
commiteab9f4cb11e643ea6eaab443eb353c855f321900 (patch)
treea3aaccf6131f5c4f28fc3480098a260a65d6d8d0
parentfd1bb2f5eadf1964c6be0023e5611cfca6d47c72 (diff)
downloadorg.eclipse.mylyn.tasks-eab9f4cb11e643ea6eaab443eb353c855f321900.tar.gz
org.eclipse.mylyn.tasks-eab9f4cb11e643ea6eaab443eb353c855f321900.tar.xz
org.eclipse.mylyn.tasks-eab9f4cb11e643ea6eaab443eb353c855f321900.zip
NEW - bug 364632: remove invocations to StatusHandler.fail()
https://bugs.eclipse.org/bugs/show_bug.cgi?id=364632
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/BugzillaAttachmentWizard.java5
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryStatus.java1
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewQueryAction.java21
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/RestoreTaskListAction.java26
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/RemoteTaskSelectionDialog.java2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/AttachmentUtil.java13
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListCellModifier.java62
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/UpdateRepositoryConfigurationAction.java56
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/EditRepositoryWizard.java8
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/TaskAttachmentWizard.java5
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiUtil.java33
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/BrowserFormPage.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage.java7
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/NewTaskWizard.java7
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/RepositoryQueryWizard.java9
-rw-r--r--org.eclipse.mylyn.tests.util/META-INF/MANIFEST.MF4
16 files changed, 117 insertions, 146 deletions
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/BugzillaAttachmentWizard.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/BugzillaAttachmentWizard.java
index 3d2b5b2de..7ae0a360a 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/BugzillaAttachmentWizard.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/BugzillaAttachmentWizard.java
@@ -18,7 +18,6 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.mylyn.internal.bugzilla.ui.BugzillaUiPlugin;
import org.eclipse.mylyn.internal.bugzilla.ui.action.ChangeAttachmentJob;
import org.eclipse.mylyn.tasks.core.ITaskAttachment;
@@ -26,6 +25,7 @@ import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
import org.eclipse.mylyn.tasks.ui.editors.AttributeEditorFactory;
import org.eclipse.mylyn.tasks.ui.editors.TaskEditor;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.statushandlers.StatusManager;
/**
* @author Frank Becker
@@ -119,7 +119,8 @@ public class BugzillaAttachmentWizard extends Wizard {
});
return true;
} catch (InvocationTargetException e) {
- StatusHandler.fail(new Status(IStatus.ERROR, BugzillaUiPlugin.ID_PLUGIN, "Unexpected error", e)); //$NON-NLS-1$
+ StatusManager.getManager()
+ .handle(new Status(IStatus.ERROR, BugzillaUiPlugin.ID_PLUGIN, "Unexpected error", e), StatusManager.SHOW | StatusManager.LOG); //$NON-NLS-1$
return false;
} catch (InterruptedException e) {
// canceled
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryStatus.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryStatus.java
index e064439f3..5c99772b9 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryStatus.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryStatus.java
@@ -47,6 +47,7 @@ public class RepositoryStatus extends Status {
public final static int REPOSITORY_LOGGED_OUT = 10;
+ @Deprecated
public final static int ERROR_INTERNAL = 7;
/**
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewQueryAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewQueryAction.java
index 9b431fe3d..adf9faa3e 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewQueryAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewQueryAction.java
@@ -15,15 +15,13 @@ package org.eclipse.mylyn.internal.tasks.ui.actions;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExecutableExtension;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.mylyn.commons.core.StatusHandler;
+import org.eclipse.mylyn.commons.workbench.WorkbenchUtil;
import org.eclipse.mylyn.internal.tasks.ui.LocalRepositoryConnectorUi;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.wizards.NewQueryWizard;
@@ -31,10 +29,8 @@ import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
import org.eclipse.mylyn.tasks.ui.TasksUiImages;
import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
-import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IViewActionDelegate;
import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.PlatformUI;
/**
* @author Mik Kersten
@@ -90,17 +86,10 @@ public class NewQueryAction extends Action implements IViewActionDelegate, IExec
wizard = new NewQueryWizard();
}
- try {
- Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
- if (shell != null && !shell.isDisposed()) {
- WizardDialog dialog = new WizardDialog(shell, wizard);
- dialog.create();
- dialog.setBlockOnOpen(true);
- dialog.open();
- }
- } catch (Exception e) {
- StatusHandler.fail(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, e.getMessage(), e));
- }
+ WizardDialog dialog = new WizardDialog(WorkbenchUtil.getShell(), wizard);
+ dialog.create();
+ dialog.setBlockOnOpen(true);
+ dialog.open();
}
public void setInitializationData(IConfigurationElement config, String propertyName, Object data)
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/RestoreTaskListAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/RestoreTaskListAction.java
index d94fd7849..195ab1dad 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/RestoreTaskListAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/RestoreTaskListAction.java
@@ -11,22 +11,17 @@
package org.eclipse.mylyn.internal.tasks.ui.actions;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
+import org.eclipse.mylyn.commons.workbench.WorkbenchUtil;
import org.eclipse.mylyn.internal.tasks.ui.wizards.TaskDataImportWizard;
-import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IViewActionDelegate;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-import org.eclipse.ui.PlatformUI;
/**
* @author Mik Kersten
@@ -42,18 +37,11 @@ public class RestoreTaskListAction extends Action implements IViewActionDelegate
@Override
public void run() {
- try {
- Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
- if (shell != null && !shell.isDisposed()) {
- IWizard wizard = new TaskDataImportWizard();
- WizardDialog dialog = new WizardDialog(shell, wizard);
- dialog.create();
- dialog.setBlockOnOpen(true);
- dialog.open();
- }
- } catch (Exception e) {
- StatusHandler.fail(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, e.getMessage(), e));
- }
+ IWizard wizard = new TaskDataImportWizard();
+ WizardDialog dialog = new WizardDialog(WorkbenchUtil.getShell(), wizard);
+ dialog.create();
+ dialog.setBlockOnOpen(true);
+ dialog.open();
}
public void selectionChanged(IAction action, ISelection selection) {
@@ -61,12 +49,10 @@ public class RestoreTaskListAction extends Action implements IViewActionDelegate
public void dispose() {
// ignore
-
}
public void init(IWorkbenchWindow window) {
// ignore
-
}
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/RemoteTaskSelectionDialog.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/RemoteTaskSelectionDialog.java
index 614c210e9..d9bdefc9f 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/RemoteTaskSelectionDialog.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/commands/RemoteTaskSelectionDialog.java
@@ -217,7 +217,7 @@ public class RemoteTaskSelectionDialog extends SelectionStatusDialog {
hndSvc.executeCommand(ITaskCommandIds.ADD_TASK_REPOSITORY, null);
repositoriesViewer.setInput(getTaskRepositories());
} catch (CommandException e) {
- StatusHandler.fail(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, e.getMessage(), e));
+ StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, e.getMessage(), e));
}
}
});
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/AttachmentUtil.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/AttachmentUtil.java
index 10065c046..a9f2c6402 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/AttachmentUtil.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/AttachmentUtil.java
@@ -55,6 +55,7 @@ import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.handlers.HandlerUtil;
import org.eclipse.ui.handlers.IHandlerService;
+import org.eclipse.ui.statushandlers.StatusManager;
/**
* @author Steffen Pingel
@@ -136,8 +137,6 @@ public class AttachmentUtil {
try {
context.run(true, true, new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- TaskRepository repository = TasksUi.getRepositoryManager().getRepository(task.getConnectorKind(),
- task.getRepositoryUrl());
File targetFile = TasksUiPlugin.getContextStore().getFileForContext(task);
try {
boolean exceptionThrown = true;
@@ -167,8 +166,9 @@ public class AttachmentUtil {
TasksUiInternal.displayStatus(Messages.AttachmentUtil_Mylyn_Information,
((CoreException) e.getCause()).getStatus());
} else {
- StatusHandler.fail(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Unexpected error while retrieving context", e)); //$NON-NLS-1$
+ StatusManager.getManager()
+ .handle(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
+ "Unexpected error while retrieving context", e), StatusManager.SHOW | StatusManager.LOG); //$NON-NLS-1$
}
return false;
} catch (InterruptedException ignored) {
@@ -207,8 +207,9 @@ public class AttachmentUtil {
}
});
} catch (InvocationTargetException e) {
- StatusHandler.fail(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Unexpected error while attaching context", e)); //$NON-NLS-1$
+ StatusManager.getManager()
+ .handle(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
+ "Unexpected error while attaching context", e), StatusManager.SHOW | StatusManager.LOG); //$NON-NLS-1$
return false;
} catch (InterruptedException ignored) {
// canceled
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListCellModifier.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListCellModifier.java
index d6e2c5dbc..502e203be 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListCellModifier.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListCellModifier.java
@@ -72,41 +72,37 @@ class TaskListCellModifier implements ICellModifier {
}
public void modify(Object element, String property, Object value) {
- int columnIndex = -1;
- try {
- if (element instanceof TreeItem && ((TreeItem) element).isDisposed()) {
- return;
- }
- columnIndex = Arrays.asList(this.taskListView.columnNames).indexOf(property);
- Object data = ((TreeItem) element).getData();
- if (data instanceof AbstractTask) {
- AbstractTask task = (AbstractTask) data;
- switch (columnIndex) {
- case 0:
- if (task != null) {
- task.setSummary(((String) value).trim());
- TasksUiPlugin.getTaskList().notifyElementChanged(task);
- }
- break;
- case 1:
- break;
- case 2:
- toggleTaskActivation((TreeItem) element, null);
- break;
- }
- } else if (data instanceof AbstractTaskCategory || data instanceof IRepositoryQuery) {
- AbstractTaskContainer container = (AbstractTaskContainer) data;
- switch (columnIndex) {
- case 0:
- TasksUiPlugin.getTaskList().renameContainer(container, ((String) value).trim());
- case 1:
- break;
- case 2:
- break;
+ if (element instanceof TreeItem && ((TreeItem) element).isDisposed()) {
+ return;
+ }
+
+ int columnIndex = Arrays.asList(this.taskListView.columnNames).indexOf(property);
+ Object data = ((TreeItem) element).getData();
+ if (data instanceof AbstractTask) {
+ AbstractTask task = (AbstractTask) data;
+ switch (columnIndex) {
+ case 0:
+ if (task != null) {
+ task.setSummary(((String) value).trim());
+ TasksUiPlugin.getTaskList().notifyElementChanged(task);
}
+ break;
+ case 1:
+ break;
+ case 2:
+ toggleTaskActivation((TreeItem) element, null);
+ break;
+ }
+ } else if (data instanceof AbstractTaskCategory || data instanceof IRepositoryQuery) {
+ AbstractTaskContainer container = (AbstractTaskContainer) data;
+ switch (columnIndex) {
+ case 0:
+ TasksUiPlugin.getTaskList().renameContainer(container, ((String) value).trim());
+ case 1:
+ break;
+ case 2:
+ break;
}
- } catch (Exception e) {
- StatusHandler.fail(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, e.getMessage(), e));
}
// XXX trigger a full refresh to ensure correct sorting
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/UpdateRepositoryConfigurationAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/UpdateRepositoryConfigurationAction.java
index cfab3daed..fb412a0b4 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/UpdateRepositoryConfigurationAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/UpdateRepositoryConfigurationAction.java
@@ -20,9 +20,7 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.mylyn.commons.workbench.WorkbenchUtil;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.actions.AbstractTaskRepositoryAction;
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
@@ -45,38 +43,34 @@ public class UpdateRepositoryConfigurationAction extends AbstractTaskRepositoryA
@Override
public void run() {
- try {
- IStructuredSelection selection = getStructuredSelection();
- for (Iterator<?> iter = selection.iterator(); iter.hasNext();) {
- final TaskRepository repository = getTaskRepository(iter.next());
- if (repository != null) {
- final AbstractRepositoryConnector connector = TasksUi.getRepositoryManager()
- .getRepositoryConnector(repository.getConnectorKind());
- if (connector != null) {
- final String jobName = MessageFormat.format(
- Messages.UpdateRepositoryConfigurationAction_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;
+ IStructuredSelection selection = getStructuredSelection();
+ for (Iterator<?> iter = selection.iterator(); iter.hasNext();) {
+ final TaskRepository repository = getTaskRepository(iter.next());
+ if (repository != null) {
+ final AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
+ repository.getConnectorKind());
+ if (connector != null) {
+ final String jobName = MessageFormat.format(
+ Messages.UpdateRepositoryConfigurationAction_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();
}
- };
- // 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();
- }
+ 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();
}
}
- } catch (Exception e) {
- StatusHandler.fail(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, e.getMessage(), e));
}
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/EditRepositoryWizard.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/EditRepositoryWizard.java
index 5f6855369..f5e76463f 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/EditRepositoryWizard.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/EditRepositoryWizard.java
@@ -17,7 +17,6 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.mylyn.internal.tasks.core.LocalRepositoryConnector;
import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryDelta;
import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryDelta.Type;
@@ -31,6 +30,7 @@ import org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositorySettingsPage;
import org.eclipse.mylyn.tasks.ui.wizards.ITaskRepositoryPage;
import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.statushandlers.StatusManager;
/**
* @author Mik Kersten
@@ -63,8 +63,10 @@ public class EditRepositoryWizard extends Wizard implements INewWizard {
try {
getContainer().run(true, false, operation);
} catch (InvocationTargetException e) {
- StatusHandler.fail(new Status(IStatus.WARNING, TasksUiPlugin.ID_PLUGIN,
- Messages.EditRepositoryWizard_Failed_to_refactor_repository_urls));
+ StatusManager.getManager().handle(
+ new Status(IStatus.WARNING, TasksUiPlugin.ID_PLUGIN,
+ Messages.EditRepositoryWizard_Failed_to_refactor_repository_urls),
+ StatusManager.SHOW | StatusManager.LOG);
return false;
} catch (InterruptedException e) {
// should not get here
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/TaskAttachmentWizard.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/TaskAttachmentWizard.java
index 8a68bdf07..40da56950 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/TaskAttachmentWizard.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/TaskAttachmentWizard.java
@@ -34,7 +34,6 @@ import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.mylyn.commons.ui.CommonImages;
import org.eclipse.mylyn.commons.ui.wizard.ScreenshotCreationPage;
import org.eclipse.mylyn.internal.tasks.core.sync.SubmitTaskAttachmentJob;
@@ -63,6 +62,7 @@ import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.ImageLoader;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.statushandlers.StatusManager;
/**
* A wizard to add a new attachment to a task report.
@@ -415,7 +415,8 @@ public class TaskAttachmentWizard extends Wizard {
handleDone(job);
return job.getStatus() == null;
} catch (InvocationTargetException e) {
- StatusHandler.fail(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Unexpected error", e)); //$NON-NLS-1$
+ StatusManager.getManager()
+ .handle(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Unexpected error", e), StatusManager.SHOW | StatusManager.LOG); //$NON-NLS-1$
return false;
} catch (InterruptedException e) {
// canceled
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiUtil.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiUtil.java
index 70e8c785a..3876fa2e8 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiUtil.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiUtil.java
@@ -51,6 +51,7 @@ import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.statushandlers.StatusManager;
/**
* @noextend This class is not intended to be subclassed by clients.
@@ -175,8 +176,9 @@ public class TasksUiUtil {
try {
return page.openEditor(input, editorId);
} catch (PartInitException e) {
- StatusHandler.fail(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Open for editor failed: " + input //$NON-NLS-1$
- + ", taskId: " + editorId, e)); //$NON-NLS-1$
+ StatusManager.getManager().handle(
+ new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Open for editor failed: " + input //$NON-NLS-1$
+ + ", taskId: " + editorId, e), StatusManager.SHOW | StatusManager.LOG); //$NON-NLS-1$
}
return null;
}
@@ -190,24 +192,21 @@ public class TasksUiUtil {
return Window.CANCEL;
}
- try {
- EditRepositoryWizard wizard = new EditRepositoryWizard(repository);
- Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
- if (shell != null && !shell.isDisposed()) {
- WizardDialog dialog = new TaskRepositoryWizardDialog(shell, wizard);
- dialog.create();
- dialog.setBlockOnOpen(true);
- if (dialog.open() == Window.CANCEL) {
- return Window.CANCEL;
- }
+ EditRepositoryWizard wizard = new EditRepositoryWizard(repository);
+ Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ if (shell != null && !shell.isDisposed()) {
+ WizardDialog dialog = new TaskRepositoryWizardDialog(shell, wizard);
+ dialog.create();
+ dialog.setBlockOnOpen(true);
+ if (dialog.open() == Window.CANCEL) {
+ return Window.CANCEL;
}
+ }
- if (TaskRepositoriesView.getFromActivePerspective() != null) {
- TaskRepositoriesView.getFromActivePerspective().getViewer().refresh();
- }
- } catch (Exception e) {
- StatusHandler.fail(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, e.getMessage(), e));
+ if (TaskRepositoriesView.getFromActivePerspective() != null) {
+ TaskRepositoriesView.getFromActivePerspective().getViewer().refresh();
}
+
return Window.OK;
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/BrowserFormPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/BrowserFormPage.java
index b97f45e99..ba3c2982c 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/BrowserFormPage.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/BrowserFormPage.java
@@ -74,11 +74,9 @@ public class BrowserFormPage extends TaskFormPage {
browserViewer.setURL(url);
}
} catch (SWTError e) {
- // TODO review error handling
- StatusHandler.fail(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Could not create browser page: " //$NON-NLS-1$
+ StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Could not create browser page: " //$NON-NLS-1$
+ e.getMessage(), e));
} catch (RuntimeException e) {
- // TODO review error handling
StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Could not create browser page", e)); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage.java
index b7aa1d4d9..85dfd39d3 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage.java
@@ -74,6 +74,7 @@ import org.eclipse.ui.forms.events.IHyperlinkListener;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Hyperlink;
+import org.eclipse.ui.statushandlers.StatusManager;
/**
* Extend to provide custom repository settings. This page is typically invoked by the user requesting properties via
@@ -1909,8 +1910,10 @@ public abstract class AbstractRepositorySettingsPage extends AbstractTaskReposit
}
});
} catch (InvocationTargetException e) {
- StatusHandler.fail(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- Messages.AbstractRepositorySettingsPage_Internal_error_validating_repository, e.getCause()));
+ StatusManager.getManager().handle(
+ new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
+ Messages.AbstractRepositorySettingsPage_Internal_error_validating_repository, e),
+ StatusManager.SHOW | StatusManager.LOG);
return;
} catch (InterruptedException e) {
// canceled
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/NewTaskWizard.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/NewTaskWizard.java
index 42529c081..b2e42df5c 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/NewTaskWizard.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/NewTaskWizard.java
@@ -33,6 +33,7 @@ import org.eclipse.mylyn.tasks.ui.TasksUiImages;
import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.statushandlers.StatusManager;
/**
* Extend for customizing how new tasks editors are created.
@@ -118,8 +119,10 @@ public class NewTaskWizard extends Wizard implements INewWizard {
TasksUiInternal.displayStatus(Messages.NewTaskWizard_Error_creating_new_task,
((CoreException) e.getCause()).getStatus());
} else {
- StatusHandler.fail(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- Messages.NewTaskWizard_Error_creating_new_task, e.getCause()));
+ StatusManager.getManager().handle(
+ new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
+ Messages.NewTaskWizard_Error_creating_new_task, e),
+ StatusManager.SHOW | StatusManager.LOG);
}
return false;
} catch (InterruptedException e) {
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/RepositoryQueryWizard.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/RepositoryQueryWizard.java
index d85a5cbb3..e4e42057c 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/RepositoryQueryWizard.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/RepositoryQueryWizard.java
@@ -12,11 +12,8 @@
package org.eclipse.mylyn.tasks.ui.wizards;
import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
@@ -26,6 +23,7 @@ import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.TasksUi;
import org.eclipse.mylyn.tasks.ui.TasksUiImages;
+import org.eclipse.osgi.util.NLS;
/**
* Extend to provide a custom edit query dialog, typically invoked by the user requesting properties on a query node in
@@ -63,9 +61,8 @@ public class RepositoryQueryWizard extends Wizard {
public boolean performFinish() {
IWizardPage currentPage = getContainer().getCurrentPage();
if (!(currentPage instanceof AbstractRepositoryQueryPage)) {
- StatusHandler.fail(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- "Current wizard page does not extends AbstractRepositoryQueryPage")); //$NON-NLS-1$
- return false;
+ throw new AssertionError(NLS.bind(
+ "Current wizard page ''{0}'' does not extends AbstractRepositoryQueryPage", currentPage.getClass())); //$NON-NLS-1$
}
AbstractRepositoryQueryPage page = (AbstractRepositoryQueryPage) currentPage;
diff --git a/org.eclipse.mylyn.tests.util/META-INF/MANIFEST.MF b/org.eclipse.mylyn.tests.util/META-INF/MANIFEST.MF
index fb2b6fcd8..107018740 100644
--- a/org.eclipse.mylyn.tests.util/META-INF/MANIFEST.MF
+++ b/org.eclipse.mylyn.tests.util/META-INF/MANIFEST.MF
@@ -11,8 +11,8 @@ Require-Bundle: org.junit,
org.eclipse.mylyn.commons.core,
org.eclipse.mylyn.commons.net,
org.eclipse.mylyn.commons.sdk.util,
- org.eclipse.mylyn.tasks.core,
- org.eclipse.mylyn.tasks.ui
+ org.eclipse.mylyn.tasks.core;bundle-version="3.7.0",
+ org.eclipse.mylyn.tasks.ui;bundle-version="3.7.0"
Bundle-ClassPath: .
Export-Package: org.eclipse.mylyn.tests.util;x-internal:=true
Bundle-RequiredExecutionEnvironment: J2SE-1.5

Back to the top