From 835e522a4e7c4d4876c529127ed73c422a469747 Mon Sep 17 00:00:00 2001 From: spingel Date: Sat, 13 Jun 2009 05:48:42 +0000 Subject: NEW - bug 275507: exception when canceling query synchronization https://bugs.eclipse.org/bugs/show_bug.cgi?id=275507 --- .../internal/trac/ui/wizard/TracQueryPage.java | 45 +++++++++++----------- 1 file changed, 23 insertions(+), 22 deletions(-) (limited to 'org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac') diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracQueryPage.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracQueryPage.java index ebdbf9444..181f6196e 100644 --- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracQueryPage.java +++ b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracQueryPage.java @@ -11,18 +11,20 @@ package org.eclipse.mylyn.internal.trac.ui.wizard; -import java.lang.reflect.InvocationTargetException; import java.util.HashMap; import java.util.Map; +import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.OperationCanceledException; import org.eclipse.core.runtime.Status; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.IDialogSettings; import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.mylyn.commons.core.StatusHandler; +import org.eclipse.mylyn.internal.provisional.commons.ui.CommonUiUtil; +import org.eclipse.mylyn.internal.provisional.commons.ui.ICoreRunnable; import org.eclipse.mylyn.internal.trac.core.TracCorePlugin; import org.eclipse.mylyn.internal.trac.core.TracRepositoryConnector; import org.eclipse.mylyn.internal.trac.core.client.ITracClient; @@ -53,7 +55,6 @@ import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.List; import org.eclipse.swt.widgets.Text; import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.progress.IProgressService; /** * Trac search page. Provides a form similar to the one the Bugzilla connector uses. @@ -370,28 +371,28 @@ public class TracQueryPage extends AbstractRepositoryQueryPage { if (!client.hasAttributes() || force) { try { - IRunnableWithProgress runnable = new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + ICoreRunnable runnable = new ICoreRunnable() { + + public void run(IProgressMonitor monitor) throws CoreException { try { client.updateAttributes(monitor, force); } catch (TracException e) { - throw new InvocationTargetException(e); + throw new CoreException(TracCorePlugin.toStatus(e, getTaskRepository())); } } }; if (getContainer() != null) { - getContainer().run(true, true, runnable); + CommonUiUtil.run(getContainer(), runnable); } else if (getSearchContainer() != null) { - getSearchContainer().getRunnableContext().run(true, true, runnable); + CommonUiUtil.run(getSearchContainer().getRunnableContext(), runnable); } else { - IProgressService service = PlatformUI.getWorkbench().getProgressService(); - service.busyCursorWhile(runnable); + CommonUiUtil.run(PlatformUI.getWorkbench().getProgressService(), runnable); } - } catch (InvocationTargetException e) { - setErrorMessage(TracCorePlugin.toStatus(e.getCause(), getTaskRepository()).getMessage()); + } catch (CoreException e) { + CommonUiUtil.setMessage(this, e.getStatus()); return; - } catch (InterruptedException e) { + } catch (OperationCanceledException e) { return; } } @@ -658,15 +659,15 @@ public class TracQueryPage extends AbstractRepositoryQueryPage { } } - public void selectItems(String[] items) { - list.deselectAll(); - for (String item : items) { - int i = list.indexOf(item); - if (i != -1) { - list.select(i); - } - } - } +// public void selectItems(String[] items) { +// list.deselectAll(); +// for (String item : items) { +// int i = list.indexOf(item); +// if (i != -1) { +// list.select(i); +// } +// } +// } } -- cgit v1.2.3