Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/CopyCommentDetailsAction.java')
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/CopyCommentDetailsAction.java56
1 files changed, 56 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/CopyCommentDetailsAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/CopyCommentDetailsAction.java
new file mode 100644
index 000000000..317c91e2a
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/CopyCommentDetailsAction.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2008 Tasktop Technologies 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:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.tasks.ui.actions;
+
+import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
+import org.eclipse.mylyn.internal.tasks.ui.util.ClipboardCopier;
+import org.eclipse.mylyn.tasks.core.IRepositoryPerson;
+import org.eclipse.mylyn.tasks.core.ITaskComment;
+import org.eclipse.ui.actions.BaseSelectionListenerAction;
+
+/**
+ * @author Steffen Pingel
+ */
+public class CopyCommentDetailsAction extends BaseSelectionListenerAction {
+
+ private final ClipboardCopier copier;
+
+ public CopyCommentDetailsAction() {
+ super("Copy Details");
+ setToolTipText("Copy User ID To Clipboard");
+ setImageDescriptor(CommonImages.COPY);
+ copier = new ClipboardCopier() {
+ @Override
+ protected String getTextForElement(Object element) {
+ if (element instanceof ITaskComment) {
+ ITaskComment comment = (ITaskComment) element;
+ IRepositoryPerson author = comment.getAuthor();
+ if (author != null) {
+ return author.toString();
+ }
+ }
+ return null;
+ }
+ };
+ }
+
+ @Override
+ public void run() {
+ copier.copy(getStructuredSelection());
+ }
+
+ public void dispose() {
+ copier.dispose();
+
+ }
+
+}

Back to the top