diff options
author | mkersten | 2005-11-08 03:37:13 +0000 |
---|---|---|
committer | mkersten | 2005-11-08 03:37:13 +0000 |
commit | 999a179305547d1dca079031ef25fa01901d8c1d (patch) | |
tree | 9d3cf4fc88df399de3ead266d944333782918a7b | |
parent | 76897ad39a1f58295723ec22036def3b41549c24 (diff) | |
download | org.eclipse.mylyn.tasks-999a179305547d1dca079031ef25fa01901d8c1d.tar.gz org.eclipse.mylyn.tasks-999a179305547d1dca079031ef25fa01901d8c1d.tar.xz org.eclipse.mylyn.tasks-999a179305547d1dca079031ef25fa01901d8c1d.zip |
Fixed Bugzilla Bug 114408: make bug report titles consistent
12 files changed, 485 insertions, 424 deletions
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/editor/ExistingBugEditorInput.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/editor/ExistingBugEditorInput.java index 4373b47d2..55bbcc0fa 100644 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/editor/ExistingBugEditorInput.java +++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/editor/ExistingBugEditorInput.java @@ -11,6 +11,7 @@ package org.eclipse.mylar.bugzilla.ui.editor; import java.io.IOException; +import java.net.UnknownHostException; import javax.security.auth.login.LoginException; @@ -20,6 +21,8 @@ import org.eclipse.mylar.bugzilla.core.BugzillaRepository; /** * The <code>IEditorInput</code> implementation for <code>ExistingBugEditor</code>. + * + * @author Mik Kersten (some hardening of initial prototype) */ public class ExistingBugEditorInput extends AbstractBugEditorInput { @@ -47,7 +50,6 @@ public class ExistingBugEditorInput extends AbstractBugEditorInput */ public ExistingBugEditorInput(int bugId) throws LoginException, IOException { this.bugId = bugId; - // get the bug from the server if it exists bug = BugzillaRepository.getInstance().getBug(bugId); } @@ -56,7 +58,21 @@ public class ExistingBugEditorInput extends AbstractBugEditorInput this.bugId = bugId; if(!offline){ - bug = BugzillaRepository.getInstance().getBug(bugId); + try { + bug = BugzillaRepository.getInstance().getBug(bugId); + } catch (UnknownHostException e) { + bug = BugzillaRepository.getInstance().getCurrentBug(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 = BugzillaRepository.getInstance().getCurrentBug(bugId); } diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/outline/BugzillaOutlineNode.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/outline/BugzillaOutlineNode.java index a84479854..3186a5d8b 100644 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/outline/BugzillaOutlineNode.java +++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/outline/BugzillaOutlineNode.java @@ -21,39 +21,39 @@ import org.eclipse.mylar.bugzilla.core.NewBugModel; import org.eclipse.mylar.bugzilla.ui.BugzillaImages; import org.eclipse.swt.graphics.Image; - /** * A node for the tree in the <code>BugzillaOutlinePage</code>. */ public class BugzillaOutlineNode implements IBugzillaReportSelection { - + /** The id of the Bugzilla object that the selection was on. */ protected int id; - + /** The server of the Bugzilla object that the selection was on. */ protected String server; - + /** The label for this piece of data. */ private String key; - + /** The children of this node. */ private ArrayList<BugzillaOutlineNode> nodeChildren; - + /** The parent of this node or null if it is the bug report */ private BugzillaOutlineNode parent; - + /** This node's image. */ private Image image; - - private Object data = null; - - private String bugSummary; - - private boolean fromEditor = false; - - private boolean isCommentHeader = false; - private boolean isDescription = false; - + + private Object data = null; + + private String bugSummary; + + private boolean fromEditor = false; + + private boolean isCommentHeader = false; + + private boolean isDescription = false; + /** * Creates a new <code>BugzillaOutlineNode</code>. * @@ -76,22 +76,22 @@ public class BugzillaOutlineNode implements IBugzillaReportSelection { this.key = key; this.nodeChildren = null; this.image = image; - this.data = data; - this.parent = null; - this.bugSummary = summary; - } - - public boolean isFromEditor(){ - return fromEditor; - } - + this.data = data; + this.parent = null; + this.bugSummary = summary; + } + + public boolean isFromEditor() { + return fromEditor; + } + /** * @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()]); } - + /** * Adds a node to this node's list of children. * @param bugNode The new child. @@ -110,7 +110,7 @@ public class BugzillaOutlineNode implements IBugzillaReportSelection { public String getKey() { return key; } - + /** * Set the label of this node. * @param key The new label. @@ -118,14 +118,14 @@ public class BugzillaOutlineNode implements IBugzillaReportSelection { public void setKey(String key) { this.key = key; } - + /** - * @return The decorator image for this node. + * TODO: remove, nodes don't need to know about image decorator */ public Image getImage() { return image; } - + /** * Sets the decorator image for this node. * @param newImage The new image. @@ -146,13 +146,12 @@ public class BugzillaOutlineNode implements IBugzillaReportSelection { } return super.equals(arg0); } - + @Override public int hashCode() { return getKey().hashCode(); } - - + /** * @return The name of this node. */ @@ -160,22 +159,21 @@ public class BugzillaOutlineNode implements IBugzillaReportSelection { return getKey(); } - /** + /** * @return The data (where applicable) this node represents. */ - public Object getData() { - return data; - } - - - /** - * Sets the data that this node represents. - * @param data The new piece of data. - */ - public void setData(Object data) { - this.data = data; - } - + public Object getData() { + return data; + } + + /** + * Sets the data that this node represents. + * @param data The new piece of data. + */ + public void setData(Object data) { + this.data = data; + } + /** * Parses the given <code>IBugzillaBug</code> into a tree of * <code>BugzillaOutlineNode</code>'s suitable for use in the @@ -189,16 +187,14 @@ public class BugzillaOutlineNode implements IBugzillaReportSelection { // Choose the appropriate parsing function based on // the type of IBugzillaBug. if (bug instanceof NewBugModel) { - return parseBugReport((NewBugModel)bug); - } - else if (bug instanceof BugReport) { - return parseBugReport((BugReport)bug); - } - else { + return parseBugReport((NewBugModel) bug); + } else if (bug instanceof BugReport) { + return parseBugReport((BugReport) bug); + } else { return null; } } - + /** * Parses the given <code>NewBugModel</code> into a tree of * <code>BugzillaOutlineNode</code>'s suitable for use in the @@ -208,21 +204,21 @@ public class BugzillaOutlineNode implements IBugzillaReportSelection { * The <code>NewBugModel</code> that needs parsing. * @return The tree of <code>BugzillaOutlineNode</code>'s. */ - protected static BugzillaOutlineNode parseBugReport(NewBugModel bug){ + protected static BugzillaOutlineNode parseBugReport(NewBugModel bug) { int bugId = bug.getId(); String bugServer = bug.getServer(); Image bugImage = BugzillaImages.getImage(BugzillaImages.BUG); - Image defaultImage = BugzillaImages.getImage(BugzillaImages.IMG_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; - } - + Image defaultImage = BugzillaImages.getImage(BugzillaImages.IMG_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>BugReport</code> into a tree of * <code>BugzillaOutlineNode</code>'s suitable for use in the @@ -233,41 +229,40 @@ public class BugzillaOutlineNode implements IBugzillaReportSelection { * @return The tree of <code>BugzillaOutlineNode</code>'s. */ protected static BugzillaOutlineNode parseBugReport(BugReport bug) { - + int bugId = bug.getId(); String bugServer = bug.getServer(); Image bugImage = BugzillaImages.getImage(BugzillaImages.BUG); - Image defaultImage = BugzillaImages.getImage(BugzillaImages.IMG_COMMENT); + Image defaultImage = BugzillaImages.getImage(BugzillaImages.IMG_COMMENT); BugzillaOutlineNode topNode = new BugzillaOutlineNode(bugId, bugServer, bug.getLabel(), bugImage, bug, bug.getSummary()); - + BugzillaOutlineNode desc = new BugzillaOutlineNode(bugId, bugServer, "Description", defaultImage, bug.getDescription(), bug.getSummary()); desc.setIsDescription(true); - + topNode.addChild(desc); - - + BugzillaOutlineNode comments = null; for (Iterator<Comment> iter = bug.getComments().iterator(); iter.hasNext();) { - Comment comment = iter.next(); + Comment comment = iter.next(); - if(comments == null){ - comments = new BugzillaOutlineNode(bugId, bugServer, "Comments", defaultImage, comment, bug.getSummary()); - comments.setIsCommentHeader(true); - } + if (comments == null) { + comments = new BugzillaOutlineNode(bugId, bugServer, "Comments", defaultImage, comment, bug.getSummary()); + comments.setIsCommentHeader(true); + } comments.addChild(new BugzillaOutlineNode(bugId, bugServer, comment.getCreated().toString(), defaultImage, comment, bug.getSummary())); } - if(comments != null){ - topNode.addChild(comments); - } - + if (comments != null) { + topNode.addChild(comments); + } + topNode.addChild(new BugzillaOutlineNode(bugId, bugServer, "New Comment", defaultImage, null, bug.getSummary())); - + BugzillaOutlineNode titleNode = new BugzillaOutlineNode(bugId, bugServer, "BugReport Object", defaultImage, null, bug.getSummary()); titleNode.addChild(topNode); - + return titleNode; - } - + } + public boolean hasComment() { // If the comment category was selected, then the comment object is // not the intended selection (it is just used to help find the correct @@ -276,7 +271,7 @@ public class BugzillaOutlineNode implements IBugzillaReportSelection { } public Comment getComment() { - return (hasComment()) ? (Comment)data : null; + return (hasComment()) ? (Comment) data : null; } public void setComment(Comment comment) { @@ -326,7 +321,7 @@ public class BugzillaOutlineNode implements IBugzillaReportSelection { public boolean isDescription() { return isDescription; } - + public void setIsCommentHeader(boolean isCommentHeader) { this.isCommentHeader = isCommentHeader; } diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/outline/BugzillaOutlinePage.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/outline/BugzillaOutlinePage.java index 4a8048eef..44e388ec1 100644 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/outline/BugzillaOutlinePage.java +++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/outline/BugzillaOutlinePage.java @@ -18,6 +18,7 @@ import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.jface.viewers.Viewer; import org.eclipse.mylar.bugzilla.core.BugzillaTools; import org.eclipse.mylar.bugzilla.core.IBugzillaReportSelection; +import org.eclipse.mylar.bugzilla.ui.BugzillaImages; import org.eclipse.mylar.bugzilla.ui.editor.AbstractBugEditor; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; @@ -75,9 +76,13 @@ public class BugzillaOutlinePage extends ContentOutlinePage{ @Override public Image getImage(Object element) { if (element instanceof BugzillaOutlineNode) { - return ((BugzillaOutlineNode)element).getImage(); - } - else { + BugzillaOutlineNode node = (BugzillaOutlineNode)element; + if (node.getComment() != null) { + return node.getImage(); + } else { + return BugzillaImages.getImage(BugzillaImages.BUG); + } + } else { return super.getImage(element); } } @@ -85,11 +90,15 @@ public class BugzillaOutlinePage extends ContentOutlinePage{ @Override public String getText(Object element) { if (element instanceof BugzillaOutlineNode) { - return ((BugzillaOutlineNode)element).getName(); - } - else { - return super.getText(element); + BugzillaOutlineNode node = (BugzillaOutlineNode)element; + if (node.getComment() != null) { + return node.getComment().getAuthorName() + + " (" + node.getName() + ")"; + } else { + return node.getName(); + } } + return super.getText(element); } }); viewer.setInput(topTreeNode); diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasklist/BugzillaTask.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasklist/BugzillaTask.java index 81e19a78b..bee3f6b45 100644 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasklist/BugzillaTask.java +++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasklist/BugzillaTask.java @@ -46,26 +46,29 @@ import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.internal.Workbench; - /** * @author Mik Kersten */ public class BugzillaTask extends Task { - + private static final String PROGRESS_LABEL_DOWNLOAD = "Downloading Bugzilla Reports..."; public enum BugReportSyncState { OUTGOING, OK, INCOMMING, CONFLICT } + /** * Comment for <code>serialVersionUID</code> */ private static final long serialVersionUID = 3257007648544469815L; - - public static final String FILE_EXTENSION = ".bug_reports"; - - public enum BugTaskState {FREE, WAITING, DOWNLOADING, COMPARING, OPENING} + + public static final String FILE_EXTENSION = ".bug_reports"; + + public enum BugTaskState { + FREE, WAITING, DOWNLOADING, COMPARING, OPENING + } + private transient BugTaskState state; /** @@ -73,25 +76,25 @@ public class BugzillaTask extends Task { * bug report with the specified ID was unable to download. */ protected transient BugReport bugReport = null; - + /** * Value is <code>true</code> if the bug report has saved changes that * need synchronizing with the Bugzilla server. */ private boolean isDirty; - + /** The last time this task's bug report was downloaded from the server. */ protected Date lastRefresh; - + /** * TODO: Move */ public static String getLastRefreshTime(Date lastRefresh) { - String toolTip = "\n---------------\n" - + "Last synchronized: "; + String toolTip = "\n---------------\n" + "Last synchronized: "; Date timeNow = new Date(); - if (lastRefresh == null) lastRefresh = new Date(); - long timeDifference = (timeNow.getTime() - lastRefresh.getTime())/60000; + if (lastRefresh == null) + lastRefresh = new Date(); + long timeDifference = (timeNow.getTime() - lastRefresh.getTime()) / 60000; long minutes = timeDifference % 60; timeDifference /= 60; long hours = timeDifference % 24; @@ -105,11 +108,12 @@ public class BugzillaTask extends Task { toolTip += minutes + ((minutes == 1) ? " minute " : " minutes ") + "ago"; return toolTip; } - + public static final ISchedulingRule rule = new ISchedulingRule() { public boolean isConflicting(ISchedulingRule schedulingRule) { return schedulingRule == this; } + public boolean contains(ISchedulingRule schedulingRule) { return schedulingRule == this; } @@ -119,34 +123,35 @@ public class BugzillaTask extends Task { super(id, label, newTask); isDirty = false; scheduleDownloadReport(); - setUrl(); - } - + setUrl(); + } + public BugzillaTask(String id, String label, boolean noDownload, boolean newTask) { - super(id, label, newTask); - isDirty = false; - if (!noDownload) { - scheduleDownloadReport(); - } - setUrl(); - } - - public BugzillaTask(BugzillaHit hit, boolean newTask) { - this(hit.getHandle(), hit.getDescription(false), newTask); - setPriority(hit.getPriority()); - setUrl(); - } - - private void setUrl() { - int id = BugzillaTask.getBugId(getHandle()); + super(id, label, newTask); + isDirty = false; + if (!noDownload) { + scheduleDownloadReport(); + } + setUrl(); + } + + public BugzillaTask(BugzillaHit hit, boolean newTask) { + this(hit.getHandle(), hit.getDescription(false), newTask); + setPriority(hit.getPriority()); + setUrl(); + } + + private void setUrl() { + int id = BugzillaTask.getBugId(getHandle()); String url = BugzillaRepository.getBugUrlWithoutLogin(id); - if (url != null) super.setIssueReportURL(url); - } - - @Override - public String getDescription(boolean isLabel) { - if (this.isBugDownloaded() || !super.getDescription(isLabel).startsWith("<")) { - return super.getDescription(isLabel); + if (url != null) + super.setIssueReportURL(url); + } + + @Override + public String getDescription(boolean truncate) { + if (this.isBugDownloaded() || !super.getDescription(truncate).startsWith("<")) { + return super.getDescription(truncate); } else { if (getState() == BugzillaTask.BugTaskState.FREE) { return BugzillaTask.getBugId(getHandle()) + ": <Could not find bug>"; @@ -154,47 +159,51 @@ public class BugzillaTask extends Task { return BugzillaTask.getBugId(getHandle()) + ":"; } } -// return BugzillaTasksTools.getBugzillaDescription(this); - } + // return BugzillaTasksTools.getBugzillaDescription(this); + } - /** + /** * @return Returns the bugReport. */ public BugReport getBugReport() { return bugReport; } - + /** * @param bugReport The bugReport to set. */ public void setBugReport(BugReport bugReport) { this.bugReport = bugReport; } - + /** * @return Returns the serialVersionUID. */ public static long getSerialVersionUID() { return serialVersionUID; } + /** * @return Returns the lastRefresh. */ public Date getLastRefresh() { return lastRefresh; } + /** * @param lastRefresh The lastRefresh to set. */ public void setLastRefresh(Date lastRefresh) { this.lastRefresh = lastRefresh; } + /** * @param state The state to set. */ public void setState(BugTaskState state) { this.state = state; } + /** * @return Returns <code>true</code> if the bug report has saved changes * that need synchronizing with the Bugzilla server. @@ -202,7 +211,7 @@ public class BugzillaTask extends Task { public boolean isDirty() { return isDirty; } - + /** * @param isDirty The isDirty to set. */ @@ -210,14 +219,14 @@ public class BugzillaTask extends Task { this.isDirty = isDirty; notifyTaskDataChange(); } - + /** * @return Returns the state of the Bugzilla task. */ public BugTaskState getState() { return state; } - + /** * Try to download the bug from the server. * @param bugId The ID of the bug report to download. @@ -228,7 +237,7 @@ public class BugzillaTask extends Task { public BugReport downloadReport() { try { // XXX make sure to send in the server name if there are multiple repositories - if(BugzillaPlugin.getDefault() == null){ + if (BugzillaPlugin.getDefault() == null) { MylarPlugin.log("Bug Beport download failed for: " + getBugId(getHandle()) + " due to bugzilla core not existing", this); return null; } @@ -237,68 +246,68 @@ public class BugzillaTask extends Task { Workbench.getInstance().getDisplay().asyncExec(new Runnable() { public void run() { - MessageDialog.openError(Display.getDefault().getActiveShell(), "Report Download Failed", "The bugzilla report failed to be downloaded since your username or password is incorrect."); + MessageDialog.openError(Display.getDefault().getActiveShell(), "Report Download Failed", + "The bugzilla report failed to be downloaded since your username or password is incorrect."); } }); } catch (IOException e) { Workbench.getInstance().getDisplay().asyncExec(new Runnable() { public void run() { - ((ApplicationWindow)BugzillaPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow()).setStatus("Download of bug " - + getBugId(getHandle()) - + " failed due to I/O exception"); + ((ApplicationWindow) BugzillaPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow()).setStatus("Download of bug " + + getBugId(getHandle()) + " failed due to I/O exception"); } }); -// MylarPlugin.log(e, "download failed due to I/O exception"); + // MylarPlugin.log(e, "download failed due to I/O exception"); } return null; } - - @Override - public void openTaskInEditor(boolean offline){ - openTask(-1, offline); - } - + + @Override + public void openTaskInEditor(boolean offline) { + openTask(-1, offline); + } + /** * Opens this task's bug report in an editor revealing the selected comment. - * @param commentNumber The comment number to reveal + * @param commentNumber The comment number to reveal */ public void openTask(int commentNumber, boolean offline) { -// if (state != BugTaskState.FREE) { -// return; -// } -// -// state = BugTaskState.OPENING; -// notifyTaskDataChange(); + // if (state != BugTaskState.FREE) { + // return; + // } + // + // state = BugTaskState.OPENING; + // notifyTaskDataChange(); OpenBugTaskJob job = new OpenBugTaskJob("Opening Bugzilla task in editor...", this, offline); job.schedule(); -// job.addJobChangeListener(new IJobChangeListener(){ -// -// public void aboutToRun(IJobChangeEvent event) { -// // don't care about this event -// } -// -// public void awake(IJobChangeEvent event) { -// // don't care about this event -// } -// public void done(IJobChangeEvent event) { -// state = BugTaskState.FREE; -// notifyTaskDataChange(); -// } -// -// public void running(IJobChangeEvent event) { -// // don't care about this event -// } -// -// public void scheduled(IJobChangeEvent event) { -// // don't care about this event -// } -// -// public void sleeping(IJobChangeEvent event) { -// // don't care about this event -// } -// }); - } - + // job.addJobChangeListener(new IJobChangeListener(){ + // + // public void aboutToRun(IJobChangeEvent event) { + // // don't care about this event + // } + // + // public void awake(IJobChangeEvent event) { + // // don't care about this event + // } + // public void done(IJobChangeEvent event) { + // state = BugTaskState.FREE; + // notifyTaskDataChange(); + // } + // + // public void running(IJobChangeEvent event) { + // // don't care about this event + // } + // + // public void scheduled(IJobChangeEvent event) { + // // don't care about this event + // } + // + // public void sleeping(IJobChangeEvent event) { + // // don't care about this event + // } + // }); + } + /** * @return <code>true</code> if the bug report for this BugzillaTask was * successfully downloaded. @@ -306,7 +315,7 @@ public class BugzillaTask extends Task { public boolean isBugDownloaded() { return bugReport != null; } - + @Override public String toString() { return "bugzilla report id: " + getHandle(); @@ -317,68 +326,72 @@ public class BugzillaTask extends Task { * attempt to get it from the server to open it */ protected void openTaskEditor(final BugzillaTaskEditorInput input, final boolean offline) { - - Workbench.getInstance().getDisplay().asyncExec(new Runnable() { - public void run() { - try{ - MylarTasklistPlugin.ReportOpenMode mode = MylarTasklistPlugin.getDefault().getReportMode(); - if (mode == MylarTasklistPlugin.ReportOpenMode.EDITOR) { - // if we can reach the server, get the latest for the bug - if(!isBugDownloaded() && offline){ - MessageDialog.openInformation(null, "Unable to open bug", "Unable to open the selected bugzilla task since you are currently offline"); - return; - }else if(!isBugDownloaded() && syncState != BugReportSyncState.OUTGOING && syncState != BugReportSyncState.CONFLICT) { - input.getBugTask().downloadReport(); - input.setOfflineBug(input.getBugTask().getBugReport()); - } else if(syncState == BugReportSyncState.OUTGOING || syncState == BugReportSyncState.CONFLICT){ - input.setOfflineBug(bugReport); - } - } - // get the active workbench page - IWorkbenchPage page = MylarTasklistPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage(); - if (page == null) return; - page.openEditor(input, "org.eclipse.mylar.bugzilla.ui.tasklist.bugzillaTaskEditor"); - - // else if (mode == MylarTasklistPlugin.ReportOpenMode.INTERNAL_BROWSER) { - // String title = "Bug #" + BugzillaTask.getBugId(getHandle()); - // BugzillaUITools.openUrl(title, title, getBugUrl()); - // } - if(syncState == BugReportSyncState.INCOMMING){ - syncState = BugReportSyncState.OK; - Display.getDefault().asyncExec(new Runnable(){ - public void run() { - if(TaskListView.getDefault() != null && TaskListView.getDefault().getViewer() != null && !TaskListView.getDefault().getViewer().getControl().isDisposed()){ - TaskListView.getDefault().getViewer().refresh(); - } - } - }); - } else if(syncState == BugReportSyncState.CONFLICT){ - syncState = BugReportSyncState.OUTGOING; - Display.getDefault().asyncExec(new Runnable(){ - public void run() { - if(TaskListView.getDefault() != null && TaskListView.getDefault().getViewer() != null && !TaskListView.getDefault().getViewer().getControl().isDisposed()){ - TaskListView.getDefault().getViewer().refresh(); - } - } - }); + + Workbench.getInstance().getDisplay().asyncExec(new Runnable() { + public void run() { + try { + MylarTasklistPlugin.ReportOpenMode mode = MylarTasklistPlugin.getDefault().getReportMode(); + if (mode == MylarTasklistPlugin.ReportOpenMode.EDITOR) { + // if we can reach the server, get the latest for the bug + if (!isBugDownloaded() && offline) { + MessageDialog.openInformation(null, "Unable to open bug", + "Unable to open the selected bugzilla task since you are currently offline"); + return; + } else if (!isBugDownloaded() && syncState != BugReportSyncState.OUTGOING && syncState != BugReportSyncState.CONFLICT) { + input.getBugTask().downloadReport(); + input.setOfflineBug(input.getBugTask().getBugReport()); + } else if (syncState == BugReportSyncState.OUTGOING || syncState == BugReportSyncState.CONFLICT) { + input.setOfflineBug(bugReport); } - } catch (Exception ex) { - MylarPlugin.log(ex, "couldn't open bugzilla task"); + } + // get the active workbench page + IWorkbenchPage page = MylarTasklistPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage(); + if (page == null) return; + page.openEditor(input, "org.eclipse.mylar.bugzilla.ui.tasklist.bugzillaTaskEditor"); + + // else if (mode == MylarTasklistPlugin.ReportOpenMode.INTERNAL_BROWSER) { + // String title = "Bug #" + BugzillaTask.getBugId(getHandle()); + // BugzillaUITools.openUrl(title, title, getBugUrl()); + // } + if (syncState == BugReportSyncState.INCOMMING) { + syncState = BugReportSyncState.OK; + Display.getDefault().asyncExec(new Runnable() { + public void run() { + if (TaskListView.getDefault() != null && TaskListView.getDefault().getViewer() != null + && !TaskListView.getDefault().getViewer().getControl().isDisposed()) { + TaskListView.getDefault().getViewer().refresh(); + } + } + }); + } else if (syncState == BugReportSyncState.CONFLICT) { + syncState = BugReportSyncState.OUTGOING; + Display.getDefault().asyncExec(new Runnable() { + public void run() { + if (TaskListView.getDefault() != null && TaskListView.getDefault().getViewer() != null + && !TaskListView.getDefault().getViewer().getControl().isDisposed()) { + TaskListView.getDefault().getViewer().refresh(); + } + } + }); } + } catch (Exception ex) { + MylarPlugin.log(ex, "couldn't open bugzilla task"); + return; } - }); - } - + } + }); + } + /** * @return The number of seconds ago that this task's bug report was * downloaded from the server. */ public long getTimeSinceLastRefresh() { Date timeNow = new Date(); - return (timeNow.getTime() - lastRefresh.getTime())/1000; + return (timeNow.getTime() - lastRefresh.getTime()) / 1000; } - + private class GetBugReportJob extends Job { public GetBugReportJob(String name) { super(name); @@ -389,14 +402,14 @@ public class BugzillaTask extends Task { @Override protected IStatus run(IProgressMonitor monitor) { - try{ + try { state = BugTaskState.DOWNLOADING; notifyTaskDataChange(); // Update time this bugtask was last downloaded. lastRefresh = new Date(); - bugReport = downloadReport(); - - state = BugTaskState.FREE; + bugReport = downloadReport(); + + state = BugTaskState.FREE; updateTaskDetails(); notifyTaskDataChange(); saveBugReport(true); @@ -405,14 +418,14 @@ public class BugzillaTask extends Task { } BugzillaUiPlugin.getDefault().getBugzillaRefreshManager().removeRefreshingTask(BugzillaTask.this); return new Status(IStatus.OK, MylarPlugin.IDENTIFIER, IStatus.OK, "", null); - } + } } - + public void updateTaskDetails() { try { - if(bugReport == null) + if (bugReport == null) bugReport = downloadReport(); - if(bugReport == null) + if (bugReport == null) return; setPriority(bugReport.getAttribute("Priority").getValue()); String status = bugReport.getAttribute("Status").getValue(); @@ -424,12 +437,13 @@ public class BugzillaTask extends Task { MylarPlugin.fail(npe, "Task details update failed", false); } } - + private class OpenBugTaskJob extends Job { - + protected BugzillaTask bugTask; + private boolean offline; - + public OpenBugTaskJob(String name, BugzillaTask bugTask, boolean offline) { super(name); this.bugTask = bugTask; @@ -438,18 +452,18 @@ public class BugzillaTask extends Task { @Override protected IStatus run(IProgressMonitor monitor) { - try{ + try { boolean isLikeOffline = offline || syncState == BugReportSyncState.OUTGOING || syncState == BugReportSyncState.CONFLICT; final BugzillaTaskEditorInput input = new BugzillaTaskEditorInput(bugTask, isLikeOffline); -// state = BugTaskState.OPENING; -// notifyTaskDataChange(); + // state = BugTaskState.OPENING; + // notifyTaskDataChange(); openTaskEditor(input, offline); - -// state = BugTaskState.FREE; -// notifyTaskDataChange(); + + // state = BugTaskState.FREE; + // notifyTaskDataChange(); return new Status(IStatus.OK, MylarPlugin.IDENTIFIER, IStatus.OK, "", null); - }catch(Exception e){ -// MessageDialog.openError(null, "Error Opening Bug", "Unable to open Bug report: " + BugzillaTask.getBugId(bugTask.getHandle())); + } catch (Exception e) { + // MessageDialog.openError(null, "Error Opening Bug", "Unable to open Bug report: " + BugzillaTask.getBugId(bugTask.getHandle())); MylarPlugin.fail(e, "Unable to open Bug report: " + BugzillaTask.getBugId(bugTask.getHandle()), true); } return Status.CANCEL_STATUS; @@ -458,144 +472,145 @@ public class BugzillaTask extends Task { @Override public String getToolTipText() { - if(lastRefresh == null) return ""; + if (lastRefresh == null) + return ""; String toolTip = getDescription(true); - toolTip += getLastRefreshTime(lastRefresh); - + return toolTip; } - public boolean readBugReport() { - // XXX server name needs to be with the bug report - IBugzillaBug tempBug = OfflineView.find(getBugId(getHandle())); - if(tempBug == null){ - bugReport = null; - return true; - } - bugReport = (BugReport)tempBug; - - if(bugReport.hasChanges()) - syncState = BugReportSyncState.OUTGOING; - return true; - } - - public void saveBugReport(boolean refresh) { - if(bugReport == null) - return; - - // XXX use the server name for multiple repositories -// OfflineReportsFile offlineReports = BugzillaPlugin.getDefault().getOfflineReports(); -// IBugzillaBug tempBug = OfflineView.find(getBugId(getHandle())); -// OfflineView.re -// if(location != -1){ -// IBugzillaBug tmpBugReport = offlineReports.elements().get(location); -// List<IBugzillaBug> l = new ArrayList<IBugzillaBug>(1); -// l.add(tmpBugReport); -// offlineReports.remove(l); -// } -// OfflineView.removeReport(tempBug); - OfflineView.saveOffline(bugReport, false); - - final IWorkbench workbench = PlatformUI.getWorkbench(); - if (refresh && !workbench.getDisplay().isDisposed()) { - workbench.getDisplay().asyncExec(new Runnable() { - public void run() { - OfflineView.refresh(); - } - }); - } - } - - public void removeReport() { - // XXX do we really want to do this??? - // XXX remove from registry too?? - IBugzillaBug tempBug = OfflineView.find(getBugId(getHandle())); - OfflineView.removeReport(tempBug); -// OfflineReportsFile offlineReports = BugzillaPlugin.getDefault().getOfflineReports(); -// int location = offlineReports.find(getBugId(getHandle())); -// if(location != -1){ -// IBugzillaBug tmpBugReport = offlineReports.elements().get(location); -// List<IBugzillaBug> l = new ArrayList<IBugzillaBug>(1); -// l.add(tmpBugReport); -// offlineReports.remove(l); -// } - } - - public static String getServerName(String handle) { - int index = handle.lastIndexOf('-'); - if(index != -1){ + public boolean readBugReport() { + // XXX server name needs to be with the bug report + IBugzillaBug tempBug = OfflineView.find(getBugId(getHandle())); + if (tempBug == null) { + bugReport = null; + return true; + } + bugReport = (BugReport) tempBug; + + if (bugReport.hasChanges()) + syncState = BugReportSyncState.OUTGOING; + return true; + } + + public void saveBugReport(boolean refresh) { + if (bugReport == null) + return; + + // XXX use the server name for multiple repositories + // OfflineReportsFile offlineReports = BugzillaPlugin.getDefault().getOfflineReports(); + // IBugzillaBug tempBug = OfflineView.find(getBugId(getHandle())); + // OfflineView.re + // if(location != -1){ + // IBugzillaBug tmpBugReport = offlineReports.elements().get(location); + // List<IBugzillaBug> l = new ArrayList<IBugzillaBug>(1); + // l.add(tmpBugReport); + // offlineReports.remove(l); + // } + // OfflineView.removeReport(tempBug); + OfflineView.saveOffline(bugReport, false); + + final IWorkbench workbench = PlatformUI.getWorkbench(); + if (refresh && !workbench.getDisplay().isDisposed()) { + workbench.getDisplay().asyncExec(new Runnable() { + public void run() { + OfflineView.refresh(); + } + }); + } + } + + public void removeReport() { + // XXX do we really want to do this??? + // XXX remove from registry too?? + IBugzillaBug tempBug = OfflineView.find(getBugId(getHandle())); + OfflineView.removeReport(tempBug); + // OfflineReportsFile offlineReports = BugzillaPlugin.getDefault().getOfflineReports(); + // int location = offlineReports.find(getBugId(getHandle())); + // if(location != -1){ + // IBugzillaBug tmpBugReport = offlineReports.elements().get(location); + // List<IBugzillaBug> l = new ArrayList<IBugzillaBug>(1); + // l.add(tmpBugReport); + // offlineReports.remove(l); + // } + } + + public static String getServerName(String handle) { + int index = handle.lastIndexOf('-'); + if (index != -1) { return handle.substring(0, index); } return null; } - + public static int getBugId(String handle) { int index = handle.lastIndexOf('-'); - if(index != -1){ - String id = handle.substring(index+1); + if (index != -1) { + String id = handle.substring(index + 1); return Integer.parseInt(id); } return -1; } - + @Override public Image getIcon() { - if(syncState == BugReportSyncState.OK){ + if (syncState == BugReportSyncState.OK) { return TaskListImages.getImage(BugzillaImages.TASK_BUGZILLA); - }else if(syncState == BugReportSyncState.OUTGOING){ + } else if (syncState == BugReportSyncState.OUTGOING) { return TaskListImages.getImage(BugzillaImages.TASK_BUGZILLA_OUTGOING); - } else if(syncState == BugReportSyncState.INCOMMING){ + } else if (syncState == BugReportSyncState.INCOMMING) { return TaskListImages.getImage(BugzillaImages.TASK_BUGZILLA_INCOMMING); - } else if(syncState == BugReportSyncState.CONFLICT){ + } else if (syncState == BugReportSyncState.CONFLICT) { return TaskListImages.getImage(BugzillaImages.TASK_BUGZILLA_CONFLICT); } else { return TaskListImages.getImage(BugzillaImages.TASK_BUGZILLA); } - + } - + public String getBugUrl() { // fix for bug 103537 - should login automatically, but dont want to show the login info in the query string return BugzillaRepository.getBugUrlWithoutLogin(getBugId(handle)); } - + + @Override + public boolean canEditDescription() { + return false; + } + + @Override + public String getDeleteConfirmationMessage() { + return "Remove this report from the task list, and discard any task context or local notes?"; + } + @Override - public boolean canEditDescription() { - return false; - } - - @Override - public String getDeleteConfirmationMessage() { - return "Remove this report from the task list, and discard any task context or local notes?"; - } - - @Override public boolean isDirectlyModifiable() { return false; } - + @Override public boolean participatesInTaskHandles() { return false; } - + @Override - public Font getFont(){ + public Font getFont() { Font f = super.getFont(); - if(f != null) return f; - - if (getState() != BugzillaTask.BugTaskState.FREE || bugReport == null) { - return ITALIC; - } - return null; + if (f != null) + return f; + + if (getState() != BugzillaTask.BugTaskState.FREE || bugReport == null) { + return ITALIC; + } + return null; } public void scheduleDownloadReport() { GetBugReportJob job = new GetBugReportJob(PROGRESS_LABEL_DOWNLOAD); - job.schedule(); + job.schedule(); } public Job getRefreshJob() { @@ -605,22 +620,23 @@ public class BugzillaTask extends Task { GetBugReportJob job = new GetBugReportJob("Refreshing Bugzilla Reports..."); return job; } - + public String getStringForSortingDescription() { - return getBugId(getHandle())+""; + return getBugId(getHandle()) + ""; } public static long getLastRefreshTimeInMinutes(Date lastRefresh) { Date timeNow = new Date(); - if (lastRefresh == null) lastRefresh = new Date(); - long timeDifference = (timeNow.getTime() - lastRefresh.getTime())/60000; + if (lastRefresh == null) + lastRefresh = new Date(); + long timeDifference = (timeNow.getTime() - lastRefresh.getTime()) / 60000; return timeDifference; } - private BugReportSyncState syncState = BugReportSyncState.OK; - + private BugReportSyncState syncState = BugReportSyncState.OK; + public void setSyncState(BugReportSyncState syncState) { - if((this.syncState == BugReportSyncState.INCOMMING && syncState == BugReportSyncState.OK)){ + if ((this.syncState == BugReportSyncState.INCOMMING && syncState == BugReportSyncState.OK)) { // do nothing } else { this.syncState = syncState; @@ -628,7 +644,7 @@ public class BugzillaTask extends Task { } public static String getHandle(IBugzillaBug bug) { - return "Bugzilla-"+bug.getId(); + return "Bugzilla-" + bug.getId(); } public BugReportSyncState getSyncState() { diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasklist/BugzillaTaskEditor.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasklist/BugzillaTaskEditor.java index adf258e0d..314f2576a 100644 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasklist/BugzillaTaskEditor.java +++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasklist/BugzillaTaskEditor.java @@ -22,7 +22,7 @@ import org.eclipse.mylar.bugzilla.ui.BugzillaImages; import org.eclipse.mylar.bugzilla.ui.editor.AbstractBugEditor; import org.eclipse.mylar.bugzilla.ui.editor.ExistingBugEditor; import org.eclipse.mylar.tasklist.TaskListImages; -import org.eclipse.mylar.tasklist.ui.TaskEditor; +import org.eclipse.mylar.tasklist.ui.MylarTaskEditor; import org.eclipse.mylar.tasklist.ui.TaskEditorInput; import org.eclipse.mylar.tasklist.ui.views.TaskListView; import org.eclipse.swt.widgets.Composite; @@ -37,7 +37,7 @@ import org.eclipse.ui.views.contentoutline.IContentOutlinePage; * @author Eric Booth * @author Mik Kersten */ -public class BugzillaTaskEditor extends TaskEditor { +public class BugzillaTaskEditor extends MylarTaskEditor { private static final String EDITOR_TAB_ITLE = "Bug Editor"; @@ -169,7 +169,8 @@ public class BugzillaTaskEditor extends TaskEditor { } // Set the title on the editor's tab - this.setPartName("Bug #" + bugzillaEditorInput.getBugId()); +// this.setPartName("Bug #" + bugzillaEditorInput.getBugId()); + this.setPartName(bugTask.getDescription(true)); this.setTitleImage(TaskListImages.getImage(BugzillaImages.TASK_BUGZILLA)); } diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasklist/BugzillaTaskEditorInput.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasklist/BugzillaTaskEditorInput.java index 3c913c206..67edca3e2 100644 --- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasklist/BugzillaTaskEditorInput.java +++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasklist/BugzillaTaskEditorInput.java @@ -29,7 +29,6 @@ import org.eclipse.ui.IPersistableElement; */ public class BugzillaTaskEditorInput extends ExistingBugEditorInput { - private String bugTitle; private BugReport offlineBug; @@ -64,7 +63,7 @@ public class BugzillaTaskEditorInput extends ExistingBugEditorInput { @Override public String getName() { - return "Bug #" + bugId; + return bugTask.getDescription(true); } @Override diff --git a/org.eclipse.mylyn.help.ui/doc/new.html b/org.eclipse.mylyn.help.ui/doc/new.html index c79866ef0..a1d77f46e 100644 --- a/org.eclipse.mylyn.help.ui/doc/new.html +++ b/org.eclipse.mylyn.help.ui/doc/new.html @@ -9,28 +9,26 @@ <title>Mylar New & Noteworthy</title> </head> <body> -<h2>New and Noteworthy for Mylar 0.4.1</h2> -<p>Released November 4th, 2005. Send questions to <a href="mailto:mylar-users@eclipse.org">mylar-users@eclipse.org</a>. +<h2>New and Noteworthy for Mylar 0.4.2</h2> +<p>Released November 14th, 2005. Send questions to <a href="mailto:mylar-users@eclipse.org">mylar-users@eclipse.org</a>. Submit feature requests to <a href="https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Mylar">Bugzilla</a>.<br> Items added since Mylar 0.4.0 <span style="background-color: #E0D0E6"> are highlighted </span></p> <h4><a href="new-0.3.html">New and Noteworthy covering Mylar 0.3</a></h4> -<h3>Bugzilla Client</h3> -<table cellpadding="10" cellspacing="0" width="600" id="table78"> +<h3>Task Contexts</h3> + +<table cellpadding="10" cellspacing="0" width="600" id="table94"> <tr> - <td align="left" valign="top" width="30%" bgcolor="#E0D0E6"> - <p align="right"><b>Bugzilla 2.20 support</b></p> + <td align="left" valign="top" width="30%"> + <p align="right"><b>Task context indication</b></p> </td> <td valign="top" width="70%"> - Bugzilla support has been updated for version 2.20. If you are - switching from Bugzilla 2.18 to 2.20 you will need to update the - existing Bugzilla Queries in your task list. Double click each - query category to edit it, press "Update Options", and then simply - click OK to save the query. Please note that the default - Bugzilla configuration is now 2.20.<p> - <img border="0" src="images/bugzilla-prefs-220.gif" width="412" height="226"></td> + If a task is inactive, but + has a context associated with it, the Activate widget appears + lightly filled (i.e. as bug 111722 below). <p> + <img border="0" src="images/tasklist-context.gif" width="297" height="191"></td> </tr> <tr> <td colspan="2"> @@ -39,19 +37,37 @@ highlighted </span></p> </tr> </table> -<table cellpadding="10" cellspacing="0" width="600" id="table77"> +<table cellpadding="10" cellspacing="0" width="600" id="table95"> + <tr> + <td width="30%" valign="top" align="left"> + <p align="right"><b>Pause and resume context capture</b></p> + </td> + <td width="70%" valign="top"> + Pause and resume task context capture using the drop-down menu on + the Task List. This can be useful for quick diversions that + don't warrant a new task. As a reminder of context capture + being paused, the Title of the Mylar Tasks view will change.<p> + <img border="0" src="images/context-pause.gif" width="250" height="236"></td> + </tr> +</table> + +<table cellpadding="10" cellspacing="0" width="600" id="table96"> + <tr> + <td> + <hr> + </td> + </tr> +</table> + +<h3>Bugzilla Client</h3> + +<table cellpadding="10" cellspacing="0" width="600" id="table93"> <tr> <td align="left" valign="top" width="30%" bgcolor="#E0D0E6"> - <p align="right"><b>Browser tab for Bugzilla reports</b></p> + <p align="right"><b>Improved Bugzilla Outline</b></p> </td> <td valign="top" width="70%"> - A new editor tab makes it easy to switch from the Bug Editor to - Browser-based editing. Note that when using the Browser - queries will not automatically refresh after submitting changes on a - bug. You can set the Browser to be the default editor in the - Task List preference page.<p> - <img border="0" src="images/bugzilla-prefs-open-reports.gif" width="231" height="50"><p> - <img border="0" src="images/bugzilla-editor-browser.gif" width="563" height="360"></td> + The Outline view can be used to navigate commenters.<p>...</td> </tr> <tr> <td colspan="2"> @@ -60,18 +76,19 @@ highlighted </span></p> </tr> </table> -<h3>Task Contexts</h3> - -<table cellpadding="10" cellspacing="0" width="600" id="table90"> +<table cellpadding="10" cellspacing="0" width="600" id="table78"> <tr> <td align="left" valign="top" width="30%"> - <p align="right"><b>Task context indication</b></p> + <p align="right"><b>Bugzilla 2.20 support</b></p> </td> <td valign="top" width="70%"> - If a task is inactive, but - has a context associated with it, the Activate widget appears - lightly filled (i.e. as bug 111722 below). <p> - <img border="0" src="images/tasklist-context.gif" width="297" height="191"></td> + Bugzilla support has been updated for version 2.20. If you are + switching from Bugzilla 2.18 to 2.20 you will need to update the + existing Bugzilla Queries in your task list. Double click each + query category to edit it, press "Update Options", and then simply + click OK to save the query. Please note that the default + Bugzilla configuration is now 2.20.<p> + <img border="0" src="images/bugzilla-prefs-220.gif" width="412" height="226"></td> </tr> <tr> <td colspan="2"> @@ -80,23 +97,22 @@ highlighted </span></p> </tr> </table> -<table cellpadding="10" cellspacing="0" width="600" id="table91"> +<table cellpadding="10" cellspacing="0" width="600" id="table77"> <tr> - <td width="30%" valign="top" align="left"> - <p align="right"><b>Pause and resume context capture</b></p> + <td align="left" valign="top" width="30%"> + <p align="right"><b>Browser tab for Bugzilla reports</b></p> </td> - <td width="70%" valign="top"> - Pause and resume task context capture using the drop-down menu on - the Task List. This can be useful for quick diversions that - don't warrant a new task. As a reminder of context capture - being paused, the Title of the Mylar Tasks view will change.<p> - <img border="0" src="images/context-pause.gif" width="250" height="236"></td> + <td valign="top" width="70%"> + A new editor tab makes it easy to switch from the Bug Editor to + Browser-based editing. Note that when using the Browser + queries will not automatically refresh after submitting changes on a + bug. You can set the Browser to be the default editor in the + Task List preference page.<p> + <img border="0" src="images/bugzilla-prefs-open-reports.gif" width="231" height="50"><p> + <img border="0" src="images/bugzilla-editor-browser.gif" width="563" height="360"></td> </tr> -</table> - -<table cellpadding="10" cellspacing="0" width="600" id="table92"> <tr> - <td> + <td colspan="2"> <hr> </td> </tr> @@ -106,7 +122,7 @@ highlighted </span></p> <table cellpadding="10" cellspacing="0" width="600" id="table86"> <tr> - <td align="left" valign="top" width="30%" bgcolor="#E0D0E6"> + <td align="left" valign="top" width="30%"> <p align="right"><b>Improved Task List actions and shortcuts</b></p> </td> <td valign="top" width="70%"> diff --git a/org.eclipse.mylyn.tasks.ui/plugin.xml b/org.eclipse.mylyn.tasks.ui/plugin.xml index 05b4d8a02..091930655 100644 --- a/org.eclipse.mylyn.tasks.ui/plugin.xml +++ b/org.eclipse.mylyn.tasks.ui/plugin.xml @@ -81,7 +81,7 @@ point="org.eclipse.ui.editors"> <editor icon="icons/eview16/task.gif" - class="org.eclipse.mylar.tasklist.ui.TaskEditor" + class="org.eclipse.mylar.tasklist.ui.MylarTaskEditor" name="Task Viewer" id="org.eclipse.mylar.tasklist.ui.taskEditor"/> <editor diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskListElement.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskListElement.java index ebd73c659..9dd5d1e9f 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskListElement.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskListElement.java @@ -35,7 +35,7 @@ public interface ITaskListElement { public abstract String getPriority(); - public abstract String getDescription(boolean label); + public abstract String getDescription(boolean truncate); public abstract void setDescription(String description); diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/Task.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/Task.java index 0e6781fb9..8dc99b45b 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/Task.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/Task.java @@ -38,6 +38,7 @@ import org.eclipse.ui.internal.Workbench; public class Task implements ITask { public static final long INACTIVITY_TIME_MILLIS = MylarPlugin.getContextManager().getActivityTimeoutSeconds() * 1000; + public static final int MAX_LABEL_LENGTH = 50; public Color ACTIVE = new Color(Display.getDefault(), 30, 30, 60); private static final long serialVersionUID = 3545518391537382197L; @@ -362,8 +363,16 @@ public class Task implements ITask { } } - public String getDescription(boolean label) { - return this.label; + public String getDescription(boolean truncate) { + if (!truncate) { + return label; + } else { + if (label == null || label.length() <= MAX_LABEL_LENGTH) { + return label; + } else { + return label.substring(0, MAX_LABEL_LENGTH) + "..."; + } + } } /** diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/TaskEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/MylarTaskEditor.java index 2a0ad3aaf..4ed0a0677 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/TaskEditor.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/MylarTaskEditor.java @@ -40,7 +40,7 @@ import org.eclipse.ui.part.MultiPageSelectionProvider; * @author Mik Kersten * @author Eric Booth (initial prototype) */ -public class TaskEditor extends MultiPageEditorPart { +public class MylarTaskEditor extends MultiPageEditorPart { private static final String TASK_INFO_PAGE_LABEL = "Task Info"; private static final String ISSUE_WEB_PAGE_LABEL = "Browser"; @@ -53,12 +53,12 @@ public class TaskEditor extends MultiPageEditorPart { private static class TaskEditorSelectionProvider extends MultiPageSelectionProvider { private ISelection globalSelection; - public TaskEditorSelectionProvider(TaskEditor taskEditor) { + public TaskEditorSelectionProvider(MylarTaskEditor taskEditor) { super(taskEditor); } public ISelection getSelection() { - IEditorPart activeEditor = ((TaskEditor) getMultiPageEditor()).getActiveEditor(); + IEditorPart activeEditor = ((MylarTaskEditor) getMultiPageEditor()).getActiveEditor(); if (activeEditor != null && activeEditor.getSite() != null) { ISelectionProvider selectionProvider = activeEditor.getSite().getSelectionProvider(); if (selectionProvider != null) @@ -68,7 +68,7 @@ public class TaskEditor extends MultiPageEditorPart { } public void setSelection(ISelection selection) { - IEditorPart activeEditor = ((TaskEditor) getMultiPageEditor()).getActiveEditor(); + IEditorPart activeEditor = ((MylarTaskEditor) getMultiPageEditor()).getActiveEditor(); if (activeEditor != null && activeEditor.getSite() != null) { ISelectionProvider selectionProvider = activeEditor.getSite().getSelectionProvider(); if (selectionProvider != null) selectionProvider.setSelection(selection); @@ -79,7 +79,7 @@ public class TaskEditor extends MultiPageEditorPart { } } - public TaskEditor() { + public MylarTaskEditor() { super(); IWorkbench workbench = MylarTasklistPlugin.getDefault().getWorkbench(); IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/TaskSummaryEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/TaskSummaryEditor.java index 7c4df46f9..e597b1f48 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/TaskSummaryEditor.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/TaskSummaryEditor.java @@ -97,7 +97,7 @@ public class TaskSummaryEditor extends EditorPart { private Spinner estimated; private boolean isDirty = false; - private TaskEditor parentEditor = null; + private MylarTaskEditor parentEditor = null; private ITaskActivityListener TASK_LIST_LISTENER = new ITaskActivityListener() { public void taskActivated(ITask activeTask) { @@ -554,7 +554,7 @@ public class TaskSummaryEditor extends EditorPart { return; } - public void setParentEditor(TaskEditor parentEditor) { + public void setParentEditor(MylarTaskEditor parentEditor) { this.parentEditor = parentEditor; } } |