Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrelves2006-06-08 03:34:12 +0000
committerrelves2006-06-08 03:34:12 +0000
commit1da2429e2fb0aff00ed898fc426c4ca0c40145c4 (patch)
tree1c0c1080179a1e959bad3856f00a19cdc4a5f7eb
parent83907ba3f8781255a02b5003a0c1370b8effe0b1 (diff)
downloadorg.eclipse.mylyn.tasks-1da2429e2fb0aff00ed898fc426c4ca0c40145c4.tar.gz
org.eclipse.mylyn.tasks-1da2429e2fb0aff00ed898fc426c4ca0c40145c4.tar.xz
org.eclipse.mylyn.tasks-1da2429e2fb0aff00ed898fc426c4ca0c40145c4.zip
Progress on: 138043: create a common task editor
https://bugs.eclipse.org/bugs/show_bug.cgi?id=138043
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/AbstractReportFactory.java2
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java19
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaTaskHyperlinkDetectorTest.java2
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaResultMatchAdapter.java6
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaTaskHyperlinkDetector.java2
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaOutlineComparer.java51
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/ExistingBugEditor.java783
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/ExistingBugEditorInput.java184
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/NewBugEditor.java54
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/NewBugEditorInput.java12
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaReportEditorFactory.java2
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositoryConnector.java117
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskEditor.java20
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskEditorInput.java60
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/OpenBugzillaReportJob.java8
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/AbstractBugzillaReportWizard.java2
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/AbstractBugzillaWizardPage.java10
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/NewBugzillaReportWizard.java15
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/bugs/BugzillaEditingMonitor.java8
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/bugs/BugzillaStructureBridge.java44
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/bugs/BugzillaUiBridge.java16
-rw-r--r--org.eclipse.mylyn.tasks.ui/META-INF/MANIFEST.MF4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/OfflineTaskManager.java175
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/RepositoryTaskAttribute.java2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskUiUtil.java64
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/AbstractBugEditorInput.java (renamed from org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/AbstractBugEditorInput.java)13
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/AbstractRepositoryTaskEditor.java (renamed from org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/AbstractBugEditor.java)570
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/ExistingBugEditorInput.java195
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/IRepositoryTaskAttributeListener.java (renamed from org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaAttributeListener.java)4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/IRepositoryTaskSelection.java (renamed from org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/IBugzillaReportSelection.java)4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/OutlineTools.java (renamed from org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaTools.java)11
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/RepositoryTaskEditorCopyAction.java (renamed from org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaEditorCopyAction.java)12
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/RepositoryTaskOutlineComparer.java49
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/RepositoryTaskOutlineNode.java (renamed from org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaOutlineNode.java)133
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/RepositoryTaskOutlinePage.java (renamed from org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaOutlinePage.java)51
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/RepositoryTaskSelection.java (renamed from org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaReportSelection.java)23
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/RepositoryTextViewer.java (renamed from org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/RepositoryTextViewer.java)2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/SpellingDialog.java (renamed from org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/SpellingDialog.java)4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/provisional/tasklist/AbstractRepositoryConnector.java52
39 files changed, 1581 insertions, 1204 deletions
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/AbstractReportFactory.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/AbstractReportFactory.java
index 15722772f..409820224 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/AbstractReportFactory.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/AbstractReportFactory.java
@@ -120,7 +120,7 @@ public class AbstractReportFactory {
}
}
} else if (connection.getContentType().contains(CONTENT_TYPE_TEXT_HTML)) {
- in.mark(0);
+ in.mark(10);
BugzillaRepositoryUtil.parseHtmlError(in);
in.reset();
String message = "";
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java
index 6d05d960f..920df6d52 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java
@@ -67,7 +67,7 @@ public class BugzillaRepositoryConnectorTest extends TestCase {
repository = new TaskRepository(DEFAULT_KIND, IBugzillaConstants.TEST_BUGZILLA_222_URL);
// Valid user name and password must be set for tests to pass
repository.setAuthenticationCredentials("enter your username here", "enter your password here");
-
+ repository.setTimeZoneId("Canada/Eastern");
manager.addRepository(repository);
assertNotNull(manager);
taskList = MylarTaskListPlugin.getTaskListManager().getTaskList();
@@ -113,24 +113,23 @@ public class BugzillaRepositoryConnectorTest extends TestCase {
BugzillaTask task = (BugzillaTask) client.createTaskFromExistingKey(repository, "1");
MylarTaskListPlugin.getTaskListManager().getTaskList().moveToRoot(task);
assertTrue(task.isDownloaded());
- // (The initial local copy from server)
- client.saveBugReport(task.getTaskData());
- assertEquals(task.getSyncState(), RepositoryTaskSyncState.SYNCHRONIZED);
-
+ // (The initial local copy from server)
+ assertEquals(RepositoryTaskSyncState.INCOMING, task.getSyncState());
+ client.synchronize(task, true, null);
+ assertEquals(RepositoryTaskSyncState.SYNCHRONIZED, task.getSyncState());
// Modify it
String newCommentText = "BugzillaRepositoryClientTest.testSynchronize(): " + (new Date()).toString();
task.getTaskData().setNewComment(newCommentText);
// overwrites old fields/attributes with new content (ususually done by
// BugEditor)
- task.getTaskData().setHasChanged(true);
-// updateBug(task.getTaskData());
- assertEquals(task.getSyncState(), RepositoryTaskSyncState.SYNCHRONIZED);
- client.saveBugReport(task.getTaskData());
+ task.getTaskData().setHasChanged(true);
+ task.setSyncState(RepositoryTaskSyncState.OUTGOING);
+ client.saveOffline(task.getTaskData());
assertEquals(RepositoryTaskSyncState.OUTGOING, task.getSyncState());
// Submit changes
MockBugzillaReportSubmitForm form = new MockBugzillaReportSubmitForm(BugzillaPlugin.ENCODING_UTF_8);
- client.submitBugReport(task.getTaskData(), form, null);
+ client.submitBugReport(task.getTaskData(), form, null);
assertEquals(RepositoryTaskSyncState.SYNCHRONIZED, task.getSyncState());
// TODO: Test that comment was appended
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaTaskHyperlinkDetectorTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaTaskHyperlinkDetectorTest.java
index 5a529b371..e038d347b 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaTaskHyperlinkDetectorTest.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaTaskHyperlinkDetectorTest.java
@@ -17,7 +17,7 @@ import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.Region;
import org.eclipse.jface.text.hyperlink.IHyperlink;
import org.eclipse.mylar.internal.bugzilla.ui.BugzillaTaskHyperlinkDetector;
-import org.eclipse.mylar.internal.bugzilla.ui.editor.RepositoryTextViewer;
+import org.eclipse.mylar.internal.tasklist.ui.editors.RepositoryTextViewer;
import org.eclipse.mylar.provisional.tasklist.TaskRepository;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Shell;
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaResultMatchAdapter.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaResultMatchAdapter.java
index bd7637105..fc6627ba0 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaResultMatchAdapter.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaResultMatchAdapter.java
@@ -11,9 +11,9 @@
package org.eclipse.mylar.internal.bugzilla.ui;
-import org.eclipse.mylar.internal.bugzilla.ui.editor.ExistingBugEditorInput;
import org.eclipse.mylar.internal.bugzilla.ui.search.BugzillaSearchResult;
import org.eclipse.mylar.internal.bugzilla.ui.search.IBugzillaResultEditorMatchAdapter;
+import org.eclipse.mylar.internal.tasklist.ui.editors.ExistingBugEditorInput;
import org.eclipse.search.ui.text.AbstractTextSearchResult;
import org.eclipse.search.ui.text.Match;
import org.eclipse.ui.IEditorInput;
@@ -41,7 +41,7 @@ public class BugzillaResultMatchAdapter implements IBugzillaResultEditorMatchAda
IEditorInput ei = editor.getEditorInput();
if (ei instanceof ExistingBugEditorInput) {
ExistingBugEditorInput bi = (ExistingBugEditorInput) ei;
- return match.getElement().equals(bi.getBug());
+ return match.getElement().equals(bi.getRepositoryTaskData());
}
return false;
}
@@ -58,7 +58,7 @@ public class BugzillaResultMatchAdapter implements IBugzillaResultEditorMatchAda
IEditorInput ei = editor.getEditorInput();
if (ei instanceof ExistingBugEditorInput) {
ExistingBugEditorInput bi = (ExistingBugEditorInput) ei;
- return result.getMatches(bi.getBug());
+ return result.getMatches(bi.getRepositoryTaskData());
}
return EMPTY_ARR;
}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaTaskHyperlinkDetector.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaTaskHyperlinkDetector.java
index fac9f2623..23673f1e5 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaTaskHyperlinkDetector.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaTaskHyperlinkDetector.java
@@ -17,7 +17,7 @@ import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.hyperlink.IHyperlink;
import org.eclipse.jface.text.hyperlink.IHyperlinkDetector;
-import org.eclipse.mylar.internal.bugzilla.ui.editor.RepositoryTextViewer;
+import org.eclipse.mylar.internal.tasklist.ui.editors.RepositoryTextViewer;
import org.eclipse.mylar.provisional.tasklist.TaskRepository;
/**
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaOutlineComparer.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaOutlineComparer.java
deleted file mode 100644
index 713c7889f..000000000
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaOutlineComparer.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * 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.editor;
-
-import org.eclipse.jface.viewers.IElementComparer;
-import org.eclipse.mylar.internal.bugzilla.ui.BugzillaTools;
-import org.eclipse.mylar.internal.bugzilla.ui.IBugzillaReportSelection;
-
-/**
- * This class is used to compare two <code>IBugzillaReportSelection</code>
- * objects.
- *
- * @see IElementComparer
- * @see IBugzillaReportSelection
- */
-public class BugzillaOutlineComparer implements IElementComparer {
-
- public boolean equals(Object a, Object b) {
- if ((a instanceof IBugzillaReportSelection) && (b instanceof IBugzillaReportSelection)) {
- IBugzillaReportSelection s1 = (IBugzillaReportSelection) a;
- IBugzillaReportSelection s2 = (IBugzillaReportSelection) b;
-
- // An IBugzillaReportSelection is uniquely defined by its handle and
- // its contents
- return ((BugzillaTools.getHandle(s1).equals(BugzillaTools.getHandle(s2))) && ((s1.getContents() == null) ? (s2
- .getContents() == null)
- : s1.getContents().equals(s2.getContents())));
- }
- return a.equals(b);
- }
-
- public int hashCode(Object element) {
- if (element instanceof IBugzillaReportSelection) {
- IBugzillaReportSelection sel = (IBugzillaReportSelection) element;
-
- // An IBugzillaReportSelection is uniquely defined by its handle and
- // its contents
- return (BugzillaTools.getHandle(sel) + sel.getContents()).hashCode();
- }
- return element.hashCode();
- }
-}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/ExistingBugEditor.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/ExistingBugEditor.java
index 39299524a..21b72bdc8 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/ExistingBugEditor.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/ExistingBugEditor.java
@@ -28,11 +28,6 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.IJobChangeListener;
import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.action.GroupMarker;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.text.TextViewer;
@@ -50,7 +45,10 @@ import org.eclipse.mylar.internal.tasklist.LocalAttachment;
import org.eclipse.mylar.internal.tasklist.RepositoryOperation;
import org.eclipse.mylar.internal.tasklist.RepositoryTaskAttribute;
import org.eclipse.mylar.internal.tasklist.RepositoryTaskData;
-import org.eclipse.mylar.internal.tasklist.ui.TaskListImages;
+import org.eclipse.mylar.internal.tasklist.ui.editors.AbstractRepositoryTaskEditor;
+import org.eclipse.mylar.internal.tasklist.ui.editors.RepositoryTaskOutlineNode;
+import org.eclipse.mylar.internal.tasklist.ui.editors.RepositoryTaskSelection;
+import org.eclipse.mylar.internal.tasklist.ui.editors.ExistingBugEditorInput;
import org.eclipse.mylar.internal.tasklist.ui.views.TaskRepositoriesView;
import org.eclipse.mylar.provisional.tasklist.AbstractRepositoryConnector;
import org.eclipse.mylar.provisional.tasklist.MylarTaskListPlugin;
@@ -60,10 +58,8 @@ import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
@@ -76,20 +72,14 @@ import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.forms.events.ExpansionAdapter;
import org.eclipse.ui.forms.events.ExpansionEvent;
-import org.eclipse.ui.forms.events.HyperlinkAdapter;
-import org.eclipse.ui.forms.events.HyperlinkEvent;
import org.eclipse.ui.forms.events.IExpansionListener;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.ImageHyperlink;
import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.forms.widgets.Section;
-import org.eclipse.ui.themes.IThemeManager;
/**
* An editor used to view a bug report that exists on a server. It uses a
@@ -98,7 +88,7 @@ import org.eclipse.ui.themes.IThemeManager;
* @author Mik Kersten (hardening of prototype)
* @author Rob Elves (adaption to Eclipse Forms)
*/
-public class ExistingBugEditor extends AbstractBugEditor {
+public class ExistingBugEditor extends AbstractRepositoryTaskEditor {
private static final String REASSIGN_BUG_TO = "Reassign bug to";
@@ -122,15 +112,17 @@ public class ExistingBugEditor extends AbstractBugEditor {
protected Text ccText;
- protected Text addCommentsText;
+ protected Text urlText;
+
+ // protected Text addCommentsText;
protected RepositoryTaskData taskData;
protected AbstractRepositoryConnector connector;
- public String getNewCommentText() {
- return addCommentsTextBox.getText();
- }
+ // public String getNewCommentText() {
+ // return addCommentsTextBox.getText();
+ // }
/**
* Creates a new <code>ExistingBugEditor</code>.
@@ -149,56 +141,59 @@ public class ExistingBugEditor extends AbstractBugEditor {
compareInput = new BugzillaCompareInput(config);
}
- @SuppressWarnings("deprecation")
+ // @SuppressWarnings("deprecation")
@Override
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
if (!(input instanceof ExistingBugEditorInput))
throw new PartInitException("Invalid Input: Must be ExistingBugEditorInput");
- ExistingBugEditorInput editorInput = (ExistingBugEditorInput) input;
+ editorInput = (ExistingBugEditorInput) input;
+ taskData = editorInput.getRepositoryTaskData();
repository = editorInput.getRepository();
connector = MylarTaskListPlugin.getRepositoryManager().getRepositoryConnector(repository.getKind());
setSite(site);
setInput(input);
- bugzillaInput = editorInput;
- bugzillaOutlineModel = BugzillaOutlineNode.parseBugReport(bugzillaInput.getBug());
- taskData = editorInput.getBug();
- restoreBug();
+ bugzillaOutlineModel = RepositoryTaskOutlineNode.parseBugReport(editorInput.getRepositoryTaskData());
+
+ // restoreBug();
isDirty = false;
updateEditorTitle();
}
- /**
- * This overrides the existing implementation in order to add an "add to
- * favorites" option to the context menu.
- *
- * @see org.eclipse.mylar.internal.bugzilla.ui.AbstractBugEditor#createContextMenu()
- */
- @Override
- protected void createContextMenu() {
- contextMenuManager = new MenuManager("#BugEditor");
- contextMenuManager.setRemoveAllWhenShown(true);
- contextMenuManager.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager manager) {
- // manager.add(new
- // AddToFavoritesAction(ExistingBugEditor.this));
- // manager.add(new Separator());
- manager.add(cutAction);
- manager.add(copyAction);
- manager.add(pasteAction);
- manager.add(new Separator());
- manager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
- if (currentSelectedText == null || currentSelectedText.getSelectionText().length() == 0) {
-
- copyAction.setEnabled(false);
- } else {
- copyAction.setEnabled(true);
- }
- }
- });
- getSite().registerContextMenu("#BugEditor", contextMenuManager, getSite().getSelectionProvider());
- }
+ // /**
+ // * This overrides the existing implementation in order to add an "add to
+ // * favorites" option to the context menu.
+ // *
+ // * @see
+ // org.eclipse.mylar.internal.bugzilla.ui.AbstractRepositoryTaskEditor#createContextMenu()
+ // */
+ // @Override
+ // protected void createContextMenu() {
+ // contextMenuManager = new MenuManager(CONTEXT_MENU_ID);
+ // contextMenuManager.setRemoveAllWhenShown(true);
+ // contextMenuManager.addMenuListener(new IMenuListener() {
+ // public void menuAboutToShow(IMenuManager manager) {
+ // // manager.add(new
+ // // AddToFavoritesAction(ExistingBugEditor.this));
+ // // manager.add(new Separator());
+ // manager.add(cutAction);
+ // manager.add(copyAction);
+ // manager.add(pasteAction);
+ // manager.add(new Separator());
+ // manager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
+ // if (currentSelectedText == null ||
+ // currentSelectedText.getSelectionText().length() == 0) {
+ //
+ // copyAction.setEnabled(false);
+ // } else {
+ // copyAction.setEnabled(true);
+ // }
+ // }
+ // });
+ // getSite().registerContextMenu("#BugEditor", contextMenuManager,
+ // getSite().getSelectionProvider());
+ // }
@Override
protected void addRadioButtons(Composite buttonComposite) {
@@ -230,7 +225,7 @@ public class ExistingBugEditor extends AbstractBugEditor {
radioData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
radioData.horizontalSpan = 1;
radioData.heightHint = 20;
- radioData.widthHint = AbstractBugEditor.WRAP_LENGTH;
+ radioData.widthHint = AbstractRepositoryTaskEditor.WRAP_LENGTH;
// radioOptions[i] = new Combo(buttonComposite, SWT.NULL);
radioOptions[i] = new CCombo(buttonComposite, SWT.FLAT | SWT.READ_ONLY);
toolkit.adapt(radioOptions[i], true, true);
@@ -354,10 +349,10 @@ public class ExistingBugEditor extends AbstractBugEditor {
return compareInput;
}
- @Override
- public RepositoryTaskData getBug() {
- return taskData;
- }
+ // @Override
+ // public RepositoryTaskData getBug() {
+ // return taskData;
+ // }
@Override
protected String getTitleString() {
@@ -369,7 +364,7 @@ public class ExistingBugEditor extends AbstractBugEditor {
@Override
public void submitBug() {
- if(isDirty()) {
+ if (isDirty()) {
this.doSave(new NullProgressMonitor());
}
updateBug();
@@ -381,10 +376,10 @@ public class ExistingBugEditor extends AbstractBugEditor {
att.setComment(attachmentComment.getText());
att.setDescription(attachmentDesc.getText());
}
-
+
try {
bugzillaReportSubmitForm = BugzillaReportSubmitForm.makeExistingBugPost(taskData, repository.getUrl(),
- repository.getUserName(), repository.getPassword(), bugzillaInput.getProxySettings(), removeCC,
+ repository.getUserName(), repository.getPassword(), editorInput.getProxySettings(), removeCC,
repository.getCharacterEncoding());
} catch (UnsupportedEncodingException e) {
// should never get here but just in case...
@@ -435,8 +430,37 @@ public class ExistingBugEditor extends AbstractBugEditor {
}
@Override
- protected void createDescriptionLayout(FormToolkit toolkit, final ScrolledForm form) {
-
+ protected void createCustomAttributeLayout(FormToolkit toolkit, final ScrolledForm form) {
+
+
+ Composite customAttributesComposite = toolkit.createComposite(form.getBody());
+ GridLayout attributesLayout = new GridLayout();
+ attributesLayout.numColumns = 4;
+ attributesLayout.horizontalSpacing = 14;
+ attributesLayout.verticalSpacing = 6;
+ customAttributesComposite.setLayout(attributesLayout);
+ GridData attributesData = new GridData(GridData.FILL_BOTH);
+ attributesData.horizontalSpan = 1;
+ attributesData.grabExcessVerticalSpace = false;
+ customAttributesComposite.setLayoutData(attributesData);
+ addCCList(toolkit, "", customAttributesComposite);
+
+ // URL field
+ // addUrlText(getReport().getAttributeValue(BugzillaReportElement.BUG_FILE_LOC.getKeyString()),
+ // customAttributesComposite);
+
+ // keywords text field (not editable)
+ try {
+ addKeywordsList(toolkit, getRepositoryTaskData().getAttributeValue(RepositoryTaskAttribute.KEYWORDS),
+ customAttributesComposite);
+ } catch (IOException e) {
+ MessageDialog.openInformation(null, "Attribute Display Error",
+ "Could not retrieve keyword list, ensure proper configuration in " + TaskRepositoriesView.NAME
+ + "\n\nError reported: " + e.getMessage());
+ }
+
+ toolkit.paintBordersFor(customAttributesComposite);
+
final Section section = toolkit.createSection(form.getBody(), ExpandableComposite.TITLE_BAR | Section.TWISTIE);
section.setText(LABEL_SECTION_DESCRIPTION);
section.setExpanded(true);
@@ -460,6 +484,8 @@ public class ExistingBugEditor extends AbstractBugEditor {
GridData sectionCompositeData = new GridData(GridData.FILL_HORIZONTAL);
sectionComposite.setLayoutData(sectionCompositeData);
+ // Perhaps these should be performed in subclass eventually
+
TextViewer viewer = addRepositoryText(repository, sectionComposite, taskData.getDescription());
final StyledText styledText = viewer.getTextWidget();
styledText.addListener(SWT.FocusIn, new DescriptionListener());
@@ -472,246 +498,274 @@ public class ExistingBugEditor extends AbstractBugEditor {
}
- /**
- * http://www.eclipse.org and http://www.eclipse.org/mylar and a
- */
- @Override
- protected void createCommentLayout(FormToolkit toolkit, final ScrolledForm form) {
-
- Section section = toolkit.createSection(form.getBody(), ExpandableComposite.TITLE_BAR | Section.TWISTIE);
- section.setText(LABEL_SECTION_COMMENTS);
- section.setExpanded(true);
- section.setLayout(new GridLayout());
- section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- section.addExpansionListener(new IExpansionListener() {
- public void expansionStateChanging(ExpansionEvent e) {
- form.reflow(true);
- }
-
- public void expansionStateChanged(ExpansionEvent e) {
- form.reflow(true);
- }
- });
-
- ImageHyperlink hyperlink = toolkit.createImageHyperlink(section, SWT.NONE);
- hyperlink.setBackgroundMode(SWT.INHERIT_NONE);
- hyperlink.setBackground(section.getTitleBarBackground());
- hyperlink.setImage(TaskListImages.getImage(TaskListImages.EXPAND_ALL));
- hyperlink.addHyperlinkListener(new HyperlinkAdapter() {
- public void linkActivated(HyperlinkEvent e) {
- revealAllComments();
- }
- });
-
- section.setTextClient(hyperlink);
-
- // Additional (read-only) Comments Area
- Composite addCommentsComposite = toolkit.createComposite(section);
- section.setClient(addCommentsComposite);
- GridLayout addCommentsLayout = new GridLayout();
- addCommentsLayout.numColumns = 1;
- addCommentsComposite.setLayout(addCommentsLayout);
- // addCommentsComposite.setBackground(background);
- GridDataFactory.fillDefaults().grab(true, false).applyTo(addCommentsComposite);
- // End Additional (read-only) Comments Area
-
- StyledText styledText = null;
- for (Iterator<Comment> it = taskData.getComments().iterator(); it.hasNext();) {
- final Comment comment = it.next();
-
- // skip comment 0 as it is the description
- if (comment.getNumber() == 0)
- continue;
-
- ExpandableComposite expandableComposite = toolkit.createExpandableComposite(addCommentsComposite,
- ExpandableComposite.TREE_NODE);
-
- if (!it.hasNext()) {
- expandableComposite.setExpanded(true);
- }
-
- expandableComposite.setText(comment.getNumber() + ": " + comment.getAuthorName() + ", "
- + simpleDateFormat.format(comment.getCreated()));
-
- expandableComposite.addExpansionListener(new ExpansionAdapter() {
- public void expansionStateChanged(ExpansionEvent e) {
- form.reflow(true);
- }
- });
-
- expandableComposite.setLayout(new GridLayout());
- expandableComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- Composite ecComposite = toolkit.createComposite(expandableComposite);
- GridLayout ecLayout = new GridLayout();
- ecLayout.marginHeight = 0;
- ecLayout.marginBottom = 10;
- ecLayout.marginLeft = 10;
- ecComposite.setLayout(ecLayout);
- ecComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- expandableComposite.setClient(ecComposite);
- // toolkit.paintBordersFor(expandableComposite);
-
- // TODO: Attachments are no longer 'attached' to Comments
-
- // if (comment.hasAttachment()) {
- //
- // Link attachmentLink = new Link(ecComposite, SWT.NONE);
- //
- // String attachmentHeader;
- //
- // if (!comment.isObsolete()) {
- // attachmentHeader = " Attached: " +
- // comment.getAttachmentDescription() + " [<a>view</a>]";
- // } else {
- // attachmentHeader = " Deprecated: " +
- // comment.getAttachmentDescription();
- // }
- // // String result = MessageFormat.format(attachmentHeader, new
- // // String[] { node
- // // .getLabelText() });
- //
- // attachmentLink.addSelectionListener(new SelectionAdapter() {
- // /*
- // * (non-Javadoc)
- // *
- // * @see
- // org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
- // */
- // public void widgetSelected(SelectionEvent e) {
- // String address = repository.getUrl() + "/attachment.cgi?id=" +
- // comment.getAttachmentId()
- // + "&amp;action=view";
- // TaskUiUtil.openUrl(address, address, address);
- //
- // }
- // });
- //
- // attachmentLink.setText(attachmentHeader);
- //
- // }
-
- // styledText = newLayout(ecComposite, 1, comment.getText(), VALUE);
- // styledText.addListener(SWT.FocusIn, new
- // CommentListener(comment));
- // styledText.setFont(COMMENT_FONT);
- // System.err.println(comment.getNumber()+" "+comment.getText());
- TextViewer viewer = addRepositoryText(repository, ecComposite, comment.getText());
- styledText = viewer.getTextWidget();
- GridDataFactory.fillDefaults().hint(DESCRIPTION_WIDTH, SWT.DEFAULT).applyTo(styledText);
-
- // line wrapping
- // GridData styledTextData = new GridData(GridData.FILL_HORIZONTAL);
- // styledTextData.widthHint = DESCRIPTION_WIDTH;
- // styledTextData.grabExcessHorizontalSpace = true;
- // styledText.setLayoutData(styledTextData);
-
- // TextViewer viewer = addRepositoryText(repository, form.getBody(),
- // bug.getDescription());// form.getBody()
- // final StyledText styledText = viewer.getTextWidget();
- // styledText.addListener(SWT.FocusIn, new DescriptionListener());
- // styledText.setLayout(new GridLayout());
- // GridData styledTextData = new GridData(GridData.FILL_HORIZONTAL);
- // styledTextData.widthHint = DESCRIPTION_WIDTH;
- // styledTextData.grabExcessHorizontalSpace = true;
-
- // code for outline
- commentStyleText.add(styledText);
- texts.add(textsindex, styledText);
- textHash.put(comment, styledText);
- textsindex++;
- }
-
- Section sectionAdditionalComments = toolkit.createSection(form.getBody(), ExpandableComposite.TITLE_BAR
- | Section.TWISTIE);
- sectionAdditionalComments.setText(LABEL_SECTION_NEW_COMMENT);
- sectionAdditionalComments.setExpanded(true);
-
- sectionAdditionalComments.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- sectionAdditionalComments.addExpansionListener(new IExpansionListener() {
- public void expansionStateChanging(ExpansionEvent e) {
- form.reflow(true);
- }
-
- public void expansionStateChanged(ExpansionEvent e) {
- form.reflow(true);
- }
- });
-
- Composite newCommentsComposite = toolkit.createComposite(sectionAdditionalComments);
- newCommentsComposite.setLayout(new GridLayout());
- newCommentsComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- addCommentsText = toolkit.createText(newCommentsComposite, taskData.getNewComment(), SWT.MULTI | SWT.V_SCROLL
- | SWT.WRAP);
-
- IThemeManager themeManager = getSite().getWorkbenchWindow().getWorkbench().getThemeManager();
- Font newCommnetFont = themeManager.getCurrentTheme().getFontRegistry().get(REPOSITORY_TEXT_ID);
- addCommentsText.setFont(newCommnetFont);
- toolkit.paintBordersFor(newCommentsComposite);
- GridData addCommentsTextData = new GridData(GridData.FILL_HORIZONTAL);
- addCommentsTextData.widthHint = DESCRIPTION_WIDTH;
- addCommentsTextData.heightHint = DESCRIPTION_HEIGHT;
- addCommentsTextData.grabExcessHorizontalSpace = true;
-
- addCommentsText.setLayoutData(addCommentsTextData);
-
- addCommentsText.addListener(SWT.KeyUp, new Listener() {
-
- public void handleEvent(Event event) {
- String sel = addCommentsText.getText();
- if (!(taskData.getNewComment().equals(sel))) {
- taskData.setNewComment(sel);
- changeDirtyStatus(true);
- }
- validateInput();
- }
- });
- addCommentsText.addListener(SWT.FocusIn, new NewCommentListener());
- addCommentsTextBox = addCommentsText;
-
- sectionAdditionalComments.setClient(newCommentsComposite);
-
- // if they aren't already on the cc list create an add self check box
-
- RepositoryTaskAttribute owner = taskData.getAttribute(BugzillaReportElement.ASSIGNED_TO.getKeyString());
-
- // Don't add addselfcc check box if the user is the bug owner
- if (owner != null && owner.getValue().indexOf(repository.getUserName()) != -1) {
- return;
- }
- // Don't add addselfcc if already there
- RepositoryTaskAttribute ccAttribute = taskData.getAttribute(BugzillaReportElement.CC.getKeyString());
- if (ccAttribute != null && ccAttribute.getValues().contains(repository.getUserName())) {
- return;
- }
- RepositoryTaskAttribute addselfcc = taskData.getAttribute(BugzillaReportElement.ADDSELFCC.getKeyString());
- if (addselfcc == null) {
- // addselfcc =
- // BugzillaRepositoryUtil.makeNewAttribute(BugzillaReportElement.ADDSELFCC);
- taskData.setAttributeValue(BugzillaReportElement.ADDSELFCC.getKeyString(), "0");
- } else {
- addselfcc.setValue("0");
- }
-
- final Button addSelfButton = toolkit.createButton(newCommentsComposite, "Add " + repository.getUserName()
- + " to CC list", SWT.CHECK);
-
- addSelfButton.addSelectionListener(new SelectionAdapter() {
+ // /**
+ // * http://www.eclipse.org and http://www.eclipse.org/mylar and a
+ // */
+ // @Override
+ // protected void createCommentLayout(FormToolkit toolkit, final
+ // ScrolledForm form) {
+ //
+ // Section section = toolkit.createSection(form.getBody(),
+ // ExpandableComposite.TITLE_BAR | Section.TWISTIE);
+ // section.setText(LABEL_SECTION_COMMENTS);
+ // section.setExpanded(true);
+ // section.setLayout(new GridLayout());
+ // section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ // section.addExpansionListener(new IExpansionListener() {
+ // public void expansionStateChanging(ExpansionEvent e) {
+ // form.reflow(true);
+ // }
+ //
+ // public void expansionStateChanged(ExpansionEvent e) {
+ // form.reflow(true);
+ // }
+ // });
+ //
+ // ImageHyperlink hyperlink = toolkit.createImageHyperlink(section,
+ // SWT.NONE);
+ // hyperlink.setBackgroundMode(SWT.INHERIT_NONE);
+ // hyperlink.setBackground(section.getTitleBarBackground());
+ // hyperlink.setImage(TaskListImages.getImage(TaskListImages.EXPAND_ALL));
+ // hyperlink.addHyperlinkListener(new HyperlinkAdapter() {
+ // public void linkActivated(HyperlinkEvent e) {
+ // revealAllComments();
+ // }
+ // });
+ //
+ // section.setTextClient(hyperlink);
+ //
+ // // Additional (read-only) Comments Area
+ // Composite addCommentsComposite = toolkit.createComposite(section);
+ // section.setClient(addCommentsComposite);
+ // GridLayout addCommentsLayout = new GridLayout();
+ // addCommentsLayout.numColumns = 1;
+ // addCommentsComposite.setLayout(addCommentsLayout);
+ // // addCommentsComposite.setBackground(background);
+ // GridDataFactory.fillDefaults().grab(true,
+ // false).applyTo(addCommentsComposite);
+ // // End Additional (read-only) Comments Area
+ //
+ // StyledText styledText = null;
+ // for (Iterator<Comment> it = taskData.getComments().iterator();
+ // it.hasNext();) {
+ // final Comment comment = it.next();
+ //
+ // // skip comment 0 as it is the description
+ // if (comment.getNumber() == 0)
+ // continue;
+ //
+ // ExpandableComposite expandableComposite =
+ // toolkit.createExpandableComposite(addCommentsComposite,
+ // ExpandableComposite.TREE_NODE);
+ //
+ // if (!it.hasNext()) {
+ // expandableComposite.setExpanded(true);
+ // }
+ //
+ // expandableComposite.setText(comment.getNumber() + ": " +
+ // comment.getAuthorName() + ", "
+ // + simpleDateFormat.format(comment.getCreated()));
+ //
+ // expandableComposite.addExpansionListener(new ExpansionAdapter() {
+ // public void expansionStateChanged(ExpansionEvent e) {
+ // form.reflow(true);
+ // }
+ // });
+ //
+ // expandableComposite.setLayout(new GridLayout());
+ // expandableComposite.setLayoutData(new
+ // GridData(GridData.FILL_HORIZONTAL));
+ //
+ // Composite ecComposite = toolkit.createComposite(expandableComposite);
+ // GridLayout ecLayout = new GridLayout();
+ // ecLayout.marginHeight = 0;
+ // ecLayout.marginBottom = 10;
+ // ecLayout.marginLeft = 10;
+ // ecComposite.setLayout(ecLayout);
+ // ecComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ // expandableComposite.setClient(ecComposite);
+ // // toolkit.paintBordersFor(expandableComposite);
+ //
+ // // TODO: Attachments are no longer 'attached' to Comments
+ //
+ // // if (comment.hasAttachment()) {
+ // //
+ // // Link attachmentLink = new Link(ecComposite, SWT.NONE);
+ // //
+ // // String attachmentHeader;
+ // //
+ // // if (!comment.isObsolete()) {
+ // // attachmentHeader = " Attached: " +
+ // // comment.getAttachmentDescription() + " [<a>view</a>]";
+ // // } else {
+ // // attachmentHeader = " Deprecated: " +
+ // // comment.getAttachmentDescription();
+ // // }
+ // // // String result = MessageFormat.format(attachmentHeader, new
+ // // // String[] { node
+ // // // .getLabelText() });
+ // //
+ // // attachmentLink.addSelectionListener(new SelectionAdapter() {
+ // // /*
+ // // * (non-Javadoc)
+ // // *
+ // // * @see
+ // //
+ // org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ // // */
+ // // public void widgetSelected(SelectionEvent e) {
+ // // String address = repository.getUrl() + "/attachment.cgi?id=" +
+ // // comment.getAttachmentId()
+ // // + "&amp;action=view";
+ // // TaskUiUtil.openUrl(address, address, address);
+ // //
+ // // }
+ // // });
+ // //
+ // // attachmentLink.setText(attachmentHeader);
+ // //
+ // // }
+ //
+ // // styledText = newLayout(ecComposite, 1, comment.getText(), VALUE);
+ // // styledText.addListener(SWT.FocusIn, new
+ // // CommentListener(comment));
+ // // styledText.setFont(COMMENT_FONT);
+ // // System.err.println(comment.getNumber()+" "+comment.getText());
+ // TextViewer viewer = addRepositoryText(repository, ecComposite,
+ // comment.getText());
+ // styledText = viewer.getTextWidget();
+ // GridDataFactory.fillDefaults().hint(DESCRIPTION_WIDTH,
+ // SWT.DEFAULT).applyTo(styledText);
+ //
+ // // line wrapping
+ // // GridData styledTextData = new GridData(GridData.FILL_HORIZONTAL);
+ // // styledTextData.widthHint = DESCRIPTION_WIDTH;
+ // // styledTextData.grabExcessHorizontalSpace = true;
+ // // styledText.setLayoutData(styledTextData);
+ //
+ // // TextViewer viewer = addRepositoryText(repository, form.getBody(),
+ // // bug.getDescription());// form.getBody()
+ // // final StyledText styledText = viewer.getTextWidget();
+ // // styledText.addListener(SWT.FocusIn, new DescriptionListener());
+ // // styledText.setLayout(new GridLayout());
+ // // GridData styledTextData = new GridData(GridData.FILL_HORIZONTAL);
+ // // styledTextData.widthHint = DESCRIPTION_WIDTH;
+ // // styledTextData.grabExcessHorizontalSpace = true;
+ //
+ // // code for outline
+ // commentStyleText.add(styledText);
+ // texts.add(textsindex, styledText);
+ // textHash.put(comment, styledText);
+ // textsindex++;
+ // }
+ //
+ // Section sectionAdditionalComments = toolkit.createSection(form.getBody(),
+ // ExpandableComposite.TITLE_BAR
+ // | Section.TWISTIE);
+ // sectionAdditionalComments.setText(LABEL_SECTION_NEW_COMMENT);
+ // sectionAdditionalComments.setExpanded(true);
+ //
+ // sectionAdditionalComments.setLayoutData(new
+ // GridData(GridData.FILL_HORIZONTAL));
+ // sectionAdditionalComments.addExpansionListener(new IExpansionListener() {
+ // public void expansionStateChanging(ExpansionEvent e) {
+ // form.reflow(true);
+ // }
+ //
+ // public void expansionStateChanged(ExpansionEvent e) {
+ // form.reflow(true);
+ // }
+ // });
+ //
+ // Composite newCommentsComposite =
+ // toolkit.createComposite(sectionAdditionalComments);
+ // newCommentsComposite.setLayout(new GridLayout());
+ // newCommentsComposite.setLayoutData(new
+ // GridData(GridData.FILL_HORIZONTAL));
+ // addCommentsText = toolkit.createText(newCommentsComposite,
+ // taskData.getNewComment(), SWT.MULTI | SWT.V_SCROLL
+ // | SWT.WRAP);
+ //
+ // IThemeManager themeManager =
+ // getSite().getWorkbenchWindow().getWorkbench().getThemeManager();
+ // Font newCommnetFont =
+ // themeManager.getCurrentTheme().getFontRegistry().get(REPOSITORY_TEXT_ID);
+ // addCommentsText.setFont(newCommnetFont);
+ // toolkit.paintBordersFor(newCommentsComposite);
+ // GridData addCommentsTextData = new GridData(GridData.FILL_HORIZONTAL);
+ // addCommentsTextData.widthHint = DESCRIPTION_WIDTH;
+ // addCommentsTextData.heightHint = DESCRIPTION_HEIGHT;
+ // addCommentsTextData.grabExcessHorizontalSpace = true;
+ //
+ // addCommentsText.setLayoutData(addCommentsTextData);
+ //
+ // addCommentsText.addListener(SWT.KeyUp, new Listener() {
+ //
+ // public void handleEvent(Event event) {
+ // String sel = addCommentsText.getText();
+ // if (!(taskData.getNewComment().equals(sel))) {
+ // taskData.setNewComment(sel);
+ // changeDirtyStatus(true);
+ // }
+ // validateInput();
+ // }
+ // });
+ // addCommentsText.addListener(SWT.FocusIn, new NewCommentListener());
+ // addCommentsTextBox = addCommentsText;
+ //
+ // sectionAdditionalComments.setClient(newCommentsComposite);
+ //
+ // // if they aren't already on the cc list create an add self check box
+ //
+ // RepositoryTaskAttribute owner =
+ // taskData.getAttribute(BugzillaReportElement.ASSIGNED_TO.getKeyString());
+ //
+ // // Don't add addselfcc check box if the user is the bug owner
+ // if (owner != null && owner.getValue().indexOf(repository.getUserName())
+ // != -1) {
+ // return;
+ // }
+ // // Don't add addselfcc if already there
+ // RepositoryTaskAttribute ccAttribute =
+ // taskData.getAttribute(BugzillaReportElement.CC.getKeyString());
+ // if (ccAttribute != null &&
+ // ccAttribute.getValues().contains(repository.getUserName())) {
+ // return;
+ // }
+ // RepositoryTaskAttribute addselfcc =
+ // taskData.getAttribute(BugzillaReportElement.ADDSELFCC.getKeyString());
+ // if (addselfcc == null) {
+ // // addselfcc =
+ // //
+ // BugzillaRepositoryUtil.makeNewAttribute(BugzillaReportElement.ADDSELFCC);
+ // taskData.setAttributeValue(BugzillaReportElement.ADDSELFCC.getKeyString(),
+ // "0");
+ // } else {
+ // addselfcc.setValue("0");
+ // }
+ //
+ // final Button addSelfButton = toolkit.createButton(newCommentsComposite,
+ // "Add " + repository.getUserName()
+ // + " to CC list", SWT.CHECK);
+ //
+ // addSelfButton.addSelectionListener(new SelectionAdapter() {
+ //
+ // @Override
+ // public void widgetSelected(SelectionEvent e) {
+ // if (addSelfButton.getSelection()) {
+ // taskData.setAttributeValue(BugzillaReportElement.ADDSELFCC.getKeyString(),
+ // "1");
+ // // connector.getAttributeFactory().setAttributeValue(taskData,
+ // // BugzillaReportElement.ADDSELFCC.getKeyString(), "1");
+ // } else {
+ // taskData.setAttributeValue(BugzillaReportElement.ADDSELFCC.getKeyString(),
+ // "0");
+ // }
+ // }
+ // });
+ // }
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (addSelfButton.getSelection()) {
- taskData.setAttributeValue(BugzillaReportElement.ADDSELFCC.getKeyString(), "1");
- // connector.getAttributeFactory().setAttributeValue(taskData,
- // BugzillaReportElement.ADDSELFCC.getKeyString(), "1");
- } else {
- taskData.setAttributeValue(BugzillaReportElement.ADDSELFCC.getKeyString(), "0");
- }
- }
- });
- }
- @Override
protected void addKeywordsList(FormToolkit toolkit, String keywords, Composite attributesComposite)
throws IOException {
// newLayout(attributesComposite, 1, "Keywords:", PROPERTY);
@@ -776,7 +830,7 @@ public class ExistingBugEditor extends AbstractBugEditor {
keyWordsList.addListener(SWT.FocusIn, new GenericListener());
}
- @Override
+
protected void addCCList(FormToolkit toolkit, String ccValue, Composite attributesComposite) {
newLayout(attributesComposite, 1, "Add CC:", PROPERTY);
ccText = toolkit.createText(attributesComposite, ccValue);
@@ -865,23 +919,23 @@ public class ExistingBugEditor extends AbstractBugEditor {
}
- @Override
- protected void restoreBug() {
-
- if (taskData == null)
- return;
-
- // go through all of the attributes and restore the new values to the
- // main ones
- // for (Iterator<RepositoryTaskAttribute> it =
- // bug.getAttributes().iterator(); it.hasNext();) {
- // RepositoryTaskAttribute a = it.next();
- // a.setNewValue(a.getValue());
- // }
-
- // Restore some other fields as well.
- // bug.setNewNewComment(bug.getNewComment());
- }
+ // @Override
+ // protected void restoreBug() {
+ //
+ // if (taskData == null)
+ // return;
+ //
+ // // go through all of the attributes and restore the new values to the
+ // // main ones
+ // // for (Iterator<RepositoryTaskAttribute> it =
+ // // bug.getAttributes().iterator(); it.hasNext();) {
+ // // RepositoryTaskAttribute a = it.next();
+ // // a.setNewValue(a.getValue());
+ // // }
+ //
+ // // Restore some other fields as well.
+ // // bug.setNewNewComment(bug.getNewComment());
+ // }
/**
* This job opens a compare editor to compare the current state of the bug
@@ -900,7 +954,7 @@ public class ExistingBugEditor extends AbstractBugEditor {
TaskRepository repository = MylarTaskListPlugin.getRepositoryManager().getRepository(
BugzillaPlugin.REPOSITORY_KIND, taskData.getRepositoryUrl());
serverBug = BugzillaRepositoryUtil.getBug(repository.getUrl(), repository.getUserName(), repository
- .getPassword(), bugzillaInput.getProxySettings(), repository.getCharacterEncoding(), taskData
+ .getPassword(), editorInput.getProxySettings(), repository.getCharacterEncoding(), taskData
.getId());
// If no bug was found on the server, throw an exception so that
// the
@@ -951,7 +1005,8 @@ public class ExistingBugEditor extends AbstractBugEditor {
if (keyWordsList.getSelectionCount() == 1) {
int index = keyWordsList.getSelectionIndex();
String keyword = keyWordsList.getItem(index);
- if (getReport().getAttributeValue(BugzillaReportElement.KEYWORDS.getKeyString()).equals(keyword))
+ if (getRepositoryTaskData().getAttributeValue(BugzillaReportElement.KEYWORDS.getKeyString()).equals(
+ keyword))
keyWordsList.deselectAll();
}
@@ -983,7 +1038,7 @@ public class ExistingBugEditor extends AbstractBugEditor {
protected class DescriptionListener implements Listener {
public void handleEvent(Event event) {
fireSelectionChanged(new SelectionChangedEvent(selectionProvider, new StructuredSelection(
- new BugzillaReportSelection(taskData.getId(), taskData.getRepositoryUrl(),
+ new RepositoryTaskSelection(taskData.getId(), taskData.getRepositoryUrl(),
LABEL_SECTION_DESCRIPTION, true, taskData.getSummary()))));
}
}
@@ -1008,24 +1063,12 @@ public class ExistingBugEditor extends AbstractBugEditor {
public void handleEvent(Event event) {
fireSelectionChanged(new SelectionChangedEvent(selectionProvider, new StructuredSelection(
- new BugzillaReportSelection(taskData.getId(), taskData.getRepositoryUrl(), comment.getCreated()
+ new RepositoryTaskSelection(taskData.getId(), taskData.getRepositoryUrl(), comment.getCreated()
.toString(), comment, taskData.getSummary()))));
}
}
/**
- * A listener for selection of the textbox where a new comment is entered
- * in.
- */
- protected class NewCommentListener implements Listener {
- public void handleEvent(Event event) {
- fireSelectionChanged(new SelectionChangedEvent(selectionProvider, new StructuredSelection(
- new BugzillaReportSelection(taskData.getId(), taskData.getRepositoryUrl(), "New Comment", false,
- taskData.getSummary()))));
- }
- }
-
- /**
* Class to handle the selection change of the radio buttons.
*/
protected class RadioButtonListener implements SelectionListener, ModifyListener {
@@ -1106,7 +1149,7 @@ public class ExistingBugEditor extends AbstractBugEditor {
}
}
- private void validateInput() {
+ protected void validateInput() {
RepositoryOperation o = taskData.getSelectedOperation();
if (o != null && o.getKnobName().compareTo("resolve") == 0
&& (addCommentsText.getText() == null || addCommentsText.getText().equals(""))) {
@@ -1118,16 +1161,66 @@ public class ExistingBugEditor extends AbstractBugEditor {
}
}
+ /**
+ * Adds a text field to display and edit the bug's URL attribute.
+ *
+ * @param url
+ * The URL attribute of the bug.
+ * @param attributesComposite
+ * The composite to add the text field to.
+ */
+ protected void addUrlText(String url, Composite attributesComposite) {
+ FormToolkit toolkit = new FormToolkit(attributesComposite.getDisplay());
+ toolkit.createLabel(attributesComposite, "URL:");
+ urlText = toolkit.createText(attributesComposite, url);
+ urlText.setFont(TEXT_FONT);
+ GridData urlTextData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+ urlTextData.horizontalSpan = 3;
+ urlTextData.widthHint = 200;
+ urlText.setLayoutData(urlTextData);
+ // urlText.setText(url);
+ urlText.addListener(SWT.KeyUp, new Listener() {
+ public void handleEvent(Event event) {
+ String sel = urlText.getText();
+ RepositoryTaskAttribute a = getRepositoryTaskData().getAttribute(
+ BugzillaReportElement.BUG_FILE_LOC.getKeyString());
+ if (!(a.getValue().equals(sel))) {
+ a.setValue(sel);
+ changeDirtyStatus(true);
+ }
+ }
+ });
+ urlText.addListener(SWT.FocusIn, new GenericListener());
+ }
+
@Override
- public void handleSummaryEvent() {
- String sel = summaryText.getText();
- RepositoryTaskAttribute a = getReport().getAttribute(BugzillaReportElement.SHORT_DESC.getKeyString());
- if (!(a.getValue().equals(sel))) {
- a.setValue(sel);
- changeDirtyStatus(true);
- }
+ public void createCustomAttributeLayout() {
+ // ignore
+
+ }
+
+ @Override
+ public RepositoryTaskData getRepositoryTaskData() {
+ return editorInput.getRepositoryTaskData();
}
+ // @Override
+ // public AbstractRepositoryTask getRepositoryTask() {
+ // // ignore
+ // return null;
+ // }
+
+ // @Override
+ // public void handleSummaryEvent() {
+ // String sel = summaryText.getText();
+ // RepositoryTaskAttribute a =
+ // getReport().getAttribute(BugzillaReportElement.SHORT_DESC.getKeyString());
+ // if (!(a.getValue().equals(sel))) {
+ // a.setValue(sel);
+ // changeDirtyStatus(true);
+ // }
+ // }
+
// TODO used for spell checking. Add back when we want to support this
// protected Button checkSpellingButton;
//
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/ExistingBugEditorInput.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/ExistingBugEditorInput.java
deleted file mode 100644
index 84f1ab266..000000000
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/ExistingBugEditorInput.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003 - 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.editor;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.net.Proxy;
-import java.security.GeneralSecurityException;
-
-import javax.security.auth.login.LoginException;
-
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.mylar.internal.bugzilla.core.BugzillaRepositoryUtil;
-import org.eclipse.mylar.internal.bugzilla.core.AbstractReportFactory.UnrecognizedBugzillaError;
-import org.eclipse.mylar.internal.bugzilla.ui.WebBrowserDialog;
-import org.eclipse.mylar.internal.tasklist.OfflineTaskManager;
-import org.eclipse.mylar.internal.tasklist.RepositoryTaskData;
-import org.eclipse.mylar.internal.tasklist.ui.views.TaskRepositoriesView;
-import org.eclipse.mylar.provisional.tasklist.MylarTaskListPlugin;
-import org.eclipse.mylar.provisional.tasklist.TaskRepository;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * The <code>IEditorInput</code> implementation for
- * <code>ExistingBugEditor</code>.
- *
- * @author Mik Kersten (some hardening of initial prototype)
- */
-public class ExistingBugEditorInput extends AbstractBugEditorInput {
-
- private TaskRepository repository;
-
- protected int bugId;
-
- protected RepositoryTaskData bug;
-
- public ExistingBugEditorInput(TaskRepository repository, RepositoryTaskData bug) {
- this.bug = bug;
- this.bugId = bug.getId();
- this.repository = repository;
- }
-
- /**
- * Creates a new <code>ExistingBugEditorInput</code>. An exception is
- * thrown if the bug could not be obtained from the server.
- *
- * @param bugId
- * The id of the bug for this editor input.
- * @throws IOException
- * @throws GeneralSecurityException
- */
- public ExistingBugEditorInput(TaskRepository repository, int bugId) throws IOException, GeneralSecurityException {
- this.bugId = bugId;
- this.repository = repository;
- // get the bug from the server if it exists
- bug = BugzillaRepositoryUtil.getBug(repository.getUrl(), repository.getUserName(), repository.getPassword(), proxySettings, repository.getCharacterEncoding(), bugId);
-// repository = MylarTaskListPlugin.getRepositoryManager().getRepository(BugzillaPlugin.REPOSITORY_KIND,
-// repositoryUrl);
- }
-
- public ExistingBugEditorInput(TaskRepository repository, int bugId, boolean offline) throws IOException, GeneralSecurityException {
- this.bugId = bugId;
- this.repository = repository;
- if (!offline) {
- try {
- bug = BugzillaRepositoryUtil.getBug(repository.getUrl(), repository.getUserName(), repository.getPassword(), proxySettings, repository.getCharacterEncoding(), bugId);
- } catch (IOException e) {
- bug = getCurrentBug(repository, proxySettings, bugId);
- // IWorkbench workbench = PlatformUI.getWorkbench();
- // workbench.getDisplay().asyncExec(new Runnable() {
- // public void run() {
- // MessageDialog.openInformation(
- // Display.getDefault().getActiveShell(),
- // "Mylar Bugzilla Client",
- // "Unable to download bug report, using offline copy.");
- //
- // }
- // });
- }
- } else {
- bug = getCurrentBug(repository, proxySettings, bugId);
- }
- }
-
- // TODO: move?
- private RepositoryTaskData getCurrentBug(final TaskRepository repository, Proxy proxySettings, final int id)
- throws IOException, GeneralSecurityException {
- RepositoryTaskData result = null;
- // Look among the offline reports for a bug with the given id.
- OfflineTaskManager reportsFile = MylarTaskListPlugin.getDefault().getOfflineReportsFile();
- if (reportsFile != null) {
- int offlineId = reportsFile.find(repository.getUrl(), id);
- // If an offline bug was found, return it if possible.
- if (offlineId != -1) {
- RepositoryTaskData bug = reportsFile.elements().get(offlineId);
- if (bug instanceof RepositoryTaskData) {
- result = (RepositoryTaskData) bug;
- }
- }
- }
- // TODO: Use downloadTaskData on repositoryConnector?
- // If a suitable offline report was not found, get it from the server
- if(result == null) {
- try {
- result = BugzillaRepositoryUtil.getBug(repository.getUrl(), repository.getUserName(), repository.getPassword(), proxySettings, repository.getCharacterEncoding(), id);
- } catch (final LoginException e) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- MessageDialog.openError(Display.getDefault().getActiveShell(), "Report Download Failed",
- "Ensure proper repository configuration of " + repository.getUrl() + " in "
- + TaskRepositoriesView.NAME + ".");
- }
- });
- } catch (final UnrecognizedBugzillaError e) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- WebBrowserDialog.openAcceptAgreement(null, "Report Download Failed", "Unrecognized response from "
- + repository.getUrl(), e.getMessage());
- }
- });
- } catch (final Exception e) {
- if (PlatformUI.getWorkbench() != null && !PlatformUI.getWorkbench().isClosing()) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (e instanceof FileNotFoundException) {
- MessageDialog.openError(PlatformUI.getWorkbench().getDisplay().getActiveShell(), "Report Download Failed",
- "Resource not found: " + e.getMessage());
-
- } else {
- MessageDialog.openError(PlatformUI.getWorkbench().getDisplay().getActiveShell(), "Report Download Failed",
- "Report "+id+" did not download correctly from " + repository.getUrl());
-
- }
- }
- });
- }
- }
- }
- return result;
- }
-
- public String getName() {
- return bug.getLabel();
- }
-
- /**
- * @return The id of the bug for this editor input.
- */
- public int getBugId() {
- return bugId;
- }
-
- @Override
- public RepositoryTaskData getBug() {
- return bug;
- }
-
- /**
- * @return <code>true</code> if the argument is a bug report editor input
- * on the same bug id.
- */
- @Override
- public boolean equals(Object o) {
- if (o instanceof ExistingBugEditorInput) {
- ExistingBugEditorInput input = (ExistingBugEditorInput) o;
- return getBugId() == input.getBugId();
- }
- return false;
- }
-
- public TaskRepository getRepository() {
- return repository;
- }
-
-}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/NewBugEditor.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/NewBugEditor.java
index 9c8bfe5f1..256e2e298 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/NewBugEditor.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/NewBugEditor.java
@@ -25,6 +25,9 @@ import org.eclipse.mylar.internal.bugzilla.core.IBugzillaConstants;
import org.eclipse.mylar.internal.bugzilla.core.NewBugzillaReport;
import org.eclipse.mylar.internal.bugzilla.ui.tasklist.BugzillaRepositoryConnector;
import org.eclipse.mylar.internal.tasklist.RepositoryTaskData;
+import org.eclipse.mylar.internal.tasklist.ui.editors.AbstractRepositoryTaskEditor;
+import org.eclipse.mylar.internal.tasklist.ui.editors.RepositoryTaskOutlineNode;
+import org.eclipse.mylar.internal.tasklist.ui.editors.RepositoryTaskSelection;
import org.eclipse.mylar.internal.tasklist.ui.views.TaskRepositoriesView;
import org.eclipse.mylar.provisional.tasklist.MylarTaskListPlugin;
import org.eclipse.mylar.provisional.tasklist.TaskRepository;
@@ -52,7 +55,7 @@ import org.eclipse.ui.themes.IThemeManager;
* An editor used to view a locally created bug that does not yet exist on a
* server. It uses a <code>NewBugModel</code> object to store the data.
*/
-public class NewBugEditor extends AbstractBugEditor {
+public class NewBugEditor extends AbstractRepositoryTaskEditor {
protected NewBugzillaReport bug;
@@ -70,18 +73,18 @@ public class NewBugEditor extends AbstractBugEditor {
}
@Override
- public RepositoryTaskData getBug() {
+ public RepositoryTaskData getRepositoryTaskData() {
return bug;
}
- @Override
- protected void addKeywordsList(FormToolkit toolkit, String keywords, Composite attributesComposite) {
- // Since NewBugModels have no keywords, there is no
- // GUI for them.
- }
+// @Override
+// protected void addKeywordsList(FormToolkit toolkit, String keywords, Composite attributesComposite) {
+// // Since NewBugModels have no keywords, there is no
+// // GUI for them.
+// }
@Override
- protected void createDescriptionLayout(FormToolkit toolkit, final ScrolledForm form) {
+ protected void createCustomAttributeLayout(FormToolkit toolkit, final ScrolledForm form) {
Section section = toolkit.createSection(form.getBody(), ExpandableComposite.TITLE_BAR | Section.TWISTIE);
section.setText(LABEL_SECTION_DESCRIPTION);
@@ -130,7 +133,7 @@ public class NewBugEditor extends AbstractBugEditor {
descriptionText = new Text(descriptionComposite, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.WRAP);
//descriptionText.setFont(COMMENT_FONT);
IThemeManager themeManager = PlatformUI.getWorkbench().getThemeManager();
- Font descriptionFont = themeManager.getCurrentTheme().getFontRegistry().get(AbstractBugEditor.REPOSITORY_TEXT_ID);
+ Font descriptionFont = themeManager.getCurrentTheme().getFontRegistry().get(AbstractRepositoryTaskEditor.REPOSITORY_TEXT_ID);
descriptionText.setFont(descriptionFont);
GridData descriptionTextData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
descriptionTextData.horizontalSpan = 4;
@@ -235,17 +238,16 @@ public class NewBugEditor extends AbstractBugEditor {
bug.setDescription(newDescription);
}
- @Override
- protected void restoreBug() {
+// @Override
+// protected void restoreBug() {
// go through all of the attributes and restore the new values to the
// main ones
// for (Iterator<AbstractRepositoryTaskAttribute> it = bug.getAttributes().iterator(); it.hasNext();) {
// AbstractRepositoryTaskAttribute a = it.next();
// a.setNewValue(a.getValue());
// }
- }
+// }
- @SuppressWarnings("deprecation")
@Override
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
if (!(input instanceof NewBugEditorInput))
@@ -253,12 +255,12 @@ public class NewBugEditor extends AbstractBugEditor {
NewBugEditorInput ei = (NewBugEditorInput) input;
setSite(site);
setInput(input);
- bugzillaInput = ei;
- bugzillaOutlineModel = BugzillaOutlineNode.parseBugReport(bugzillaInput.getBug());
- bug = ei.getBug();
+ editorInput = ei;
+ bugzillaOutlineModel = RepositoryTaskOutlineNode.parseBugReport(editorInput.getRepositoryTaskData());
+ bug = ei.getRepositoryTaskData();
newSummary = bug.getSummary();
newDescription = bug.getDescription();
- restoreBug();
+ //restoreBug();
isDirty = false;
updateEditorTitle();
}
@@ -269,7 +271,7 @@ public class NewBugEditor extends AbstractBugEditor {
protected class DescriptionListener implements Listener {
public void handleEvent(Event event) {
fireSelectionChanged(new SelectionChangedEvent(selectionProvider, new StructuredSelection(
- new BugzillaReportSelection(bug.getId(), bug.getRepositoryUrl(), "New Description", false, bug
+ new RepositoryTaskSelection(bug.getId(), bug.getRepositoryUrl(), "New Description", false, bug
.getSummary()))));
}
}
@@ -283,9 +285,21 @@ public class NewBugEditor extends AbstractBugEditor {
}
}
+// @Override
+// protected void addCCList(FormToolkit toolkit, String value, Composite attributesComposite) {
+// // do nothing here right now
+// }
+
@Override
- protected void addCCList(FormToolkit toolkit, String value, Composite attributesComposite) {
- // do nothing here right now
+ public void createCustomAttributeLayout() {
+ // ignore
+
+ }
+
+ @Override
+ protected void validateInput() {
+ // ignore
+
}
}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/NewBugEditorInput.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/NewBugEditorInput.java
index caef37e84..725760732 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/NewBugEditorInput.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/NewBugEditorInput.java
@@ -12,6 +12,8 @@
package org.eclipse.mylar.internal.bugzilla.ui.editor;
import org.eclipse.mylar.internal.bugzilla.core.NewBugzillaReport;
+import org.eclipse.mylar.internal.tasklist.ui.editors.AbstractBugEditorInput;
+import org.eclipse.mylar.provisional.tasklist.TaskRepository;
/**
* The <code>IEditorInput</code> implementation for <code>NewBugEditor</code>.
@@ -35,7 +37,7 @@ public class NewBugEditorInput extends AbstractBugEditorInput {
}
@Override
- public NewBugzillaReport getBug() {
+ public NewBugzillaReport getRepositoryTaskData() {
return bug;
}
@@ -43,9 +45,15 @@ public class NewBugEditorInput extends AbstractBugEditorInput {
public boolean equals(Object o) {
if (o instanceof NewBugEditorInput) {
NewBugEditorInput input = (NewBugEditorInput) o;
- return input.getBug().equals(bug);
+ return input.getRepositoryTaskData().equals(bug);
}
return false;
}
+ @Override
+ public TaskRepository getRepository() {
+ // ignore
+ return null;
+ }
+
}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaReportEditorFactory.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaReportEditorFactory.java
index 5253966e3..3147fa3e3 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaReportEditorFactory.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaReportEditorFactory.java
@@ -53,7 +53,7 @@ public class BugzillaReportEditorFactory implements ITaskEditorFactory {
BugzillaPlugin.REPOSITORY_KIND, bugzillaTask.getRepositoryUrl());
try {
BugzillaTaskEditorInput input = new BugzillaTaskEditorInput(repository, bugzillaTask, true);
- input.setOfflineBug(bugzillaTask.getTaskData());
+ //input.setOfflineBug(bugzillaTask.getTaskData());
return input;
} catch (final LoginException e) {
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositoryConnector.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositoryConnector.java
index efe8ce54c..745de8406 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositoryConnector.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositoryConnector.java
@@ -20,6 +20,7 @@ import java.net.Proxy;
import java.net.URLEncoder;
import java.security.GeneralSecurityException;
import java.util.ArrayList;
+import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@@ -38,7 +39,6 @@ import org.eclipse.core.runtime.jobs.IJobChangeListener;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.window.ApplicationWindow;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.mylar.internal.bugzilla.core.AbstractReportFactory;
@@ -75,8 +75,6 @@ import org.eclipse.mylar.provisional.tasklist.AbstractRepositoryTask;
import org.eclipse.mylar.provisional.tasklist.ITask;
import org.eclipse.mylar.provisional.tasklist.MylarTaskListPlugin;
import org.eclipse.mylar.provisional.tasklist.TaskRepository;
-import org.eclipse.mylar.provisional.tasklist.AbstractRepositoryTask.RepositoryTaskSyncState;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PlatformUI;
@@ -124,26 +122,26 @@ public class BugzillaRepositoryConnector extends AbstractRepositoryConnector {
return BugzillaPlugin.REPOSITORY_KIND;
}
- // TODO: eliminate this method, should only need call to saveOffline(..)
- public void saveBugReport(RepositoryTaskData bugzillaBug) {
- String handle = AbstractRepositoryTask.getHandle(bugzillaBug.getRepositoryUrl(), bugzillaBug.getId());
- ITask task = MylarTaskListPlugin.getTaskListManager().getTaskList().getTask(handle);
- if (task instanceof BugzillaTask) {
- BugzillaTask bugzillaTask = (BugzillaTask) task;
- bugzillaTask.setTaskData(bugzillaBug);
-
- if (bugzillaBug.hasChanges()) {
- bugzillaTask.setSyncState(RepositoryTaskSyncState.OUTGOING);
- } else {
- bugzillaTask.setSyncState(RepositoryTaskSyncState.SYNCHRONIZED);
- }
- }
-
- saveOffline(bugzillaBug, false);
-
- }
-
- public RepositoryTaskData downloadTaskData(final AbstractRepositoryTask bugzillaTask) {
+// // TODO: eliminate this method, should only need call to saveOffline(..)
+// public void saveBugReport(RepositoryTaskData bugzillaBug) {
+// String handle = AbstractRepositoryTask.getHandle(bugzillaBug.getRepositoryUrl(), bugzillaBug.getId());
+// ITask task = MylarTaskListPlugin.getTaskListManager().getTaskList().getTask(handle);
+// if (task instanceof BugzillaTask) {
+// BugzillaTask bugzillaTask = (BugzillaTask) task;
+// bugzillaTask.setTaskData(bugzillaBug);
+//
+// if (bugzillaBug.hasChanges()) {
+// bugzillaTask.setSyncState(RepositoryTaskSyncState.OUTGOING);
+// } else {
+// bugzillaTask.setSyncState(RepositoryTaskSyncState.SYNCHRONIZED);
+// }
+// }
+//
+// saveOffline(bugzillaBug, false);
+//
+// }
+
+ public RepositoryTaskData downloadTaskData(final AbstractRepositoryTask bugzillaTask) throws CoreException {
TaskRepository repository = MylarTaskListPlugin.getRepositoryManager().getRepository(
BugzillaPlugin.REPOSITORY_KIND, bugzillaTask.getRepositoryUrl());
Proxy proxySettings = MylarTaskListPlugin.getDefault().getProxySettings();
@@ -152,39 +150,44 @@ public class BugzillaRepositoryConnector extends AbstractRepositoryConnector {
.getPassword(), proxySettings, repository.getCharacterEncoding(), AbstractRepositoryTask
.getTaskIdAsInt(bugzillaTask.getHandleIdentifier()));
} catch (final LoginException e) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- MessageDialog.openError(Display.getDefault().getActiveShell(), "Report Download Failed",
- "Ensure proper repository configuration of " + bugzillaTask.getRepositoryUrl() + " in "
- + TaskRepositoriesView.NAME + ".");
- }
- });
+ throw new CoreException(new Status(IStatus.ERROR, BugzillaPlugin.PLUGIN_ID, 0, "Report download failed. Ensure proper repository configuration of " + bugzillaTask.getRepositoryUrl() + " in "
+ + TaskRepositoriesView.NAME + ".", e ));
+// PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+// public void run() {
+// MessageDialog.openError(Display.getDefault().getActiveShell(), "Report Download Failed",
+// "Ensure proper repository configuration of " + bugzillaTask.getRepositoryUrl() + " in "
+// + TaskRepositoriesView.NAME + ".");
+// }
+// });
} catch (final UnrecognizedBugzillaError e) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- WebBrowserDialog.openAcceptAgreement(null, "Report Download Failed", "Unrecognized response from "
- + bugzillaTask.getRepositoryUrl(), e.getMessage());
- }
- });
+ throw new CoreException(new Status(IStatus.ERROR, BugzillaPlugin.PLUGIN_ID, 0, "Report download failed. Unrecognized response from " + bugzillaTask.getRepositoryUrl() + ".", e ));
+// PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+// public void run() {
+// WebBrowserDialog.openAcceptAgreement(null, "Report Download Failed", "Unrecognized response from "
+// + bugzillaTask.getRepositoryUrl(), e.getMessage());
+// }
+// });
+ } catch (final FileNotFoundException e) {
+ throw new CoreException(new Status(IStatus.ERROR, BugzillaPlugin.PLUGIN_ID, 0, "Report download from " + bugzillaTask.getRepositoryUrl() + " failed. File not found: "+e.getMessage(), e ));
} catch (final Exception e) {
- if (PlatformUI.getWorkbench() != null && !PlatformUI.getWorkbench().isClosing()) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
-
- if (e instanceof FileNotFoundException) {
- MessageDialog.openError(Display.getDefault().getActiveShell(), "Report Download Failed",
- "Resource not found: " + e.getMessage());
- return;
- }
-
- ((ApplicationWindow) PlatformUI.getWorkbench().getActiveWorkbenchWindow())
- .setStatus("Download of bug: " + bugzillaTask + " from "
- + bugzillaTask.getRepositoryUrl() + " failed due to exception: " + e);
- }
- });
- }
+ throw new CoreException(new Status(IStatus.ERROR, BugzillaPlugin.PLUGIN_ID, 0, "Report download from " + bugzillaTask.getRepositoryUrl() + " failed, please see details.", e ));
+// if (PlatformUI.getWorkbench() != null && !PlatformUI.getWorkbench().isClosing()) {
+// PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+// public void run() {
+//
+// if (e instanceof FileNotFoundException) {
+// MessageDialog.openError(Display.getDefault().getActiveShell(), "Report Download Failed",
+// "Resource not found: " + e.getMessage());
+// return;
+// }
+//
+// ((ApplicationWindow) PlatformUI.getWorkbench().getActiveWorkbenchWindow())
+// .setStatus("Download of bug: " + bugzillaTask + " from "
+// + bugzillaTask.getRepositoryUrl() + " failed due to exception: " + e);
+// }
+// });
+// }
}
- return null;
}
public ITask createTaskFromExistingKey(TaskRepository repository, String id) {
@@ -542,8 +545,14 @@ public class BugzillaRepositoryConnector extends AbstractRepositoryConnector {
+ TaskRepositoriesView.NAME + ".", BugzillaRepositoryConnector.class);
}
- String dateString = DateUtil.getZoneFormattedDate(timeZone, repository.getSyncTime(),
+
+ // XXX: This is a hack to adjust for slow local clock.
+ // Backs query start date up by 5 minutes.
+ Date syncTime = new Date(repository.getSyncTime().getTime() - (60000 * 5));
+
+ String dateString = DateUtil.getZoneFormattedDate(timeZone, syncTime,
CHANGED_BUGS_START_DATE_LONG);
+
String urlQueryBase;
String urlQueryString;
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskEditor.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskEditor.java
index 9d57ea361..be2e2f54e 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskEditor.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskEditor.java
@@ -16,12 +16,12 @@ package org.eclipse.mylar.internal.bugzilla.ui.tasklist;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.mylar.internal.bugzilla.core.IBugzillaAttributeListener;
-import org.eclipse.mylar.internal.bugzilla.ui.editor.AbstractBugEditor;
-import org.eclipse.mylar.internal.bugzilla.ui.editor.BugzillaOutlineNode;
import org.eclipse.mylar.internal.bugzilla.ui.editor.ExistingBugEditor;
import org.eclipse.mylar.internal.tasklist.RepositoryTaskData;
import org.eclipse.mylar.internal.tasklist.ui.TaskListImages;
+import org.eclipse.mylar.internal.tasklist.ui.editors.AbstractRepositoryTaskEditor;
+import org.eclipse.mylar.internal.tasklist.ui.editors.RepositoryTaskOutlineNode;
+import org.eclipse.mylar.internal.tasklist.ui.editors.IRepositoryTaskAttributeListener;
import org.eclipse.mylar.internal.tasklist.ui.editors.MylarTaskEditor;
import org.eclipse.mylar.internal.tasklist.ui.editors.TaskEditorInput;
import org.eclipse.swt.widgets.Composite;
@@ -48,11 +48,11 @@ public class BugzillaTaskEditor extends MylarTaskEditor {
private BugzillaTaskEditorInput bugzillaEditorInput;
-// private BugzillaOutlinePage outlinePage = null;
+// private RepositoryTaskOutlinePage outlinePage = null;
-// protected BugzillaOutlineNode bugzillaOutlineModel = null;
+// protected RepositoryTaskOutlineNode bugzillaOutlineModel = null;
- private IBugzillaAttributeListener ATTRIBUTE_LISTENER = new IBugzillaAttributeListener() {
+ private IRepositoryTaskAttributeListener ATTRIBUTE_LISTENER = new IRepositoryTaskAttributeListener() {
public void attributeChanged(String attribute, String value) {
// TODO: get rid of this?
if (attribute.equals("Priority")) {
@@ -82,7 +82,7 @@ public class BugzillaTaskEditor extends MylarTaskEditor {
// taskSummaryEditor.setParentEditor(this);
}
- public AbstractBugEditor getBugzillaEditor() {
+ public AbstractRepositoryTaskEditor getBugzillaEditor() {
return bugzillaEditor;
}
@@ -139,8 +139,8 @@ public class BugzillaTaskEditor extends MylarTaskEditor {
super.init(site, (IEditorInput) new TaskEditorInput(((BugzillaTaskEditorInput) editorInput).getBugTask(), false));
bugzillaEditorInput = (BugzillaTaskEditorInput) editorInput;
bugTask = bugzillaEditorInput.getBugTask();
- bugzillaEditor.setBugzillaOutlineModel(BugzillaOutlineNode.parseBugReport(bugzillaEditorInput.getBug()));
- offlineBug = bugzillaEditorInput.getOfflineBug();
+ bugzillaEditor.setBugzillaOutlineModel(RepositoryTaskOutlineNode.parseBugReport(bugzillaEditorInput.getRepositoryTaskData()));
+ offlineBug = bugzillaEditorInput.getRepositoryTaskData();
super.setSite(site);
super.setInput(editorInput);
@@ -211,7 +211,7 @@ public class BugzillaTaskEditor extends MylarTaskEditor {
// public Object getAdapter(Class adapter) {
// if (IContentOutlinePage.class.equals(adapter)) {
// if (outlinePage == null && bugzillaEditorInput != null) {
-// outlinePage = new BugzillaOutlinePage(bugzillaOutlineModel);
+// outlinePage = new RepositoryTaskOutlinePage(bugzillaOutlineModel);
// }
// return outlinePage;
// }
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskEditorInput.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskEditorInput.java
index 3ebb14c44..c4fec7579 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskEditorInput.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskEditorInput.java
@@ -17,11 +17,9 @@ import java.io.IOException;
import java.security.GeneralSecurityException;
import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.mylar.internal.bugzilla.ui.editor.ExistingBugEditorInput;
-import org.eclipse.mylar.internal.tasklist.RepositoryTaskData;
+import org.eclipse.mylar.internal.tasklist.ui.editors.ExistingBugEditorInput;
import org.eclipse.mylar.provisional.tasklist.AbstractRepositoryTask;
import org.eclipse.mylar.provisional.tasklist.TaskRepository;
-import org.eclipse.mylar.provisional.tasklist.AbstractRepositoryTask.RepositoryTaskSyncState;
import org.eclipse.ui.IPersistableElement;
/**
@@ -32,19 +30,19 @@ public class BugzillaTaskEditorInput extends ExistingBugEditorInput {
private String bugTitle;
- private RepositoryTaskData offlineBug;
+ //private RepositoryTaskData offlineBug;
private BugzillaTask bugTask;
- private boolean offline;
+ //private boolean offline;
public BugzillaTaskEditorInput(TaskRepository repository, BugzillaTask bugTask, boolean offline) throws IOException, GeneralSecurityException {
- super(repository, AbstractRepositoryTask.getTaskIdAsInt(bugTask.getHandleIdentifier()), offline);
+ super(repository, AbstractRepositoryTask.getTaskIdAsInt(bugTask.getHandleIdentifier()));
this.bugTask = bugTask;
- offlineBug = bugTask.getTaskData();
+// offlineBug = bugTask.getTaskData();
bugId = AbstractRepositoryTask.getTaskIdAsInt(bugTask.getHandleIdentifier());
bugTitle = "";
- this.offline = offline;
+// this.offline = offline;
}
protected void setBugTitle(String str) {
@@ -87,29 +85,29 @@ public class BugzillaTaskEditorInput extends ExistingBugEditorInput {
return bugId;
}
- /**
- * Returns the online server bug for this input
- *
- * @see BugzillaRepositoryUtil
- * @see BugReport
- */
- // public BugReport getServerBug() {
- // return serverBug;
- // }
- /**
- * Returns the offline bug for this input's Bugzilla task
- */
- public RepositoryTaskData getOfflineBug() {
- if (offline || bugTask.getSyncState() == RepositoryTaskSyncState.OUTGOING
- || bugTask.getSyncState() == RepositoryTaskSyncState.CONFLICT)
- return offlineBug;
- else
- return super.getBug();
- }
-
- public void setOfflineBug(RepositoryTaskData offlineBug) {
- this.offlineBug = offlineBug;
- }
+// /**
+// * Returns the online server bug for this input
+// *
+// * @see BugzillaRepositoryUtil
+// * @see BugReport
+// */
+// // public BugReport getServerBug() {
+// // return serverBug;
+// // }
+// /**
+// * Returns the offline bug for this input's Bugzilla task
+// */
+// public RepositoryTaskData getOfflineBug() {
+// if (offline || bugTask.getSyncState() == RepositoryTaskSyncState.OUTGOING
+// || bugTask.getSyncState() == RepositoryTaskSyncState.CONFLICT)
+// return offlineBug;
+// else
+// return super.getBug();
+// }
+//
+// public void setOfflineBug(RepositoryTaskData offlineBug) {
+// this.offlineBug = offlineBug;
+// }
/**
* Gets the bug page input stream
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/OpenBugzillaReportJob.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/OpenBugzillaReportJob.java
index 41d4b057f..cbb20ddc7 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/OpenBugzillaReportJob.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/OpenBugzillaReportJob.java
@@ -22,9 +22,9 @@ import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaPlugin;
import org.eclipse.mylar.internal.bugzilla.ui.BugzillaUiPlugin;
-import org.eclipse.mylar.internal.bugzilla.ui.editor.AbstractBugEditor;
-import org.eclipse.mylar.internal.bugzilla.ui.editor.ExistingBugEditorInput;
import org.eclipse.mylar.internal.core.util.MylarStatusHandler;
+import org.eclipse.mylar.internal.tasklist.ui.editors.AbstractRepositoryTaskEditor;
+import org.eclipse.mylar.internal.tasklist.ui.editors.ExistingBugEditorInput;
import org.eclipse.mylar.provisional.tasklist.MylarTaskListPlugin;
import org.eclipse.mylar.provisional.tasklist.TaskRepository;
import org.eclipse.ui.IWorkbenchPage;
@@ -66,11 +66,11 @@ public class OpenBugzillaReportJob extends Job {
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
public void run() {
- if (editorInput.getBug() == null) {
+ if (editorInput.getRepositoryTaskData() == null) {
MessageDialog.openError(null, "Server Setting Error", "Incorrect server set for the bug.");
} else {
try {
- AbstractBugEditor abe = (AbstractBugEditor) page.openEditor(editorInput,
+ AbstractRepositoryTaskEditor abe = (AbstractRepositoryTaskEditor) page.openEditor(editorInput,
BugzillaUiPlugin.EXISTING_BUG_EDITOR_ID);
abe.selectDescription();
// if (commentNumber == 0) {
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/AbstractBugzillaReportWizard.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/AbstractBugzillaReportWizard.java
index 86f66f49b..b49f07e18 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/AbstractBugzillaReportWizard.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/AbstractBugzillaReportWizard.java
@@ -29,8 +29,8 @@ import org.eclipse.mylar.internal.bugzilla.core.NewBugzillaReport;
import org.eclipse.mylar.internal.bugzilla.core.PossibleBugzillaFailureException;
import org.eclipse.mylar.internal.bugzilla.ui.BugzillaUiPlugin;
import org.eclipse.mylar.internal.bugzilla.ui.WebBrowserDialog;
-import org.eclipse.mylar.internal.bugzilla.ui.editor.ExistingBugEditorInput;
import org.eclipse.mylar.internal.core.util.MylarStatusHandler;
+import org.eclipse.mylar.internal.tasklist.ui.editors.ExistingBugEditorInput;
import org.eclipse.mylar.internal.tasklist.ui.views.TaskRepositoriesView;
import org.eclipse.mylar.provisional.tasklist.MylarTaskListPlugin;
import org.eclipse.mylar.provisional.tasklist.TaskRepository;
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/AbstractBugzillaWizardPage.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/AbstractBugzillaWizardPage.java
index a28672074..fe6839ad7 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/AbstractBugzillaWizardPage.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/AbstractBugzillaWizardPage.java
@@ -22,9 +22,9 @@ import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaReportElement;
import org.eclipse.mylar.internal.bugzilla.core.NewBugzillaReport;
-import org.eclipse.mylar.internal.bugzilla.ui.editor.AbstractBugEditor;
import org.eclipse.mylar.internal.core.util.MylarStatusHandler;
import org.eclipse.mylar.internal.tasklist.RepositoryTaskAttribute;
+import org.eclipse.mylar.internal.tasklist.ui.editors.AbstractRepositoryTaskEditor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
@@ -605,7 +605,7 @@ public abstract class AbstractBugzillaWizardPage extends WizardPage implements L
IThemeManager themeManager = PlatformUI.getWorkbench().getThemeManager();
- Font repositoryFont = themeManager.getCurrentTheme().getFontRegistry().get(AbstractBugEditor.REPOSITORY_TEXT_ID);
+ Font repositoryFont = themeManager.getCurrentTheme().getFontRegistry().get(AbstractRepositoryTaskEditor.REPOSITORY_TEXT_ID);
// add the summary text field
newLayout(textComposite, 1, BugzillaReportElement.SHORT_DESC.toString(), PROPERTY);
@@ -633,12 +633,12 @@ public abstract class AbstractBugzillaWizardPage extends WizardPage implements L
// add the description text field
descriptionText = new Text(attributesComposite, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.WRAP);
- //descriptionText.setFont(AbstractBugEditor.COMMENT_FONT);
+ //descriptionText.setFont(AbstractRepositoryTaskEditor.COMMENT_FONT);
descriptionText.setFont(repositoryFont);
GridData descriptionTextData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
descriptionTextData.horizontalSpan = 4;
- descriptionTextData.widthHint = AbstractBugEditor.DESCRIPTION_WIDTH;
- descriptionTextData.heightHint = AbstractBugEditor.DESCRIPTION_HEIGHT;
+ descriptionTextData.widthHint = AbstractRepositoryTaskEditor.DESCRIPTION_WIDTH;
+ descriptionTextData.heightHint = AbstractRepositoryTaskEditor.DESCRIPTION_HEIGHT;
descriptionText.setLayoutData(descriptionTextData);
descriptionText.addListener(SWT.Modify, this);
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/NewBugzillaReportWizard.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/NewBugzillaReportWizard.java
index b2feeeefb..a06815a8c 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/NewBugzillaReportWizard.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/NewBugzillaReportWizard.java
@@ -63,7 +63,7 @@ public class NewBugzillaReportWizard extends AbstractBugzillaReportWizard {
@Override
protected void saveBugOffline() {
AbstractRepositoryConnector client = (AbstractRepositoryConnector)MylarTaskListPlugin.getRepositoryManager().getRepositoryConnector(BugzillaPlugin.REPOSITORY_KIND);
- client.saveOffline(model, true);
+ client.saveOffline(model);
}
@Override
@@ -119,14 +119,15 @@ public class NewBugzillaReportWizard extends AbstractBugzillaReportWizard {
MylarTaskListPlugin.getTaskListManager().getTaskList().getRootCategory());
}
- AbstractRepositoryConnector client = MylarTaskListPlugin.getRepositoryManager().getRepositoryConnector(
- BugzillaPlugin.REPOSITORY_KIND);
+// AbstractRepositoryConnector client = MylarTaskListPlugin.getRepositoryManager().getRepositoryConnector(
+// BugzillaPlugin.REPOSITORY_KIND);
// client.addTaskToArchive(newTask);
- TaskUiUtil.openEditor(newTask, true);
+ //TaskUiUtil.openEditor(newTask, true);
+ TaskUiUtil.refreshAndOpenTaskListElement(newTask);
- if (!newTask.isDownloaded()) {
- client.synchronize(newTask, true, null);
- }
+// if (!newTask.isDownloaded()) {
+// client.synchronize(newTask, true, null);
+// }
return true;
}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/bugs/BugzillaEditingMonitor.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/bugs/BugzillaEditingMonitor.java
index 056fc73b5..54ab017b2 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/bugs/BugzillaEditingMonitor.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/bugs/BugzillaEditingMonitor.java
@@ -13,9 +13,9 @@ package org.eclipse.mylar.internal.bugs;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.mylar.internal.bugzilla.ui.editor.AbstractBugEditor;
-import org.eclipse.mylar.internal.bugzilla.ui.editor.BugzillaReportSelection;
import org.eclipse.mylar.internal.bugzilla.ui.tasklist.BugzillaTaskEditor;
+import org.eclipse.mylar.internal.tasklist.ui.editors.AbstractRepositoryTaskEditor;
+import org.eclipse.mylar.internal.tasklist.ui.editors.RepositoryTaskSelection;
import org.eclipse.mylar.provisional.core.AbstractUserInteractionMonitor;
import org.eclipse.ui.IWorkbenchPart;
@@ -30,13 +30,13 @@ public class BugzillaEditingMonitor extends AbstractUserInteractionMonitor {
@Override
protected void handleWorkbenchPartSelection(IWorkbenchPart part, ISelection selection, boolean contributeToContext) {
- if (!(part instanceof AbstractBugEditor) && !(part instanceof BugzillaTaskEditor))
+ if (!(part instanceof AbstractRepositoryTaskEditor) && !(part instanceof BugzillaTaskEditor))
return;
if (selection instanceof StructuredSelection) {
StructuredSelection ss = (StructuredSelection) selection;
Object object = ss.getFirstElement();
- if (object instanceof BugzillaReportSelection)
+ if (object instanceof RepositoryTaskSelection)
super.handleElementSelection(part, object, contributeToContext);
}
}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/bugs/BugzillaStructureBridge.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/bugs/BugzillaStructureBridge.java
index e42f1da9a..abddc74f2 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/bugs/BugzillaStructureBridge.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/bugs/BugzillaStructureBridge.java
@@ -15,11 +15,11 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-import org.eclipse.mylar.internal.bugzilla.ui.BugzillaTools;
-import org.eclipse.mylar.internal.bugzilla.ui.editor.BugzillaOutlineNode;
-import org.eclipse.mylar.internal.bugzilla.ui.editor.BugzillaReportSelection;
import org.eclipse.mylar.internal.bugzilla.ui.search.BugzillaSearchHit;
import org.eclipse.mylar.internal.core.DegreeOfSeparation;
+import org.eclipse.mylar.internal.tasklist.ui.editors.RepositoryTaskOutlineNode;
+import org.eclipse.mylar.internal.tasklist.ui.editors.RepositoryTaskSelection;
+import org.eclipse.mylar.internal.tasklist.ui.editors.OutlineTools;
import org.eclipse.mylar.provisional.core.AbstractRelationProvider;
import org.eclipse.mylar.provisional.core.IDegreeOfSeparation;
import org.eclipse.mylar.provisional.core.IMylarStructureBridge;
@@ -48,15 +48,15 @@ public class BugzillaStructureBridge implements IMylarStructureBridge {
/**
* Handle format: <server-name:port>;<bug-id>;<comment#>
*
- * Use: BugzillaTools ???
+ * Use: OutlineTools ???
*/
public String getHandleIdentifier(Object object) {
- if (object instanceof BugzillaOutlineNode) {
- BugzillaOutlineNode node = (BugzillaOutlineNode) object;
- return BugzillaTools.getHandle(node);
- } else if (object instanceof BugzillaReportSelection) {
- BugzillaReportSelection n = (BugzillaReportSelection) object;
- return BugzillaTools.getHandle(n);
+ if (object instanceof RepositoryTaskOutlineNode) {
+ RepositoryTaskOutlineNode node = (RepositoryTaskOutlineNode) object;
+ return OutlineTools.getHandle(node);
+ } else if (object instanceof RepositoryTaskSelection) {
+ RepositoryTaskSelection n = (RepositoryTaskSelection) object;
+ return OutlineTools.getHandle(n);
}
return null;
}
@@ -92,9 +92,9 @@ public class BugzillaStructureBridge implements IMylarStructureBridge {
// } catch (NullPointerException e) {
// // do nothing, this just means that there is no active page
// }
-// if (editorPart != null && editorPart instanceof AbstractBugEditor) {
-// AbstractBugEditor abe = ((AbstractBugEditor) editorPart);
-// BugzillaOutlineNode node = abe.getOutlineModel();
+// if (editorPart != null && editorPart instanceof AbstractRepositoryTaskEditor) {
+// AbstractRepositoryTaskEditor abe = ((AbstractRepositoryTaskEditor) editorPart);
+// RepositoryTaskOutlineNode node = abe.getOutlineModel();
// return findNode(node, commentNumber);
// }
//
@@ -136,7 +136,7 @@ public class BugzillaStructureBridge implements IMylarStructureBridge {
return null;
}
-// private BugzillaOutlineNode findNode(BugzillaOutlineNode startNode, int commentNumber) {
+// private RepositoryTaskOutlineNode findNode(RepositoryTaskOutlineNode startNode, int commentNumber) {
//
// if (commentNumber == -1) {
// return startNode;
@@ -148,9 +148,9 @@ public class BugzillaStructureBridge implements IMylarStructureBridge {
// return startNode;
// }
//
-// BugzillaOutlineNode[] children = startNode.getChildren();
+// RepositoryTaskOutlineNode[] children = startNode.getChildren();
// for (int i = 0; i < children.length; i++) {
-// BugzillaOutlineNode n = findNode(children[i], commentNumber);
+// RepositoryTaskOutlineNode n = findNode(children[i], commentNumber);
// if (n != null)
// return n;
// }
@@ -164,9 +164,9 @@ public class BugzillaStructureBridge implements IMylarStructureBridge {
if (!handle.matches(".*;.*;.*"))
return null;
- BugzillaOutlineNode bon = (BugzillaOutlineNode) getObjectForHandle(handle);
+ RepositoryTaskOutlineNode bon = (RepositoryTaskOutlineNode) getObjectForHandle(handle);
if (bon != null && bon.getParent() != null)
- return BugzillaTools.getHandle(bon.getParent());
+ return OutlineTools.getHandle(bon.getParent());
else
return null;
// String [] parts = handle.split(";");
@@ -183,9 +183,9 @@ public class BugzillaStructureBridge implements IMylarStructureBridge {
}
public String getName(Object object) {
- if (object instanceof BugzillaOutlineNode) {
- BugzillaOutlineNode b = (BugzillaOutlineNode) object;
- return BugzillaTools.getName(b);
+ if (object instanceof RepositoryTaskOutlineNode) {
+ RepositoryTaskOutlineNode b = (RepositoryTaskOutlineNode) object;
+ return OutlineTools.getName(b);
} else if (object instanceof BugzillaReportInfo) {
BugzillaSearchHit hit = ((BugzillaReportInfo) object).getHit();
return hit.getRepositoryUrl() + ": Bug#: " + hit.getId() + ": " + hit.getDescription();
@@ -198,7 +198,7 @@ public class BugzillaStructureBridge implements IMylarStructureBridge {
}
public boolean acceptsObject(Object object) {
- return object instanceof BugzillaOutlineNode || object instanceof BugzillaReportSelection;
+ return object instanceof RepositoryTaskOutlineNode || object instanceof RepositoryTaskSelection;
}
public boolean canFilter(Object element) {
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/bugs/BugzillaUiBridge.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/bugs/BugzillaUiBridge.java
index 9f840aa04..07df09112 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/bugs/BugzillaUiBridge.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/bugs/BugzillaUiBridge.java
@@ -20,10 +20,10 @@ import org.eclipse.jface.text.TextSelection;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaRepositoryUtil;
-import org.eclipse.mylar.internal.bugzilla.ui.editor.AbstractBugEditor;
-import org.eclipse.mylar.internal.bugzilla.ui.editor.BugzillaOutlinePage;
import org.eclipse.mylar.internal.bugzilla.ui.tasklist.BugzillaTaskEditor;
import org.eclipse.mylar.internal.tasklist.ui.TaskUiUtil;
+import org.eclipse.mylar.internal.tasklist.ui.editors.AbstractRepositoryTaskEditor;
+import org.eclipse.mylar.internal.tasklist.ui.editors.RepositoryTaskOutlinePage;
import org.eclipse.mylar.provisional.core.IMylarElement;
import org.eclipse.mylar.provisional.tasklist.ITask;
import org.eclipse.mylar.provisional.tasklist.MylarTaskListPlugin;
@@ -87,8 +87,8 @@ public class BugzillaUiBridge implements IMylarUiBridge {
for (int i = 0; i < references.length; i++) {
IEditorPart part = references[i].getEditor(false);
if (part != null) {
- if (part instanceof AbstractBugEditor) {
- ((AbstractBugEditor) part).close();
+ if (part instanceof AbstractRepositoryTaskEditor) {
+ ((AbstractRepositoryTaskEditor) part).close();
} else if (part instanceof BugzillaTaskEditor) {
((BugzillaTaskEditor) part).close();
}
@@ -98,7 +98,7 @@ public class BugzillaUiBridge implements IMylarUiBridge {
}
public boolean acceptsEditor(IEditorPart editorPart) {
- return editorPart instanceof AbstractBugEditor;
+ return editorPart instanceof AbstractRepositoryTaskEditor;
}
public List<TreeViewer> getContentOutlineViewers(IEditorPart editor) {
@@ -110,9 +110,9 @@ public class BugzillaUiBridge implements IMylarUiBridge {
}
protected TreeViewer getOutlineTreeViewer(IEditorPart editor) {
- if (editor instanceof AbstractBugEditor) {
- AbstractBugEditor abe = (AbstractBugEditor) editor;
- BugzillaOutlinePage outline = abe.getOutline();
+ if (editor instanceof AbstractRepositoryTaskEditor) {
+ AbstractRepositoryTaskEditor abe = (AbstractRepositoryTaskEditor) editor;
+ RepositoryTaskOutlinePage outline = abe.getOutline();
if (outline != null)
return outline.getOutlineTreeViewer();
}
diff --git a/org.eclipse.mylyn.tasks.ui/META-INF/MANIFEST.MF b/org.eclipse.mylyn.tasks.ui/META-INF/MANIFEST.MF
index 74e7e6536..f2084c474 100644
--- a/org.eclipse.mylyn.tasks.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.mylyn.tasks.ui/META-INF/MANIFEST.MF
@@ -11,7 +11,9 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.jface.text,
org.eclipse.mylar.core,
org.eclipse.update.core,
- org.eclipse.ui.browser
+ org.eclipse.ui.browser,
+ org.eclipse.ui.editors,
+ org.eclipse.ui.views
Eclipse-AutoStart: true
Bundle-Vendor: Eclipse.org
Bundle-ClassPath: mylar-tasklist.jar
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/OfflineTaskManager.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/OfflineTaskManager.java
index f03440cb9..60cdb961a 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/OfflineTaskManager.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/OfflineTaskManager.java
@@ -23,7 +23,6 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.mylar.provisional.tasklist.AbstractRepositoryConnector;
import org.eclipse.mylar.provisional.tasklist.MylarTaskListPlugin;
-import org.eclipse.mylar.provisional.tasklist.AbstractRepositoryTask.RepositoryTaskSyncState;
/**
* Class to persist the data for the offline reports list
@@ -62,93 +61,115 @@ public class OfflineTaskManager {
/**
- * Add an offline report to the offline reports list
+ * Add a RepositoryTaskData to the offline reports file
*
* @param entry
* The bug to add
*/
- public RepositoryTaskSyncState add(final RepositoryTaskData entry, boolean forceSync) throws CoreException {
+ public void add(final RepositoryTaskData entry) throws CoreException {
+ int index = -1;
+ if ((index = find(entry.getRepositoryUrl(), entry.getId())) >= 0) {
- RepositoryTaskSyncState status = RepositoryTaskSyncState.SYNCHRONIZED;
-//
-// try {
-//
-// String handle = AbstractRepositoryTask.getHandle(entry.getRepositoryUrl(), entry.getId());
-// ITask task = MylarTaskListPlugin.getTaskListManager().getTaskList().getTask(handle);
-//
-// if (task != null && task instanceof AbstractRepositoryTask) {
-// AbstractRepositoryTask repositoryTask = (AbstractRepositoryTask) task;
-//
-// TaskRepository repository = MylarTaskListPlugin.getRepositoryManager().getRepository(
-// repositoryTask.getRepositoryKind(), repositoryTask.getRepositoryUrl());
-//
-// if (repository == null) {
-// throw new Exception("No repository associated with task. Unable to retrieve timezone information.");
-// }
-//
-// TimeZone repositoryTimeZone = DateUtil.getTimeZone(repository.getTimeZoneId());
+ list.remove(index);
- int index = -1;
- if ((index = find(entry.getRepositoryUrl(), entry.getId())) >= 0) {
- //RepositoryTaskData oldBug = list.get(index);
+ list.add(entry);
+ writeFile();
-// if (repositoryTask.getLastSynchronized() == null
-// || entry.getLastModified(repositoryTimeZone)
-// .compareTo(repositoryTask.getLastSynchronized()) > 0 || forceSync) {
+ } else {
+ list.add(entry);
+ writeFile();
+ }
+ }
+
+
+// /**
+// * Add an offline report to the offline reports list
+// *
+// * @param entry
+// * The bug to add
+// */
+// public RepositoryTaskSyncState add(final RepositoryTaskData entry, boolean forceSync) throws CoreException {
//
-// if (oldBug.hasChanges()) {
+// RepositoryTaskSyncState status = RepositoryTaskSyncState.SYNCHRONIZED;
+////
+//// try {
+////
+//// String handle = AbstractRepositoryTask.getHandle(entry.getRepositoryUrl(), entry.getId());
+//// ITask task = MylarTaskListPlugin.getTaskListManager().getTaskList().getTask(handle);
+////
+//// if (task != null && task instanceof AbstractRepositoryTask) {
+//// AbstractRepositoryTask repositoryTask = (AbstractRepositoryTask) task;
+////
+//// TaskRepository repository = MylarTaskListPlugin.getRepositoryManager().getRepository(
+//// repositoryTask.getRepositoryKind(), repositoryTask.getRepositoryUrl());
+////
+//// if (repository == null) {
+//// throw new Exception("No repository associated with task. Unable to retrieve timezone information.");
+//// }
+////
+//// TimeZone repositoryTimeZone = DateUtil.getTimeZone(repository.getTimeZoneId());
//
-// PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
-// public void run() {
-// updateLocalCopy = MessageDialog
-// .openQuestion(
-// null,
-// "Update Local Copy",
-// "Local copy of Report "
-// + entry.getId()
-// + " on "
-// + entry.getRepositoryUrl()
-// + " has changes.\nWould you like to override local changes? \n\nNote: if you select No, only the new comment will be saved with the updated bug, all other changes will be lost.");
-// }
-// });
+// int index = -1;
+// if ((index = find(entry.getRepositoryUrl(), entry.getId())) >= 0) {
+// //RepositoryTaskData oldBug = list.get(index);
//
-// if (!updateLocalCopy) {
-// ((RepositoryTaskData) entry).setNewComment(((RepositoryTaskData) oldBug).getNewComment());
-// ((RepositoryTaskData) entry).setHasChanged(true);
-// status = RepositoryTaskSyncState.CONFLICT;
-// } else {
-// ((RepositoryTaskData) entry).setHasChanged(false);
-// status = RepositoryTaskSyncState.SYNCHRONIZED;
-// }
-// } else {
-// if (forceSync) {
-// status = RepositoryTaskSyncState.SYNCHRONIZED;
-// } else {
-// status = RepositoryTaskSyncState.INCOMING;
-// }
-// }
- list.remove(index);
-// if (entry.hasChanges() && status != RepositoryTaskSyncState.CONFLICT) {
-// status = RepositoryTaskSyncState.OUTGOING;
-// }
- list.add(entry);
- writeFile();
-
- } else {
- // report doesn't exist in offline reports
- list.add(entry);
- writeFile();
- }
- //repositoryTask.setLastSynchronized(entry.getLastModified(repositoryTimeZone));
+//// if (repositoryTask.getLastSynchronized() == null
+//// || entry.getLastModified(repositoryTimeZone)
+//// .compareTo(repositoryTask.getLastSynchronized()) > 0 || forceSync) {
+////
+//// if (oldBug.hasChanges()) {
+////
+//// PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
+//// public void run() {
+//// updateLocalCopy = MessageDialog
+//// .openQuestion(
+//// null,
+//// "Update Local Copy",
+//// "Local copy of Report "
+//// + entry.getId()
+//// + " on "
+//// + entry.getRepositoryUrl()
+//// + " has changes.\nWould you like to override local changes? \n\nNote: if you select No, only the new comment will be saved with the updated bug, all other changes will be lost.");
+//// }
+//// });
+////
+//// if (!updateLocalCopy) {
+//// ((RepositoryTaskData) entry).setNewComment(((RepositoryTaskData) oldBug).getNewComment());
+//// ((RepositoryTaskData) entry).setHasChanged(true);
+//// status = RepositoryTaskSyncState.CONFLICT;
+//// } else {
+//// ((RepositoryTaskData) entry).setHasChanged(false);
+//// status = RepositoryTaskSyncState.SYNCHRONIZED;
+//// }
+//// } else {
+//// if (forceSync) {
+//// status = RepositoryTaskSyncState.SYNCHRONIZED;
+//// } else {
+//// status = RepositoryTaskSyncState.INCOMING;
+//// }
+//// }
+// list.remove(index);
+//// if (entry.hasChanges() && status != RepositoryTaskSyncState.CONFLICT) {
+//// status = RepositoryTaskSyncState.OUTGOING;
+//// }
+// list.add(entry);
+// writeFile();
+//
+// } else {
+// // report doesn't exist in offline reports
+// list.add(entry);
+// writeFile();
+// }
+// //repositoryTask.setLastSynchronized(entry.getLastModified(repositoryTimeZone));
+//// }
+//// } catch (Exception e) {
+//// e.printStackTrace();
+//// IStatus runtimestatus = new Status(IStatus.ERROR, MylarTaskListPlugin.PLUGIN_ID, IStatus.OK,
+//// "failed to add offline report", e);
+//// throw new CoreException(runtimestatus);
+//// }
+// return status;
// }
-// } catch (Exception e) {
-// e.printStackTrace();
-// IStatus runtimestatus = new Status(IStatus.ERROR, MylarTaskListPlugin.PLUGIN_ID, IStatus.OK,
-// "failed to add offline report", e);
-// throw new CoreException(runtimestatus);
-// }
- return status;
- }
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/RepositoryTaskAttribute.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/RepositoryTaskAttribute.java
index 8b5a16c0f..ce2359c69 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/RepositoryTaskAttribute.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/RepositoryTaskAttribute.java
@@ -18,7 +18,7 @@ import java.util.List;
import java.util.Map;
/**
- * Class representing a report attribute may contain child attributes
+ * Class representing a report attribute
*
* @author Rob Elves
*/
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskUiUtil.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskUiUtil.java
index 66545bef9..ab5a92f11 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskUiUtil.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskUiUtil.java
@@ -16,6 +16,9 @@ import java.net.URL;
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.mylar.internal.core.util.MylarStatusHandler;
import org.eclipse.mylar.internal.tasklist.TaskListPreferenceConstants;
@@ -142,52 +145,37 @@ public class TaskUiUtil {
}
if (task instanceof AbstractRepositoryTask) {
- String repositoryKind = ((AbstractRepositoryTask) task).getRepositoryKind();
+ final AbstractRepositoryTask repositoryTask = (AbstractRepositoryTask) task;
+ String repositoryKind = repositoryTask.getRepositoryKind();
final AbstractRepositoryConnector connector = MylarTaskListPlugin.getRepositoryManager()
.getRepositoryConnector(repositoryKind);
- TaskRepository repository = MylarTaskListPlugin.getRepositoryManager().getRepository(repositoryKind, ((AbstractRepositoryTask) task).getRepositoryUrl());
+ TaskRepository repository = MylarTaskListPlugin.getRepositoryManager().getRepository(repositoryKind, repositoryTask.getRepositoryUrl());
if (!repository.hasCredentials()) {
MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
MylarTaskListPlugin.TITLE_DIALOG,
"Repository does not have credentials set, verify via " + TaskRepositoriesView.NAME + " view");
}
- if (connector != null) {
- TaskUiUtil.openEditor(task, false);
- connector.synchronize((AbstractRepositoryTask) task, false, null);
-
-
-// Job refreshJob = connector.synchronize((AbstractRepositoryTask) task, forceUpdate,
-// new IJobChangeListener() {
-//
-// public void done(IJobChangeEvent event) {
-// TaskUiUtil.openEditor(task, false);
-// }
-//
-// public void aboutToRun(IJobChangeEvent event) {
-// // ignore
-// }
-//
-// public void awake(IJobChangeEvent event) {
-// // ignore
-// }
-//
-// public void running(IJobChangeEvent event) {
-// // ignore
-// }
-//
-// public void scheduled(IJobChangeEvent event) {
-// // ignore
-// }
-//
-// public void sleeping(IJobChangeEvent event) {
-// // ignore
-// }
-// });
-// if (refreshJob == null) {
-// TaskUiUtil.openEditor(task, false);
-// }
- }
+ if (connector != null)
+ if (repositoryTask.getTaskData() != null) {
+ TaskUiUtil.openEditor(task, false);
+ // TODO: Eventually will need to check that this task
+ // isn't a new report awaiting submission if so
+ // don't synchronize
+ connector.synchronize((AbstractRepositoryTask) task, false, null);
+ } else {
+ Job refreshJob = connector.synchronize((AbstractRepositoryTask) task, true,
+ new JobChangeAdapter() {
+ public void done(IJobChangeEvent event) {
+ if (repositoryTask.getTaskData() != null) {
+ TaskUiUtil.openEditor(task, false);
+ }
+ }
+ });
+ if (refreshJob == null) {
+ TaskUiUtil.openEditor(task, false);
+ }
+ }
} else {
TaskUiUtil.openEditor(task, false);
}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/AbstractBugEditorInput.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/AbstractBugEditorInput.java
index 5df7d7187..08a93404a 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/AbstractBugEditorInput.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/AbstractBugEditorInput.java
@@ -9,19 +9,20 @@
* University Of British Columbia - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylar.internal.bugzilla.ui.editor;
+package org.eclipse.mylar.internal.tasklist.ui.editors;
import java.net.Proxy;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.mylar.internal.tasklist.RepositoryTaskData;
import org.eclipse.mylar.provisional.tasklist.MylarTaskListPlugin;
+import org.eclipse.mylar.provisional.tasklist.TaskRepository;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IPersistableElement;
/**
* Abstract base implementation of an <code>IEditorInput</code> for a subclass
- * of <code>AbstractBugEditor</code>.
+ * of <code>AbstractRepositoryTaskEditor</code>.
*/
public abstract class AbstractBugEditorInput implements IEditorInput {
@@ -48,10 +49,7 @@ public abstract class AbstractBugEditorInput implements IEditorInput {
return true;
}
- /**
- * @return The <code>IBugzillaBug</code> object for this editor input.
- */
- public abstract RepositoryTaskData getBug();
+ public abstract RepositoryTaskData getRepositoryTaskData();
public ImageDescriptor getImageDescriptor() {
return null;
@@ -79,4 +77,7 @@ public abstract class AbstractBugEditorInput implements IEditorInput {
public Proxy getProxySettings() {
return proxySettings;
}
+
+
+ public abstract TaskRepository getRepository();
}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/AbstractBugEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/AbstractRepositoryTaskEditor.java
index 3939cd801..21d0f1931 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/AbstractBugEditor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/AbstractRepositoryTaskEditor.java
@@ -8,13 +8,13 @@
* Contributors:
* University Of British Columbia - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylar.internal.bugzilla.ui.editor;
+package org.eclipse.mylar.internal.tasklist.ui.editors;
-import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -25,7 +25,6 @@ import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.text.Document;
@@ -44,25 +43,19 @@ import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.mylar.internal.bugzilla.core.BugzillaPlugin;
-import org.eclipse.mylar.internal.bugzilla.core.BugzillaReportElement;
-import org.eclipse.mylar.internal.bugzilla.core.IBugzillaAttributeListener;
-import org.eclipse.mylar.internal.bugzilla.core.IBugzillaConstants;
-import org.eclipse.mylar.internal.bugzilla.ui.BugzillaTools;
-import org.eclipse.mylar.internal.bugzilla.ui.BugzillaUiPlugin;
-import org.eclipse.mylar.internal.bugzilla.ui.IBugzillaReportSelection;
-import org.eclipse.mylar.internal.bugzilla.ui.tasklist.BugzillaRepositoryConnector;
import org.eclipse.mylar.internal.core.util.MylarStatusHandler;
import org.eclipse.mylar.internal.tasklist.Comment;
import org.eclipse.mylar.internal.tasklist.LocalAttachment;
import org.eclipse.mylar.internal.tasklist.RepositoryAttachment;
import org.eclipse.mylar.internal.tasklist.RepositoryTaskAttribute;
import org.eclipse.mylar.internal.tasklist.RepositoryTaskData;
+import org.eclipse.mylar.internal.tasklist.ui.TaskListImages;
import org.eclipse.mylar.internal.tasklist.ui.TaskUiUtil;
-import org.eclipse.mylar.internal.tasklist.ui.editors.MylarTaskEditor;
-import org.eclipse.mylar.internal.tasklist.ui.views.TaskRepositoriesView;
+import org.eclipse.mylar.provisional.tasklist.AbstractRepositoryConnector;
+import org.eclipse.mylar.provisional.tasklist.AbstractRepositoryTask;
import org.eclipse.mylar.provisional.tasklist.MylarTaskListPlugin;
import org.eclipse.mylar.provisional.tasklist.TaskRepository;
+import org.eclipse.mylar.provisional.tasklist.AbstractRepositoryTask.RepositoryTaskSyncState;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.custom.StyledText;
@@ -87,21 +80,25 @@ import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.ISelectionListener;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.actions.ActionFactory;
import org.eclipse.ui.actions.RetargetAction;
+import org.eclipse.ui.forms.events.ExpansionAdapter;
import org.eclipse.ui.forms.events.ExpansionEvent;
+import org.eclipse.ui.forms.events.HyperlinkAdapter;
+import org.eclipse.ui.forms.events.HyperlinkEvent;
import org.eclipse.ui.forms.events.IExpansionListener;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.ImageHyperlink;
import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.forms.widgets.Section;
import org.eclipse.ui.internal.WorkbenchImages;
import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.help.WorkbenchHelpSystem;
import org.eclipse.ui.part.EditorPart;
import org.eclipse.ui.themes.IThemeManager;
import org.eclipse.ui.views.contentoutline.ContentOutline;
@@ -113,7 +110,9 @@ import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
* @author Mik Kersten (some hardening of prototype)
* @author Rob Elves (Conversion to Eclipse Forms)
*/
-public abstract class AbstractBugEditor extends EditorPart {
+public abstract class AbstractRepositoryTaskEditor extends EditorPart {
+
+ protected static final String CONTEXT_MENU_ID = "#BugEditor";
public static final String REPOSITORY_TEXT_ID = "org.eclipse.mylar.tasklist.ui.fonts.task.editor.comment";
@@ -162,11 +161,11 @@ public abstract class AbstractBugEditor extends EditorPart {
//
// protected Color foreground;
- protected AbstractBugEditorInput bugzillaInput;
+ protected AbstractBugEditorInput editorInput;
private MylarTaskEditor parentEditor = null;
- protected BugzillaOutlineNode bugzillaOutlineModel = null;
+ protected RepositoryTaskOutlineNode bugzillaOutlineModel = null;
// private static int MARGIN = 0;// 5
@@ -197,25 +196,27 @@ public abstract class AbstractBugEditor extends EditorPart {
protected CCombo attributeCombo;
- protected CCombo versionCombo;
-
- protected CCombo platformCombo;
-
- protected CCombo priorityCombo;
-
- protected CCombo severityCombo;
-
- protected CCombo milestoneCombo;
-
- protected CCombo componentCombo;
+ // protected CCombo versionCombo;
+ //
+ // protected CCombo platformCombo;
+ //
+ // protected CCombo priorityCombo;
+ //
+ // protected CCombo severityCombo;
+ //
+ // protected CCombo milestoneCombo;
+ //
+ // protected CCombo componentCombo;
protected Button addSelfToCCCheck;
- protected Text urlText;
+ // protected Text urlText;
protected Text summaryText;
- protected Text assignedTo;
+ protected Text addCommentsText;
+
+ // protected Text assignedTo;
protected Text attachmentDesc;
@@ -252,7 +253,7 @@ public abstract class AbstractBugEditor extends EditorPart {
protected RetargetAction cutAction;
- protected BugzillaEditorCopyAction copyAction;
+ protected RepositoryTaskEditorCopyAction copyAction;
// private Action revealAllAction;
@@ -300,7 +301,7 @@ public abstract class AbstractBugEditor extends EditorPart {
extensions2Types.put("gz", "application/octet-stream");
}
- private List<IBugzillaAttributeListener> attributesListeners = new ArrayList<IBugzillaAttributeListener>();
+ private List<IRepositoryTaskAttributeListener> attributesListeners = new ArrayList<IRepositoryTaskAttributeListener>();
protected final ISelectionProvider selectionProvider = new ISelectionProvider() {
public void addSelectionChangedListener(ISelectionChangedListener listener) {
@@ -324,17 +325,17 @@ public abstract class AbstractBugEditor extends EditorPart {
protected HashMap<CCombo, RepositoryTaskAttribute> comboListenerMap = new HashMap<CCombo, RepositoryTaskAttribute>();
- private IBugzillaReportSelection lastSelected = null;
+ private IRepositoryTaskSelection lastSelected = null;
protected final ISelectionListener selectionListener = new ISelectionListener() {
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
if ((part instanceof ContentOutline) && (selection instanceof StructuredSelection)) {
Object select = ((StructuredSelection) selection).getFirstElement();
- if (select instanceof BugzillaOutlineNode) {
- BugzillaOutlineNode n = (BugzillaOutlineNode) select;
+ if (select instanceof RepositoryTaskOutlineNode) {
+ RepositoryTaskOutlineNode n = (RepositoryTaskOutlineNode) select;
- if (n != null && lastSelected != null
- && BugzillaTools.getHandle(n).equals(BugzillaTools.getHandle(lastSelected))) {
+ if (n != null && lastSelected != null
+ && OutlineTools.getHandle(n).equals(OutlineTools.getHandle(lastSelected))) {
// we don't need to set the selection if it is already
// set
return;
@@ -377,7 +378,7 @@ public abstract class AbstractBugEditor extends EditorPart {
RepositoryTaskAttribute attribute = comboListenerMap.get(combo);
if (sel != null && !(sel.equals(attribute.getValue()))) {
attribute.setValue(sel);
- for (IBugzillaAttributeListener client : attributesListeners) {
+ for (IRepositoryTaskAttributeListener client : attributesListeners) {
client.attributeChanged(attribute.getName(), sel);
}
changeDirtyStatus(true);
@@ -388,10 +389,10 @@ public abstract class AbstractBugEditor extends EditorPart {
}
/**
- * Creates a new <code>AbstractBugEditor</code>. Sets up the default
- * fonts and cut/copy/paste actions.
+ * Creates a new <code>AbstractRepositoryTaskEditor</code>. Sets up the
+ * default fonts and cut/copy/paste actions.
*/
- public AbstractBugEditor() {
+ public AbstractRepositoryTaskEditor() {
// set the scroll increments so the editor scrolls normally with the
// scroll wheel
FontData[] fd = TEXT_FONT.getFontData();
@@ -420,7 +421,7 @@ public abstract class AbstractBugEditor extends EditorPart {
pasteAction.setAccelerator(SWT.CTRL | 'v');
pasteAction.setActionDefinitionId(pasteActionDefId);
- copyAction = new BugzillaEditorCopyAction(this);
+ copyAction = new RepositoryTaskEditorCopyAction(this);
copyAction.setText(WorkbenchMessages.Workbench_copy);// WorkbenchMessages.getString("Workbench.copy"));
copyAction.setImageDescriptor(WorkbenchImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY));
copyAction.setHoverImageDescriptor(WorkbenchImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY));
@@ -443,15 +444,14 @@ public abstract class AbstractBugEditor extends EditorPart {
}
/**
- * @return The bug this editor is displaying.
+ * @return The task data this editor is displaying.
*/
- public abstract RepositoryTaskData getBug();
+ public abstract RepositoryTaskData getRepositoryTaskData();
- // TODO: temporary as part of conversion to xml
- public RepositoryTaskData getReport() {
- return (RepositoryTaskData) getBug();
+ public String getNewCommentText() {
+ return addCommentsTextBox.getText();
}
-
+
/**
* @return Any currently selected text.
*/
@@ -463,19 +463,19 @@ public abstract class AbstractBugEditor extends EditorPart {
* @return The action used to copy selected text from a bug editor to the
* clipboard.
*/
- protected BugzillaEditorCopyAction getCopyAction() {
+ protected RepositoryTaskEditorCopyAction getCopyAction() {
return copyAction;
}
@Override
public void createPartControl(Composite parent) {
- if (getBug() == null) {
-
+ if (getRepositoryTaskData() == null) {
// MessageDialog.openError(Display.getDefault().getActiveShell(),
// "Bugzilla Client Errror",
- // "Could not resolve the requested bug, check Bugzilla server and version.");
+ // "Could not resolve the requested bug, check Bugzilla server and
+ // version.");
Composite composite = new Composite(parent, SWT.NULL);
composite.setLayout(new GridLayout());
@@ -507,20 +507,20 @@ public abstract class AbstractBugEditor extends EditorPart {
toolkit.paintBordersFor(summaryComposite);
Composite headerInfoComposite = toolkit.createComposite(editorComposite);
headerInfoComposite.setLayout(new GridLayout(6, false));
- toolkit.createLabel(headerInfoComposite, "Bug# ").setFont(TITLE_FONT);
- toolkit.createText(headerInfoComposite, "" + getReport().getId(), SWT.FLAT | SWT.READ_ONLY);
+ toolkit.createLabel(headerInfoComposite, "Task# ").setFont(TITLE_FONT);
+ toolkit.createText(headerInfoComposite, "" + getRepositoryTaskData().getId(), SWT.FLAT | SWT.READ_ONLY);
toolkit.createLabel(headerInfoComposite, " Opened: ").setFont(TITLE_FONT);
String openedDateString = "";
- if (getBug().getCreated() != null) {
- openedDateString = simpleDateFormat.format(getBug().getCreated());
+ if (getRepositoryTaskData().getCreated() != null) {
+ openedDateString = simpleDateFormat.format(getRepositoryTaskData().getCreated());
}
toolkit.createText(headerInfoComposite, openedDateString, SWT.FLAT | SWT.READ_ONLY);
toolkit.createLabel(headerInfoComposite, " Modified: ").setFont(TITLE_FONT);
String lastModifiedDateString = "";
- if (getBug().getLastModified(null) != null) {
- lastModifiedDateString = simpleDateFormat.format(getBug().getLastModified(null));
+ if (getRepositoryTaskData().getLastModified(null) != null) {
+ lastModifiedDateString = simpleDateFormat.format(getRepositoryTaskData().getLastModified(null));
}
toolkit.createText(headerInfoComposite, lastModifiedDateString, SWT.FLAT | SWT.READ_ONLY);
@@ -532,12 +532,13 @@ public abstract class AbstractBugEditor extends EditorPart {
// createInfoArea(editorComposite);
createContextMenu();
createAttributeLayout();
+ createCustomAttributeLayout(toolkit, form);
createAttachmentLayout();
- createDescriptionLayout(toolkit, form);
createCommentLayout(toolkit, form);
createButtonLayouts(toolkit, form.getBody());
- WorkbenchHelpSystem.getInstance().setHelp(parent, BugzillaUiPlugin.EDITOR_PAGE_CONTEXT);
+ // WorkbenchHelpSystem.getInstance().setHelp(parent,
+ // BugzillaUiPlugin.EDITOR_PAGE_CONTEXT);
editorComposite.setMenu(contextMenuManager.createContextMenu(editorComposite));
form.reflow(true);
@@ -545,11 +546,13 @@ public abstract class AbstractBugEditor extends EditorPart {
getSite().setSelectionProvider(selectionProvider);
}
+ public abstract void createCustomAttributeLayout();
+
/**
* Create a context menu for this editor.
*/
protected void createContextMenu() {
- contextMenuManager = new MenuManager("#BugEditor");
+ contextMenuManager = new MenuManager(CONTEXT_MENU_ID);
contextMenuManager.setRemoveAllWhenShown(true);
contextMenuManager.addMenuListener(new IMenuListener() {
public void menuAboutToShow(IMenuManager manager) {
@@ -567,7 +570,7 @@ public abstract class AbstractBugEditor extends EditorPart {
}
}
});
- getSite().registerContextMenu("#BugEditor", contextMenuManager, getSite().getSelectionProvider());
+ getSite().registerContextMenu(CONTEXT_MENU_ID, contextMenuManager, getSite().getSelectionProvider());
}
// /**
@@ -644,7 +647,8 @@ public abstract class AbstractBugEditor extends EditorPart {
// String key = attribute.getID();
// String name = attribute.getName();
// String value = checkText(attribute.getValue());
- // System.err.println(">>> AbstractBugEditor>> name: "+name+" key: "+key+"
+ // System.err.println(">>> AbstractRepositoryTaskEditor>> name: "+name+"
+ // key: "+key+"
// value:"+value);
// Map<String, String> values = attribute.getOptionValues();
//
@@ -678,11 +682,11 @@ public abstract class AbstractBugEditor extends EditorPart {
// addCCList(toolkit, "", attributesComposite);
// } else if (key.equals(BugzillaReportElement.DEPENDSON.getKeyString())) {
// // Dependson and blocked are multi valued so need to explicitly
- // // be parsed and shown in the AbstractBugEditor
+ // // be parsed and shown in the AbstractRepositoryTaskEditor
// continue;
// } else if (key.equals(BugzillaReportElement.BLOCKED.getKeyString())) {
// // Dependson and blocked are multi valued so need to explicitly
- // // be parsed and shown in the AbstractBugEditor
+ // // be parsed and shown in the AbstractRepositoryTaskEditor
// continue;
// } else if (key.equals("bug_file_loc")) {
// url = value;
@@ -986,11 +990,11 @@ public abstract class AbstractBugEditor extends EditorPart {
attributesData.grabExcessVerticalSpace = false;
attributesComposite.setLayoutData(attributesData);
section.setClient(attributesComposite);
- bugzillaInput.setToolTipText(title);
+ editorInput.setToolTipText(title);
int currentCol = 1;
- for (RepositoryTaskAttribute attribute : getReport().getAttributes()) {
+ for (RepositoryTaskAttribute attribute : getRepositoryTaskData().getAttributes()) {
// String key = attribute.getID();
String name = attribute.getName();
@@ -1003,7 +1007,8 @@ public abstract class AbstractBugEditor extends EditorPart {
// } catch (UnsupportedEncodingException e1) {
// // ignore
// }
- // System.err.println(">>> AbstractBugEditor>> name: "+name+"
+ // System.err.println(">>> AbstractRepositoryTaskEditor>> name:
+ // "+name+"
// key:"+key+" value:"+value+" is hidden"+attribute.isHidden());
if (attribute.isHidden())
continue;
@@ -1073,32 +1078,35 @@ public abstract class AbstractBugEditor extends EditorPart {
}
- // make sure that we are in the first column
- if (currentCol > 1) {
- while (currentCol <= attributesLayout.numColumns) {
- toolkit.createLabel(attributesComposite, "");
- // newLayout(attributesComposite, 1, "", PROPERTY);
- currentCol++;
- }
- }
-
- // Perhaps these should be performed in subclass eventually
-
- addCCList(toolkit, "", attributesComposite);
-
- // URL field
- addUrlText(getReport().getAttributeValue(BugzillaReportElement.BUG_FILE_LOC.getKeyString()),
- attributesComposite);
+ // // make sure that we are in the first column
+ // if (currentCol > 1) {
+ // while (currentCol <= attributesLayout.numColumns) {
+ // toolkit.createLabel(attributesComposite, "");
+ // // newLayout(attributesComposite, 1, "", PROPERTY);
+ // currentCol++;
+ // }
+ // }
- // keywords text field (not editable)
- try {
- addKeywordsList(toolkit, getReport().getAttributeValue(BugzillaReportElement.KEYWORDS.getKeyString()),
- attributesComposite);
- } catch (IOException e) {
- MessageDialog.openInformation(null, IBugzillaConstants.TITLE_MESSAGE_DIALOG,
- "Could not retrieve keyword list, ensure proper configuration in " + TaskRepositoriesView.NAME
- + "\n\nError reported: " + e.getMessage());
- }
+ // // Perhaps these should be performed in subclass eventually
+ //
+ // addCCList(toolkit, "", attributesComposite);
+ //
+ // // URL field
+ // addUrlText(getReport().getAttributeValue(BugzillaReportElement.BUG_FILE_LOC.getKeyString()),
+ // attributesComposite);
+ //
+ // // keywords text field (not editable)
+ // try {
+ // addKeywordsList(toolkit,
+ // getReport().getAttributeValue(BugzillaReportElement.KEYWORDS.getKeyString()),
+ // attributesComposite);
+ // } catch (IOException e) {
+ // MessageDialog.openInformation(null,
+ // IBugzillaConstants.TITLE_MESSAGE_DIALOG,
+ // "Could not retrieve keyword list, ensure proper configuration in " +
+ // TaskRepositoriesView.NAME
+ // + "\n\nError reported: " + e.getMessage());
+ // }
// addSelfToCCCheck = toolkit.createButton(attributesComposite, "Add
// "+repository.getUserName()+" to CC", SWT.FLAT | SWT.CHECK);
@@ -1119,41 +1127,10 @@ public abstract class AbstractBugEditor extends EditorPart {
toolkit.paintBordersFor(attributesComposite);
}
- /**
- * Adds a text field to display and edit the bug's URL attribute.
- *
- * @param url
- * The URL attribute of the bug.
- * @param attributesComposite
- * The composite to add the text field to.
- */
- protected void addUrlText(String url, Composite attributesComposite) {
- // newLayout(attributesComposite, 1, "URL:", PROPERTY);
- toolkit.createLabel(attributesComposite, "URL:");
- urlText = toolkit.createText(attributesComposite, url);
- urlText.setFont(TEXT_FONT);
- GridData urlTextData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- urlTextData.horizontalSpan = 3;
- urlTextData.widthHint = 200;
- urlText.setLayoutData(urlTextData);
- // urlText.setText(url);
- urlText.addListener(SWT.KeyUp, new Listener() {
- public void handleEvent(Event event) {
- String sel = urlText.getText();
- RepositoryTaskAttribute a = getReport().getAttribute(BugzillaReportElement.BUG_FILE_LOC.getKeyString());
- if (!(a.getValue().equals(sel))) {
- a.setValue(sel);
- changeDirtyStatus(true);
- }
- }
- });
- urlText.addListener(SWT.FocusIn, new GenericListener());
- }
-
- protected abstract void addKeywordsList(FormToolkit toolkit, String keywords, Composite attributesComposite)
- throws IOException;
-
- protected abstract void addCCList(FormToolkit toolkit, String value, Composite attributesComposite);
+// protected abstract void addKeywordsList(FormToolkit toolkit, String keywords, Composite attributesComposite)
+// throws IOException;
+//
+// protected abstract void addCCList(FormToolkit toolkit, String value, Composite attributesComposite);
/**
* Adds a text field to display and edit the bug's summary.
@@ -1164,7 +1141,7 @@ public abstract class AbstractBugEditor extends EditorPart {
protected void addSummaryText(Composite attributesComposite) {
// newLayout(attributesComposite, 1, "Summary:", PROPERTY);
toolkit.createLabel(attributesComposite, "Summary:").setFont(TITLE_FONT);
- summaryText = toolkit.createText(attributesComposite, getBug().getSummary(), SWT.FLAT);
+ summaryText = toolkit.createText(attributesComposite, getRepositoryTaskData().getSummary(), SWT.FLAT);
IThemeManager themeManager = getSite().getWorkbenchWindow().getWorkbench().getThemeManager();
Font summaryFont = themeManager.getCurrentTheme().getFontRegistry().get(REPOSITORY_TEXT_ID);
summaryText.setFont(summaryFont);
@@ -1180,7 +1157,7 @@ public abstract class AbstractBugEditor extends EditorPart {
protected void createAttachmentLayout() {
Section section = toolkit.createSection(form.getBody(), ExpandableComposite.TITLE_BAR | Section.TWISTIE);
section.setText(LABEL_SECTION_ATTACHMENTS);
- section.setExpanded(getReport().getAttachments().size() > 0);
+ section.setExpanded(getRepositoryTaskData().getAttachments().size() > 0);
section.setLayout(new GridLayout());
section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
@@ -1189,7 +1166,7 @@ public abstract class AbstractBugEditor extends EditorPart {
attachmentsComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
section.setClient(attachmentsComposite);
- if (getReport().getAttachments().size() > 0) {
+ if (getRepositoryTaskData().getAttachments().size() > 0) {
attachmentsTable = toolkit.createTable(attachmentsComposite, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION);
attachmentsTable.setLinesVisible(true);
@@ -1226,7 +1203,7 @@ public abstract class AbstractBugEditor extends EditorPart {
attachmentsTableViewer.setContentProvider(new IStructuredContentProvider() {
public Object[] getElements(Object inputElement) {
- return getReport().getAttachments().toArray();
+ return getRepositoryTaskData().getAttachments().toArray();
}
public void dispose() {
@@ -1298,7 +1275,7 @@ public abstract class AbstractBugEditor extends EditorPart {
}
});
- attachmentsTableViewer.setInput(getReport());
+ attachmentsTableViewer.setInput(getRepositoryTaskData());
} else {
toolkit.createLabel(attachmentsComposite, "No attachments");
@@ -1311,7 +1288,7 @@ public abstract class AbstractBugEditor extends EditorPart {
Button addAttachmentButton = toolkit.createButton(addAttachmentComposite, "Add an Attachment...", SWT.PUSH);
final Text fname = new Text(addAttachmentComposite, SWT.LEFT);// toolkit.createText(addAttachmentComposite,
- // "");
+ // "");
fname.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
final Composite addAttachmentInfo = toolkit.createComposite(addAttachmentComposite);
@@ -1358,10 +1335,10 @@ public abstract class AbstractBugEditor extends EditorPart {
*/
fname.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
- LocalAttachment att = getBug().getNewAttachment();
+ LocalAttachment att = getRepositoryTaskData().getNewAttachment();
if (att == null) {
att = new LocalAttachment();
- att.setReport(getBug());
+ att.setReport(getRepositoryTaskData());
}
if ("".equals(fname.getText())) {
attachmentDesc.setEnabled(false);
@@ -1372,7 +1349,7 @@ public abstract class AbstractBugEditor extends EditorPart {
attachmentComment.setEnabled(true);
}
att.setFilePath(fname.getText());
- getBug().setNewAttachment(att);
+ getRepositoryTaskData().setNewAttachment(att);
/* TODO jpound - UI for content type */
// Determine type by extension
@@ -1398,7 +1375,7 @@ public abstract class AbstractBugEditor extends EditorPart {
}
public void widgetSelected(SelectionEvent e) {
- LocalAttachment att = getBug().getNewAttachment();
+ LocalAttachment att = getRepositoryTaskData().getNewAttachment();
att.setPatch(isPatchButton.getSelection());
}
});
@@ -1409,13 +1386,227 @@ public abstract class AbstractBugEditor extends EditorPart {
* Creates the description layout, which displays and possibly edits the
* bug's description.
*/
- protected abstract void createDescriptionLayout(FormToolkit toolkit, final ScrolledForm form);
+ protected abstract void createCustomAttributeLayout(FormToolkit toolkit, final ScrolledForm form);
+
+ protected void createCommentLayout(FormToolkit toolkit, final ScrolledForm form) {
+
+ Section section = toolkit.createSection(form.getBody(), ExpandableComposite.TITLE_BAR | Section.TWISTIE);
+ section.setText(LABEL_SECTION_COMMENTS);
+ section.setExpanded(true);
+ section.setLayout(new GridLayout());
+ section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ section.addExpansionListener(new IExpansionListener() {
+ public void expansionStateChanging(ExpansionEvent e) {
+ form.reflow(true);
+ }
+
+ public void expansionStateChanged(ExpansionEvent e) {
+ form.reflow(true);
+ }
+ });
+
+ ImageHyperlink hyperlink = toolkit.createImageHyperlink(section, SWT.NONE);
+ hyperlink.setBackgroundMode(SWT.INHERIT_NONE);
+ hyperlink.setBackground(section.getTitleBarBackground());
+ hyperlink.setImage(TaskListImages.getImage(TaskListImages.EXPAND_ALL));
+ hyperlink.addHyperlinkListener(new HyperlinkAdapter() {
+ public void linkActivated(HyperlinkEvent e) {
+ revealAllComments();
+ }
+ });
+
+ section.setTextClient(hyperlink);
+
+ // Additional (read-only) Comments Area
+ Composite addCommentsComposite = toolkit.createComposite(section);
+ section.setClient(addCommentsComposite);
+ GridLayout addCommentsLayout = new GridLayout();
+ addCommentsLayout.numColumns = 1;
+ addCommentsComposite.setLayout(addCommentsLayout);
+ // addCommentsComposite.setBackground(background);
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(addCommentsComposite);
+ // End Additional (read-only) Comments Area
+
+ StyledText styledText = null;
+ for (Iterator<Comment> it = getRepositoryTaskData().getComments().iterator(); it.hasNext();) {
+ final Comment comment = it.next();
+
+ // skip comment 0 as it is the description
+ if (comment.getNumber() == 0)
+ continue;
+
+ ExpandableComposite expandableComposite = toolkit.createExpandableComposite(addCommentsComposite,
+ ExpandableComposite.TREE_NODE);
+
+ if (!it.hasNext()) {
+ expandableComposite.setExpanded(true);
+ }
+
+ expandableComposite.setText(comment.getNumber() + ": " + comment.getAuthorName() + ", "
+ + simpleDateFormat.format(comment.getCreated()));
+
+ expandableComposite.addExpansionListener(new ExpansionAdapter() {
+ public void expansionStateChanged(ExpansionEvent e) {
+ form.reflow(true);
+ }
+ });
+
+ expandableComposite.setLayout(new GridLayout());
+ expandableComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ Composite ecComposite = toolkit.createComposite(expandableComposite);
+ GridLayout ecLayout = new GridLayout();
+ ecLayout.marginHeight = 0;
+ ecLayout.marginBottom = 10;
+ ecLayout.marginLeft = 10;
+ ecComposite.setLayout(ecLayout);
+ ecComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ expandableComposite.setClient(ecComposite);
+ // toolkit.paintBordersFor(expandableComposite);
+
+ // TODO: Attachments are no longer 'attached' to Comments
+
+ // if (comment.hasAttachment()) {
+ //
+ // Link attachmentLink = new Link(ecComposite, SWT.NONE);
+ //
+ // String attachmentHeader;
+ //
+ // if (!comment.isObsolete()) {
+ // attachmentHeader = " Attached: " +
+ // comment.getAttachmentDescription() + " [<a>view</a>]";
+ // } else {
+ // attachmentHeader = " Deprecated: " +
+ // comment.getAttachmentDescription();
+ // }
+ // // String result = MessageFormat.format(attachmentHeader, new
+ // // String[] { node
+ // // .getLabelText() });
+ //
+ // attachmentLink.addSelectionListener(new SelectionAdapter() {
+ // /*
+ // * (non-Javadoc)
+ // *
+ // * @see
+ // org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ // */
+ // public void widgetSelected(SelectionEvent e) {
+ // String address = repository.getUrl() + "/attachment.cgi?id=" +
+ // comment.getAttachmentId()
+ // + "&amp;action=view";
+ // TaskUiUtil.openUrl(address, address, address);
+ //
+ // }
+ // });
+ //
+ // attachmentLink.setText(attachmentHeader);
+ //
+ // }
+
+ TextViewer viewer = addRepositoryText(repository, ecComposite, comment.getText());
+ styledText = viewer.getTextWidget();
+ GridDataFactory.fillDefaults().hint(DESCRIPTION_WIDTH, SWT.DEFAULT).applyTo(styledText);
+
+
+ // code for outline
+ commentStyleText.add(styledText);
+ texts.add(textsindex, styledText);
+ textHash.put(comment, styledText);
+ textsindex++;
+ }
+
+ Section sectionAdditionalComments = toolkit.createSection(form.getBody(), ExpandableComposite.TITLE_BAR
+ | Section.TWISTIE);
+ sectionAdditionalComments.setText(LABEL_SECTION_NEW_COMMENT);
+ sectionAdditionalComments.setExpanded(true);
+
+ sectionAdditionalComments.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ sectionAdditionalComments.addExpansionListener(new IExpansionListener() {
+ public void expansionStateChanging(ExpansionEvent e) {
+ form.reflow(true);
+ }
+
+ public void expansionStateChanged(ExpansionEvent e) {
+ form.reflow(true);
+ }
+ });
+
+ Composite newCommentsComposite = toolkit.createComposite(sectionAdditionalComments);
+ newCommentsComposite.setLayout(new GridLayout());
+ newCommentsComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ addCommentsText = toolkit.createText(newCommentsComposite, getRepositoryTaskData().getNewComment(), SWT.MULTI | SWT.V_SCROLL
+ | SWT.WRAP);
+
+ IThemeManager themeManager = getSite().getWorkbenchWindow().getWorkbench().getThemeManager();
+ Font newCommnetFont = themeManager.getCurrentTheme().getFontRegistry().get(REPOSITORY_TEXT_ID);
+ addCommentsText.setFont(newCommnetFont);
+ toolkit.paintBordersFor(newCommentsComposite);
+ GridData addCommentsTextData = new GridData(GridData.FILL_HORIZONTAL);
+ addCommentsTextData.widthHint = DESCRIPTION_WIDTH;
+ addCommentsTextData.heightHint = DESCRIPTION_HEIGHT;
+ addCommentsTextData.grabExcessHorizontalSpace = true;
+
+ addCommentsText.setLayoutData(addCommentsTextData);
+
+ addCommentsText.addListener(SWT.KeyUp, new Listener() {
+
+ public void handleEvent(Event event) {
+ String sel = addCommentsText.getText();
+ if (!(getRepositoryTaskData().getNewComment().equals(sel))) {
+ getRepositoryTaskData().setNewComment(sel);
+ changeDirtyStatus(true);
+ }
+ validateInput();
+ }
+ });
+ addCommentsText.addListener(SWT.FocusIn, new NewCommentListener());
+ addCommentsTextBox = addCommentsText;
+
+ sectionAdditionalComments.setClient(newCommentsComposite);
+
+// TODO: move into ExistingBugEditor commands section
+// // if they aren't already on the cc list create an add self check box
+//
+// RepositoryTaskAttribute owner = getReport().getAttribute(RepositoryTaskAttribute.USER_ASSIGNED);
+//
+// // Don't add addselfcc check box if the user is the bug owner
+// if (owner != null && owner.getValue().indexOf(repository.getUserName()) != -1) {
+// return;
+// }
+// // Don't add addselfcc if already there
+// RepositoryTaskAttribute ccAttribute = getReport().getAttribute(RepositoryTaskAttribute.USER_CC);
+// if (ccAttribute != null && ccAttribute.getValues().contains(repository.getUserName())) {
+// return;
+// }
+// RepositoryTaskAttribute addselfcc = getReport().getAttribute(BugzillaReportElement.ADDSELFCC.getKeyString());
+// if (addselfcc == null) {
+// // addselfcc =
+// // BugzillaRepositoryUtil.makeNewAttribute(BugzillaReportElement.ADDSELFCC);
+// getReport().setAttributeValue(BugzillaReportElement.ADDSELFCC.getKeyString(), "0");
+// } else {
+// addselfcc.setValue("0");
+// }
+//
+// final Button addSelfButton = toolkit.createButton(newCommentsComposite, "Add " + repository.getUserName()
+// + " to CC list", SWT.CHECK);
+//
+// addSelfButton.addSelectionListener(new SelectionAdapter() {
+//
+// @Override
+// public void widgetSelected(SelectionEvent e) {
+// if (addSelfButton.getSelection()) {
+// getReport().setAttributeValue(BugzillaReportElement.ADDSELFCC.getKeyString(), "1");
+// // connector.getAttributeFactory().setAttributeValue(getReport(),
+// // BugzillaReportElement.ADDSELFCC.getKeyString(), "1");
+// } else {
+// getReport().setAttributeValue(BugzillaReportElement.ADDSELFCC.getKeyString(), "0");
+// }
+// }
+// });
+ }
+
+ protected abstract void validateInput();
- /**
- * Creates the comment layout, which displays the bug's comments and
- * possibly lets the user enter a new one.
- */
- protected abstract void createCommentLayout(FormToolkit toolkit, final ScrolledForm form);
/**
* Creates the button layout. This displays options and buttons at the
@@ -1472,7 +1663,8 @@ public abstract class AbstractBugEditor extends EditorPart {
submitButton = toolkit.createButton(buttonComposite, LABEL_BUTTON_SUBMIT, SWT.NONE);
// submitButton.setFont(TEXT_FONT);
GridData submitButtonData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- // submitButtonData.widthHint = AbstractBugEditor.WRAP_LENGTH;
+ // submitButtonData.widthHint =
+ // AbstractRepositoryTaskEditor.WRAP_LENGTH;
// submitButtonData.heightHint = 20;
submitButton.setLayoutData(submitButtonData);
@@ -1710,11 +1902,26 @@ public abstract class AbstractBugEditor extends EditorPart {
public void saveBug() {
try {
updateBug();
- // IBugzillaBug bug = getBug();
- final BugzillaRepositoryConnector bugzillaRepositoryClient = (BugzillaRepositoryConnector) MylarTaskListPlugin
- .getRepositoryManager().getRepositoryConnector(BugzillaPlugin.REPOSITORY_KIND);
- bugzillaRepositoryClient.saveBugReport((RepositoryTaskData) getReport());
+ final AbstractRepositoryConnector bugzillaRepositoryClient = (AbstractRepositoryConnector) MylarTaskListPlugin
+ .getRepositoryManager().getRepositoryConnector(getRepositoryTaskData().getRepositoryKind());
+
+ IEditorInput input = this.getEditorInput();
+ if (input instanceof ExistingBugEditorInput) {
+ ExistingBugEditorInput existingInput = (ExistingBugEditorInput) input;
+ AbstractRepositoryTask repositoryTask = existingInput.getRepositoryTask();
+ // AbstractRepositoryTask repositoryTask = getRepositoryTask();
+ if (repositoryTask != null) {
+ if (getRepositoryTaskData().hasChanges()) {
+ repositoryTask.setSyncState(RepositoryTaskSyncState.OUTGOING);
+ } else {
+ repositoryTask.setSyncState(RepositoryTaskSyncState.SYNCHRONIZED);
+ }
+ MylarTaskListPlugin.getTaskListManager().getTaskList().notifyRepositoryInfoChanged(repositoryTask);
+ }
+ }
+
+ bugzillaRepositoryClient.saveOffline(getRepositoryTaskData());
changeDirtyStatus(false);
if (parentEditor != null) {
parentEditor.notifyTaskChanged();
@@ -1731,11 +1938,11 @@ public abstract class AbstractBugEditor extends EditorPart {
*/
protected abstract void updateBug();
- /**
- * Resets the data fields to contain the data currently in the
- * <code>IBugzillaBug</code> object.
- */
- protected abstract void restoreBug();
+// /**
+// * Resets the data fields to contain the data currently in the
+// * <code>IBugzillaBug</code> object.
+// */
+// protected abstract void restoreBug();
/**
* Refreshes any text labels in the editor that contain information that
@@ -1783,7 +1990,7 @@ public abstract class AbstractBugEditor extends EditorPart {
* the title.
*/
protected void updateEditorTitle() {
- setPartName(bugzillaInput.getName());
+ setPartName(editorInput.getName());
}
@Override
@@ -1825,7 +2032,7 @@ public abstract class AbstractBugEditor extends EditorPart {
// Attribute attribute = getBug().getAttribute(comboListenerMap.get(combo));
// if (sel != null && !(sel.equals(attribute.getNewValue()))) {
// attribute.setNewValue(sel);
- // for (IBugzillaAttributeListener client : attributesListeners) {
+ // for (IRepositoryTaskAttributeListener client : attributesListeners) {
// client.attributeChanged(attribute.getName(), sel);
// }
// changeDirtyStatus(true);
@@ -1858,11 +2065,11 @@ public abstract class AbstractBugEditor extends EditorPart {
* A generic listener for selection of unimportant items. The default
* selection item sent out is the entire bug object.
*/
- protected class GenericListener implements Listener {
+ public class GenericListener implements Listener {
public void handleEvent(Event event) {
- RepositoryTaskData bug = (RepositoryTaskData) getReport();
+ RepositoryTaskData bug = (RepositoryTaskData) getRepositoryTaskData();
fireSelectionChanged(new SelectionChangedEvent(selectionProvider, new StructuredSelection(
- new BugzillaReportSelection(bug.getId(), bug.getRepositoryUrl(), bug.getLabel(), false, bug
+ new RepositoryTaskSelection(bug.getId(), bug.getRepositoryUrl(), bug.getLabel(), false, bug
.getSummary()))));
}
}
@@ -1879,7 +2086,14 @@ public abstract class AbstractBugEditor extends EditorPart {
/**
* Check if the summary field was modified, and update it if necessary.
*/
- public abstract void handleSummaryEvent();
+ public void handleSummaryEvent() {
+ String sel = summaryText.getText();
+ RepositoryTaskAttribute a = getRepositoryTaskData().getAttribute(RepositoryTaskAttribute.SUMMARY);
+ if (!(a.getValue().equals(sel))) {
+ a.setValue(sel);
+ changeDirtyStatus(true);
+ }
+ }
/*----------------------------------------------------------*
* CODE TO SCROLL TO A COMMENT OR OTHER PIECE OF TEXT
@@ -1962,7 +2176,7 @@ public abstract class AbstractBugEditor extends EditorPart {
public void selectDescription() {
for (Object o : textHash.keySet()) {
- if (o.equals(bugzillaInput.getBug().getDescription())) {
+ if (o.equals(editorInput.getRepositoryTaskData().getDescription())) {
select(o, true);
}
}
@@ -2020,24 +2234,24 @@ public abstract class AbstractBugEditor extends EditorPart {
form.setOrigin(0, pos);
}
- private BugzillaOutlinePage outlinePage = null;
+ private RepositoryTaskOutlinePage outlinePage = null;
@Override
public Object getAdapter(Class adapter) {
if (IContentOutlinePage.class.equals(adapter)) {
- if (outlinePage == null && bugzillaInput != null) {
- outlinePage = new BugzillaOutlinePage(bugzillaOutlineModel);
+ if (outlinePage == null && editorInput != null) {
+ outlinePage = new RepositoryTaskOutlinePage(bugzillaOutlineModel);
}
return outlinePage;
}
return super.getAdapter(adapter);
}
- public BugzillaOutlineNode getOutlineModel() {
+ public RepositoryTaskOutlineNode getOutlineModel() {
return bugzillaOutlineModel;
}
- public BugzillaOutlinePage getOutline() {
+ public RepositoryTaskOutlinePage getOutline() {
return outlinePage;
}
@@ -2051,21 +2265,21 @@ public abstract class AbstractBugEditor extends EditorPart {
Display activeDisplay = getSite().getShell().getDisplay();
activeDisplay.asyncExec(new Runnable() {
public void run() {
- if (getSite() != null && getSite().getPage() != null && !AbstractBugEditor.this.isDisposed())
+ if (getSite() != null && getSite().getPage() != null && !AbstractRepositoryTaskEditor.this.isDisposed())
if (parentEditor != null) {
getSite().getPage().closeEditor(parentEditor, false);
} else {
- getSite().getPage().closeEditor(AbstractBugEditor.this, false);
+ getSite().getPage().closeEditor(AbstractRepositoryTaskEditor.this, false);
}
}
});
}
- public void addAttributeListener(IBugzillaAttributeListener listener) {
+ public void addAttributeListener(IRepositoryTaskAttributeListener listener) {
attributesListeners.add(listener);
}
- public void removeAttributeListener(IBugzillaAttributeListener listener) {
+ public void removeAttributeListener(IRepositoryTaskAttributeListener listener) {
attributesListeners.remove(listener);
}
@@ -2073,13 +2287,25 @@ public abstract class AbstractBugEditor extends EditorPart {
this.parentEditor = parentEditor;
}
- public BugzillaOutlineNode getBugzillaOutlineModel() {
+ public RepositoryTaskOutlineNode getBugzillaOutlineModel() {
return bugzillaOutlineModel;
}
- public void setBugzillaOutlineModel(BugzillaOutlineNode bugzillaOutlineModel) {
+ public void setBugzillaOutlineModel(RepositoryTaskOutlineNode bugzillaOutlineModel) {
this.bugzillaOutlineModel = bugzillaOutlineModel;
}
+
+ /**
+ * A listener for selection of the textbox where a new comment is entered
+ * in.
+ */
+ protected class NewCommentListener implements Listener {
+ public void handleEvent(Event event) {
+ fireSelectionChanged(new SelectionChangedEvent(selectionProvider, new StructuredSelection(
+ new RepositoryTaskSelection(getRepositoryTaskData().getId(), getRepositoryTaskData().getRepositoryUrl(), "New Comment", false,
+ getRepositoryTaskData().getSummary()))));
+ }
+ }
// private void addHyperlinks(final StyledText styledText, Composite
// composite) {
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/ExistingBugEditorInput.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/ExistingBugEditorInput.java
new file mode 100644
index 000000000..3c4a57ca9
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/ExistingBugEditorInput.java
@@ -0,0 +1,195 @@
+/*******************************************************************************
+ * Copyright (c) 2003 - 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.tasklist.ui.editors;
+
+import java.io.IOException;
+import java.net.Proxy;
+import java.security.GeneralSecurityException;
+
+import org.eclipse.mylar.internal.core.util.MylarStatusHandler;
+import org.eclipse.mylar.internal.tasklist.OfflineTaskManager;
+import org.eclipse.mylar.internal.tasklist.RepositoryTaskData;
+import org.eclipse.mylar.provisional.tasklist.AbstractRepositoryTask;
+import org.eclipse.mylar.provisional.tasklist.ITask;
+import org.eclipse.mylar.provisional.tasklist.MylarTaskListPlugin;
+import org.eclipse.mylar.provisional.tasklist.TaskRepository;
+
+/**
+ * The <code>IEditorInput</code> implementation for
+ * <code>ExistingBugEditor</code>.
+ *
+ * @author Mik Kersten
+ * @author Rob Elves
+ */
+public class ExistingBugEditorInput extends AbstractBugEditorInput {
+
+ private TaskRepository repository;
+
+ protected int bugId;
+ protected AbstractRepositoryTask repositoryTask;
+ protected RepositoryTaskData repositoryTaskData;
+
+ // Called for new bug reports
+ public ExistingBugEditorInput(TaskRepository repository, RepositoryTaskData bug) {
+ this.repositoryTaskData = bug;
+ this.bugId = bug.getId();
+ this.repository = repository;
+ }
+
+
+// public ExistingBugEditorInput(TaskRepository repository, AbstractRepositoryTask task) throws IOException, GeneralSecurityException {
+// this.repositoryTask = task;
+// this.repository = repository;
+// this.repositoryTaskData = task.getTaskData();
+// //bug = BugzillaRepositoryUtil.getBug(repository.getUrl(), repository.getUserName(), repository.getPassword(), proxySettings, repository.getCharacterEncoding(), bugId);
+// }
+
+ public ExistingBugEditorInput(TaskRepository repository, int bugId) throws IOException, GeneralSecurityException {
+ this.bugId = bugId;
+ this.repository = repository;
+ this.repositoryTaskData = getOfflineTaskData(repository, proxySettings, bugId);
+
+
+ String handle = AbstractRepositoryTask.getHandle(repository.getUrl(), bugId);
+ ITask task = MylarTaskListPlugin.getTaskListManager().getTaskList().getTask(handle);
+ if(task != null && task instanceof AbstractRepositoryTask) {
+ this.repositoryTask = (AbstractRepositoryTask)task;
+ } else {
+ MylarStatusHandler.log("Could not locate repository task", this);
+ }
+
+
+
+ //bug = BugzillaRepositoryUtil.getBug(repository.getUrl(), repository.getUserName(), repository.getPassword(), proxySettings, repository.getCharacterEncoding(), bugId);
+ }
+
+ public AbstractRepositoryTask getRepositoryTask() {
+ return repositoryTask;
+ }
+
+ @Override
+ public RepositoryTaskData getRepositoryTaskData() {
+ return repositoryTaskData;
+ }
+// public ExistingBugEditorInput(TaskRepository repository, int bugId, boolean offline) throws IOException, GeneralSecurityException {
+// this.bugId = bugId;
+// this.repository = repository;
+// this.repositoryTaskData = getOfflineTaskData(repository, proxySettings, bugId);
+// // if (!offline) {
+// // try {
+// // bug = BugzillaRepositoryUtil.getBug(repository.getUrl(),
+// // repository.getUserName(), repository.getPassword(), proxySettings,
+// // repository.getCharacterEncoding(), bugId);
+// // } catch (IOException e) {
+// // bug = getCurrentBug(repository, proxySettings, bugId);
+// // // IWorkbench workbench = PlatformUI.getWorkbench();
+// // // workbench.getDisplay().asyncExec(new Runnable() {
+// // // public void run() {
+// // // MessageDialog.openInformation(
+// // // Display.getDefault().getActiveShell(),
+// // // "Mylar Bugzilla Client",
+// // // "Unable to download bug report, using offline copy.");
+// // //
+// // // }
+// // // });
+// // }
+// // } else {
+// // bug = getCurrentBug(repository, proxySettings, bugId);
+// // }
+// }
+
+ // TODO: move?
+ private RepositoryTaskData getOfflineTaskData(final TaskRepository repository, Proxy proxySettings, final int id)
+ throws IOException, GeneralSecurityException {
+ RepositoryTaskData result = null;
+ // Look among the offline reports for a bug with the given id.
+ OfflineTaskManager reportsFile = MylarTaskListPlugin.getDefault().getOfflineReportsFile();
+ if (reportsFile != null) {
+ int offlineId = reportsFile.find(repository.getUrl(), id);
+ // If an offline bug was found, return it if possible.
+ if (offlineId != -1) {
+ RepositoryTaskData bug = reportsFile.elements().get(offlineId);
+ if (bug instanceof RepositoryTaskData) {
+ result = (RepositoryTaskData) bug;
+ }
+ }
+ }
+
+ // If a suitable offline report was not found, get it from the server
+// if(result == null) {
+// try {
+// result = BugzillaRepositoryUtil.getBug(repository.getUrl(), repository.getUserName(), repository.getPassword(), proxySettings, repository.getCharacterEncoding(), id);
+// } catch (final LoginException e) {
+// PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+// public void run() {
+// MessageDialog.openError(Display.getDefault().getActiveShell(), "Report Download Failed",
+// "Ensure proper repository configuration of " + repository.getUrl() + " in "
+// + TaskRepositoriesView.NAME + ".");
+// }
+// });
+// } catch (final UnrecognizedBugzillaError e) {
+// PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+// public void run() {
+// WebBrowserDialog.openAcceptAgreement(null, "Report Download Failed", "Unrecognized response from "
+// + repository.getUrl(), e.getMessage());
+// }
+// });
+// } catch (final Exception e) {
+// if (PlatformUI.getWorkbench() != null && !PlatformUI.getWorkbench().isClosing()) {
+// PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+// public void run() {
+// if (e instanceof FileNotFoundException) {
+// MessageDialog.openError(PlatformUI.getWorkbench().getDisplay().getActiveShell(), "Report Download Failed",
+// "Resource not found: " + e.getMessage());
+//
+// } else {
+// MessageDialog.openError(PlatformUI.getWorkbench().getDisplay().getActiveShell(), "Report Download Failed",
+// "Report "+id+" did not download correctly from " + repository.getUrl());
+//
+// }
+// }
+// });
+// }
+// }
+// }
+ return result;
+ }
+
+ public String getName() {
+ return repositoryTaskData.getLabel();
+ }
+
+ /**
+ * @return The id of the bug for this editor input.
+ */
+ public int getBugId() {
+ return bugId;
+ }
+
+
+ /**
+ * @return <code>true</code> if the argument is a bug report editor input
+ * on the same bug id.
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (o instanceof ExistingBugEditorInput) {
+ ExistingBugEditorInput input = (ExistingBugEditorInput) o;
+ return getBugId() == input.getBugId();
+ }
+ return false;
+ }
+
+ public TaskRepository getRepository() {
+ return repository;
+ }
+
+}
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaAttributeListener.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/IRepositoryTaskAttributeListener.java
index 66802b7bc..199926120 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaAttributeListener.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/IRepositoryTaskAttributeListener.java
@@ -9,11 +9,11 @@
* University Of British Columbia - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylar.internal.bugzilla.core;
+package org.eclipse.mylar.internal.tasklist.ui.editors;
/**
* @author Ken Sueda
*/
-public interface IBugzillaAttributeListener {
+public interface IRepositoryTaskAttributeListener {
public abstract void attributeChanged(String attribute, String value);
}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/IBugzillaReportSelection.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/IRepositoryTaskSelection.java
index 69b564f37..09825e830 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/IBugzillaReportSelection.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/IRepositoryTaskSelection.java
@@ -9,7 +9,7 @@
* University Of British Columbia - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylar.internal.bugzilla.ui;
+package org.eclipse.mylar.internal.tasklist.ui.editors;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.mylar.internal.tasklist.Comment;
@@ -17,7 +17,7 @@ import org.eclipse.mylar.internal.tasklist.Comment;
/**
* Interface for a selection of a Bugzilla element in a view.
*/
-public interface IBugzillaReportSelection extends ISelection {
+public interface IRepositoryTaskSelection extends ISelection {
/**
* @return <code>true</code> if a comment was selected.
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaTools.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/OutlineTools.java
index bb7fd3a5f..55fdeb523 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaTools.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/OutlineTools.java
@@ -8,14 +8,11 @@
* Contributors:
* University Of British Columbia - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylar.internal.bugzilla.ui;
+package org.eclipse.mylar.internal.tasklist.ui.editors;
import org.eclipse.mylar.internal.tasklist.RepositoryTaskData;
-/**
- * Miscellaneous constants and functions for this plugin.
- */
-public class BugzillaTools {
+public class OutlineTools {
/** The default string used for locally created bugs. */
public static final String OFFLINE_SERVER_DEFAULT = "[local]";
@@ -28,7 +25,7 @@ public class BugzillaTools {
* The bugzilla selection.
* @return The handle for the bugzilla selection.
*/
- public static String getHandle(IBugzillaReportSelection bugSel) {
+ public static String getHandle(IRepositoryTaskSelection bugSel) {
String handle = bugSel.getServer() + ";" + bugSel.getId();
if (bugSel.hasComment()) {
int number = bugSel.getComment().getNumber() + 1;
@@ -41,7 +38,7 @@ public class BugzillaTools {
return handle;
}
- public static String getName(IBugzillaReportSelection bugSel) {
+ public static String getName(IRepositoryTaskSelection bugSel) {
String name = bugSel.getServer() + ": Bug#: " + bugSel.getId() + ": " + bugSel.getBugSummary();
if (bugSel.hasComment()) {
name += " : Comment#: " + bugSel.getComment().getNumber();
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaEditorCopyAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/RepositoryTaskEditorCopyAction.java
index bd8b6db5a..322ac2af4 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaEditorCopyAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/RepositoryTaskEditorCopyAction.java
@@ -9,26 +9,26 @@
* University Of British Columbia - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylar.internal.bugzilla.ui.editor;
+package org.eclipse.mylar.internal.tasklist.ui.editors;
import org.eclipse.jface.action.Action;
/**
* Action used to copy selected text from a bug editor to the clipboard.
*/
-public class BugzillaEditorCopyAction extends Action {
+public class RepositoryTaskEditorCopyAction extends Action {
/** The editor to copy text selections from. */
- private AbstractBugEditor bugEditor;
+ private AbstractRepositoryTaskEditor bugEditor;
/**
- * Creates a new <code>BugzillaEditorCopyAction</code>.
+ * Creates a new <code>RepositoryTaskEditorCopyAction</code>.
*
* @param editor
* The editor that this action is copying text selections from.
*/
- public BugzillaEditorCopyAction(AbstractBugEditor editor) {
+ public RepositoryTaskEditorCopyAction(AbstractRepositoryTaskEditor editor) {
bugEditor = editor;
- setText("AbstractBugEditor.copy.text");
+ setText("AbstractRepositoryTaskEditor.copy.text");
}
@Override
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/RepositoryTaskOutlineComparer.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/RepositoryTaskOutlineComparer.java
new file mode 100644
index 000000000..b9f6405e2
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/RepositoryTaskOutlineComparer.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * 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.tasklist.ui.editors;
+
+import org.eclipse.jface.viewers.IElementComparer;
+
+/**
+ * This class is used to compare two <code>IRepositoryTaskSelection</code>
+ * objects.
+ *
+ * @see IElementComparer
+ * @see IRepositoryTaskSelection
+ */
+public class RepositoryTaskOutlineComparer implements IElementComparer {
+
+ public boolean equals(Object a, Object b) {
+ if ((a instanceof IRepositoryTaskSelection) && (b instanceof IRepositoryTaskSelection)) {
+ IRepositoryTaskSelection s1 = (IRepositoryTaskSelection) a;
+ IRepositoryTaskSelection s2 = (IRepositoryTaskSelection) b;
+
+ // An IRepositoryTaskSelection is uniquely defined by its handle and
+ // its contents
+ return ((OutlineTools.getHandle(s1).equals(OutlineTools.getHandle(s2))) && ((s1.getContents() == null) ? (s2
+ .getContents() == null)
+ : s1.getContents().equals(s2.getContents())));
+ }
+ return a.equals(b);
+ }
+
+ public int hashCode(Object element) {
+ if (element instanceof IRepositoryTaskSelection) {
+ IRepositoryTaskSelection sel = (IRepositoryTaskSelection) element;
+
+ // An IRepositoryTaskSelection is uniquely defined by its handle and
+ // its contents
+ return (OutlineTools.getHandle(sel) + sel.getContents()).hashCode();
+ }
+ return element.hashCode();
+ }
+}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaOutlineNode.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/RepositoryTaskOutlineNode.java
index e52238989..562e4b923 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaOutlineNode.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/RepositoryTaskOutlineNode.java
@@ -8,24 +8,22 @@
* Contributors:
* University Of British Columbia - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylar.internal.bugzilla.ui.editor;
+package org.eclipse.mylar.internal.tasklist.ui.editors;
import java.util.ArrayList;
import java.util.Iterator;
-import org.eclipse.mylar.internal.bugzilla.core.NewBugzillaReport;
-import org.eclipse.mylar.internal.bugzilla.ui.BugzillaImages;
-import org.eclipse.mylar.internal.bugzilla.ui.IBugzillaReportSelection;
-import org.eclipse.mylar.internal.tasklist.RepositoryTaskData;
import org.eclipse.mylar.internal.tasklist.Comment;
+import org.eclipse.mylar.internal.tasklist.RepositoryTaskData;
+import org.eclipse.mylar.internal.tasklist.ui.TaskListImages;
import org.eclipse.swt.graphics.Image;
/**
- * A node for the tree in the <code>BugzillaOutlinePage</code>.
+ * A node for the tree in the <code>RepositoryTaskOutlinePage</code>.
*
* @author Mik Kersten (hardening of prototype)
*/
-public class BugzillaOutlineNode implements IBugzillaReportSelection {
+public class RepositoryTaskOutlineNode implements IRepositoryTaskSelection {
/** The id of the Bugzilla object that the selection was on. */
protected int id;
@@ -37,10 +35,10 @@ public class BugzillaOutlineNode implements IBugzillaReportSelection {
private String key;
/** The children of this node. */
- private ArrayList<BugzillaOutlineNode> nodeChildren;
+ private ArrayList<RepositoryTaskOutlineNode> nodeChildren;
/** The parent of this node or null if it is the bug report */
- private BugzillaOutlineNode parent;
+ private RepositoryTaskOutlineNode parent;
/** This node's image. */
private Image image;
@@ -56,7 +54,7 @@ public class BugzillaOutlineNode implements IBugzillaReportSelection {
private boolean isDescription = false;
/**
- * Creates a new <code>BugzillaOutlineNode</code>.
+ * Creates a new <code>RepositoryTaskOutlineNode</code>.
*
* @param id
* The id of the bug this outline is for.
@@ -71,7 +69,7 @@ public class BugzillaOutlineNode implements IBugzillaReportSelection {
* @param parent
* The parent of this node
*/
- public BugzillaOutlineNode(int id, String server, String key, Image image, Object data, String summary) {
+ public RepositoryTaskOutlineNode(int id, String server, String key, Image image, Object data, String summary) {
this.id = id;
this.server = server;
this.key = key;
@@ -90,9 +88,9 @@ public class BugzillaOutlineNode implements IBugzillaReportSelection {
* @return The children of this node, represented as an <code>Object</code>
* array.
*/
- public BugzillaOutlineNode[] getChildren() {
- return (nodeChildren == null) ? new BugzillaOutlineNode[0] : nodeChildren
- .toArray(new BugzillaOutlineNode[nodeChildren.size()]);
+ public RepositoryTaskOutlineNode[] getChildren() {
+ return (nodeChildren == null) ? new RepositoryTaskOutlineNode[0] : nodeChildren
+ .toArray(new RepositoryTaskOutlineNode[nodeChildren.size()]);
}
/**
@@ -101,9 +99,9 @@ public class BugzillaOutlineNode implements IBugzillaReportSelection {
* @param bugNode
* The new child.
*/
- public void addChild(BugzillaOutlineNode bugNode) {
+ public void addChild(RepositoryTaskOutlineNode bugNode) {
if (nodeChildren == null) {
- nodeChildren = new ArrayList<BugzillaOutlineNode>();
+ nodeChildren = new ArrayList<RepositoryTaskOutlineNode>();
}
bugNode.setParent(this);
nodeChildren.add(bugNode);
@@ -147,8 +145,8 @@ public class BugzillaOutlineNode implements IBugzillaReportSelection {
*/
@Override
public boolean equals(Object arg0) {
- if (arg0 instanceof BugzillaOutlineNode) {
- BugzillaOutlineNode bugNode = (BugzillaOutlineNode) arg0;
+ if (arg0 instanceof RepositoryTaskOutlineNode) {
+ RepositoryTaskOutlineNode bugNode = (RepositoryTaskOutlineNode) arg0;
return getKey().equals(bugNode.getKey());
}
return super.equals(arg0);
@@ -185,87 +183,90 @@ public class BugzillaOutlineNode implements IBugzillaReportSelection {
/**
* Parses the given <code>IBugzillaBug</code> into a tree of
- * <code>BugzillaOutlineNode</code>'s suitable for use in the
- * <code>BugzillaOutlinePage</code> view.
+ * <code>RepositoryTaskOutlineNode</code>'s suitable for use in the
+ * <code>RepositoryTaskOutlinePage</code> view.
*
* @param bug
* The bug that needs parsing.
- * @return The tree of <code>BugzillaOutlineNode</code>'s.
+ * @return The tree of <code>RepositoryTaskOutlineNode</code>'s.
*/
- public static BugzillaOutlineNode parseBugReport(RepositoryTaskData bug) {
+ public static RepositoryTaskOutlineNode parseBugReport(RepositoryTaskData bug) {
// Choose the appropriate parsing function based on
// the type of IBugzillaBug.
- if (bug instanceof NewBugzillaReport) {
- return parseNewBugReport((NewBugzillaReport) bug);
- } else if (bug instanceof RepositoryTaskData) {
+// if (bug instanceof NewBugzillaReport) {
+// return parseNewBugReport((NewBugzillaReport) bug);
+// } else
+ if (bug instanceof RepositoryTaskData) {
return parseExistingBugReport((RepositoryTaskData) bug);
} else {
return null;
}
}
- /**
- * Parses the given <code>NewBugModel</code> into a tree of
- * <code>BugzillaOutlineNode</code>'s suitable for use in the
- * <code>BugzillaOutlinePage</code> view.
- *
- * @param bug
- * The <code>NewBugModel</code> that needs parsing.
- * @return The tree of <code>BugzillaOutlineNode</code>'s.
- */
- protected static BugzillaOutlineNode parseNewBugReport(NewBugzillaReport bug) {
- int bugId = bug.getId();
- String bugServer = bug.getRepositoryUrl();
- Image bugImage = BugzillaImages.getImage(BugzillaImages.BUG);
- Image defaultImage = BugzillaImages.getImage(BugzillaImages.BUG_COMMENT);
- BugzillaOutlineNode topNode = new BugzillaOutlineNode(bugId, bugServer, bug.getLabel(), bugImage, bug, bug
- .getSummary());
-
- topNode.addChild(new BugzillaOutlineNode(bugId, bugServer, "New Description", defaultImage, null, bug
- .getSummary()));
-
- BugzillaOutlineNode titleNode = new BugzillaOutlineNode(bugId, bugServer, "NewBugModel Object", defaultImage,
- null, bug.getSummary());
- titleNode.addChild(topNode);
-
- return titleNode;
- }
+// /**
+// * Parses the given <code>NewBugModel</code> into a tree of
+// * <code>RepositoryTaskOutlineNode</code>'s suitable for use in the
+// * <code>RepositoryTaskOutlinePage</code> view.
+// *
+// * @param bug
+// * The <code>NewBugModel</code> that needs parsing.
+// * @return The tree of <code>RepositoryTaskOutlineNode</code>'s.
+// */
+// protected static RepositoryTaskOutlineNode parseNewBugReport(NewBugzillaReport bug) {
+// int bugId = bug.getId();
+// String bugServer = bug.getRepositoryUrl();
+// Image bugImage = BugzillaImages.getImage(BugzillaImages.BUG);
+// Image defaultImage = BugzillaImages.getImage(BugzillaImages.BUG_COMMENT);
+// RepositoryTaskOutlineNode topNode = new RepositoryTaskOutlineNode(bugId, bugServer, bug.getLabel(), bugImage, bug, bug
+// .getSummary());
+//
+// topNode.addChild(new RepositoryTaskOutlineNode(bugId, bugServer, "New Description", defaultImage, null, bug
+// .getSummary()));
+//
+// RepositoryTaskOutlineNode titleNode = new RepositoryTaskOutlineNode(bugId, bugServer, "NewBugModel Object", defaultImage,
+// null, bug.getSummary());
+// titleNode.addChild(topNode);
+//
+// return titleNode;
+// }
/**
* Parses the given <code>BugReport</code> into a tree of
- * <code>BugzillaOutlineNode</code>'s suitable for use in the
- * <code>BugzillaOutlinePage</code> view.
+ * <code>RepositoryTaskOutlineNode</code>'s suitable for use in the
+ * <code>RepositoryTaskOutlinePage</code> view.
*
* @param bug
* The <code>BugReport</code> that needs parsing.
- * @return The tree of <code>BugzillaOutlineNode</code>'s.
+ * @return The tree of <code>RepositoryTaskOutlineNode</code>'s.
*/
- protected static BugzillaOutlineNode parseExistingBugReport(RepositoryTaskData bug) {
+ protected static RepositoryTaskOutlineNode parseExistingBugReport(RepositoryTaskData bug) {
int bugId = bug.getId();
String bugServer = bug.getRepositoryUrl();
- Image bugImage = BugzillaImages.getImage(BugzillaImages.BUG);
- Image defaultImage = BugzillaImages.getImage(BugzillaImages.BUG_COMMENT);
- BugzillaOutlineNode topNode = new BugzillaOutlineNode(bugId, bugServer, bug.getLabel(), bugImage, bug, bug
+ Image bugImage = TaskListImages.getImage(TaskListImages.TASK_REMOTE);
+ //MylarTaskListPlugin.getDefault().BugzillaImages.getImage(BugzillaImages.BUG);
+ Image defaultImage = TaskListImages.getImage(TaskListImages.TASK_NOTES);
+ //BugzillaImages.getImage(BugzillaImages.BUG_COMMENT);
+ RepositoryTaskOutlineNode topNode = new RepositoryTaskOutlineNode(bugId, bugServer, bug.getLabel(), bugImage, bug, bug
.getSummary());
- BugzillaOutlineNode desc = new BugzillaOutlineNode(bugId, bugServer, "Description", defaultImage, bug
+ RepositoryTaskOutlineNode desc = new RepositoryTaskOutlineNode(bugId, bugServer, "Description", defaultImage, bug
.getDescription(), bug.getSummary());
desc.setIsDescription(true);
topNode.addChild(desc);
- BugzillaOutlineNode comments = null;
+ RepositoryTaskOutlineNode comments = null;
for (Iterator<Comment> iter = bug.getComments().iterator(); iter.hasNext();) {
Comment comment = iter.next();
// first comment is the bug description
if(comment.getNumber() == 0) continue;
if (comments == null) {
- comments = new BugzillaOutlineNode(bugId, bugServer, "Comments", defaultImage, comment, bug
+ comments = new RepositoryTaskOutlineNode(bugId, bugServer, "Comments", defaultImage, comment, bug
.getSummary());
comments.setIsCommentHeader(true);
}
- comments.addChild(new BugzillaOutlineNode(bugId, bugServer, comment.getCreated().toString(), defaultImage,
+ comments.addChild(new RepositoryTaskOutlineNode(bugId, bugServer, comment.getCreated().toString(), defaultImage,
comment, bug.getSummary()));
}
if (comments != null) {
@@ -273,9 +274,9 @@ public class BugzillaOutlineNode implements IBugzillaReportSelection {
}
topNode
- .addChild(new BugzillaOutlineNode(bugId, bugServer, "New Comment", defaultImage, null, bug.getSummary()));
+ .addChild(new RepositoryTaskOutlineNode(bugId, bugServer, "New Comment", defaultImage, null, bug.getSummary()));
- BugzillaOutlineNode titleNode = new BugzillaOutlineNode(bugId, bugServer, "BugReport Object", defaultImage,
+ RepositoryTaskOutlineNode titleNode = new RepositoryTaskOutlineNode(bugId, bugServer, "BugReport Object", defaultImage,
null, bug.getSummary());
titleNode.addChild(topNode);
@@ -325,11 +326,11 @@ public class BugzillaOutlineNode implements IBugzillaReportSelection {
return (server == null) || ((getContents() == null) && (getComment() == null));
}
- public BugzillaOutlineNode getParent() {
+ public RepositoryTaskOutlineNode getParent() {
return parent;
}
- public void setParent(BugzillaOutlineNode parent) {
+ public void setParent(RepositoryTaskOutlineNode parent) {
this.parent = parent;
}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaOutlinePage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/RepositoryTaskOutlinePage.java
index 07302dcb3..351941349 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaOutlinePage.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/RepositoryTaskOutlinePage.java
@@ -8,7 +8,7 @@
* Contributors:
* University Of British Columbia - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylar.internal.bugzilla.ui.editor;
+package org.eclipse.mylar.internal.tasklist.ui.editors;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -16,10 +16,8 @@ import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.mylar.internal.bugzilla.ui.BugzillaImages;
-import org.eclipse.mylar.internal.bugzilla.ui.BugzillaTools;
-import org.eclipse.mylar.internal.bugzilla.ui.IBugzillaReportSelection;
import org.eclipse.mylar.internal.core.util.MylarStatusHandler;
+import org.eclipse.mylar.internal.tasklist.ui.TaskListImages;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.ISelectionListener;
@@ -29,20 +27,20 @@ import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
/**
* An outline page for a <code>BugEditor</code>.
*/
-public class BugzillaOutlinePage extends ContentOutlinePage {
+public class RepositoryTaskOutlinePage extends ContentOutlinePage {
- private BugzillaOutlineNode topTreeNode;
+ private RepositoryTaskOutlineNode topTreeNode;
protected final ISelectionListener selectionListener = new ISelectionListener() {
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
- if ((part instanceof AbstractBugEditor) && (selection instanceof IStructuredSelection)) {
- if (((IStructuredSelection) selection).getFirstElement() instanceof IBugzillaReportSelection) {
- if (((IStructuredSelection) getSelection()).getFirstElement() instanceof IBugzillaReportSelection) {
- IBugzillaReportSelection brs1 = (IBugzillaReportSelection) ((IStructuredSelection) getSelection())
+ if ((part instanceof AbstractRepositoryTaskEditor) && (selection instanceof IStructuredSelection)) {
+ if (((IStructuredSelection) selection).getFirstElement() instanceof IRepositoryTaskSelection) {
+ if (((IStructuredSelection) getSelection()).getFirstElement() instanceof IRepositoryTaskSelection) {
+ IRepositoryTaskSelection brs1 = (IRepositoryTaskSelection) ((IStructuredSelection) getSelection())
.getFirstElement();
- IBugzillaReportSelection brs2 = ((IBugzillaReportSelection) ((IStructuredSelection) selection)
+ IRepositoryTaskSelection brs2 = ((IRepositoryTaskSelection) ((IStructuredSelection) selection)
.getFirstElement());
- if (BugzillaTools.getHandle(brs1).compareTo(BugzillaTools.getHandle(brs2)) == 0) {
+ if (OutlineTools.getHandle(brs1).compareTo(OutlineTools.getHandle(brs2)) == 0) {
// don't need to make a selection for the same
// element
return;
@@ -57,14 +55,14 @@ public class BugzillaOutlinePage extends ContentOutlinePage {
private TreeViewer viewer;
/**
- * Creates a new <code>BugzillaOutlinePage</code>.
+ * Creates a new <code>RepositoryTaskOutlinePage</code>.
*
* @param topTreeNode
* The top data node of the tree for this view.
* @param editor
* The editor this outline page is for.
*/
- public BugzillaOutlinePage(BugzillaOutlineNode topTreeNode) {
+ public RepositoryTaskOutlinePage(RepositoryTaskOutlineNode topTreeNode) {
super();
this.topTreeNode = topTreeNode;
}
@@ -77,12 +75,13 @@ public class BugzillaOutlinePage extends ContentOutlinePage {
viewer.setLabelProvider(new LabelProvider() {
@Override
public Image getImage(Object element) {
- if (element instanceof BugzillaOutlineNode) {
- BugzillaOutlineNode node = (BugzillaOutlineNode) element;
+ if (element instanceof RepositoryTaskOutlineNode) {
+ RepositoryTaskOutlineNode node = (RepositoryTaskOutlineNode) element;
if (node.getComment() != null) {
return node.getImage();
} else {
- return BugzillaImages.getImage(BugzillaImages.BUG);
+ return TaskListImages.getImage(TaskListImages.TASK);
+ //BugzillaImages.getImage(BugzillaImages.BUG);
}
} else {
return super.getImage(element);
@@ -91,8 +90,8 @@ public class BugzillaOutlinePage extends ContentOutlinePage {
@Override
public String getText(Object element) {
- if (element instanceof BugzillaOutlineNode) {
- BugzillaOutlineNode node = (BugzillaOutlineNode) element;
+ if (element instanceof RepositoryTaskOutlineNode) {
+ RepositoryTaskOutlineNode node = (RepositoryTaskOutlineNode) element;
if (node.getComment() != null) {
return node.getComment().getAuthorName() + " (" + node.getName() + ")";
} else {
@@ -104,7 +103,7 @@ public class BugzillaOutlinePage extends ContentOutlinePage {
});
try {
viewer.setInput(topTreeNode);
- viewer.setComparer(new BugzillaOutlineComparer());
+ viewer.setComparer(new RepositoryTaskOutlineComparer());
viewer.expandAll();
} catch (Exception e) {
MylarStatusHandler.fail(e, "could not create bugzilla outline", true);
@@ -130,8 +129,8 @@ public class BugzillaOutlinePage extends ContentOutlinePage {
protected class BugTaskOutlineContentProvider implements ITreeContentProvider {
public Object[] getChildren(Object parentElement) {
- if (parentElement instanceof BugzillaOutlineNode) {
- Object[] children = ((BugzillaOutlineNode) parentElement).getChildren();
+ if (parentElement instanceof RepositoryTaskOutlineNode) {
+ Object[] children = ((RepositoryTaskOutlineNode) parentElement).getChildren();
if (children.length > 0) {
return children;
}
@@ -144,15 +143,15 @@ public class BugzillaOutlinePage extends ContentOutlinePage {
}
public boolean hasChildren(Object element) {
- if (element instanceof BugzillaOutlineNode) {
- return ((BugzillaOutlineNode) element).getChildren().length > 0;
+ if (element instanceof RepositoryTaskOutlineNode) {
+ return ((RepositoryTaskOutlineNode) element).getChildren().length > 0;
}
return false;
}
public Object[] getElements(Object inputElement) {
- if (inputElement instanceof BugzillaOutlineNode) {
- Object[] children = ((BugzillaOutlineNode) inputElement).getChildren();
+ if (inputElement instanceof RepositoryTaskOutlineNode) {
+ Object[] children = ((RepositoryTaskOutlineNode) inputElement).getChildren();
if (children.length > 0) {
return children;
}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaReportSelection.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/RepositoryTaskSelection.java
index c5e1d8636..a9d48f708 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaReportSelection.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/RepositoryTaskSelection.java
@@ -9,15 +9,14 @@
* University Of British Columbia - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylar.internal.bugzilla.ui.editor;
+package org.eclipse.mylar.internal.tasklist.ui.editors;
-import org.eclipse.mylar.internal.bugzilla.ui.IBugzillaReportSelection;
import org.eclipse.mylar.internal.tasklist.Comment;
/**
- * A selection of a Bugzilla element in a view.
+ * A selection of an element in a view.
*/
-public class BugzillaReportSelection implements IBugzillaReportSelection {
+public class RepositoryTaskSelection implements IRepositoryTaskSelection {
/**
* The id of the Bugzilla object that the selection was on.
@@ -39,7 +38,7 @@ public class BugzillaReportSelection implements IBugzillaReportSelection {
protected Comment comment;
/**
- * Creates a new <code>BugzillaReportSelection</code> with no supplied
+ * Creates a new <code>RepositoryTaskSelection</code> with no supplied
* contents or comment.
*
* @param id
@@ -47,12 +46,12 @@ public class BugzillaReportSelection implements IBugzillaReportSelection {
* @param server
* The server of the Bugzilla object that the selection was on.
*/
- public BugzillaReportSelection(int id, String server, String summary) {
+ public RepositoryTaskSelection(int id, String server, String summary) {
this(id, server, null, null, summary);
}
/**
- * Creates a new <code>BugzillaReportSelection</code> with no supplied
+ * Creates a new <code>RepositoryTaskSelection</code> with no supplied
* comment.
*
* @param id
@@ -62,13 +61,13 @@ public class BugzillaReportSelection implements IBugzillaReportSelection {
* @param contents
* The contents of the selection.
*/
- public BugzillaReportSelection(int id, String server, String contents, boolean isDescription, String summary) {
+ public RepositoryTaskSelection(int id, String server, String contents, boolean isDescription, String summary) {
this(id, server, contents, null, summary);
this.isDescription = isDescription;
}
/**
- * Creates a new <code>BugzillaReportSelection</code> with no supplied
+ * Creates a new <code>RepositoryTaskSelection</code> with no supplied
* contents.
*
* @param id
@@ -80,12 +79,12 @@ public class BugzillaReportSelection implements IBugzillaReportSelection {
* comment was not selected, then this should be
* <code>null</code>.
*/
- public BugzillaReportSelection(int id, String server, Comment comment, String summary) {
+ public RepositoryTaskSelection(int id, String server, Comment comment, String summary) {
this(id, server, null, comment, summary);
}
/**
- * Creates a new <code>BugzillaReportSelection</code>.
+ * Creates a new <code>RepositoryTaskSelection</code>.
*
* @param id
* The id of the Bugzilla object that the selection was on.
@@ -98,7 +97,7 @@ public class BugzillaReportSelection implements IBugzillaReportSelection {
* comment was not selected, then this should be
* <code>null</code>.
*/
- public BugzillaReportSelection(int id, String server, String contents, Comment comment, String summary) {
+ public RepositoryTaskSelection(int id, String server, String contents, Comment comment, String summary) {
this.id = id;
this.server = server;
this.contents = contents;
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/RepositoryTextViewer.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/RepositoryTextViewer.java
index 651d856aa..795e116ad 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/RepositoryTextViewer.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/RepositoryTextViewer.java
@@ -9,7 +9,7 @@
* University Of British Columbia - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylar.internal.bugzilla.ui.editor;
+package org.eclipse.mylar.internal.tasklist.ui.editors;
import java.util.ArrayList;
import java.util.Arrays;
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/SpellingDialog.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/SpellingDialog.java
index f4b40ef25..82ec9311e 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/SpellingDialog.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/editors/SpellingDialog.java
@@ -9,7 +9,7 @@
* University Of British Columbia - initial API and implementation
*******************************************************************************/
-package org.eclipse.mylar.internal.bugzilla.ui.editor;
+package org.eclipse.mylar.internal.tasklist.ui.editors;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.text.IDocument;
@@ -65,7 +65,7 @@ public class SpellingDialog extends Dialog {
suggestions = new List(spellingComposite, SWT.BORDER);
gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
gd.widthHint = 150;
- gd.heightHint = AbstractBugEditor.WRAP_LENGTH;
+ gd.heightHint = AbstractRepositoryTaskEditor.WRAP_LENGTH;
suggestions.setLayoutData(gd);
return c;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/provisional/tasklist/AbstractRepositoryConnector.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/provisional/tasklist/AbstractRepositoryConnector.java
index ab1904162..8b40e1a58 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/provisional/tasklist/AbstractRepositoryConnector.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/provisional/tasklist/AbstractRepositoryConnector.java
@@ -27,6 +27,7 @@ import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.jobs.IJobChangeListener;
import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.mylar.internal.core.util.DateUtil;
@@ -117,11 +118,31 @@ public abstract class AbstractRepositoryConnector {
public abstract List<AbstractQueryHit> performQuery(AbstractRepositoryQuery query, IProgressMonitor monitor,
MultiStatus queryStatus);
+
// Precondition of note: offline file is removed upon submit to repository resulting in a synchronized state.
- protected void updateOfflineState(AbstractRepositoryTask repositoryTask, boolean forceSync) {
+ protected void updateOfflineState(final AbstractRepositoryTask repositoryTask, boolean forceSync) {
RepositoryTaskSyncState status = repositoryTask.getSyncState();
+ RepositoryTaskData downloadedTaskData;
+
+ final TaskRepository repository = MylarTaskListPlugin.getRepositoryManager().getRepository(
+ repositoryTask.getRepositoryKind(), repositoryTask.getRepositoryUrl());
- final RepositoryTaskData downloadedTaskData = downloadTaskData(repositoryTask);
+ if (repository == null) {
+ MylarStatusHandler
+ .log("No repository associated with task "+repositoryTask.getDescription()+". Unable to retrieve timezone information.", this);
+ return;
+ }
+
+ try {
+ downloadedTaskData = downloadTaskData(repositoryTask);
+ } catch (final CoreException e) {
+ PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ ErrorDialog.openError(PlatformUI.getWorkbench().getDisplay().getActiveShell(), "Error Downloading Report", "Unable to synchronize "+repositoryTask.getDescription()+" on "+repository.getUrl(), e.getStatus());
+ }
+ });
+ return;
+ }
if (downloadedTaskData == null) {
MylarStatusHandler.log("Download of " + repositoryTask.getDescription() + " from "
@@ -132,14 +153,6 @@ public abstract class AbstractRepositoryConnector {
RepositoryTaskData offlineTaskData = OfflineTaskManager.findBug(downloadedTaskData.getRepositoryUrl(),
downloadedTaskData.getId());
- TaskRepository repository = MylarTaskListPlugin.getRepositoryManager().getRepository(
- repositoryTask.getRepositoryKind(), repositoryTask.getRepositoryUrl());
-
- if (repository == null) {
- MylarStatusHandler
- .log("No repository associated with task. Unable to retrieve timezone information.", this);
- return;
- }
TimeZone repositoryTimeZone = DateUtil.getTimeZone(repository.getTimeZoneId());
if (offlineTaskData != null) {
@@ -155,9 +168,9 @@ public abstract class AbstractRepositoryConnector {
null,
"Update Local Copy",
"Local copy of Report "
- + downloadedTaskData.getId()
+ + repositoryTask.getDescription()
+ " on "
- + downloadedTaskData.getRepositoryUrl()
+ + repositoryTask.getRepositoryUrl()
+ " has changes.\nWould you like to override local changes? \n\nNote: if you select No, only the new comment will be saved with the updated bug, all other changes will be lost.");
}
});
@@ -186,12 +199,12 @@ public abstract class AbstractRepositoryConnector {
status = RepositoryTaskSyncState.SYNCHRONIZED;
}
repositoryTask.setLastSynchronized(downloadedTaskData.getLastModified(repositoryTimeZone));
- repositoryTask.setTaskData(downloadedTaskData);
+ repositoryTask.setTaskData(downloadedTaskData);
repositoryTask.setSyncState(status);
- saveOffline(downloadedTaskData, forceSync);
+ saveOffline(downloadedTaskData);
}
- protected abstract RepositoryTaskData downloadTaskData(AbstractRepositoryTask bugzillaTask);
+ protected abstract RepositoryTaskData downloadTaskData(AbstractRepositoryTask bugzillaTask) throws CoreException;
public abstract String getLabel();
@@ -387,11 +400,10 @@ public abstract class AbstractRepositoryConnector {
public AbstractAttributeFactory getAttributeFactory() {
return attributeFactory;
}
-
- public void saveOffline(final RepositoryTaskData report, final boolean forceSync) {
- try {
- MylarTaskListPlugin.getDefault().getOfflineReportsFile().add(report, forceSync);
- // report.setOfflineState(true);
+
+ public void saveOffline(RepositoryTaskData taskData) {
+ try {
+ MylarTaskListPlugin.getDefault().getOfflineReportsFile().add(taskData);
} catch (CoreException e) {
MylarStatusHandler.fail(e, e.getMessage(), false);
}

Back to the top