Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 187327 Details for
Bug 199283
[api] make attachments actionable from associated comment in task editor
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
patch V6
patch199283V6.txt (text/plain), 18.04 KB, created by
Frank Becker
on 2011-01-21 15:43:58 EST
(
hide
)
Description:
patch V6
Filename:
MIME Type:
Creator:
Frank Becker
Created:
2011-01-21 15:43:58 EST
Size:
18.04 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylyn.bugzilla.ui >Index: src/org/eclipse/mylyn/internal/bugzilla/ui/Messages.java >=================================================================== >RCS file: /cvsroot/mylyn/org.eclipse.mylyn.tasks/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/Messages.java,v >retrieving revision 1.1 >diff -u -r1.1 Messages.java >--- src/org/eclipse/mylyn/internal/bugzilla/ui/Messages.java 14 Aug 2009 14:04:23 -0000 1.1 >+++ src/org/eclipse/mylyn/internal/bugzilla/ui/Messages.java 21 Jan 2011 20:39:37 -0000 >@@ -16,7 +16,9 @@ > public class Messages extends NLS { > private static final String BUNDLE_NAME = "org.eclipse.mylyn.internal.bugzilla.ui.messages"; //$NON-NLS-1$ > >- public static String TaskAttachmentHyperlink_Open_Attachment_X_in_X; >+ public static String TaskAttachmentHyperlink_Open_Attachment_X_in_Y; >+ >+ public static String TaskAttachmentTableEditorHyperlink_Show_Attachment_X_in_Y; > > static { > // initialize resource bundle >Index: src/org/eclipse/mylyn/internal/bugzilla/ui/TaskAttachmentHyperlink.java >=================================================================== >RCS file: /cvsroot/mylyn/org.eclipse.mylyn.tasks/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/TaskAttachmentHyperlink.java,v >retrieving revision 1.3 >diff -u -r1.3 TaskAttachmentHyperlink.java >--- src/org/eclipse/mylyn/internal/bugzilla/ui/TaskAttachmentHyperlink.java 8 Jun 2010 23:05:42 -0000 1.3 >+++ src/org/eclipse/mylyn/internal/bugzilla/ui/TaskAttachmentHyperlink.java 21 Jan 2011 20:39:37 -0000 >@@ -43,7 +43,7 @@ > } > > public String getHyperlinkText() { >- return MessageFormat.format(Messages.TaskAttachmentHyperlink_Open_Attachment_X_in_X, attachmentId, >+ return MessageFormat.format(Messages.TaskAttachmentHyperlink_Open_Attachment_X_in_Y, attachmentId, > repository.getRepositoryLabel()); > } > >Index: src/org/eclipse/mylyn/internal/bugzilla/ui/TaskAttachmentTableEditorHyperlink.java >=================================================================== >RCS file: src/org/eclipse/mylyn/internal/bugzilla/ui/TaskAttachmentTableEditorHyperlink.java >diff -N src/org/eclipse/mylyn/internal/bugzilla/ui/TaskAttachmentTableEditorHyperlink.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/internal/bugzilla/ui/TaskAttachmentTableEditorHyperlink.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,140 @@ >+/******************************************************************************* >+ * Copyright (c) 2010 Frank Becker 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: >+ * Frank Becker - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.mylyn.internal.bugzilla.ui; >+ >+import java.text.MessageFormat; >+ >+import org.eclipse.core.runtime.Assert; >+import org.eclipse.jface.text.IRegion; >+import org.eclipse.jface.text.hyperlink.IHyperlink; >+import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants; >+import org.eclipse.mylyn.tasks.core.TaskRepository; >+import org.eclipse.mylyn.tasks.core.data.TaskAttribute; >+import org.eclipse.mylyn.tasks.ui.TasksUiUtil; >+import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPage; >+import org.eclipse.mylyn.tasks.ui.editors.TaskEditor; >+import org.eclipse.ui.IEditorPart; >+import org.eclipse.ui.IWorkbenchPage; >+import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.forms.editor.IFormPage; >+ >+/** >+ * @since 3.2 >+ */ >+public final class TaskAttachmentTableEditorHyperlink implements IHyperlink { >+ >+ private final IRegion region; >+ >+ private final TaskRepository repository; >+ >+ private final String attachmentId; >+ >+ public TaskAttachmentTableEditorHyperlink(IRegion region, TaskRepository repository, String attachmentId) { >+ Assert.isNotNull(repository); >+ this.region = region; >+ this.repository = repository; >+ this.attachmentId = attachmentId; >+ } >+ >+ public IRegion getHyperlinkRegion() { >+ return region; >+ } >+ >+ public String getHyperlinkText() { >+ return MessageFormat.format(Messages.TaskAttachmentTableEditorHyperlink_Show_Attachment_X_in_Y, attachmentId, >+ repository.getRepositoryLabel()); >+ } >+ >+ public String getTypeLabel() { >+ return null; >+ } >+ >+ public void open() { >+ AbstractTaskEditorPage page = getTaskEditorPage(); >+ if (page != null) { >+ if (!page.selectReveal(TaskAttribute.PREFIX_ATTACHMENT + attachmentId)) { >+ String url = repository.getUrl() + IBugzillaConstants.URL_GET_ATTACHMENT_SUFFIX + attachmentId; >+ TasksUiUtil.openUrl(url); >+ } >+ } >+ } >+ >+ @Override >+ public int hashCode() { >+ final int prime = 31; >+ int result = 1; >+ result = prime * result + ((attachmentId == null) ? 0 : attachmentId.hashCode()); >+ result = prime * result + ((region == null) ? 0 : region.hashCode()); >+ result = prime * result + ((repository == null) ? 0 : repository.hashCode()); >+ return result; >+ } >+ >+ @Override >+ public boolean equals(Object obj) { >+ if (this == obj) { >+ return true; >+ } >+ if (obj == null) { >+ return false; >+ } >+ if (getClass() != obj.getClass()) { >+ return false; >+ } >+ TaskAttachmentTableEditorHyperlink other = (TaskAttachmentTableEditorHyperlink) obj; >+ if (attachmentId == null) { >+ if (other.attachmentId != null) { >+ return false; >+ } >+ } else if (!attachmentId.equals(other.attachmentId)) { >+ return false; >+ } >+ if (region == null) { >+ if (other.region != null) { >+ return false; >+ } >+ } else if (!region.equals(other.region)) { >+ return false; >+ } >+ if (repository == null) { >+ if (other.repository != null) { >+ return false; >+ } >+ } else if (!repository.equals(other.repository)) { >+ return false; >+ } >+ return true; >+ } >+ >+ @Override >+ public String toString() { >+ return "TaskAttachmentHyperlink [attachmentId=" + attachmentId + ", region=" + region + ", repository=" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >+ + repository + "]"; //$NON-NLS-1$ >+ } >+ >+ protected AbstractTaskEditorPage getTaskEditorPage() { >+ IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); >+ if (activePage == null) { >+ return null; >+ } >+ IEditorPart editorPart = activePage.getActiveEditor(); >+ AbstractTaskEditorPage taskEditorPage = null; >+ if (editorPart instanceof TaskEditor) { >+ TaskEditor taskEditor = (TaskEditor) editorPart; >+ IFormPage formPage = taskEditor.getActivePageInstance(); >+ if (formPage instanceof AbstractTaskEditorPage) { >+ taskEditorPage = (AbstractTaskEditorPage) formPage; >+ } >+ } >+ return taskEditorPage; >+ } >+ >+} >Index: src/org/eclipse/mylyn/internal/bugzilla/ui/messages.properties >=================================================================== >RCS file: /cvsroot/mylyn/org.eclipse.mylyn.tasks/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/messages.properties,v >retrieving revision 1.2 >diff -u -r1.2 messages.properties >--- src/org/eclipse/mylyn/internal/bugzilla/ui/messages.properties 8 Jun 2010 23:05:42 -0000 1.2 >+++ src/org/eclipse/mylyn/internal/bugzilla/ui/messages.properties 21 Jan 2011 20:39:37 -0000 >@@ -8,4 +8,5 @@ > # Contributors: > # Tasktop Technologies - initial API and implementation > ############################################################################### >-TaskAttachmentHyperlink_Open_Attachment_X_in_X=Open Attachment {0} in {1} >\ No newline at end of file >+TaskAttachmentHyperlink_Open_Attachment_X_in_Y=Open Attachment {0} in {1} >+TaskAttachmentTableEditorHyperlink_Show_Attachment_X_in_Y=Show Attachment {0} in {1} >Index: src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaConnectorUi.java >=================================================================== >RCS file: /cvsroot/mylyn/org.eclipse.mylyn.tasks/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaConnectorUi.java,v >retrieving revision 1.58 >diff -u -r1.58 BugzillaConnectorUi.java >--- src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaConnectorUi.java 8 Jun 2010 23:05:42 -0000 1.58 >+++ src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaConnectorUi.java 21 Jan 2011 20:39:37 -0000 >@@ -19,6 +19,7 @@ > import java.util.regex.Matcher; > import java.util.regex.Pattern; > >+import org.eclipse.core.runtime.Platform; > import org.eclipse.jface.resource.ImageDescriptor; > import org.eclipse.jface.text.Region; > import org.eclipse.jface.text.hyperlink.IHyperlink; >@@ -30,6 +31,7 @@ > import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants; > import org.eclipse.mylyn.internal.bugzilla.ui.BugzillaImages; > import org.eclipse.mylyn.internal.bugzilla.ui.TaskAttachmentHyperlink; >+import org.eclipse.mylyn.internal.bugzilla.ui.TaskAttachmentTableEditorHyperlink; > import org.eclipse.mylyn.internal.bugzilla.ui.search.BugzillaSearchPage; > import org.eclipse.mylyn.internal.bugzilla.ui.wizard.NewBugzillaTaskWizard; > import org.eclipse.mylyn.tasks.core.IRepositoryQuery; >@@ -45,6 +47,8 @@ > import org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositoryQueryPage; > import org.eclipse.mylyn.tasks.ui.wizards.ITaskRepositoryPage; > import org.eclipse.mylyn.tasks.ui.wizards.RepositoryQueryWizard; >+import org.osgi.framework.Bundle; >+import org.osgi.framework.Version; > > /** > * @author Mik Kersten >@@ -65,6 +69,22 @@ > > private static final Pattern PATTERN_ATTACHMENT = Pattern.compile(REGEXP_ATTACHMENT, Pattern.CASE_INSENSITIVE); > >+ /* >+ * because of bug# 322293 (NPE when select Hyperlink from MultipleHyperlinkPresenter List) >+ * for MacOS we enable this only if running on Eclipse >= "3.7.0.v201101192000" >+ * >+ */ >+ private final boolean doAttachmentTableEditorHyperlink; >+ >+ public BugzillaConnectorUi() { >+ super(); >+ Bundle bundle = Platform.getBundle("org.eclipse.platform"); //$NON-NLS-1$ >+ String versionString = bundle.getHeaders().get("Bundle-Version"); //$NON-NLS-1$ >+ >+ Version version = new Version(versionString); >+ doAttachmentTableEditorHyperlink = version.compareTo(new Version("3.7.0.v201101192000")) >= 0; //$NON-NLS-1$ >+ } >+ > @Override > public String getAccountCreationUrl(TaskRepository taskRepository) { > return taskRepository.getRepositoryUrl() + "/createaccount.cgi"; //$NON-NLS-1$ >@@ -220,11 +240,14 @@ > if (index == -1 || (index >= ma.start() && index <= ma.end())) { > // attachment > Region region = new Region(textOffset + ma.start(), ma.end() - ma.start()); >- TaskAttachmentHyperlink link = new TaskAttachmentHyperlink(region, repository, ma.group(1)); >+ TaskAttachmentHyperlink link0 = new TaskAttachmentHyperlink(region, repository, ma.group(1)); > if (hyperlinksFound == null) { > hyperlinksFound = new ArrayList<IHyperlink>(); > } >- hyperlinksFound.add(link); >+ hyperlinksFound.add(link0); >+ if (doAttachmentTableEditorHyperlink) { >+ hyperlinksFound.add(new TaskAttachmentTableEditorHyperlink(region, repository, ma.group(1))); >+ } > } > } > >#P org.eclipse.mylyn.tasks.ui >Index: src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorAttachmentPart.java >=================================================================== >RCS file: /cvsroot/mylyn/org.eclipse.mylyn.tasks/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorAttachmentPart.java,v >retrieving revision 1.60 >diff -u -r1.60 TaskEditorAttachmentPart.java >--- src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorAttachmentPart.java 27 Oct 2010 13:27:54 -0000 1.60 >+++ src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorAttachmentPart.java 21 Jan 2011 20:40:02 -0000 >@@ -33,6 +33,7 @@ > import org.eclipse.jface.viewers.StructuredSelection; > import org.eclipse.jface.viewers.TableViewer; > import org.eclipse.jface.window.ToolTip; >+import org.eclipse.mylyn.internal.provisional.commons.ui.CommonFormUtil; > import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages; > import org.eclipse.mylyn.internal.provisional.commons.ui.TableSorter; > import org.eclipse.mylyn.internal.provisional.commons.ui.TableViewerSupport; >@@ -56,10 +57,14 @@ > import org.eclipse.swt.widgets.Menu; > import org.eclipse.swt.widgets.Table; > import org.eclipse.swt.widgets.TableColumn; >+import org.eclipse.swt.widgets.TableItem; > import org.eclipse.ui.IWorkbenchPage; >+import org.eclipse.ui.forms.IManagedForm; > import org.eclipse.ui.forms.events.ExpansionAdapter; > import org.eclipse.ui.forms.events.ExpansionEvent; >+import org.eclipse.ui.forms.widgets.ExpandableComposite; > import org.eclipse.ui.forms.widgets.FormToolkit; >+import org.eclipse.ui.forms.widgets.ScrolledForm; > import org.eclipse.ui.forms.widgets.Section; > > /** >@@ -117,6 +122,8 @@ > > private Composite attachmentsComposite; > >+ private Table attachmentsTable; >+ > public TaskEditorAttachmentPart() { > setPartName(Messages.TaskEditorAttachmentPart_Attachments); > } >@@ -315,4 +322,46 @@ > // canceled > } > } >+ >+ @Override >+ public boolean setFormInput(Object input) { >+ if (input instanceof String) { >+ String text = (String) input; >+ if (attachments != null) { >+ for (TaskAttribute attachmentAttribute : attachments) { >+ if (text.equals(attachmentAttribute.getId())) { >+ CommonFormUtil.setExpanded((ExpandableComposite) getControl(), true); >+ >+ return selectReveal(attachmentAttribute); >+ } >+ } >+ } >+ } >+ return super.setFormInput(input); >+ } >+ >+ public boolean selectReveal(TaskAttribute attachmentAttribute) { >+ if (attachmentAttribute == null || attachmentsTable == null) { >+ return false; >+ } >+ TableItem[] attachments = attachmentsTable.getItems(); >+ int index = 0; >+ for (TableItem attachment : attachments) { >+ Object data = attachment.getData(); >+ if (data instanceof ITaskAttachment) { >+ ITaskAttachment attachmentData = ((ITaskAttachment) data); >+ if (attachmentData.getTaskAttribute().getValue().equals(attachmentAttribute.getValue())) { >+ attachmentsTable.deselectAll(); >+ attachmentsTable.select(index); >+ IManagedForm mform = getManagedForm(); >+ ScrolledForm form = mform.getForm(); >+ EditorUtil.focusOn(form, attachmentsTable); >+ return true; >+ } >+ } >+ index++; >+ } >+ return false; >+ } >+ > } >Index: src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorOutlineNode.java >=================================================================== >RCS file: /cvsroot/mylyn/org.eclipse.mylyn.tasks/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorOutlineNode.java,v >retrieving revision 1.11 >diff -u -r1.11 TaskEditorOutlineNode.java >--- src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorOutlineNode.java 6 Jan 2011 19:45:17 -0000 1.11 >+++ src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorOutlineNode.java 21 Jan 2011 20:40:02 -0000 >@@ -31,6 +31,7 @@ > import org.eclipse.mylyn.tasks.core.data.TaskAttribute; > import org.eclipse.mylyn.tasks.core.data.TaskData; > import org.eclipse.mylyn.tasks.core.data.TaskRelation; >+import org.eclipse.mylyn.tasks.core.data.TaskRelation.Direction; > import org.eclipse.mylyn.tasks.ui.TasksUi; > import org.eclipse.osgi.util.NLS; > >@@ -144,6 +145,12 @@ > label = NLS.bind(Messages.TaskEditorOutlineNode_TaskRelation_Label, > new Object[] { taskRelation.getTaskId(), Messages.TaskEditorOutlineNode_unknown_Label }); > } >+ >+ if (taskRelation.getDirection().compareTo(Direction.INWARD) == 0) { >+ label = label + Messages.TaskEditorOutlineNode_ParentRelation; >+ } else { >+ label = label + Messages.TaskEditorOutlineNode_ChildRelation; >+ } > TaskEditorOutlineNode childNode = new TaskEditorOutlineNode(label); > > childNode.setTaskRelation(taskRelation); >Index: src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage.java >=================================================================== >RCS file: /cvsroot/mylyn/org.eclipse.mylyn.tasks/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage.java,v >retrieving revision 1.163 >diff -u -r1.163 AbstractTaskEditorPage.java >--- src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage.java 19 Aug 2010 20:31:44 -0000 1.163 >+++ src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage.java 21 Jan 2011 20:40:02 -0000 >@@ -1732,7 +1732,46 @@ > > @Override > public boolean selectReveal(Object object) { >- if (object instanceof TaskEditorOutlineNode) { >+ if (object instanceof String) { >+ String objString = (String) object; >+ if (objString != null && objString.startsWith(TaskAttribute.PREFIX_ATTACHMENT)) { >+ AbstractTaskEditorPart actionPart = this.getPart(AbstractTaskEditorPage.ID_PART_ATTACHMENTS); >+ if (actionPart != null && actionPart.getControl() instanceof ExpandableComposite) { >+ CommonFormUtil.setExpanded((ExpandableComposite) actionPart.getControl(), true); >+ if (actionPart.getControl() instanceof Section) { >+ Control client = actionPart.getControl(); >+ if (client instanceof Composite) { >+ for (Control control : ((Composite) client).getChildren()) { >+ if (control instanceof Composite) { >+ for (Control control1 : ((Composite) control).getChildren()) { >+ if (control1 instanceof org.eclipse.swt.widgets.Table) { >+ org.eclipse.swt.widgets.Table attachmentTable = ((org.eclipse.swt.widgets.Table) control1); >+ TableItem[] attachments = attachmentTable.getItems(); >+ int index = 0; >+ for (TableItem attachment : attachments) { >+ Object data = attachment.getData(); >+ if (data instanceof ITaskAttachment) { >+ ITaskAttachment attachmentData = ((ITaskAttachment) data); >+ if (attachmentData.getTaskAttribute().getId().equals(objString)) { >+ attachmentTable.deselectAll(); >+ attachmentTable.select(index); >+ IManagedForm mform = actionPart.getManagedForm(); >+ ScrolledForm form = mform.getForm(); >+ EditorUtil.focusOn(form, attachmentTable); >+ return true; >+ } >+ } >+ index++; >+ } >+ } >+ } >+ } >+ } >+ } >+ } >+ } >+ } >+ } else if (object instanceof TaskEditorOutlineNode) { > TaskEditorOutlineNode node = (TaskEditorOutlineNode) object; > TaskAttribute attribute = node.getData(); > if (attribute != null) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 199283
:
163181
|
163182
|
173583
|
173584
|
176402
|
176403
|
176404
|
176405
|
187141
|
187142
| 187327 |
187328
|
187342
|
187361