Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2010-07-13 14:52:24 -0400
committerspingel2010-07-13 14:52:24 -0400
commit4a65316f0d6d18a03be6e0af5c865eb26a406261 (patch)
treead1ddc2fa4cf963508759d8331a823bc84a018ee
parent75e8bd19e37ab23b1838c3fb42ae17be8dd4b812 (diff)
downloadorg.eclipse.mylyn.tasks-4a65316f0d6d18a03be6e0af5c865eb26a406261.tar.gz
org.eclipse.mylyn.tasks-4a65316f0d6d18a03be6e0af5c865eb26a406261.tar.xz
org.eclipse.mylyn.tasks-4a65316f0d6d18a03be6e0af5c865eb26a406261.zip
ASSIGNED - bug 317751: [backport] Details and Mark as menu on attachment shows on all connectors
https://bugs.eclipse.org/bugs/show_bug.cgi?id=317751
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/plugin.xml17
-rw-r--r--org.eclipse.mylyn.tasks.ui/plugin.xml5
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskAttachmentAdapterFactory.java53
3 files changed, 70 insertions, 5 deletions
diff --git a/org.eclipse.mylyn.bugzilla.ui/plugin.xml b/org.eclipse.mylyn.bugzilla.ui/plugin.xml
index 29d438f41..c321f8bfb 100644
--- a/org.eclipse.mylyn.bugzilla.ui/plugin.xml
+++ b/org.eclipse.mylyn.bugzilla.ui/plugin.xml
@@ -98,6 +98,9 @@
label="%Mark_not_obsolete_Action_Label"
menubarPath="org.eclipse.mylyn.bugzilla.ui.attachments.mark/markadditions"
tooltip="%Mark_not_obsolete_Action_Tooltip">
+ <enablement>
+ <objectState name="connectorKind" value="bugzilla"/>
+ </enablement>
</action>
<action
class="org.eclipse.mylyn.internal.bugzilla.ui.action.BugzillaObsoleteAttachmentAction"
@@ -106,22 +109,26 @@
label="%Mark_obsolete_Action_Label"
menubarPath="org.eclipse.mylyn.bugzilla.ui.attachments.mark/markadditions"
tooltip="%Mark_obsolete_Action_Tooltip">
+ <enablement>
+ <objectState name="connectorKind" value="bugzilla"/>
+ </enablement>
</action>
<action
class="org.eclipse.mylyn.internal.bugzilla.ui.action.BugzillaAttachmentUpdateAction"
- enablesFor="*"
+ enablesFor="1"
id="org.eclipse.mylyn.bugzilla.ui.contribution.attachment.update"
label="%Details_Action_Label"
menubarPath="org.eclipse.mylyn.bugzilla.ui.attachments.mark"
tooltip="%Details_Action_Tooltip">
</action>
- <menu
+ <visibility>
+ <objectState name="connectorKind" value="bugzilla"></objectState>
+ </visibility>
+ <menu
id="org.eclipse.mylyn.bugzilla.ui.attachments.mark"
label="%Mark_as_Menu_Label"
path="markadditions">
- </menu>
+ </menu>
</objectContribution>
</extension>
-
-
</plugin>
diff --git a/org.eclipse.mylyn.tasks.ui/plugin.xml b/org.eclipse.mylyn.tasks.ui/plugin.xml
index 2ee467742..e4db24ed4 100644
--- a/org.eclipse.mylyn.tasks.ui/plugin.xml
+++ b/org.eclipse.mylyn.tasks.ui/plugin.xml
@@ -1138,6 +1138,11 @@
type="org.eclipse.mylyn.tasks.core.TaskRepository">
</adapter>
</factory>
+ <factory
+ adaptableType="org.eclipse.mylyn.tasks.core.ITaskAttachment"
+ class="org.eclipse.mylyn.internal.tasks.ui.TaskAttachmentAdapterFactory">
+ <adapter type="org.eclipse.ui.IActionFilter"/>
+ </factory>
</extension>
<extension
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskAttachmentAdapterFactory.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskAttachmentAdapterFactory.java
new file mode 100644
index 000000000..acada15d4
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskAttachmentAdapterFactory.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * 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;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.mylyn.internal.tasks.core.TaskAttachment;
+import org.eclipse.ui.IActionFilter;
+
+/**
+ * @author Frank Becker
+ */
+public class TaskAttachmentAdapterFactory implements IAdapterFactory {
+
+ @SuppressWarnings("rawtypes")
+ private static final Class[] ADAPTER_TYPES = new Class[] { IActionFilter.class };
+
+ @SuppressWarnings("rawtypes")
+ public Class[] getAdapterList() {
+ return ADAPTER_TYPES;
+ }
+
+ @SuppressWarnings("rawtypes")
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (adaptableObject instanceof TaskAttachment) {
+ return new IActionFilter() {
+ public boolean testAttribute(Object target, String name, String value) {
+ TaskAttachment taskAttachment = (TaskAttachment) target;
+ if ("connectorKind".equals(name)) { //$NON-NLS-1$
+ return value.equals(taskAttachment.getConnectorKind());
+ } else if ("contentType".equals(name)) { //$NON-NLS-1$
+ return value.equals(taskAttachment.getContentType());
+ } else if ("isDeprecated".equals(name)) { //$NON-NLS-1$
+ return Boolean.valueOf(value).booleanValue() == taskAttachment.isDeprecated();
+ } else if ("isPatch".equals(name)) { //$NON-NLS-1$
+ return Boolean.valueOf(value).booleanValue() == taskAttachment.isPatch();
+ }
+ return false;
+ }
+ };
+ }
+ // ignore
+ return null;
+ }
+}

Back to the top