Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugReportEditorFactory.java')
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugReportEditorFactory.java115
1 files changed, 115 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugReportEditorFactory.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugReportEditorFactory.java
new file mode 100644
index 000000000..eb738767d
--- /dev/null
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugReportEditorFactory.java
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * Copyright (c) 2004 - 2006 University Of British Columbia and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * University Of British Columbia - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylar.internal.bugzilla.ui.tasklist;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.mylar.core.MylarPlugin;
+import org.eclipse.mylar.internal.bugzilla.ui.editor.ExistingBugEditor;
+import org.eclipse.mylar.internal.bugzilla.ui.tasklist.BugzillaTask.BugReportSyncState;
+import org.eclipse.mylar.internal.core.util.MylarStatusHandler;
+import org.eclipse.mylar.internal.tasklist.TaskRepositoryManager;
+import org.eclipse.mylar.internal.tasklist.ui.ITaskEditorFactory;
+import org.eclipse.mylar.internal.tasklist.ui.MylarTaskEditor;
+import org.eclipse.mylar.tasklist.ITask;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.part.EditorPart;
+
+/**
+ * @author Mik Kersten
+ */
+public class BugReportEditorFactory implements ITaskEditorFactory {
+
+ private static final String REPOSITORY_INFO = "Repository Report";
+
+ public void notifyEditorActivationChange(IEditorPart editor) {
+
+ }
+
+ public EditorPart createEditor(MylarTaskEditor parentEditor) {
+ ExistingBugEditor editor = new ExistingBugEditor();
+ editor.setParentEditor(parentEditor);
+ return new ExistingBugEditor();
+ }
+
+ public IEditorInput createEditorInput(ITask task) {
+ if (task instanceof BugzillaTask) {
+ BugzillaTask bugzillaTask = (BugzillaTask) task;
+// bugzillaTask.downloadReport();
+
+ boolean offline = bugzillaTask.getSyncState() == BugReportSyncState.OUTGOING
+ || bugzillaTask.getSyncState() == BugReportSyncState.CONFLICT;
+
+ try {
+ return new BugzillaTaskEditorInput(bugzillaTask, offline);
+ // GetBugzillaReportJob getBugzillaReportJob = new
+ // GetBugzillaReportJob(bugzillaTask);
+ // return getBugzillaReportJob.getEditorInput();
+ // BugzillaTaskEditorInput input = new
+ // BugzillaTaskEditorInput(bugTask, offline);
+ // try {
+ //
+ } catch (Exception e) {
+ MylarStatusHandler.fail(e, "Could not create Bugzilla editor input", true);
+ }
+ }
+ return null;
+ }
+
+ public String getTitle() {
+ return REPOSITORY_INFO;
+ }
+
+ @SuppressWarnings("unused")
+ private class GetBugzillaReportJob extends Job {
+
+ private static final String LABEL = "Download Bugzilla Report";
+
+ protected BugzillaTask bugzillaTask;
+
+ private BugzillaTaskEditorInput editorInput = null;
+
+ public GetBugzillaReportJob(BugzillaTask bugzillaTask) {
+ super(LABEL);
+ this.bugzillaTask = bugzillaTask;
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ // final BugzillaTaskEditorInput input = new
+ // BugzillaTaskEditorInput(bugTask, offline);
+ boolean offline = bugzillaTask.getSyncState() == BugReportSyncState.OUTGOING
+ || bugzillaTask.getSyncState() == BugReportSyncState.CONFLICT;
+
+ editorInput = new BugzillaTaskEditorInput(bugzillaTask, offline);
+ // openTaskEditor(input, offline);
+ return new Status(IStatus.OK, MylarPlugin.PLUGIN_ID, IStatus.OK, "", null);
+ } catch (Exception e) {
+ MylarStatusHandler.fail(e, "Unable to open Bug report: "
+ + TaskRepositoryManager.getTaskIdAsInt(bugzillaTask.getHandleIdentifier()), true);
+ }
+ return Status.CANCEL_STATUS;
+ }
+
+ public BugzillaTaskEditorInput getEditorInput() {
+ return editorInput;
+ }
+ }
+
+ public boolean canCreateEditorFor(ITask task) {
+ return task instanceof BugzillaTask;
+ }
+}

Back to the top