diff options
author | fbecker | 2011-05-14 19:42:18 +0000 |
---|---|---|
committer | fbecker | 2011-05-14 19:42:18 +0000 |
commit | ce29bafd6f70146f1ae6eb973ebc277481ef8227 (patch) | |
tree | 47b80aec5543155b7334d6e48ed41bb637b00d8a /org.eclipse.mylyn.bugzilla.ui | |
parent | 7809fae63ffe145defb0fb3a330983c10d5aa0c6 (diff) | |
download | org.eclipse.mylyn.tasks-ce29bafd6f70146f1ae6eb973ebc277481ef8227.tar.gz org.eclipse.mylyn.tasks-ce29bafd6f70146f1ae6eb973ebc277481ef8227.tar.xz org.eclipse.mylyn.tasks-ce29bafd6f70146f1ae6eb973ebc277481ef8227.zip |
ASSIGNED - bug 345056: disable the submit button if we know that we get an error
https://bugs.eclipse.org/bugs/show_bug.cgi?id=345056
Diffstat (limited to 'org.eclipse.mylyn.bugzilla.ui')
-rw-r--r-- | org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java | 106 |
1 files changed, 67 insertions, 39 deletions
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java index 256693d11..d73f018cb 100644 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java +++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java @@ -20,6 +20,8 @@ import java.util.Set; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.jobs.IJobChangeEvent; +import org.eclipse.core.runtime.jobs.JobChangeAdapter; import org.eclipse.jface.dialogs.IMessageProvider; import org.eclipse.mylyn.commons.core.StatusHandler; import org.eclipse.mylyn.commons.net.AuthenticationCredentials; @@ -37,6 +39,9 @@ import org.eclipse.mylyn.internal.bugzilla.core.RepositoryConfiguration; import org.eclipse.mylyn.internal.bugzilla.ui.BugzillaUiPlugin; import org.eclipse.mylyn.internal.provisional.commons.ui.WorkbenchUtil; import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorActionPart; +import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal; +import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector; +import org.eclipse.mylyn.tasks.core.ITask; import org.eclipse.mylyn.tasks.core.RepositoryResponse; import org.eclipse.mylyn.tasks.core.RepositoryStatus; import org.eclipse.mylyn.tasks.core.TaskRepository; @@ -512,46 +517,69 @@ public class BugzillaTaskEditorPage extends AbstractTaskEditorPage { }); return false; } -// if (!getModel().getTaskData().isNew()) { -// TaskAttribute exporter = getModel().getTaskData() -// .getRoot() -// .getAttribute(BugzillaAttribute.EXPORTER_NAME.getKey()); -// if (exporter == null) { -// PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { -// public void run() { -// getTaskEditor().setMessage(Messages.BugzillaTaskEditorPage_submit_disabled_please_refresh, -// type, new HyperlinkAdapter() { -// @Override -// public void linkActivated(HyperlinkEvent e) { -// ITask task = getModel().getTask(); -// AbstractRepositoryConnector connector = TasksUi.getRepositoryManager() -// .getRepositoryConnector(task.getConnectorKind()); -// if (connector == null) { -// return; -// } -// TasksUiInternal.synchronizeTask(connector, task, true, new JobChangeAdapter() { -// @Override -// public void done(IJobChangeEvent event) { -// PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { -// public void run() { -// try { -// getTaskEditor().refreshPages(); -// } finally { -// if (getTaskEditor() != null) { -// getTaskEditor().showBusy(false); -// } -// } -// } -// }); -// } -// }); -// } -// }); -// } -// }); -// return false; + if (!getModel().getTaskData().isNew()) { + TaskAttribute urlbase = getModel().getTaskData().getRoot().getAttribute(BugzillaAttribute.URLBASE.getKey()); + if (urlbase == null) { + // refresh the TaskData so we know the value of the new exporter attribute + // TODO e3.7: we can remove this see bug 345056 + PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { + + public void run() { + ITask task = getModel().getTask(); + AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector( + task.getConnectorKind()); + if (connector == null) { + return; + } + TasksUiInternal.synchronizeTask(connector, task, true, null); + } + }); + } else { + TaskAttribute exporter = getModel().getTaskData() + .getRoot() + .getAttribute(BugzillaAttribute.EXPORTER_NAME.getKey()); + if (exporter == null) { + PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { + public void run() { + getTaskEditor().setMessage(Messages.BugzillaTaskEditorPage_submit_disabled_please_refresh, + type, new HyperlinkAdapter() { + @Override + public void linkActivated(HyperlinkEvent e) { + ITask task = getModel().getTask(); + AbstractRepositoryConnector connector = TasksUi.getRepositoryManager() + .getRepositoryConnector(task.getConnectorKind()); + if (connector == null) { + return; + } + TasksUiInternal.synchronizeTask(connector, task, true, + new JobChangeAdapter() { + @Override + public void done(IJobChangeEvent event) { + PlatformUI.getWorkbench() + .getDisplay() + .asyncExec(new Runnable() { + public void run() { + try { + getTaskEditor().refreshPages(); + } finally { + if (getTaskEditor() != null) { + getTaskEditor().showBusy(false); + } + } + } + }); + } + }); + } + }); + } + }); + return false; + } // } -// } + + } + } return true; } } |