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 174179 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]
commited patch
250257V4.txt (text/plain), 43.76 KB, created by
Frank Becker
on 2010-07-13 13:32:13 EDT
(
hide
)
Description:
commited patch
Filename:
MIME Type:
Creator:
Frank Becker
Created:
2010-07-13 13:32:13 EDT
Size:
43.76 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylyn.tasks.ui >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.17 >diff -u -r1.17 ITasksUiPreferenceConstants.java >--- src/org/eclipse/mylyn/internal/tasks/ui/ITasksUiPreferenceConstants.java 13 Jul 2010 03:57:44 -0000 1.17 >+++ src/org/eclipse/mylyn/internal/tasks/ui/ITasksUiPreferenceConstants.java 13 Jul 2010 17:07:39 -0000 >@@ -74,6 +74,10 @@ > > public static final String AUTO_EXPAND_TASK_LIST = "org.eclipse.mylyn.tasks.ui.auto.expand"; //$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$ >+ > /** > * Local subtasks are now enabled by default. > * >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.140 >diff -u -r1.140 TasksUiPlugin.java >--- src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java 13 Jul 2010 03:57:44 -0000 1.140 >+++ src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java 13 Jul 2010 17:07:39 -0000 >@@ -72,8 +72,8 @@ > import org.eclipse.mylyn.internal.tasks.core.TaskActivityUtil; > import org.eclipse.mylyn.internal.tasks.core.TaskList; > import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryDelta; >-import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryManager; > import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryDelta.Type; >+import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryManager; > import org.eclipse.mylyn.internal.tasks.core.data.TaskDataManager; > import org.eclipse.mylyn.internal.tasks.core.data.TaskDataStore; > import org.eclipse.mylyn.internal.tasks.core.externalization.ExternalizationManager; >@@ -91,12 +91,12 @@ > import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector; > import org.eclipse.mylyn.tasks.core.IRepositoryQuery; > import org.eclipse.mylyn.tasks.core.ITask; >+import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel; > import org.eclipse.mylyn.tasks.core.ITaskActivationListener; > import org.eclipse.mylyn.tasks.core.ITaskContainer; > import org.eclipse.mylyn.tasks.core.RepositoryTemplate; > import org.eclipse.mylyn.tasks.core.TaskActivationAdapter; > import org.eclipse.mylyn.tasks.core.TaskRepository; >-import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel; > import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi; > import org.eclipse.mylyn.tasks.ui.AbstractTaskRepositoryLinkProvider; > import org.eclipse.mylyn.tasks.ui.TasksUi; >@@ -511,11 +511,13 @@ > return; > } > >- boolean enabled = TasksUiPlugin.getDefault().getPreferenceStore().getBoolean( >- ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_ENABLED); >+ boolean enabled = TasksUiPlugin.getDefault() >+ .getPreferenceStore() >+ .getBoolean(ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_ENABLED); > if (enabled) { >- long interval = TasksUiPlugin.getDefault().getPreferenceStore().getLong( >- ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_MILISECONDS); >+ long interval = TasksUiPlugin.getDefault() >+ .getPreferenceStore() >+ .getLong(ITasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_MILISECONDS); > if (initial) { > synchronizationScheduler.setInterval(DELAY_QUERY_REFRESH_ON_STARTUP, interval); > } else { >@@ -889,15 +891,18 @@ > } > } > >- if (!MonitorUiPlugin.getDefault().getPreferenceStore().getBoolean( >- MonitorUiPlugin.ACTIVITY_TRACKING_ENABLED + ".checked")) { //$NON-NLS-1$ >+ if (!MonitorUiPlugin.getDefault() >+ .getPreferenceStore() >+ .getBoolean(MonitorUiPlugin.ACTIVITY_TRACKING_ENABLED + ".checked")) { //$NON-NLS-1$ > if (!taskActivityMonitor.getActivationHistory().isEmpty()) { > // tasks have been active before so fore preference enabled >- MonitorUiPlugin.getDefault().getPreferenceStore().setValue(MonitorUiPlugin.ACTIVITY_TRACKING_ENABLED, >- true); >- } >- MonitorUiPlugin.getDefault().getPreferenceStore().setValue( >- MonitorUiPlugin.ACTIVITY_TRACKING_ENABLED + ".checked", true); //$NON-NLS-1$ >+ MonitorUiPlugin.getDefault() >+ .getPreferenceStore() >+ .setValue(MonitorUiPlugin.ACTIVITY_TRACKING_ENABLED, true); >+ } >+ MonitorUiPlugin.getDefault() >+ .getPreferenceStore() >+ .setValue(MonitorUiPlugin.ACTIVITY_TRACKING_ENABLED + ".checked", true); //$NON-NLS-1$ > MonitorUiPlugin.getDefault().savePluginPreferences(); > } > >@@ -959,6 +964,8 @@ > store.setDefault(ITasksUiPreferenceConstants.TASK_LIST_TOOL_TIPS_ENABLED, true); > > store.setDefault(ITasksUiPreferenceConstants.SERVICE_MESSAGE_URL, "http://eclipse.org/mylyn/message.xml"); //$NON-NLS-1$ >+ store.setDefault(ITasksUiPreferenceConstants.ATTACHMENT_SHOW_ID, false); >+ store.setDefault(ITasksUiPreferenceConstants.ATTACHMENT_COLUMN_TO_STD, true); > } > > public static TaskActivityManager getTaskActivityManager() { >@@ -977,8 +984,9 @@ > } > > public boolean groupSubtasks(ITaskContainer element) { >- boolean groupSubtasks = TasksUiPlugin.getDefault().getPreferenceStore().getBoolean( >- ITasksUiPreferenceConstants.GROUP_SUBTASKS); >+ boolean groupSubtasks = TasksUiPlugin.getDefault() >+ .getPreferenceStore() >+ .getBoolean(ITasksUiPreferenceConstants.GROUP_SUBTASKS); > > if (element instanceof ITask) { > AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin.getConnectorUi(((ITask) element).getConnectorKind()); >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.26 >diff -u -r1.26 AttachmentTableLabelProvider.java >--- src/org/eclipse/mylyn/internal/tasks/ui/editors/AttachmentTableLabelProvider.java 13 Jul 2010 03:57:44 -0000 1.26 >+++ src/org/eclipse/mylyn/internal/tasks/ui/editors/AttachmentTableLabelProvider.java 13 Jul 2010 17:07:39 -0000 >@@ -56,7 +56,7 @@ > > public Image getColumnImage(Object element, int columnIndex) { > ITaskAttachment attachment = (ITaskAttachment) element; >- if (columnIndex == 0) { >+ if (columnIndex == 1) { > if (AttachmentUtil.isContext(attachment)) { > return CommonImages.getImage(TasksUiImages.CONTEXT_TRANSFER); > } else if (attachment.isPatch()) { >@@ -76,7 +76,7 @@ > } > return WorkbenchImages.getImage(ISharedImages.IMG_OBJ_FILE); > } >- } else if (columnIndex == 3) { >+ } else if (columnIndex == 4) { > return getAuthorImage(attachment.getAuthor(), attachment.getTaskRepository()); > } > return null; >@@ -101,6 +101,14 @@ > ITaskAttachment attachment = (ITaskAttachment) element; > switch (columnIndex) { > 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()) { >@@ -108,17 +116,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/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.33 >diff -u -r1.33 Messages.java >--- src/org/eclipse/mylyn/internal/tasks/ui/editors/Messages.java 13 Jul 2010 03:57:44 -0000 1.33 >+++ src/org/eclipse/mylyn/internal/tasks/ui/editors/Messages.java 13 Jul 2010 17:07:39 -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.51 >diff -u -r1.51 TaskEditorAttachmentPart.java >--- src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorAttachmentPart.java 13 Jul 2010 03:57:44 -0000 1.51 >+++ src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorAttachmentPart.java 13 Jul 2010 17:07:39 -0000 >@@ -13,32 +13,38 @@ > > 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; > 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.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.commands.OpenTaskAttachmentHandler; >+import org.eclipse.mylyn.internal.tasks.ui.util.ColumnState; > 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; >+import org.eclipse.mylyn.tasks.ui.TasksUiUtil; > import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPart; > import org.eclipse.swt.SWT; > import org.eclipse.swt.events.SelectionAdapter; >@@ -50,7 +56,6 @@ > 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.IWorkbenchPage; > import org.eclipse.ui.forms.events.ExpansionAdapter; > import org.eclipse.ui.forms.events.ExpansionEvent; >@@ -66,12 +71,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; >@@ -80,69 +79,146 @@ > > private Composite attachmentsComposite; > >+ private class AttachmentTableViewer extends AbstractTableViewerConfigurator { >+ public AttachmentTableViewer(File stateFile) { >+ super(stateFile); >+ // ignore >+ } >+ >+ @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())); >+ 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; >+ >+ private boolean propertyListenerIstalled = false; >+ > 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.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); >+ private final org.eclipse.jface.util.IPropertyChangeListener PROPERTY_LISTENER = new org.eclipse.jface.util.IPropertyChangeListener() { > >- 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; >+ 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)) { >+ if (attachmentsViewer != null) { >+ attachmentsViewer.resetColumnInfosToDefault(); >+ Table table = attachmentsViewer.getTable(); >+ if (!table.isDisposed()) { >+ if (TasksUiPlugin.getDefault() >+ .getPreferenceStore() >+ .getBoolean(ITasksUiPreferenceConstants.ATTACHMENT_SHOW_ID)) { >+ table.getColumn(0).setWidth(70); >+ } else { >+ table.getColumn(0).setWidth(0); >+ } >+ } >+ } else { >+ IPath stateLocation = Platform.getStateLocation(TasksUiPlugin.getDefault().getBundle()); >+ File attachmentStateFile = stateLocation.append("TaskEditorAttachment.obj").toFile(); //$NON-NLS-1$ >+ attachmentStateFile.delete(); >+ } >+ } >+ } else if (event.getProperty().equals(ITasksUiPreferenceConstants.ATTACHMENT_SHOW_ID)) { >+ if (attachmentsViewer != null) { >+ Table table = attachmentsViewer.getTable(); >+ if (!table.isDisposed()) { >+ if (TasksUiPlugin.getDefault() >+ .getPreferenceStore() >+ .getBoolean(ITasksUiPreferenceConstants.ATTACHMENT_SHOW_ID)) { >+ table.getColumn(0).setWidth(70); >+ } else { >+ table.getColumn(0).setWidth(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); >- } >- attachmentsViewer.setContentProvider(new ArrayContentProvider()); >- attachmentsViewer.setLabelProvider(new AttachmentTableLabelProvider(getModel(), >- getTaskEditorPage().getAttributeEditorToolkit())); >- attachmentsViewer.addOpenListener(new IOpenListener() { >- public void open(OpenEvent event) { >- openAttachments(event); >- } >- }); >- attachmentsViewer.addSelectionChangedListener(getTaskEditorPage()); >- attachmentsViewer.setInput(attachmentList.toArray()); >+ } >+ }; > >+ 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); > menuManager.addMenuListener(new IMenuListener() { >@@ -151,8 +227,9 @@ > } > }); > 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) { >@@ -227,6 +304,10 @@ > > @Override > public void dispose() { >+ if (propertyListenerIstalled) { >+ TasksUiPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(PROPERTY_LISTENER); >+ propertyListenerIstalled = false; >+ } > if (menuManager != null) { > menuManager.dispose(); > } >@@ -242,6 +323,10 @@ > break; > } > } >+ if (!propertyListenerIstalled) { >+ TasksUiPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(PROPERTY_LISTENER); >+ propertyListenerIstalled = true; >+ } > } > > @Override >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.41 >diff -u -r1.41 messages.properties >--- src/org/eclipse/mylyn/internal/tasks/ui/editors/messages.properties 13 Jul 2010 03:57:44 -0000 1.41 >+++ src/org/eclipse/mylyn/internal/tasks/ui/editors/messages.properties 13 Jul 2010 17:07:39 -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 >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.9 >diff -u -r1.9 Messages.java >--- src/org/eclipse/mylyn/internal/tasks/ui/preferences/Messages.java 13 Jul 2010 03:57:44 -0000 1.9 >+++ src/org/eclipse/mylyn/internal/tasks/ui/preferences/Messages.java 13 Jul 2010 17:07:39 -0000 >@@ -57,6 +57,8 @@ > > public static String TasksUiPreferencePage_highlight_current_line; > >+ public static String TasksUiPreferencePage_reset_to_standard_Column; >+ > public static String TasksUiPreferencePage_Rich_Editor__Recommended_; > > public static String TasksUiPreferencePage_Scheduling; >@@ -65,6 +67,8 @@ > > public static String TasksUiPreferencePage_show_service_messages; > >+ public static String TasksUiPreferencePage_Show_Attachment_ID; >+ > public static String TasksUiPreferencePage_Show_tooltip_on_hover_Label; > > public static String TasksUiPreferencePage_Specify_the_folder_for_tasks; >@@ -85,6 +89,8 @@ > > public static String TasksUiPreferencePage_Task_Editing; > >+ public static String TasksUiPreferencePage_Task_Editor_Attachment_Table; >+ > public static String TasksUiPreferencePage_Task_List_Group; > > public static String TasksUiPreferencePage_Task_Timing; >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.45 >diff -u -r1.45 TasksUiPreferencePage.java >--- src/org/eclipse/mylyn/internal/tasks/ui/preferences/TasksUiPreferencePage.java 13 Jul 2010 03:57:44 -0000 1.45 >+++ src/org/eclipse/mylyn/internal/tasks/ui/preferences/TasksUiPreferencePage.java 13 Jul 2010 17:07:39 -0000 >@@ -112,6 +112,10 @@ > // Disabled for initial 3.4 release as per bug#263528 > // private Button taskListServiceMessageEnabledButton; > >+ private Button attachmentShowID; >+ >+ private Button attachmentColumnUseStdWidth; >+ > public TasksUiPreferencePage() { > super(); > setPreferenceStore(TasksUiPlugin.getDefault().getPreferenceStore()); >@@ -140,6 +144,7 @@ > } > > createLinks(advanced); >+ createAttachmentTable(advanced); > updateRefreshGroupEnablements(); > applyDialogFont(container); > return container; >@@ -218,13 +223,16 @@ > getPreferenceStore().setValue(ITasksUiPreferenceConstants.WEEK_START_DAY, getWeekStartValue()); > //getPreferenceStore().setValue(TasksUiPreferenceConstants.PLANNING_STARTHOUR, hourDayStart.getSelection()); > // getPreferenceStore().setValue(TasksUiPreferenceConstants.PLANNING_ENDHOUR, hourDayEnd.getSelection()); >- MonitorUiPlugin.getDefault().getPreferenceStore().setValue(ActivityContextManager.ACTIVITY_TIMEOUT_ENABLED, >- timeoutEnabledButton.getSelection()); >- MonitorUiPlugin.getDefault().getPreferenceStore().setValue(ActivityContextManager.ACTIVITY_TIMEOUT, >- timeoutMinutes.getSelection() * (60 * 1000)); >- >- MonitorUiPlugin.getDefault().getPreferenceStore().setValue(MonitorUiPlugin.ACTIVITY_TRACKING_ENABLED, >- activityTrackingEnabledButton.getSelection()); >+ MonitorUiPlugin.getDefault() >+ .getPreferenceStore() >+ .setValue(ActivityContextManager.ACTIVITY_TIMEOUT_ENABLED, timeoutEnabledButton.getSelection()); >+ MonitorUiPlugin.getDefault() >+ .getPreferenceStore() >+ .setValue(ActivityContextManager.ACTIVITY_TIMEOUT, timeoutMinutes.getSelection() * (60 * 1000)); >+ >+ MonitorUiPlugin.getDefault() >+ .getPreferenceStore() >+ .setValue(MonitorUiPlugin.ACTIVITY_TRACKING_ENABLED, activityTrackingEnabledButton.getSelection()); > > String taskDirectory = taskDirectoryText.getText(); > taskDirectory = taskDirectory.replaceAll(BACKSLASH_MULTI, FORWARDSLASH); >@@ -254,6 +262,12 @@ > return false; > } > } >+ getPreferenceStore().setValue(ITasksUiPreferenceConstants.ATTACHMENT_SHOW_ID, attachmentShowID.getSelection()); >+ getPreferenceStore().setValue(ITasksUiPreferenceConstants.ATTACHMENT_COLUMN_TO_STD, >+ attachmentColumnUseStdWidth.getSelection()); >+ getPreferenceStore().setValue(ITasksUiPreferenceConstants.ATTACHMENT_COLUMN_TO_STD, false); >+ >+ attachmentColumnUseStdWidth.setSelection(false); > > return true; > } >@@ -294,11 +308,16 @@ > int minutes = MonitorUiPlugin.getDefault().getPreferenceStore().getInt(ActivityContextManager.ACTIVITY_TIMEOUT) > / MS_MINUTES; > timeoutMinutes.setSelection(minutes); >- timeoutEnabledButton.setSelection(MonitorUiPlugin.getDefault().getPreferenceStore().getBoolean( >- ActivityContextManager.ACTIVITY_TIMEOUT_ENABLED)); >- >- activityTrackingEnabledButton.setSelection(MonitorUiPlugin.getDefault().getPreferenceStore().getBoolean( >- MonitorUiPlugin.ACTIVITY_TRACKING_ENABLED)); >+ timeoutEnabledButton.setSelection(MonitorUiPlugin.getDefault() >+ .getPreferenceStore() >+ .getBoolean(ActivityContextManager.ACTIVITY_TIMEOUT_ENABLED)); >+ >+ 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; > } >@@ -337,15 +356,22 @@ > weekStartCombo.select(getPreferenceStore().getDefaultInt(ITasksUiPreferenceConstants.WEEK_START_DAY) - 1); > // hourDayStart.setSelection(getPreferenceStore().getDefaultInt(TasksUiPreferenceConstants.PLANNING_STARTHOUR)); > // hourDayEnd.setSelection(getPreferenceStore().getDefaultInt(TasksUiPreferenceConstants.PLANNING_ENDHOUR)); >- int activityTimeoutMinutes = MonitorUiPlugin.getDefault().getPreferenceStore().getDefaultInt( >- ActivityContextManager.ACTIVITY_TIMEOUT) >+ int activityTimeoutMinutes = MonitorUiPlugin.getDefault() >+ .getPreferenceStore() >+ .getDefaultInt(ActivityContextManager.ACTIVITY_TIMEOUT) > / MS_MINUTES; > timeoutMinutes.setSelection(activityTimeoutMinutes); >- timeoutEnabledButton.setSelection(MonitorUiPlugin.getDefault().getPreferenceStore().getDefaultBoolean( >- ActivityContextManager.ACTIVITY_TIMEOUT_ENABLED)); >- >- activityTrackingEnabledButton.setSelection(MonitorUiPlugin.getDefault().getPreferenceStore().getDefaultBoolean( >- MonitorUiPlugin.ACTIVITY_TRACKING_ENABLED)); >+ timeoutEnabledButton.setSelection(MonitorUiPlugin.getDefault() >+ .getPreferenceStore() >+ .getDefaultBoolean(ActivityContextManager.ACTIVITY_TIMEOUT_ENABLED)); >+ >+ 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(); > } >@@ -509,11 +535,13 @@ > group.setLayout(new GridLayout(3, false)); > group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); > >- boolean activityTrackingEnabled = MonitorUiPlugin.getDefault().getPreferenceStore().getBoolean( >- MonitorUiPlugin.ACTIVITY_TRACKING_ENABLED); >- >- boolean timeoutEnabled = MonitorUiPlugin.getDefault().getPreferenceStore().getBoolean( >- ActivityContextManager.ACTIVITY_TIMEOUT_ENABLED); >+ boolean activityTrackingEnabled = MonitorUiPlugin.getDefault() >+ .getPreferenceStore() >+ .getBoolean(MonitorUiPlugin.ACTIVITY_TRACKING_ENABLED); >+ >+ boolean timeoutEnabled = MonitorUiPlugin.getDefault() >+ .getPreferenceStore() >+ .getBoolean(ActivityContextManager.ACTIVITY_TIMEOUT_ENABLED); > > activityTrackingEnabledButton = new Button(group, SWT.CHECK); > activityTrackingEnabledButton.setText(Messages.TasksUiPreferencePage_Enable_Time_Tracking); >@@ -546,8 +574,9 @@ > timeoutMinutes.setIncrement(5); > timeoutMinutes.setMaximum(60); > timeoutMinutes.setMinimum(1); >- long minutes = MonitorUiPlugin.getDefault().getPreferenceStore().getLong( >- ActivityContextManager.ACTIVITY_TIMEOUT) >+ long minutes = MonitorUiPlugin.getDefault() >+ .getPreferenceStore() >+ .getLong(ActivityContextManager.ACTIVITY_TIMEOUT) > / MS_MINUTES; > timeoutMinutes.setSelection((int) minutes); > timeoutMinutes.addSelectionListener(new SelectionAdapter() { >@@ -639,4 +668,22 @@ > } > super.dispose(); > } >+ >+ 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_Task_Editor_Attachment_Table); >+ >+ attachmentColumnUseStdWidth = new Button(attachmentContainer, SWT.CHECK); >+ attachmentColumnUseStdWidth.setText(Messages.TasksUiPreferencePage_reset_to_standard_Column); >+ attachmentColumnUseStdWidth.setSelection(getPreferenceStore().getBoolean( >+ ITasksUiPreferenceConstants.ATTACHMENT_COLUMN_TO_STD)); >+ >+ attachmentShowID = new Button(attachmentContainer, SWT.CHECK); >+ attachmentShowID.setText(Messages.TasksUiPreferencePage_Show_Attachment_ID); >+ attachmentShowID.setSelection(getPreferenceStore().getBoolean(ITasksUiPreferenceConstants.ATTACHMENT_SHOW_ID)); >+ >+ } >+ > } >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.13 >diff -u -r1.13 messages.properties >--- src/org/eclipse/mylyn/internal/tasks/ui/preferences/messages.properties 13 Jul 2010 03:57:44 -0000 1.13 >+++ src/org/eclipse/mylyn/internal/tasks/ui/preferences/messages.properties 13 Jul 2010 17:07:40 -0000 >@@ -24,10 +24,12 @@ > TasksUiPreferencePage_minutes_of_inactivity=minutes of inactivity. > TasksUiPreferencePage_A_new_empty_Task_List_will_be_created_in_the_chosen_directory_if_one_does_not_already_exists=A new empty Task List will be created in the chosen directory if one does not already exists. Your previous directory and its contents will not be deleted.\n\nProceed? > TasksUiPreferencePage_highlight_current_line=Highlight current line >+TasksUiPreferencePage_reset_to_standard_Column=reset to standard Column > TasksUiPreferencePage_Rich_Editor__Recommended_=Rich Editor (Recommended) > TasksUiPreferencePage_Scheduling=Scheduling > TasksUiPreferencePage_See_X_for_configuring_Task_List_colors=See <a>''{0}''</a> for configuring Task List colors. > TasksUiPreferencePage_show_service_messages=Show service messages >+TasksUiPreferencePage_Show_Attachment_ID=Show Attachment ID > TasksUiPreferencePage_Show_tooltip_on_hover_Label=Show task overview popups on hover > TasksUiPreferencePage_Specify_the_folder_for_tasks=Specify the folder for tasks > TasksUiPreferencePage_Stop_time_accumulation_after=Stop time accumulation after >@@ -38,6 +40,7 @@ > TasksUiPreferencePage_Task_Data=Task Data > TasksUiPreferencePage_Task_Data_Directory_Error=Task Data Directory Error > TasksUiPreferencePage_Task_Editing=Task Editing >+TasksUiPreferencePage_Task_Editor_Attachment_Table=Task Editor Attachment Table > TasksUiPreferencePage_Task_List_Group=Task List > TasksUiPreferencePage_Task_Timing=Time Tracking > TasksUiPreferencePage_Track_Time_Spent=Track time spent within Eclipse when a task is active >Index: src/org/eclipse/mylyn/internal/tasks/ui/util/ColumnState.java >=================================================================== >RCS file: src/org/eclipse/mylyn/internal/tasks/ui/util/ColumnState.java >diff -N src/org/eclipse/mylyn/internal/tasks/ui/util/ColumnState.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/internal/tasks/ui/util/ColumnState.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,74 @@ >+/******************************************************************************* >+ * 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.tasks.ui.util; >+ >+import java.io.Serializable; >+ >+import org.eclipse.swt.SWT; >+import org.eclipse.ui.IMemento; >+ >+public class ColumnState implements Serializable { >+ >+ private static final long serialVersionUID = 6303376618126218826L; >+ >+ 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,226 @@ >+/******************************************************************************* >+ * 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.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.util.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(); >+ if (!table.isDisposed()) { >+ 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); >+ } >+ >+}
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