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 153117 Details for
Bug 178474
[api] open corresponding task should highlight or expand comment number
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]
POC
patch178474.txt (text/plain), 42.23 KB, created by
Frank Becker
on 2009-11-25 15:34:34 EST
(
hide
)
Description:
POC
Filename:
MIME Type:
Creator:
Frank Becker
Created:
2009-11-25 15:34:34 EST
Size:
42.23 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.23 >diff -u -r1.23 AttachmentTableLabelProvider.java >--- src/org/eclipse/mylyn/internal/tasks/ui/editors/AttachmentTableLabelProvider.java 7 Dec 2008 03:26:58 -0000 1.23 >+++ src/org/eclipse/mylyn/internal/tasks/ui/editors/AttachmentTableLabelProvider.java 25 Nov 2009 20:31:45 -0000 >@@ -46,14 +46,17 @@ > > private final AttributeEditorToolkit attributeEditorToolkit; > >- public AttachmentTableLabelProvider(TaskDataModel model, AttributeEditorToolkit attributeEditorToolkit) { >+ int offset; >+ >+ public AttachmentTableLabelProvider(TaskDataModel model, AttributeEditorToolkit attributeEditorToolkit, int offset) { > this.model = model; > this.attributeEditorToolkit = attributeEditorToolkit; >+ this.offset = offset; > } > > public Image getColumnImage(Object element, int columnIndex) { > ITaskAttachment attachment = (ITaskAttachment) element; >- if (columnIndex == 0) { >+ if (columnIndex == 1 + offset) { > if (AttachmentUtil.isContext(attachment)) { > return CommonImages.getImage(TasksUiImages.CONTEXT_TRANSFER); > } else if (attachment.isPatch()) { >@@ -80,8 +83,16 @@ > > public String getColumnText(Object element, int columnIndex) { > ITaskAttachment attachment = (ITaskAttachment) element; >- switch (columnIndex) { >+ switch (columnIndex - offset) { > case 0: >+ 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$ >+ } >+ case 1: > if (AttachmentUtil.isContext(attachment)) { > return Messages.AttachmentTableLabelProvider_Task_Context; > } else if (attachment.isPatch()) { >@@ -89,17 +100,17 @@ > } else { > return " " + attachment.getFileName(); //$NON-NLS-1$ > } >- case 1: >- return attachment.getDescription(); > case 2: >+ return attachment.getDescription(); >+ case 3: > Long length = attachment.getLength(); > if (length < 0) { > return "-"; //$NON-NLS-1$ > } > return sizeFormatter.format(length); >- case 3: >- return (attachment.getAuthor() != null) ? attachment.getAuthor().toString() : ""; //$NON-NLS-1$ > case 4: >+ return (attachment.getAuthor() != null) ? attachment.getAuthor().toString() : ""; //$NON-NLS-1$ >+ case 5: > return (attachment.getCreationDate() != null) ? EditorUtil.formatDateTime(attachment.getCreationDate()) > : ""; //$NON-NLS-1$ > } >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.43 >diff -u -r1.43 TaskEditorAttachmentPart.java >--- src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorAttachmentPart.java 6 Oct 2009 06:44:06 -0000 1.43 >+++ src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorAttachmentPart.java 25 Nov 2009 20:31:45 -0000 >@@ -13,16 +13,18 @@ > > 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; > import org.eclipse.jface.action.MenuManager; > import org.eclipse.jface.action.ToolBarManager; >-import org.eclipse.jface.layout.GridDataFactory; > import org.eclipse.jface.viewers.ArrayContentProvider; > import org.eclipse.jface.viewers.ColumnViewerToolTipSupport; > import org.eclipse.jface.viewers.IOpenListener; >@@ -34,7 +36,10 @@ > import org.eclipse.jface.window.ToolTip; > import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages; > import org.eclipse.mylyn.internal.tasks.core.TaskAttachment; >+import org.eclipse.mylyn.internal.tasks.ui.ITasksUiPreferenceConstants; >+import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin; > import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiMenus; >+import org.eclipse.mylyn.internal.tasks.ui.views.AbstractTableViewerConfigurator; > 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; >@@ -49,11 +54,10 @@ > import org.eclipse.swt.widgets.Composite; > import org.eclipse.swt.widgets.Label; > import org.eclipse.swt.widgets.Menu; >-import org.eclipse.swt.widgets.Table; >-import org.eclipse.swt.widgets.TableColumn; > import org.eclipse.ui.forms.events.ExpansionAdapter; > import org.eclipse.ui.forms.events.ExpansionEvent; > import org.eclipse.ui.forms.widgets.FormToolkit; >+import org.eclipse.ui.forms.widgets.ScrolledForm; > import org.eclipse.ui.forms.widgets.Section; > > /** >@@ -65,12 +69,6 @@ > > 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 }; >- >- private final int[] attachmentsColumnWidths = { 130, 150, /*100,*/70, 100, 100 }; >- > private List<TaskAttribute> attachments; > > private boolean hasIncoming; >@@ -79,72 +77,133 @@ > > private Composite attachmentsComposite; > >- public TaskEditorAttachmentPart() { >- setPartName(Messages.TaskEditorAttachmentPart_Attachments); >- } >+ private class AttachmentTableViewer extends AbstractTableViewerConfigurator { > >- private void createAttachmentTable(FormToolkit toolkit, final Composite attachmentsComposite) { >- Table 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); >- 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]); >- } >- // size column >- attachmentsTable.getColumn(2).setAlignment(SWT.RIGHT); >- >- TableViewer attachmentsViewer = new TableViewer(attachmentsTable); >- attachmentsViewer.setUseHashlookup(true); >- attachmentsViewer.setColumnProperties(attachmentsColumns); >- ColumnViewerToolTipSupport.enableFor(attachmentsViewer, ToolTip.NO_RECREATE); >+ public AttachmentTableViewer(File stateFile) { >+ super(stateFile); >+ // ignore >+ } > >- 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; >+ @Override >+ protected void adjustColumInfos() { >+ boolean showAttachmentID = TasksUiPlugin.getDefault().getPreferenceStore().getBoolean( >+ ITasksUiPreferenceConstants.ATTACHMENT_SHOW_ID); >+ int idWidth = columnInfos.get(0).getWidths(); >+ if (!showAttachmentID && idWidth > 0) { >+ columnInfos.get(0).setWidths(0); >+ } else if (showAttachmentID && idWidth == 0) { >+ columnInfos.get(0).setWidths(70); >+ } >+ >+ } >+ >+ @Override >+ protected void setDefaultColumnInfos() { >+ columnInfos.add(new ColumnState(Messages.TaskEditorAttachmentPart_Id, 70)); >+ columnInfos.add(new ColumnState(Messages.TaskEditorAttachmentPart_Name, 130)); >+ columnInfos.add(new ColumnState(Messages.TaskEditorAttachmentPart_Description, 150)); >+ ColumnState columnState = new ColumnState(Messages.TaskEditorAttachmentPart_Size, 70); >+ columnState.setAlignment(SWT.RIGHT); >+ columnInfos.add(columnState); >+ columnInfos.add(new ColumnState(Messages.TaskEditorAttachmentPart_Creator, 100)); >+ columnInfos.add(new ColumnState(Messages.TaskEditorAttachmentPart_Created, 100)); >+ >+ orderArray = new int[6]; >+ for (int i = 0; i < 6; i++) { >+ orderArray[i] = i; >+ } >+ >+ } >+ >+ @Override >+ protected void setupTableViewer() { >+ tableViewer.setUseHashlookup(true); >+ ColumnViewerToolTipSupport.enableFor(tableViewer, ToolTip.NO_RECREATE); >+ >+ tableViewer.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; >+ } > } >+ }); >+ List<ITaskAttachment> attachmentList = new ArrayList<ITaskAttachment>(attachments.size()); >+ for (TaskAttribute attribute : attachments) { >+ TaskAttachment taskAttachment = new TaskAttachment(getModel().getTaskRepository(), >+ getModel().getTask(), attribute); >+ getTaskData().getAttributeMapper().updateTaskAttachment(taskAttachment, attribute); >+ attachmentList.add(taskAttachment); > } >- }); >+ tableViewer.setContentProvider(new ArrayContentProvider()); >+ tableViewer.setLabelProvider(new AttachmentTableLabelProvider(getModel(), >+ getTaskEditorPage().getAttributeEditorToolkit(), 0)); >+ tableViewer.addOpenListener(new IOpenListener() { >+ public void open(OpenEvent event) { >+ if (!event.getSelection().isEmpty()) { >+ StructuredSelection selection = (StructuredSelection) event.getSelection(); >+ ITaskAttachment attachment = (ITaskAttachment) selection.getFirstElement(); >+ TasksUiUtil.openUrl(attachment.getUrl()); >+ } >+ } >+ }); >+ tableViewer.addSelectionChangedListener(getTaskEditorPage()); >+ tableViewer.setInput(attachmentList.toArray()); >+ } >+ >+ } >+ >+ private AttachmentTableViewer attachmentsViewer; > >- List<ITaskAttachment> attachmentList = new ArrayList<ITaskAttachment>(attachments.size()); >- for (TaskAttribute attribute : attachments) { >- TaskAttachment taskAttachment = new TaskAttachment(getModel().getTaskRepository(), getModel().getTask(), >- attribute); >- getTaskData().getAttributeMapper().updateTaskAttachment(taskAttachment, attribute); >- attachmentList.add(taskAttachment); >- } >- attachmentsViewer.setContentProvider(new ArrayContentProvider()); >- attachmentsViewer.setLabelProvider(new AttachmentTableLabelProvider(getModel(), >- getTaskEditorPage().getAttributeEditorToolkit())); >- attachmentsViewer.addOpenListener(new IOpenListener() { >- public void open(OpenEvent event) { >- if (!event.getSelection().isEmpty()) { >- StructuredSelection selection = (StructuredSelection) event.getSelection(); >- ITaskAttachment attachment = (ITaskAttachment) selection.getFirstElement(); >- TasksUiUtil.openUrl(attachment.getUrl()); >+ private boolean propertyListenerIstalled = false; >+ >+ private final org.eclipse.jface.util.IPropertyChangeListener PROPERTY_LISTENER = new org.eclipse.jface.util.IPropertyChangeListener() { >+ >+ public void propertyChange(org.eclipse.jface.util.PropertyChangeEvent event) { >+ if (event.getProperty().equals(ITasksUiPreferenceConstants.ATTACHMENT_COLUMN_TO_STD)) { >+ if (TasksUiPlugin.getDefault().getPreferenceStore().getBoolean( >+ ITasksUiPreferenceConstants.ATTACHMENT_COLUMN_TO_STD)) { >+ attachmentsViewer.resetColumnInfosToDefault(); >+ if (TasksUiPlugin.getDefault().getPreferenceStore().getBoolean( >+ ITasksUiPreferenceConstants.ATTACHMENT_SHOW_ID)) { >+ attachmentsViewer.getTable().getColumn(0).setWidth(70); >+ } else { >+ attachmentsViewer.getTable().getColumn(0).setWidth(0); >+ } >+ TasksUiPlugin.getDefault().getPreferenceStore().setValue( >+ ITasksUiPreferenceConstants.ATTACHMENT_COLUMN_TO_STD, false); >+ } >+ } else if (event.getProperty().equals(ITasksUiPreferenceConstants.ATTACHMENT_SHOW_ID)) { >+ if (TasksUiPlugin.getDefault().getPreferenceStore().getBoolean( >+ ITasksUiPreferenceConstants.ATTACHMENT_SHOW_ID)) { >+ attachmentsViewer.getTable().getColumn(0).setWidth(70); >+ } else { >+ attachmentsViewer.getTable().getColumn(0).setWidth(0); > } > } >- }); >- attachmentsViewer.addSelectionChangedListener(getTaskEditorPage()); >- attachmentsViewer.setInput(attachmentList.toArray()); >+ >+ } >+ }; >+ >+ public TaskEditorAttachmentPart() { >+ setPartName(Messages.TaskEditorAttachmentPart_Attachments); >+ } >+ >+ private void createAttachmentTable(FormToolkit toolkit, final Composite attachmentsComposite) { >+ IPath stateLocation = Platform.getStateLocation(TasksUiPlugin.getDefault().getBundle()); >+ File attachmentStateFile = stateLocation.append("TaskEditorAttachment.obj").toFile(); //$NON-NLS-1$ >+ attachmentsViewer = new AttachmentTableViewer(attachmentStateFile); >+ attachmentsViewer.create(toolkit, attachmentsComposite, 5); > > menuManager = new MenuManager(); > menuManager.setRemoveAllWhenShown(true); >@@ -154,8 +213,8 @@ > } > }); > getTaskEditorPage().getEditorSite().registerContextMenu(ID_POPUP_MENU, menuManager, attachmentsViewer, true); >- Menu menu = menuManager.createContextMenu(attachmentsTable); >- attachmentsTable.setMenu(menu); >+ Menu menu = menuManager.createContextMenu(attachmentsViewer.getTable()); >+ attachmentsViewer.getTable().setMenu(menu); > } > > private void createButtons(Composite attachmentsComposite, FormToolkit toolkit) { >@@ -191,7 +250,7 @@ > initialize(); > > final Section section = createSection(parent, toolkit, hasIncoming); >- section.setText(getPartName() + " (" + attachments.size() + ")"); //$NON-NLS-1$ //$NON-NLS-2$ >+ section.setText(getPartName() + " (" + attachments.size() + ")"); > if (hasIncoming) { > expandSection(toolkit, section); > } else { >@@ -237,6 +296,10 @@ > } > > private void initialize() { >+ if (!propertyListenerIstalled) { >+ TasksUiPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(PROPERTY_LISTENER); >+ propertyListenerIstalled = true; >+ } > attachments = getTaskData().getAttributeMapper().getAttributesByType(getTaskData(), > TaskAttribute.TYPE_ATTACHMENT); > for (TaskAttribute attachmentAttribute : attachments) { >@@ -260,4 +323,23 @@ > toolBarManager.add(attachFileAction); > } > >+ public void selectAttachment(ScrolledForm form, TaskAttribute attribute) { >+ TableViewer tv = attachmentsViewer.getTableViewer(); >+ int anz = tv.getTable().getItemCount(); >+ int i = 0; >+ tv.getTable().setSelection(0, 0); >+ EditorUtil.focusOn(form, tv.getControl()); >+ for (; i < anz; i++) { >+ TaskAttachment tableItem = (TaskAttachment) tv.getElementAt(i); >+ if (tableItem.getTaskAttribute().equals(attribute)) { >+ tv.getTable().setSelection(i, i); >+ break; >+ } >+ } >+ } >+ >+ public void resetSelectedAttachment(ScrolledForm form) { >+ TableViewer tv = attachmentsViewer.getTableViewer(); >+ tv.getTable().deselectAll(); >+ } > } >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.34 >diff -u -r1.34 messages.properties >--- src/org/eclipse/mylyn/internal/tasks/ui/editors/messages.properties 14 Oct 2009 07:17:11 -0000 1.34 >+++ src/org/eclipse/mylyn/internal/tasks/ui/editors/messages.properties 25 Nov 2009 20:31:45 -0000 >@@ -62,6 +62,7 @@ > TaskEditorAttachmentPart_Created=Created > TaskEditorAttachmentPart_Creator=Creator > TaskEditorAttachmentPart_Description=Description >+TaskEditorAttachmentPart_Id=Id > TaskEditorAttachmentPart_Name=Name > TaskEditorAttachmentPart_No_attachments=No attachments > TaskEditorAttachmentPart_Size=Size >@@ -89,6 +90,7 @@ > TaskEditorOutlineNode_Description=Description > TaskEditorOutlineNode_New_Comment=New Comment > TaskEditorOutlineNode_Task_=Task >+TaskEditorOutlineNode_Attachments=Attachments > > TaskEditorPeoplePart_People=People > >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.26 >diff -u -r1.26 Messages.java >--- src/org/eclipse/mylyn/internal/tasks/ui/editors/Messages.java 14 Oct 2009 02:54:48 -0000 1.26 >+++ src/org/eclipse/mylyn/internal/tasks/ui/editors/Messages.java 25 Nov 2009 20:31:45 -0000 >@@ -115,6 +115,8 @@ > > public static String TaskEditorAttachmentPart_Description; > >+ public static String TaskEditorAttachmentPart_Id; >+ > public static String TaskEditorAttachmentPart_Name; > > public static String TaskEditorAttachmentPart_No_attachments; >@@ -161,6 +163,8 @@ > > public static String TaskEditorOutlineNode_Task_; > >+ public static String TaskEditorOutlineNode_Attachments; >+ > public static String TaskEditorPeoplePart_People; > > public static String TaskEditorPlanningPart_0_SECOUNDS; >Index: src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorOutlineNode.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorOutlineNode.java,v >retrieving revision 1.6 >diff -u -r1.6 TaskEditorOutlineNode.java >--- src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorOutlineNode.java 5 Dec 2008 23:25:50 -0000 1.6 >+++ src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorOutlineNode.java 25 Nov 2009 20:31:45 -0000 >@@ -18,6 +18,7 @@ > import org.eclipse.core.runtime.Assert; > import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin; > import org.eclipse.mylyn.tasks.core.IRepositoryPerson; >+import org.eclipse.mylyn.tasks.core.ITaskAttachment; > import org.eclipse.mylyn.tasks.core.ITaskComment; > import org.eclipse.mylyn.tasks.core.data.TaskAttribute; > import org.eclipse.mylyn.tasks.core.data.TaskData; >@@ -35,6 +36,8 @@ > > public static final String LABEL_NEW_COMMENT = Messages.TaskEditorOutlineNode_New_Comment; > >+ public static final String LABEL_ATTACHMENTS = Messages.TaskEditorOutlineNode_Attachments; >+ > private static TaskEditorOutlineNode createNode(TaskData taskData, String attributeId, String label) { > TaskAttribute taskAttribute = taskData.getRoot().getMappedAttribute(attributeId); > if (taskAttribute != null) { >@@ -69,6 +72,19 @@ > node.setTaskComment(taskComment); > return node; > } >+ } else if (TaskAttribute.TYPE_ATTACHMENT.equals(type)) { >+ ITaskAttachment taskAttachment = TasksUiPlugin.getRepositoryModel().createTaskAttachment(taskAttribute); >+ if (taskAttachment != null) { >+ taskAttribute.getTaskData().getAttributeMapper().updateTaskAttachment(taskAttachment, taskAttribute); >+ StringBuilder sb = new StringBuilder(); >+ sb.append(taskAttachment.getTaskAttribute().getValue()); >+ sb.append(": "); //$NON-NLS-1$ >+ sb.append(taskAttachment.getFileName()); >+ >+ TaskEditorOutlineNode node = new TaskEditorOutlineNode(sb.toString(), taskAttribute); >+ node.setTaskAttachment(taskAttachment); >+ return node; >+ } > } else { > String label = taskAttribute.getTaskData().getAttributeMapper().getValueLabel(taskAttribute); > return new TaskEditorOutlineNode(label, taskAttribute); >@@ -82,6 +98,20 @@ > rootNode = new TaskEditorOutlineNode(Messages.TaskEditorOutlineNode_Task_ + taskData.getTaskId()); > } > addNode(rootNode, taskData, TaskAttribute.DESCRIPTION, LABEL_DESCRIPTION); >+ >+ List<TaskAttribute> attachments = taskData.getAttributeMapper().getAttributesByType(taskData, >+ TaskAttribute.TYPE_ATTACHMENT); >+ if (attachments.size() > 0) { >+ TaskEditorOutlineNode attachmentNode = new TaskEditorOutlineNode(LABEL_ATTACHMENTS); >+ rootNode.addChild(attachmentNode); >+ for (TaskAttribute attachmentAttribute : attachments) { >+ TaskEditorOutlineNode node = createNode(attachmentAttribute); >+ if (node != null) { >+ attachmentNode.addChild(node); >+ } >+ } >+ } >+ > List<TaskAttribute> comments = taskData.getAttributeMapper().getAttributesByType(taskData, > TaskAttribute.TYPE_COMMENT); > if (comments.size() > 0) { >@@ -118,6 +148,8 @@ > > private ITaskComment taskComment; > >+ private ITaskAttachment taskAttachment; >+ > public TaskEditorOutlineNode(String label) { > this(label, null); > } >@@ -183,4 +215,12 @@ > return getLabel(); > } > >+ public ITaskAttachment getTaskAttachment() { >+ return taskAttachment; >+ } >+ >+ public void setTaskAttachment(ITaskAttachment taskAttachment) { >+ this.taskAttachment = taskAttachment; >+ } >+ > } >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.40 >diff -u -r1.40 EditorUtil.java >--- src/org/eclipse/mylyn/internal/tasks/ui/editors/EditorUtil.java 15 Oct 2009 02:27:13 -0000 1.40 >+++ src/org/eclipse/mylyn/internal/tasks/ui/editors/EditorUtil.java 25 Nov 2009 20:31:45 -0000 >@@ -153,7 +153,7 @@ > * @param control > * The StyledText to scroll to > */ >- private static void focusOn(ScrolledForm form, Control control) { >+ public static void focusOn(ScrolledForm form, Control control) { > int pos = 0; > control.setEnabled(true); > control.setFocus(); >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.153 >diff -u -r1.153 AbstractTaskEditorPage.java >--- src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage.java 15 Oct 2009 23:05:50 -0000 1.153 >+++ src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage.java 25 Nov 2009 20:31:46 -0000 >@@ -1033,6 +1033,7 @@ > ISelection selection = event.getSelection(); > if (selection instanceof StructuredSelection) { > Object select = ((StructuredSelection) selection).getFirstElement(); >+ TaskEditorAttachmentPart attachmentPart = (TaskEditorAttachmentPart) getPart(ID_PART_ATTACHMENTS); > if (select instanceof TaskEditorOutlineNode) { > TaskEditorOutlineNode node = (TaskEditorOutlineNode) select; > TaskAttribute attribute = node.getData(); >@@ -1053,9 +1054,28 @@ > } > } > } >+ attachmentPart.resetSelectedAttachment(form); >+ EditorUtil.reveal(form, attribute.getId()); >+ } else if (TaskAttribute.TYPE_ATTACHMENT.equals(attribute.getMetaData().getType())) { >+ AbstractTaskEditorPart actionPart = getPart(ID_PART_ATTACHMENTS); >+ if (actionPart != null && actionPart.getControl() instanceof ExpandableComposite) { >+ CommonFormUtil.setExpanded((ExpandableComposite) actionPart.getControl(), true); >+ if (actionPart.getControl() instanceof Section) { >+ Control client = ((Section) actionPart.getControl()).getClient(); >+ if (client instanceof Composite) { >+ for (Control control : ((Composite) client).getChildren()) { >+ // toggle subsections >+ if (control instanceof Section) { >+ CommonFormUtil.setExpanded((Section) control, true); >+ } >+ } >+ } >+ } >+ } >+ attachmentPart.selectAttachment(form, attribute); > } >- EditorUtil.reveal(form, attribute.getId()); > } else { >+ attachmentPart.resetSelectedAttachment(form); > EditorUtil.reveal(form, node.getLabel()); > } > getEditor().setActivePage(getId()); >Index: src/org/eclipse/mylyn/internal/tasks/ui/preferences/Messages.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/preferences/Messages.java,v >retrieving revision 1.2 >diff -u -r1.2 Messages.java >--- src/org/eclipse/mylyn/internal/tasks/ui/preferences/Messages.java 12 Oct 2009 23:14:10 -0000 1.2 >+++ src/org/eclipse/mylyn/internal/tasks/ui/preferences/Messages.java 25 Nov 2009 20:31:45 -0000 >@@ -88,4 +88,11 @@ > public static String TasksUiPreferencePage_Web_Browser; > > public static String TasksUiPreferencePage_Week_Start; >+ >+ public static String TasksUiPreferencePage_Attachment_Table; >+ >+ public static String TasksUiPreferencePage_Attachment_Show_Id; >+ >+ public static String TasksUiPreferencePage_Attachment_Coloumn_To_Std; >+ > } >Index: src/org/eclipse/mylyn/internal/tasks/ui/preferences/TasksUiPreferencePage.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/preferences/TasksUiPreferencePage.java,v >retrieving revision 1.38 >diff -u -r1.38 TasksUiPreferencePage.java >--- src/org/eclipse/mylyn/internal/tasks/ui/preferences/TasksUiPreferencePage.java 15 Oct 2009 00:36:23 -0000 1.38 >+++ src/org/eclipse/mylyn/internal/tasks/ui/preferences/TasksUiPreferencePage.java 25 Nov 2009 20:31:46 -0000 >@@ -75,6 +75,10 @@ > > private Button useRichEditor; > >+ private Button attachmentShowID; >+ >+ private Button attachmentColumnUseStdWidth; >+ > private Button useWebBrowser; > > private Text synchScheduleTime = null; >@@ -122,6 +126,7 @@ > createSchedulingGroup(container); > createOpenWith(container); > createTaskActivityGroup(container); >+ > Composite advanced = createAdvancedSection(container); > createTaskDataControl(advanced); > >@@ -132,6 +137,7 @@ > } > > createLinks(advanced); >+ createAttachmentTable(advanced); > updateRefreshGroupEnablements(); > applyDialogFont(container); > return container; >@@ -237,6 +243,10 @@ > // shouldn't get here > } > } >+ getPreferenceStore().setValue(ITasksUiPreferenceConstants.ATTACHMENT_SHOW_ID, attachmentShowID.getSelection()); >+ getPreferenceStore().setValue(ITasksUiPreferenceConstants.ATTACHMENT_COLUMN_TO_STD, >+ attachmentColumnUseStdWidth.getSelection()); >+ attachmentColumnUseStdWidth.setSelection(false); > > return true; > } >@@ -274,6 +284,9 @@ > activityTrackingEnabledButton.setSelection(MonitorUiPlugin.getDefault().getPreferenceStore().getBoolean( > MonitorUiPlugin.ACTIVITY_TRACKING_ENABLED)); > >+ attachmentShowID.setSelection(getPreferenceStore().getBoolean(ITasksUiPreferenceConstants.ATTACHMENT_SHOW_ID)); >+ attachmentColumnUseStdWidth.setSelection(getPreferenceStore().getBoolean( >+ ITasksUiPreferenceConstants.ATTACHMENT_COLUMN_TO_STD)); > return true; > } > >@@ -322,6 +335,11 @@ > activityTrackingEnabledButton.setSelection(MonitorUiPlugin.getDefault().getPreferenceStore().getDefaultBoolean( > MonitorUiPlugin.ACTIVITY_TRACKING_ENABLED)); > >+ attachmentShowID.setSelection(getPreferenceStore().getDefaultBoolean( >+ ITasksUiPreferenceConstants.ATTACHMENT_SHOW_ID)); >+ attachmentColumnUseStdWidth.setSelection(getPreferenceStore().getDefaultBoolean( >+ ITasksUiPreferenceConstants.ATTACHMENT_COLUMN_TO_STD)); >+ > updateRefreshGroupEnablements(); > } > >@@ -369,10 +387,28 @@ > > } > >+ private void createAttachmentTable(Composite parent) { >+ Group attachmentContainer = new Group(parent, SWT.SHADOW_ETCHED_IN); >+ attachmentContainer.setLayout(new GridLayout(2, false)); >+ attachmentContainer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); >+ attachmentContainer.setText(Messages.TasksUiPreferencePage_Attachment_Table); >+ >+ attachmentColumnUseStdWidth = new Button(attachmentContainer, SWT.CHECK); >+ attachmentColumnUseStdWidth.setText(Messages.TasksUiPreferencePage_Attachment_Coloumn_To_Std); >+ attachmentColumnUseStdWidth.setSelection(getPreferenceStore().getBoolean( >+ ITasksUiPreferenceConstants.ATTACHMENT_COLUMN_TO_STD)); >+ >+ attachmentShowID = new Button(attachmentContainer, SWT.CHECK); >+ attachmentShowID.setText(Messages.TasksUiPreferencePage_Attachment_Show_Id); >+ attachmentShowID.setSelection(getPreferenceStore().getBoolean(ITasksUiPreferenceConstants.ATTACHMENT_SHOW_ID)); >+ >+ } >+ > private void createOpenWith(Composite parent) { > Group container = new Group(parent, SWT.SHADOW_ETCHED_IN); >- container.setLayout(new GridLayout(3, false)); >+ container.setLayout(new GridLayout(2, false)); > container.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); >+// container.setLayoutData(new GridData(SWT.LEFT, 1, true, true)); > > container.setText(Messages.TasksUiPreferencePage_Task_Editing); > useRichEditor = new Button(container, SWT.RADIO); >Index: src/org/eclipse/mylyn/internal/tasks/ui/preferences/messages.properties >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/preferences/messages.properties,v >retrieving revision 1.4 >diff -u -r1.4 messages.properties >--- src/org/eclipse/mylyn/internal/tasks/ui/preferences/messages.properties 12 Oct 2009 23:14:10 -0000 1.4 >+++ src/org/eclipse/mylyn/internal/tasks/ui/preferences/messages.properties 25 Nov 2009 20:31:46 -0000 >@@ -40,3 +40,6 @@ > TasksUiPreferencePage_Use_the_Restore_dialog_to_recover_missing_tasks=Use the Restore dialog to recover missing tasks > TasksUiPreferencePage_Web_Browser=Web Browser > TasksUiPreferencePage_Week_Start=Week Start: >+TasksUiPreferencePage_Attachment_Table=Task Editor Attachment Table >+TasksUiPreferencePage_Attachment_Show_Id=Show Attachment ID >+TasksUiPreferencePage_Attachment_Coloumn_To_Std=use standard ColumnInfo (undo not supported) >Index: src/org/eclipse/mylyn/internal/tasks/ui/ITasksUiPreferenceConstants.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ITasksUiPreferenceConstants.java,v >retrieving revision 1.10 >diff -u -r1.10 ITasksUiPreferenceConstants.java >--- src/org/eclipse/mylyn/internal/tasks/ui/ITasksUiPreferenceConstants.java 24 Jul 2009 12:05:46 -0000 1.10 >+++ src/org/eclipse/mylyn/internal/tasks/ui/ITasksUiPreferenceConstants.java 25 Nov 2009 20:31:44 -0000 >@@ -58,6 +58,10 @@ > > public static final String EDITOR_TASKS_RICH = "org.eclipse.mylyn.tasks.ui.reporting.open.editor"; //$NON-NLS-1$ > >+ public static final String ATTACHMENT_SHOW_ID = "org.eclipse.mylyn.tasks.ui.attachment.showid"; //$NON-NLS-1$ >+ >+ public static final String ATTACHMENT_COLUMN_TO_STD = "org.eclipse.mylyn.tasks.ui.attachment.column.to.std"; //$NON-NLS-1$ >+ > public static final String USE_STRIKETHROUGH_FOR_COMPLETED = "org.eclipse.mylyn.tasks.ui.strikethrough.for.completed"; //$NON-NLS-1$ > > public static final String REPOSITORY_SYNCH_SCHEDULE_ENABLED = "org.eclipse.mylyn.tasks.ui.repositories.synch.schedule"; //$NON-NLS-1$ >Index: src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java,v >retrieving revision 1.125 >diff -u -r1.125 TasksUiPlugin.java >--- src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java 13 Oct 2009 03:10:02 -0000 1.125 >+++ src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java 25 Nov 2009 20:31:45 -0000 >@@ -889,6 +889,9 @@ > store.setDefault(ITasksUiPreferenceConstants.PLANNING_ENDHOUR, 18); > > store.setDefault(ITasksUiPreferenceConstants.AUTO_EXPAND_TASK_LIST, true); >+ >+ store.setDefault(ITasksUiPreferenceConstants.ATTACHMENT_SHOW_ID, false); >+ store.setDefault(ITasksUiPreferenceConstants.ATTACHMENT_COLUMN_TO_STD, true); > } > > public static TaskActivityManager getTaskActivityManager() { >Index: src/org/eclipse/mylyn/internal/tasks/ui/editors/ColumnState.java >=================================================================== >RCS file: src/org/eclipse/mylyn/internal/tasks/ui/editors/ColumnState.java >diff -N src/org/eclipse/mylyn/internal/tasks/ui/editors/ColumnState.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/internal/tasks/ui/editors/ColumnState.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,75 @@ >+/******************************************************************************* >+ * Copyright (c) 2009 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.tasks.ui.editors; >+ >+import java.io.Serializable; >+ >+import org.eclipse.swt.SWT; >+import org.eclipse.ui.IMemento; >+ >+public class ColumnState implements Serializable { >+ >+ private static final long serialVersionUID = -3746488897344479189L; >+ >+ private String name; >+ >+ private int widths; >+ >+ private int alignment; >+ >+ public ColumnState(String name, int widths) { >+ super(); >+ this.name = name; >+ this.widths = widths; >+ alignment = SWT.LEFT; >+ } >+ >+ public String getName() { >+ return name; >+ } >+ >+ public void setName(String name) { >+ this.name = name; >+ } >+ >+ public int getWidths() { >+ return widths; >+ } >+ >+ public void setWidths(int widths) { >+ this.widths = widths; >+ } >+ >+ public int getAlignment() { >+ return alignment; >+ } >+ >+ public void setAlignment(int alignment) { >+ this.alignment = alignment; >+ } >+ >+ public void saveState(IMemento memento) { >+ IMemento child = memento.createChild("ColumnState"); //$NON-NLS-1$ >+ child.putString("name", name); //$NON-NLS-1$ >+ child.putInteger("widths", widths); //$NON-NLS-1$ >+ child.putInteger("alignment", alignment); //$NON-NLS-1$ >+ >+ } >+ >+ public static ColumnState createState(IMemento memento) { >+ ColumnState erg; >+ erg = new ColumnState(memento.getString("name"), memento.getInteger("widths")); >+ erg.setAlignment(memento.getInteger("alignment")); >+ return erg; >+ } >+ >+} >Index: src/org/eclipse/mylyn/internal/tasks/ui/views/AbstractTableViewerConfigurator.java >=================================================================== >RCS file: src/org/eclipse/mylyn/internal/tasks/ui/views/AbstractTableViewerConfigurator.java >diff -N src/org/eclipse/mylyn/internal/tasks/ui/views/AbstractTableViewerConfigurator.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/internal/tasks/ui/views/AbstractTableViewerConfigurator.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,227 @@ >+/******************************************************************************* >+ * Copyright (c) 2009 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.tasks.ui.views; >+ >+import java.io.File; >+import java.io.FileReader; >+import java.io.FileWriter; >+import java.io.IOException; >+import java.util.ArrayList; >+ >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Status; >+import org.eclipse.jface.layout.GridDataFactory; >+import org.eclipse.jface.viewers.ISelection; >+import org.eclipse.jface.viewers.ISelectionChangedListener; >+import org.eclipse.jface.viewers.ISelectionProvider; >+import org.eclipse.jface.viewers.TableViewer; >+import org.eclipse.mylyn.commons.core.StatusHandler; >+import org.eclipse.mylyn.internal.tasks.ui.ITasksUiPreferenceConstants; >+import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin; >+import org.eclipse.mylyn.internal.tasks.ui.editors.ColumnState; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.events.ControlEvent; >+import org.eclipse.swt.events.ControlListener; >+import org.eclipse.swt.layout.GridLayout; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Table; >+import org.eclipse.swt.widgets.TableColumn; >+import org.eclipse.ui.IMemento; >+import org.eclipse.ui.WorkbenchException; >+import org.eclipse.ui.XMLMemento; >+import org.eclipse.ui.forms.widgets.FormToolkit; >+ >+public abstract class AbstractTableViewerConfigurator implements ISelectionProvider { >+ protected TableViewer tableViewer; >+ >+ protected Table table; >+ >+ private final File stateFile; >+ >+ protected ArrayList<ColumnState> columnInfos; >+ >+ protected int[] orderArray; >+ >+ public AbstractTableViewerConfigurator(File stateFile) { >+ super(); >+ this.stateFile = stateFile; >+ } >+ >+ abstract protected void setDefaultColumnInfos(); >+ >+ abstract protected void setupTableViewer(); >+ >+ private void readStateFile() { >+ if (stateFile.exists()) { >+ try { >+ FileReader reader = new FileReader(stateFile); >+ try { >+ XMLMemento memento = XMLMemento.createReadRoot(reader); >+ IMemento child = memento.getChild("Columns"); //$NON-NLS-1$ >+ int size = child.getInteger("count"); //$NON-NLS-1$ >+ IMemento[] children = memento.getChildren("ColumnState"); //$NON-NLS-1$ >+ for (int i = 0; i < size; i++) { >+ columnInfos.add(ColumnState.createState(children[i])); >+ } >+ String orderString = child.getString("order"); //$NON-NLS-1$ >+ String[] orderStringArray = orderString.split(","); //$NON-NLS-1$ >+ orderArray = new int[orderStringArray.length]; >+ for (int i = 0; i < orderStringArray.length; i++) { >+ orderArray[i] = Integer.parseInt(orderStringArray[i]); >+ } >+ } catch (WorkbenchException e) { >+ StatusHandler.log(new Status(IStatus.WARNING, TasksUiPlugin.ID_PLUGIN, >+ "The TableViewerState cache could not be read", e)); //$NON-NLS-1$ >+ } finally { >+ reader.close(); >+ } >+ } catch (IOException e) { >+ StatusHandler.log(new Status(IStatus.WARNING, TasksUiPlugin.ID_PLUGIN, >+ "The TableViewerState cache could not be read", e)); //$NON-NLS-1$ >+ } >+ } >+ >+ } >+ >+ protected void writeStateFile() { >+ >+ if (stateFile == null) { >+ return; >+ } >+ >+ XMLMemento memento = XMLMemento.createWriteRoot("TableViewerState"); //$NON-NLS-1$ >+ IMemento child = memento.createChild("Columns"); //$NON-NLS-1$ >+ child.putInteger("count", columnInfos.size()); //$NON-NLS-1$ >+ for (ColumnState col : columnInfos) { >+ col.saveState(memento); >+ } >+ >+ int[] colOrder = table.getColumnOrder(); >+ String orderString = ""; //$NON-NLS-1$ >+ for (int colPos : colOrder) { >+ if (orderString.length() > 0) { >+ orderString += ","; //$NON-NLS-1$ >+ } >+ orderString += colPos; >+ } >+ child.putString("order", orderString); //$NON-NLS-1$ >+ >+ try { >+ FileWriter writer = new FileWriter(stateFile); >+ try { >+ memento.save(writer); >+ } finally { >+ writer.close(); >+ } >+ } catch (IOException e) { >+ StatusHandler.log(new Status(IStatus.WARNING, TasksUiPlugin.ID_PLUGIN, >+ "The TaskEditorAttachment cache could not be written", e)); //$NON-NLS-1$ >+ } >+ } >+ >+ protected void adjustColumInfos() { >+ >+ } >+ >+ public void create(FormToolkit toolkit, Composite parent, int initialColumnCount) { >+ table = createTable(parent, toolkit); >+ columnInfos = new ArrayList<ColumnState>(initialColumnCount); >+ readStateFile(); >+ if (columnInfos.size() == 0) { >+ setDefaultColumnInfos(); >+ } >+ adjustColumInfos(); >+ for (int index = 0; index < columnInfos.size(); index++) { >+ ColumnState colState = columnInfos.get(index); >+ final TableColumn column = new TableColumn(table, colState.getAlignment(), index); >+ column.setText(colState.getName()); >+ column.setWidth(colState.getWidths()); >+ column.setMoveable(true); >+ column.addControlListener(createColumnControlListener(table, column, index)); >+ } >+ >+ tableViewer = new TableViewer(table); >+ table.setColumnOrder(orderArray); >+ setupTableViewer(); >+ } >+ >+ protected ControlListener createColumnControlListener(Table table, final TableColumn column, final int index) { >+ return new ControlListener() { >+ >+ public void controlResized(ControlEvent e) { >+ if (!TasksUiPlugin.getDefault().getPreferenceStore().getBoolean( >+ ITasksUiPreferenceConstants.ATTACHMENT_COLUMN_TO_STD)) { >+ columnInfos.get(index).setWidths(column.getWidth()); >+ writeStateFile(); >+ } >+ } >+ >+ public void controlMoved(ControlEvent e) { >+ writeStateFile(); >+ } >+ }; >+ >+ } >+ >+ protected Table createTable(Composite parent, FormToolkit toolkit) { >+ Table table = toolkit.createTable(parent, SWT.MULTI | SWT.FULL_SELECTION); >+ table.setLinesVisible(true); >+ table.setHeaderVisible(true); >+ table.setLayout(new GridLayout()); >+ GridDataFactory.fillDefaults() >+ .align(SWT.FILL, SWT.FILL) >+ .grab(true, false) >+ .hint(500, SWT.DEFAULT) >+ .applyTo(table); >+ table.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TREE_BORDER); >+ >+ return table; >+ } >+ >+ public Table getTable() { >+ return table; >+ } >+ >+ public void resetColumnInfosToDefault() { >+ columnInfos.clear(); >+ setDefaultColumnInfos(); >+ for (int index = 0; index < columnInfos.size(); index++) { >+ TableColumn col = table.getColumn(index); >+ ColumnState colState = columnInfos.get(index); >+ col.setAlignment(colState.getAlignment()); >+ col.setWidth(colState.getWidths()); >+ col.setText(colState.getName()); >+ } >+ table.setColumnOrder(orderArray); >+ } >+ >+ public void addSelectionChangedListener(ISelectionChangedListener listener) { >+ tableViewer.addSelectionChangedListener(listener); >+ } >+ >+ public ISelection getSelection() { >+ return tableViewer.getSelection(); >+ } >+ >+ public void removeSelectionChangedListener(ISelectionChangedListener listener) { >+ tableViewer.removeSelectionChangedListener(listener); >+ } >+ >+ public void setSelection(ISelection selection) { >+ tableViewer.setSelection(selection); >+ } >+ >+ public TableViewer getTableViewer() { >+ return tableViewer; >+ } >+ >+}
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 178474
: 153117 |
153118
|
161181
|
163114
|
163115
|
168854
|
168855