Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten2005-06-20 22:17:50 -0400
committermkersten2005-06-20 22:17:50 -0400
commitf019ba33bdace8e0bb918bf85d1f8981182f1a3d (patch)
treed6f0e73bc62c4327a4af763cab926dd9b40094ca
parent2989c0d6f6e93549aabecdbdd5cd7dfb40a438ac (diff)
downloadorg.eclipse.mylyn.tasks-f019ba33bdace8e0bb918bf85d1f8981182f1a3d.tar.gz
org.eclipse.mylyn.tasks-f019ba33bdace8e0bb918bf85d1f8981182f1a3d.tar.xz
org.eclipse.mylyn.tasks-f019ba33bdace8e0bb918bf85d1f8981182f1a3d.zip
Ken's patch for: 100931
changing the priority on a bugzilla report doesn't affect task list.
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/IBugzillaAttributeListener.java9
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/ui/editor/AbstractBugEditor.java17
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/BugzillaTask.java9
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/BugzillaTaskEditor.java39
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskSummaryEditor.java8
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/views/TaskListView.java17
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/util/XmlUtil.java4
7 files changed, 73 insertions, 30 deletions
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/IBugzillaAttributeListener.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/IBugzillaAttributeListener.java
new file mode 100644
index 000000000..36687da45
--- /dev/null
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/IBugzillaAttributeListener.java
@@ -0,0 +1,9 @@
+package org.eclipse.mylar.bugzilla;
+
+
+/**
+ * @author Ken Sueda
+ */
+public interface IBugzillaAttributeListener {
+ public abstract void attributeChanged(String attribute, String value);
+}
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/ui/editor/AbstractBugEditor.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/ui/editor/AbstractBugEditor.java
index a34b2b29c..5eac9e07d 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/ui/editor/AbstractBugEditor.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/ui/editor/AbstractBugEditor.java
@@ -15,6 +15,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -38,6 +39,7 @@ import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.mylar.bugzilla.BugzillaPlugin;
import org.eclipse.mylar.bugzilla.BugzillaPreferences;
+import org.eclipse.mylar.bugzilla.IBugzillaAttributeListener;
import org.eclipse.mylar.bugzilla.IBugzillaConstants;
import org.eclipse.mylar.bugzilla.core.Attribute;
import org.eclipse.mylar.bugzilla.core.BugPost;
@@ -183,6 +185,8 @@ public abstract class AbstractBugEditor extends EditorPart implements Listener {
protected StyledText generalTitleText;
+ private List<IBugzillaAttributeListener> attributesListeners = new ArrayList<IBugzillaAttributeListener>();
+
protected final ISelectionProvider selectionProvider = new ISelectionProvider() {
public void addSelectionChangedListener(ISelectionChangedListener listener) {
selectionChangedListeners.add(listener);
@@ -1319,7 +1323,10 @@ public abstract class AbstractBugEditor extends EditorPart implements Listener {
String sel = combo.getItem(combo.getSelectionIndex());
Attribute a = getBug().getAttribute(comboListenerMap.get(combo));
if (!(a.getNewValue().equals(sel))) {
- a.setNewValue(sel);
+ a.setNewValue(sel);
+ for(IBugzillaAttributeListener client : attributesListeners) {
+ client.attributeChanged(a.getName(), sel);
+ }
changeDirtyStatus(true);
}
}
@@ -1519,4 +1526,12 @@ public abstract class AbstractBugEditor extends EditorPart implements Listener {
}
});
}
+
+ public void addAttributeListener(IBugzillaAttributeListener listener) {
+ attributesListeners.add(listener);
+ }
+
+ public void removeAttributeListener(IBugzillaAttributeListener listener) {
+ attributesListeners.remove(listener);
+ }
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/BugzillaTask.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/BugzillaTask.java
index 475bf3f7d..9ffe0bd39 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/BugzillaTask.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/BugzillaTask.java
@@ -16,7 +16,6 @@ package org.eclipse.mylar.tasks;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
-import java.util.Iterator;
import java.util.List;
import javax.security.auth.login.LoginException;
@@ -30,7 +29,6 @@ import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.mylar.bugzilla.BugzillaPlugin;
-import org.eclipse.mylar.bugzilla.core.Attribute;
import org.eclipse.mylar.bugzilla.core.BugReport;
import org.eclipse.mylar.bugzilla.core.BugzillaRepository;
import org.eclipse.mylar.bugzilla.core.IBugzillaBug;
@@ -323,9 +321,10 @@ public class BugzillaTask extends Task {
}
public void updateTaskDetails() {
- for (Iterator<Attribute> it = bugReport.getAttributes().iterator(); it.hasNext();) {
-// Attribute attribute = it.next();
-// String key = attribute.getParameterName();
+ setPriority(bugReport.getAttribute("Priority").getValue());
+ String status = bugReport.getAttribute("Status").getValue();
+ if (status.equals("RESOLVED")) {
+ setCompleted(true);
}
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/BugzillaTaskEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/BugzillaTaskEditor.java
index 89fde40ae..fc16aec88 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/BugzillaTaskEditor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/BugzillaTaskEditor.java
@@ -16,12 +16,15 @@ package org.eclipse.mylar.tasks.ui;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.mylar.bugzilla.IBugzillaAttributeListener;
import org.eclipse.mylar.bugzilla.core.BugReport;
import org.eclipse.mylar.bugzilla.ui.editor.AbstractBugEditor;
import org.eclipse.mylar.bugzilla.ui.editor.ExistingBugEditor;
+import org.eclipse.mylar.bugzilla.ui.editor.ExistingBugEditorInput;
import org.eclipse.mylar.core.MylarPlugin;
import org.eclipse.mylar.tasks.BugzillaTask;
import org.eclipse.mylar.tasks.MylarTasksPlugin;
+import org.eclipse.mylar.tasks.ui.views.TaskListView;
import org.eclipse.mylar.ui.MylarImages;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
@@ -49,7 +52,7 @@ public class BugzillaTaskEditor extends MultiPageEditorPart {
/** This bug report can be modified by the user and saved offline. */
protected BugReport offlineBug;
- private ExistingBugEditor buzillaEditor;
+ private ExistingBugEditor bugzillaEditor;
private BugzillaTaskEditorInput bugzillaEditorInput;
@@ -57,6 +60,16 @@ public class BugzillaTaskEditor extends MultiPageEditorPart {
protected IContentOutlinePage outlinePage = null;
+ private IBugzillaAttributeListener ATTRIBUTE_LISTENER = new IBugzillaAttributeListener() {
+ public void attributeChanged(String attribute, String value) {
+ if (attribute.equals("Priority")) {
+ bugTask.setPriority(value);
+ if (TaskListView.getDefault() != null) TaskListView.getDefault().notifyTaskDataChanged();
+ }
+ }
+ };
+
+
public BugzillaTaskEditor() {
super();
@@ -67,12 +80,13 @@ public class BugzillaTaskEditor extends MultiPageEditorPart {
BugzillaTaskEditorListener listener = new BugzillaTaskEditorListener();
ap.addPartListener(listener);
- buzillaEditor = new ExistingBugEditor();
+ bugzillaEditor = new ExistingBugEditor();
+ bugzillaEditor.addAttributeListener(ATTRIBUTE_LISTENER);
taskSummaryEditor = new TaskSummaryEditor();
}
public AbstractBugEditor getBugzillaEditor(){
- return buzillaEditor;
+ return bugzillaEditor;
}
public TaskSummaryEditor getTaskEditor(){
@@ -89,8 +103,8 @@ public class BugzillaTaskEditor extends MultiPageEditorPart {
* which allows you to change the font used in page 2.
*/
private void createBugzillaSubmitPage() {
- buzillaEditor.createPartControl(getContainer());
- Composite composite = buzillaEditor.getEditorComposite();
+ bugzillaEditor.createPartControl(getContainer());
+ Composite composite = bugzillaEditor.getEditorComposite();
int index = addPage(composite);
setPageText(index, "Bugzilla");
}
@@ -148,7 +162,7 @@ public class BugzillaTaskEditor extends MultiPageEditorPart {
super.setInput(editorInput);
try {
- buzillaEditor.init(this.getEditorSite(), this.getEditorInput());
+ bugzillaEditor.init(this.getEditorSite(), this.getEditorInput());
}
catch (Exception e) {
throw new PartInitException(e.getMessage());
@@ -178,7 +192,7 @@ public class BugzillaTaskEditor extends MultiPageEditorPart {
@Override
public void setFocus() {
// The default focus for this editor is the submit page
- buzillaEditor.setFocus();
+ bugzillaEditor.setFocus();
}
/**
@@ -228,13 +242,16 @@ public class BugzillaTaskEditor extends MultiPageEditorPart {
BugzillaTaskEditor taskEditor = (BugzillaTaskEditor)part;
// check if it needs to be saved
- if (taskEditor.buzillaEditor.isDirty) {
+ if (taskEditor.bugzillaEditor.isDirty) {
// ask the user whether they want to save it or not and perform the appropriate action
- taskEditor.buzillaEditor.changeDirtyStatus(false);
+ taskEditor.bugzillaEditor.changeDirtyStatus(false);
boolean response = MessageDialog.openQuestion(null, "Save Changes",
"You have made some changes to the bug, do you want to save them?");
if (response) {
- taskEditor.buzillaEditor.saveBug();
+ taskEditor.bugzillaEditor.saveBug();
+ } else {
+ ExistingBugEditorInput input = (ExistingBugEditorInput)taskEditor.bugzillaEditor.getEditorInput();
+ bugTask.setPriority(input.getBug().getAttribute("Priority").getValue());
}
}
}
@@ -260,7 +277,7 @@ public class BugzillaTaskEditor extends MultiPageEditorPart {
@Override
public Object getAdapter(Class adapter) {
- return buzillaEditor.getAdapter(adapter);
+ return bugzillaEditor.getAdapter(adapter);
}
public void close() {
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskSummaryEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskSummaryEditor.java
index e7e7e448e..c7a7e7e95 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskSummaryEditor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskSummaryEditor.java
@@ -122,9 +122,8 @@ public class TaskSummaryEditor extends EditorPart {
private Action delete;
private ITaskActivityListener TASK_LIST_LISTENER = new ITaskActivityListener() {
-
public void taskActivated(ITask activeTask) {
- if (activeTask.getHandle().equals(task.getHandle())) {
+ if (task != null && activeTask.getHandle().equals(task.getHandle())) {
browse.setEnabled(false);
}
}
@@ -136,11 +135,10 @@ public class TaskSummaryEditor extends EditorPart {
}
public void taskDeactivated(ITask deactiveTask) {
- if (deactiveTask.getHandle().equals(task.getHandle())) {
+ if (task != null && deactiveTask.getHandle().equals(task.getHandle())) {
browse.setEnabled(true);
}
- }
-
+ }
};
/**
*
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/views/TaskListView.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/views/TaskListView.java
index 1ef4fce79..14d825a15 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/views/TaskListView.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/views/TaskListView.java
@@ -280,17 +280,18 @@ public class TaskListView extends ViewPart {
case 2:
Integer intVal = (Integer) value;
task.setPriority("P" + (intVal + 1));
- viewer.setSelection(null);
+ viewer.setSelection(null);
break;
case 3:
task.setLabel(((String) value).trim());
- viewer.setSelection(null);
+ viewer.setSelection(null);
break;
case 4:
break;
}
viewer.refresh();
} catch (Exception e) {
+ MylarPlugin.log(e, e.getMessage());
}
}
}
@@ -667,7 +668,11 @@ public class TaskListView extends ViewPart {
String bugIdString = getBugIdFromUser();
int bugId = -1;
try {
- bugId = Integer.parseInt(bugIdString);
+ if (bugIdString != null) {
+ bugId = Integer.parseInt(bugIdString);
+ } else {
+ return;
+ }
} catch (NumberFormatException nfe) {
showMessage("Please enter a valid report number");
return;
@@ -680,10 +685,10 @@ public class TaskListView extends ViewPart {
List<ITask> tasks = MylarTasksPlugin.getTaskListManager().getTaskList().getRootTasks();
for (Iterator<ITask> iter = tasks.iterator(); iter.hasNext() && !doesIdExistAlready;) {
ITask task = iter.next();
- doesIdExistAlready = lookForId(task, "" + bugId); // HACK:
+ doesIdExistAlready = lookForId(task, "Bugzilla-" + bugId);
}
if (doesIdExistAlready) {
- showMessage("A Bugzilla task with ID " + bugId + " already exists.");
+ showMessage("A Bugzilla task with ID Bugzilla-" + bugId + " already exists.");
return;
}
@@ -853,7 +858,7 @@ public class TaskListView extends ViewPart {
* children
*/
protected boolean lookForId(ITask task, String taskId) {
- if (task.getHandle() == taskId) {
+ if (task.getHandle().equals(taskId)) {
return true;
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/util/XmlUtil.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/util/XmlUtil.java
index 45f26a060..93e8d2c2a 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/util/XmlUtil.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/util/XmlUtil.java
@@ -301,9 +301,9 @@ public class XmlUtil {
MylarPlugin.log("Failed to read bug report");
}
} else {
- t = new Task(handle, label);
- t.setPriority(priority);
+ t = new Task(handle, label);
}
+ t.setPriority(priority);
t.setPath(e.getAttribute("Path"));
if (e.getAttribute("Active").compareTo("true") == 0) {

Back to the top