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 176404 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 with workaround
patch199283V4.txt (text/plain), 15.71 KB, created by
Frank Becker
on 2010-08-11 16:42:36 EDT
(
hide
)
Description:
patch with workaround
Filename:
MIME Type:
Creator:
Frank Becker
Created:
2010-08-11 16:42:36 EDT
Size:
15.71 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/tools/org.eclipse.mylyn/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 11 Aug 2010 20:38:17 -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/tools/org.eclipse.mylyn/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 11 Aug 2010 20:38:17 -0000 >@@ -18,7 +18,20 @@ > 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.swt.SWT; >+import org.eclipse.swt.widgets.Display; >+import org.eclipse.swt.widgets.Event; >+import org.eclipse.swt.widgets.Listener; >+import org.eclipse.swt.widgets.Menu; >+import org.eclipse.swt.widgets.MenuItem; >+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 >@@ -43,7 +56,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()); > } > >@@ -52,8 +65,44 @@ > } > > public void open() { >- String url = repository.getUrl() + IBugzillaConstants.URL_GET_ATTACHMENT_SUFFIX + attachmentId; >- TasksUiUtil.openUrl(url); >+// FIXME disabled until bug# 322293 is fixed >+// String url = repository.getUrl() + IBugzillaConstants.URL_GET_ATTACHMENT_SUFFIX + attachmentId; >+// TasksUiUtil.openUrl(url); >+ >+// FIXME enabled until bug# 322293 is fixed >+ Display display = PlatformUI.getWorkbench().getDisplay(); >+ Menu menu = new Menu(display.getActiveShell(), SWT.POP_UP); >+ MenuItem item = new MenuItem(menu, SWT.PUSH); >+ item.setText(MessageFormat.format(Messages.TaskAttachmentTableEditorHyperlink_Show_Attachment_X_in_Y, >+ attachmentId, repository.getRepositoryLabel())); >+ item.addListener(SWT.Selection, new Listener() { >+ public void handleEvent(final Event event) { >+ 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); >+ } >+ } >+ } >+ }); >+ item = new MenuItem(menu, SWT.PUSH); >+ item.setText(MessageFormat.format(Messages.TaskAttachmentHyperlink_Open_Attachment_X_in_Y, attachmentId, >+ repository.getRepositoryLabel())); >+ item.addListener(SWT.Selection, new Listener() { >+ public void handleEvent(final Event event) { >+ String url = repository.getUrl() + IBugzillaConstants.URL_GET_ATTACHMENT_SUFFIX + attachmentId; >+ TasksUiUtil.openUrl(url); >+ } >+ }); >+ >+ menu.setVisible(true); >+ while (!menu.isDisposed() && menu.isVisible()) { >+ if (!display.readAndDispatch()) { >+ display.sleep(); >+ } >+ } >+ menu.dispose(); > } > > @Override >@@ -108,4 +157,22 @@ > + repository + "]"; //$NON-NLS-1$ > } > >+ // FIXME enabled until bug# 322293 is fixed >+ private 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/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/tools/org.eclipse.mylyn/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 11 Aug 2010 20:38:19 -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/tools/org.eclipse.mylyn/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 11 Aug 2010 20:38:19 -0000 >@@ -220,11 +220,13 @@ > 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); >+// FIXME disabled until bug# 322293 is fixed >+// 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/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorAttachmentPart.java,v >retrieving revision 1.58 >diff -u -r1.58 TaskEditorAttachmentPart.java >--- src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorAttachmentPart.java 11 Aug 2010 20:15:34 -0000 1.58 >+++ src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorAttachmentPart.java 11 Aug 2010 20:38:21 -0000 >@@ -32,6 +32,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; >@@ -55,10 +56,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; > > /** >@@ -116,12 +121,14 @@ > > private Composite attachmentsComposite; > >+ private Table attachmentsTable; >+ > public TaskEditorAttachmentPart() { > setPartName(Messages.TaskEditorAttachmentPart_Attachments); > } > > private void createAttachmentTable(FormToolkit toolkit, final Composite attachmentsComposite) { >- Table attachmentsTable = toolkit.createTable(attachmentsComposite, SWT.MULTI | SWT.FULL_SELECTION); >+ attachmentsTable = toolkit.createTable(attachmentsComposite, SWT.MULTI | SWT.FULL_SELECTION); > attachmentsTable.setLinesVisible(true); > attachmentsTable.setHeaderVisible(true); > attachmentsTable.setLayout(new GridLayout()); >@@ -311,4 +318,45 @@ > > OpenTaskAttachmentHandler.openAttachments(page, attachments); > } >+ >+ @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; >+ } > }
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