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 173583 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]
updated patch
199283V1.txt (text/plain), 12.49 KB, created by
Frank Becker
on 2010-07-06 14:20:19 EDT
(
hide
)
Description:
updated patch
Filename:
MIME Type:
Creator:
Frank Becker
Created:
2010-07-06 14:20:19 EDT
Size:
12.49 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 6 Jul 2010 18:15:14 -0000 >@@ -18,6 +18,10 @@ > > public static String TaskAttachmentHyperlink_Open_Attachment_X_in_X; > >+ public static String TaskAttachmentHyperlink_Open_With_Browser; >+ >+ public static String TaskAttachmentHyperlink_Show_in_Editor; >+ > static { > // initialize resource bundle > NLS.initializeMessages(BUNDLE_NAME, Messages.class); >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 6 Jul 2010 18:15:14 -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 >@@ -52,8 +65,37 @@ > } > > public void open() { >- String url = repository.getUrl() + IBugzillaConstants.URL_GET_ATTACHMENT_SUFFIX + attachmentId; >- TasksUiUtil.openUrl(url); >+ Display display = PlatformUI.getWorkbench().getDisplay(); >+ Menu menu = new Menu(display.getActiveShell(), SWT.POP_UP); >+ MenuItem item = new MenuItem(menu, SWT.PUSH); >+ item.setText(Messages.TaskAttachmentHyperlink_Show_in_Editor); >+ 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(Messages.TaskAttachmentHyperlink_Open_With_Browser); >+ 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 +150,21 @@ > + 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 6 Jul 2010 18:15:14 -0000 >@@ -8,4 +8,6 @@ > # 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_X=Open Attachment {0} in {1} >+TaskAttachmentHyperlink_Open_With_Browser=Open with Browser >+TaskAttachmentHyperlink_Show_in_Editor=Show in Editor >#P org.eclipse.mylyn.tasks.ui >Index: src/org/eclipse/mylyn/internal/tasks/ui/editors/EditorUtil.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/EditorUtil.java,v >retrieving revision 1.42 >diff -u -r1.42 EditorUtil.java >--- src/org/eclipse/mylyn/internal/tasks/ui/editors/EditorUtil.java 8 Jun 2010 23:10:07 -0000 1.42 >+++ src/org/eclipse/mylyn/internal/tasks/ui/editors/EditorUtil.java 6 Jul 2010 18:15:15 -0000 >@@ -148,10 +148,12 @@ > } > > /** >- * Scroll to a specified piece of text >+ * Scroll to a specified control > * >+ * @param form >+ * The ScrolledForm we want to set the new Origin > * @param control >- * The StyledText to scroll to >+ * Control that should be visible > */ > public static void focusOn(ScrolledForm form, Control control) { > int pos = 0; >@@ -163,7 +165,7 @@ > control = control.getParent(); > } > >- pos = pos - 60; // form.getOrigin().y; >+ pos = pos - 60; > if (!form.getBody().isDisposed()) { > form.setOrigin(0, pos); > } >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.45 >diff -u -r1.45 TaskEditorAttachmentPart.java >--- src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorAttachmentPart.java 8 Jun 2010 23:10:07 -0000 1.45 >+++ src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorAttachmentPart.java 6 Jul 2010 18:15:15 -0000 >@@ -32,6 +32,7 @@ > import org.eclipse.jface.viewers.Viewer; > import org.eclipse.jface.viewers.ViewerSorter; > 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.tasks.core.TaskAttachment; > import org.eclipse.mylyn.internal.tasks.ui.commands.OpenTaskAttachmentHandler; >@@ -51,10 +52,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; > > /** >@@ -80,17 +85,22 @@ > > 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()); >- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).hint(500, SWT.DEFAULT).applyTo( >- attachmentsTable); >+ GridDataFactory.fillDefaults() >+ .align(SWT.FILL, SWT.FILL) >+ .grab(true, false) >+ .hint(500, SWT.DEFAULT) >+ .applyTo(attachmentsTable); > attachmentsTable.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TREE_BORDER); > > for (int i = 0; i < attachmentsColumns.length; i++) { >@@ -277,4 +287,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; >+ } > } >Index: src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage.java,v >retrieving revision 1.162 >diff -u -r1.162 AbstractTaskEditorPage.java >--- src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage.java 8 Jun 2010 23:10:09 -0000 1.162 >+++ src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage.java 6 Jul 2010 18:15:15 -0000 >@@ -92,10 +92,10 @@ > import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector; > import org.eclipse.mylyn.tasks.core.IRepositoryElement; > import org.eclipse.mylyn.tasks.core.ITask; >+import org.eclipse.mylyn.tasks.core.ITask.SynchronizationState; > import org.eclipse.mylyn.tasks.core.ITaskAttachment; > import org.eclipse.mylyn.tasks.core.RepositoryStatus; > import org.eclipse.mylyn.tasks.core.TaskRepository; >-import org.eclipse.mylyn.tasks.core.ITask.SynchronizationState; > import org.eclipse.mylyn.tasks.core.data.ITaskDataWorkingCopy; > import org.eclipse.mylyn.tasks.core.data.TaskAttribute; > import org.eclipse.mylyn.tasks.core.data.TaskData; >@@ -1291,15 +1291,21 @@ > if (part.getControl() != null) { > if (ID_PART_ACTIONS.equals(part.getPartId())) { > // do not expand horizontally >- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(false, false).applyTo( >- part.getControl()); >+ GridDataFactory.fillDefaults() >+ .align(SWT.FILL, SWT.FILL) >+ .grab(false, false) >+ .applyTo(part.getControl()); > } else { > if (part.getExpandVertically()) { >- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo( >- part.getControl()); >+ GridDataFactory.fillDefaults() >+ .align(SWT.FILL, SWT.FILL) >+ .grab(true, true) >+ .applyTo(part.getControl()); > } else { >- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).grab(true, false).applyTo( >- part.getControl()); >+ GridDataFactory.fillDefaults() >+ .align(SWT.FILL, SWT.TOP) >+ .grab(true, false) >+ .applyTo(part.getControl()); > } > } > // for outline
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
Flags:
eclipse
:
review?
Actions:
View
|
Diff
Attachments on
bug 199283
:
163181
|
163182
| 173583 |
173584
|
176402
|
176403
|
176404
|
176405
|
187141
|
187142
|
187327
|
187328
|
187342
|
187361