Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfbecker2011-05-14 19:42:18 +0000
committerfbecker2011-05-14 19:42:18 +0000
commitce29bafd6f70146f1ae6eb973ebc277481ef8227 (patch)
tree47b80aec5543155b7334d6e48ed41bb637b00d8a
parent7809fae63ffe145defb0fb3a330983c10d5aa0c6 (diff)
downloadorg.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
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttribute.java3
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/Messages.java2
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java9
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/messages.properties1
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java106
5 files changed, 80 insertions, 41 deletions
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttribute.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttribute.java
index 8ca7ae3ac..7b6bd0e7a 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttribute.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttribute.java
@@ -91,6 +91,7 @@ public enum BugzillaAttribute {
ESTIMATED_TIME(Messages.BugzillaAttribute_Estimated_Time,
"estimated_time", TaskAttribute.TYPE_SHORT_TEXT, true, false), //$NON-NLS-1$
+
EXPORTER_NAME(Messages.BugzillaAttribute_Exporter, "exporter", TaskAttribute.TYPE_PERSON, true, true), //$NON-NLS-1$
FILENAME(Messages.BugzillaAttribute_filename, "filename", TaskAttribute.TYPE_SHORT_TEXT, false, false), //$NON-NLS-1$
@@ -150,6 +151,8 @@ public enum BugzillaAttribute {
UNKNOWN(Messages.BugzillaAttribute_UNKNOWN, "UNKNOWN", TaskAttribute.TYPE_SHORT_TEXT, false, false), //$NON-NLS-1$
+ URLBASE(Messages.BugzillaAttribute_URLBASE, "urlbase", TaskAttribute.TYPE_SHORT_TEXT, true, true), //$NON-NLS-1$
+
VERSION(Messages.BugzillaAttribute_Version, "version", TaskAttribute.TYPE_SINGLE_SELECT, false, false), //$NON-NLS-1$
INSTALL_VERSION(Messages.BugzillaAttribute_version_of_bugzilla_installed, "install_version", null, true, false), //$NON-NLS-1$
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/Messages.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/Messages.java
index 4552d82e9..9a6bb295a 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/Messages.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/Messages.java
@@ -155,6 +155,8 @@ public class Messages extends NLS {
public static String BugzillaAttribute_URL;
+ public static String BugzillaAttribute_URLBASE;
+
public static String BugzillaAttribute_Query_Timestamp;
public static String BugzillaAttribute_used_by_search_engine_bugs;
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java
index b98341a33..2eb6303b7 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java
@@ -73,6 +73,8 @@ public class SaxMultiBugReportContentHandler extends DefaultHandler {
private String exporter;
+ private String urlbase;
+
private TaskAttribute attachmentAttribute;
private boolean bugParseErrorOccurred;
@@ -124,9 +126,9 @@ public class SaxMultiBugReportContentHandler extends DefaultHandler {
case BUGZILLA:
// Note: here we can get the bugzilla version if necessary
// String version = attributes.getValue("version");
-// String urlbase = attributes.getValue("urlbase");
+ urlbase = attributes.getValue("urlbase"); //$NON-NLS-1$
// String maintainer = attributes.getValue("maintainer");
- exporter = attributes.getValue("exporter");
+ exporter = attributes.getValue("exporter"); //$NON-NLS-1$
break;
case BUG:
if (attributes != null && (attributes.getValue("error") != null)) { //$NON-NLS-1$
@@ -313,6 +315,9 @@ public class SaxMultiBugReportContentHandler extends DefaultHandler {
if (exporter != null) {
createAttrribute(exporter, BugzillaAttribute.EXPORTER_NAME);
}
+ if (urlbase != null) {
+ createAttrribute(urlbase, BugzillaAttribute.URLBASE);
+ }
break;
}
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/messages.properties b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/messages.properties
index 049140ea6..faccd3a70 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/messages.properties
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/messages.properties
@@ -73,6 +73,7 @@ BugzillaAttribute_thetext=thetext
BugzillaAttribute_type=type
BugzillaAttribute_UNKNOWN=UNKNOWN
BugzillaAttribute_URL=URL:
+BugzillaAttribute_URLBASE=URL Base:
BugzillaAttribute_Query_Timestamp=Query Timestamp:
BugzillaAttribute_used_by_search_engine_bugs=used by search engine
BugzillaAttribute_used_by_search_engine_desc=used by search engine
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;
}
}

Back to the top