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 175449 Details for
Bug 250257
persist columns in attachments table
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 v7
clipboard.txt (text/plain), 9.37 KB, created by
Steffen Pingel
on 2010-07-28 20:33:16 EDT
(
hide
)
Description:
patch v7
Filename:
MIME Type:
Creator:
Steffen Pingel
Created:
2010-07-28 20:33:16 EDT
Size:
9.37 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylyn.tasks.ui >Index: src/org/eclipse/mylyn/internal/tasks/ui/editors/AttachmentTableLabelProvider.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/AttachmentTableLabelProvider.java,v >retrieving revision 1.28 >diff -u -r1.28 AttachmentTableLabelProvider.java >--- src/org/eclipse/mylyn/internal/tasks/ui/editors/AttachmentTableLabelProvider.java 13 Jul 2010 20:32:16 -0000 1.28 >+++ src/org/eclipse/mylyn/internal/tasks/ui/editors/AttachmentTableLabelProvider.java 29 Jul 2010 00:32:14 -0000 >@@ -121,10 +121,23 @@ > case 4: > return (attachment.getCreationDate() != null) ? EditorUtil.formatDateTime(attachment.getCreationDate()) > : ""; //$NON-NLS-1$ >+ case 5: >+ // FIXME add id to ITaskAttachment >+ return getAttachmentId(attachment); > } > return "unrecognized column"; //$NON-NLS-1$ > } > >+ static String getAttachmentId(ITaskAttachment attachment) { >+ String a = attachment.getUrl(); >+ int i = a.indexOf("?id="); //$NON-NLS-1$ >+ if (i != -1) { >+ return a.substring(i + 4); >+ } else { >+ return ""; //$NON-NLS-1$ >+ } >+ } >+ > @Override > public void addListener(ILabelProviderListener listener) { > // ignore >Index: src/org/eclipse/mylyn/internal/tasks/ui/editors/Messages.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/Messages.java,v >retrieving revision 1.35 >diff -u -r1.35 Messages.java >--- src/org/eclipse/mylyn/internal/tasks/ui/editors/Messages.java 13 Jul 2010 20:32:16 -0000 1.35 >+++ src/org/eclipse/mylyn/internal/tasks/ui/editors/Messages.java 29 Jul 2010 00:32:14 -0000 >@@ -113,6 +113,8 @@ > > public static String TaskEditorAttachmentPart_Description; > >+ public static String TaskEditorAttachmentPart_ID; >+ > public static String TaskEditorAttachmentPart_Name; > > public static String TaskEditorAttachmentPart_No_attachments; >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.54 >diff -u -r1.54 TaskEditorAttachmentPart.java >--- src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorAttachmentPart.java 13 Jul 2010 20:32:16 -0000 1.54 >+++ src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorAttachmentPart.java 29 Jul 2010 00:32:14 -0000 >@@ -13,10 +13,12 @@ > > package org.eclipse.mylyn.internal.tasks.ui.editors; > >+import java.io.File; > import java.util.ArrayList; >-import java.util.Date; > import java.util.List; > >+import org.eclipse.core.runtime.IPath; >+import org.eclipse.core.runtime.Platform; > import org.eclipse.jface.action.Action; > import org.eclipse.jface.action.IMenuListener; > import org.eclipse.jface.action.IMenuManager; >@@ -29,13 +31,15 @@ > import org.eclipse.jface.viewers.OpenEvent; > import org.eclipse.jface.viewers.StructuredSelection; > import org.eclipse.jface.viewers.TableViewer; >-import org.eclipse.jface.viewers.Viewer; >-import org.eclipse.jface.viewers.ViewerSorter; > import org.eclipse.jface.window.ToolTip; > 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; > import org.eclipse.mylyn.internal.tasks.core.TaskAttachment; >+import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin; > import org.eclipse.mylyn.internal.tasks.ui.commands.OpenTaskAttachmentHandler; > import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiMenus; >+import org.eclipse.mylyn.internal.tasks.ui.views.TaskKeyComparator; > import org.eclipse.mylyn.internal.tasks.ui.wizards.TaskAttachmentWizard.Mode; > import org.eclipse.mylyn.tasks.core.ITaskAttachment; > import org.eclipse.mylyn.tasks.core.data.TaskAttribute; >@@ -64,13 +68,45 @@ > */ > public class TaskEditorAttachmentPart extends AbstractTaskEditorPart { > >+ private class AttachmentTableSorter extends TableSorter { >+ >+ TaskKeyComparator keyComparator = new TaskKeyComparator(); >+ >+ @Override >+ public int compare(TableViewer viewer, Object e1, Object e2, int columnIndex) { >+ ITaskAttachment attachment1 = (ITaskAttachment) e1; >+ ITaskAttachment attachment2 = (ITaskAttachment) e2; >+ switch (columnIndex) { >+ case 0: >+ return compare(attachment1.getFileName(), attachment2.getFileName()); >+ case 1: >+ String description1 = attachment1.getDescription(); >+ String description2 = attachment2.getDescription(); >+ return compare(description1, description2); >+ case 2: >+ return compare(attachment1.getLength(), attachment2.getLength()); >+ case 3: >+ return compare(attachment1.getAuthor().toString(), attachment2.getAuthor().toString()); >+ case 4: >+ return compare(attachment1.getCreationDate(), attachment2.getCreationDate()); >+ case 5: >+ String key1 = AttachmentTableLabelProvider.getAttachmentId(attachment1); >+ String key2 = AttachmentTableLabelProvider.getAttachmentId(attachment2); >+ return keyComparator.compare2(key1, key2); >+ } >+ return super.compare(viewer, e1, e2, columnIndex); >+ } >+ >+ } >+ > private static final String ID_POPUP_MENU = "org.eclipse.mylyn.tasks.ui.editor.menu.attachments"; //$NON-NLS-1$ > > private final String[] attachmentsColumns = { Messages.TaskEditorAttachmentPart_Name, > Messages.TaskEditorAttachmentPart_Description, /*"Type", */Messages.TaskEditorAttachmentPart_Size, >- Messages.TaskEditorAttachmentPart_Creator, Messages.TaskEditorAttachmentPart_Created }; >+ Messages.TaskEditorAttachmentPart_Creator, Messages.TaskEditorAttachmentPart_Created, >+ Messages.TaskEditorAttachmentPart_ID }; > >- private final int[] attachmentsColumnWidths = { 130, 150, /*100,*/70, 100, 100 }; >+ private final int[] attachmentsColumnWidths = { 130, 150, /*100,*/70, 100, 100, 0 }; > > private List<TaskAttribute> attachments; > >@@ -89,14 +125,21 @@ > 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++) { > TableColumn column = new TableColumn(attachmentsTable, SWT.LEFT, i); > column.setText(attachmentsColumns[i]); > column.setWidth(attachmentsColumnWidths[i]); >+ if (i == 4) { >+ attachmentsTable.setSortColumn(column); >+ attachmentsTable.setSortDirection(SWT.UP); >+ } > } > // size column > attachmentsTable.getColumn(2).setAlignment(SWT.RIGHT); >@@ -106,24 +149,7 @@ > attachmentsViewer.setColumnProperties(attachmentsColumns); > ColumnViewerToolTipSupport.enableFor(attachmentsViewer, ToolTip.NO_RECREATE); > >- attachmentsViewer.setSorter(new ViewerSorter() { >- @Override >- public int compare(Viewer viewer, Object e1, Object e2) { >- ITaskAttachment attachment1 = (ITaskAttachment) e1; >- ITaskAttachment attachment2 = (ITaskAttachment) e2; >- Date created1 = attachment1.getCreationDate(); >- Date created2 = attachment2.getCreationDate(); >- if (created1 != null && created2 != null) { >- return created1.compareTo(created2); >- } else if (created1 == null && created2 != null) { >- return -1; >- } else if (created1 != null && created2 == null) { >- return 1; >- } else { >- return 0; >- } >- } >- }); >+ attachmentsViewer.setSorter(new AttachmentTableSorter()); > > List<ITaskAttachment> attachmentList = new ArrayList<ITaskAttachment>(attachments.size()); > for (TaskAttribute attribute : attachments) { >@@ -153,6 +179,13 @@ > getTaskEditorPage().getEditorSite().registerContextMenu(ID_POPUP_MENU, menuManager, attachmentsViewer, true); > Menu menu = menuManager.createContextMenu(attachmentsTable); > attachmentsTable.setMenu(menu); >+ >+ new TableViewerSupport(attachmentsViewer, getStateFile()); >+ } >+ >+ private File getStateFile() { >+ IPath stateLocation = Platform.getStateLocation(TasksUiPlugin.getDefault().getBundle()); >+ return stateLocation.append("TaskEditorAttachmentPart.xml").toFile(); //$NON-NLS-1$ > } > > private void createButtons(Composite attachmentsComposite, FormToolkit toolkit) { >Index: src/org/eclipse/mylyn/internal/tasks/ui/editors/messages.properties >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/messages.properties,v >retrieving revision 1.43 >diff -u -r1.43 messages.properties >--- src/org/eclipse/mylyn/internal/tasks/ui/editors/messages.properties 13 Jul 2010 20:32:16 -0000 1.43 >+++ src/org/eclipse/mylyn/internal/tasks/ui/editors/messages.properties 29 Jul 2010 00:32:14 -0000 >@@ -60,6 +60,7 @@ > TaskEditorAttachmentPart_Created=Created > TaskEditorAttachmentPart_Creator=Creator > TaskEditorAttachmentPart_Description=Description >+TaskEditorAttachmentPart_ID=ID > TaskEditorAttachmentPart_Name=Name > TaskEditorAttachmentPart_No_attachments=No attachments > TaskEditorAttachmentPart_Size=Size
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 250257
:
152248
|
152249
|
152640
|
152641
|
158913
|
158914
|
158915
|
158916
|
173981
|
173982
|
174179
|
174180
|
174213
|
174214
|
174251
|
174252
| 175449 |
175450