Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Pingel2011-10-14 18:26:49 +0000
committerSteffen Pingel2011-10-14 18:26:49 +0000
commitd900e33856efb753373526a67d804b33b88eb80a (patch)
treeb4fa1e2a1b9200f22dd1b0d7ffe508972fcfb942 /org.eclipse.mylyn.tasks.ui
parent7e1fe28fbf7810ca8759cf0801c9c7babf555a3f (diff)
downloadorg.eclipse.mylyn.tasks-d900e33856efb753373526a67d804b33b88eb80a.tar.gz
org.eclipse.mylyn.tasks-d900e33856efb753373526a67d804b33b88eb80a.tar.xz
org.eclipse.mylyn.tasks-d900e33856efb753373526a67d804b33b88eb80a.zip
RESOLVED - bug 359595: support filtering of deprecated attachments
https://bugs.eclipse.org/bugs/show_bug.cgi?id=359595 Change-Id: I0fd10daaf53b23824ac737fdc4967de811440ba8
Diffstat (limited to 'org.eclipse.mylyn.tasks.ui')
-rw-r--r--org.eclipse.mylyn.tasks.ui/icons/etool12/filter-obsolete.gifbin0 -> 309 bytes
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorAttachmentPart.java56
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiImages.java5
3 files changed, 31 insertions, 30 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/icons/etool12/filter-obsolete.gif b/org.eclipse.mylyn.tasks.ui/icons/etool12/filter-obsolete.gif
new file mode 100644
index 000000000..74b7b4707
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/icons/etool12/filter-obsolete.gif
Binary files differ
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorAttachmentPart.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorAttachmentPart.java
index c2a22663d..e192b07bd 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorAttachmentPart.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorAttachmentPart.java
@@ -47,6 +47,7 @@ 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;
+import org.eclipse.mylyn.tasks.ui.TasksUiImages;
import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPart;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
@@ -60,7 +61,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.swt.widgets.TableItem;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.events.ExpansionAdapter;
@@ -163,6 +163,8 @@ public class TaskEditorAttachmentPart extends AbstractTaskEditorPart {
private int nonDeprecatedCount;
+ private Action filterDeprecatedAttachmentsAction;
+
public TaskEditorAttachmentPart() {
setPartName(Messages.TaskEditorAttachmentPart_Attachments);
}
@@ -331,20 +333,17 @@ public class TaskEditorAttachmentPart extends AbstractTaskEditorPart {
@Override
protected void fillToolBar(ToolBarManager toolBarManager) {
- Action filterDeprecatedAttachmentsAction = new Action() {
+ filterDeprecatedAttachmentsAction = new Action() {
@Override
public void run() {
TasksUiPlugin.getDefault().getPreferenceStore().setValue(PREF_FILTER_DEPRECATED, isChecked());
filterDeprecated(isChecked());
}
};
- filterDeprecatedAttachmentsAction.setImageDescriptor(CommonImages.FILTER_COMPLETE);
- filterDeprecatedAttachmentsAction.setToolTipText("Hide Deprecated Attachments");
+ filterDeprecatedAttachmentsAction.setImageDescriptor(TasksUiImages.FILTER_OBSOLETE);
+ filterDeprecatedAttachmentsAction.setToolTipText("Hide Obsolete Attachments");
if (nonDeprecatedCount > 0 && nonDeprecatedCount < attachmentAttributes.size()) {
- filterDeprecatedAttachmentsAction.setChecked(TasksUiPlugin.getDefault()
- .getPreferenceStore()
- .getBoolean(PREF_FILTER_DEPRECATED));
- filterDeprecated(filterDeprecatedAttachmentsAction.isChecked());
+ filterDeprecated(TasksUiPlugin.getDefault().getPreferenceStore().getBoolean(PREF_FILTER_DEPRECATED));
} else {
// do not allow filtering if it would cause the table to be empty or no change
filterDeprecatedAttachmentsAction.setEnabled(false);
@@ -400,10 +399,10 @@ public class TaskEditorAttachmentPart extends AbstractTaskEditorPart {
if (input instanceof String) {
String text = (String) input;
if (attachmentAttributes != null) {
- for (TaskAttribute attachmentAttribute : attachmentAttributes) {
- if (text.equals(attachmentAttribute.getId())) {
+ for (ITaskAttachment attachment : attachmentList) {
+ if (text.equals(attachment.getTaskAttribute().getId())) {
CommonFormUtil.setExpanded((ExpandableComposite) getControl(), true);
- return selectReveal(attachmentAttribute);
+ return selectReveal(attachment);
}
}
}
@@ -411,31 +410,28 @@ public class TaskEditorAttachmentPart extends AbstractTaskEditorPart {
return super.setFormInput(input);
}
- public boolean selectReveal(TaskAttribute attachmentAttribute) {
- if (attachmentAttribute == null || attachmentsTable == null) {
+ private boolean selectReveal(ITaskAttachment attachment) {
+ if (attachment == null || attachmentsTable == null) {
return false;
}
- TableItem[] attachments = attachmentsTable.getItems();
- int index = 0;
- for (TableItem attachment : attachments) {
- Object data = attachment.getData();
- if (data instanceof ITaskAttachment) {
- ITaskAttachment attachmentData = ((ITaskAttachment) data);
- if (attachmentData.getTaskAttribute().getValue().equals(attachmentAttribute.getValue())) {
- attachmentsTable.deselectAll();
- attachmentsTable.select(index);
- IManagedForm mform = getManagedForm();
- ScrolledForm form = mform.getForm();
- EditorUtil.focusOn(form, attachmentsTable);
- return true;
- }
- }
- index++;
+
+ if (tableFilter.isFilterDeprecatedEnabled() && attachment.isDeprecated()) {
+ filterDeprecated(false);
}
- return false;
+
+ attachmentsViewer.setSelection(new StructuredSelection(attachment));
+
+ IManagedForm mform = getManagedForm();
+ ScrolledForm form = mform.getForm();
+ EditorUtil.focusOn(form, attachmentsTable);
+
+ return true;
}
void filterDeprecated(boolean filter) {
+ if (filterDeprecatedAttachmentsAction.isChecked() != filter) {
+ filterDeprecatedAttachmentsAction.setChecked(filter);
+ }
tableFilter.setFilterDeprecatedEnabled(filter);
if (attachmentsViewer != null) {
attachmentsViewer.refresh();
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiImages.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiImages.java
index 358a61d07..f9ccc1263 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiImages.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiImages.java
@@ -67,6 +67,11 @@ public class TasksUiImages {
public static final ImageDescriptor TASK_ATTACHMENT_PATCH = create(OBJ, "attachment-patch.gif"); //$NON-NLS-1$
+ /**
+ * @since 3.7
+ */
+ public static final ImageDescriptor FILTER_OBSOLETE = create(TOOL_SMALL, "filter-obsolete.gif"); //$NON-NLS-1$
+
public static final ImageDescriptor TASK_RETRIEVE = create(TOOL, "task-retrieve.gif"); //$NON-NLS-1$
public static final ImageDescriptor TASK_REPOSITORY = create(TOOL, "task-repository.gif"); //$NON-NLS-1$

Back to the top