Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten2006-12-19 00:01:58 -0500
committermkersten2006-12-19 00:01:58 -0500
commit99fc8d832857b7c338fb5d1769f572696720b053 (patch)
treeda88d40c522904f71757fec550c362ba7aaa1ecd
parente301eed464204fd713376a829b0974cd052752ab (diff)
downloadorg.eclipse.mylyn.tasks-99fc8d832857b7c338fb5d1769f572696720b053.tar.gz
org.eclipse.mylyn.tasks-99fc8d832857b7c338fb5d1769f572696720b053.tar.xz
org.eclipse.mylyn.tasks-99fc8d832857b7c338fb5d1769f572696720b053.zip
NEW - bug 168308: Add ability to get bugzilla web path from bug form
https://bugs.eclipse.org/bugs/show_bug.cgi?id=168308
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/CopyTaskDetailsAction.java21
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorActionContributor.java11
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListView.java24
3 files changed, 27 insertions, 29 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/CopyTaskDetailsAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/CopyTaskDetailsAction.java
index ca864c8ca..6609b7d9a 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/CopyTaskDetailsAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/CopyTaskDetailsAction.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.mylar.internal.tasks.ui.actions;
-import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.mylar.internal.tasks.ui.TaskListImages;
@@ -22,35 +21,37 @@ import org.eclipse.mylar.tasks.core.ITask;
import org.eclipse.mylar.tasks.core.ITaskListElement;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.actions.BaseSelectionListenerAction;
/**
* @author Mik Kersten
*/
-public class CopyTaskDetailsAction extends Action {
+public class CopyTaskDetailsAction extends BaseSelectionListenerAction {
private static final String LABEL = "Copy Details";
public static final String ID = "org.eclipse.mylar.tasklist.actions.copy";
- private TaskListView view;
-
- public CopyTaskDetailsAction(TaskListView view) {
- this.view = view;
- setText(LABEL);
+ public CopyTaskDetailsAction(boolean setAccelerator) {
+ super(LABEL);
setToolTipText(LABEL);
setId(ID);
setImageDescriptor(TaskListImages.COPY);
- setAccelerator(SWT.MOD1 + 'c');
+ if (setAccelerator) {
+ setAccelerator(SWT.MOD1 + 'c');
+ }
}
@Override
public void run() {
- ISelection selection = this.view.getViewer().getSelection();
+ ISelection selection = super.getStructuredSelection();
Object object = ((IStructuredSelection) selection).getFirstElement();
String text = getTextForTask(object);
// HACK: this should be done using proper copying
- StyledText styledText = new StyledText(view.getDummyComposite(), SWT.NULL);
+ Composite dummyComposite = TaskListView.getFromActivePerspective().getFilteredTree();
+ StyledText styledText = new StyledText(dummyComposite, SWT.NULL);
styledText.setText(text);
styledText.selectAll();
styledText.copy();
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorActionContributor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorActionContributor.java
index 79d45f078..5c78028b0 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorActionContributor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorActionContributor.java
@@ -28,6 +28,7 @@ import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.mylar.internal.tasks.ui.IDynamicSubMenuContributor;
+import org.eclipse.mylar.internal.tasks.ui.actions.CopyTaskDetailsAction;
import org.eclipse.mylar.internal.tasks.ui.actions.OpenWithBrowserAction;
import org.eclipse.mylar.internal.tasks.ui.actions.TaskActivateAction;
import org.eclipse.mylar.internal.tasks.ui.actions.TaskDeactivateAction;
@@ -63,6 +64,8 @@ public class TaskEditorActionContributor extends MultiPageEditorActionBarContrib
private OpenWithBrowserAction openWithBrowserAction = new OpenWithBrowserAction();
+ private CopyTaskDetailsAction copyTaskDetailsAction = new CopyTaskDetailsAction(false);
+
private GlobalAction cutAction;
private GlobalAction undoAction;
@@ -74,7 +77,7 @@ public class TaskEditorActionContributor extends MultiPageEditorActionBarContrib
private GlobalAction pasteAction;
private GlobalAction selectAllAction;
-
+
public TaskEditorActionContributor() {
cutAction = new GlobalAction(ActionFactory.CUT.getId());
@@ -100,7 +103,7 @@ public class TaskEditorActionContributor extends MultiPageEditorActionBarContrib
copyAction.setHoverImageDescriptor(WorkbenchImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY));
copyAction.setDisabledImageDescriptor(WorkbenchImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY_DISABLED));
copyAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.COPY);
-
+
undoAction = new GlobalAction(ActionFactory.UNDO.getId());
undoAction.setText(WorkbenchMessages.Workbench_undo);
undoAction.setImageDescriptor(WorkbenchImages.getImageDescriptor(ISharedImages.IMG_TOOL_UNDO));
@@ -128,6 +131,7 @@ public class TaskEditorActionContributor extends MultiPageEditorActionBarContrib
manager.add(new Separator());
manager.add(cutAction);
manager.add(copyAction);
+ manager.add(copyTaskDetailsAction);
manager.add(pasteAction);
manager.add(selectAllAction);
manager.add(new Separator());
@@ -154,7 +158,10 @@ public class TaskEditorActionContributor extends MultiPageEditorActionBarContrib
if (task == null) {
return;
} else {
+ // TODO: refactor
openWithBrowserAction.selectionChanged(new StructuredSelection(task));
+ copyTaskDetailsAction.selectionChanged(new StructuredSelection(task));
+
manager.add(openWithBrowserAction);
if (task.isActive()) {
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListView.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListView.java
index a369aed04..36df5717a 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListView.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListView.java
@@ -938,8 +938,6 @@ public class TaskListView extends ViewPart {
selectedElements.add((ITaskListElement) object);
}
}
- openWithBrowser.selectionChanged((StructuredSelection) getViewer().getSelection());
-
ITask task = null;
if ((element instanceof ITask) || (element instanceof AbstractQueryHit)) {
if (element instanceof AbstractQueryHit) {
@@ -1109,23 +1107,18 @@ public class TaskListView extends ViewPart {
private void makeActions() {
- copyDetailsAction = new CopyTaskDetailsAction(this);
- // workOffline = new WorkOfflineAction();
+ copyDetailsAction = new CopyTaskDetailsAction(true);
goIntoAction = new GoIntoAction();
goUpAction = new GoUpAction(drillDownAdapter);
newLocalTaskAction = new NewLocalTaskAction(this);
- // newCategoryAction = new NewCategoryAction(this);
removeFromCategoryAction = new RemoveFromCategoryAction(this);
renameAction = new RenameAction(this);
deleteAction = new DeleteAction();
collapseAll = new CollapseAllAction(this);
expandAll = new ExpandAllAction(this);
- // autoClose = new ManageEditorsAction();
- // markIncompleteAction = new MarkTaskCompleteAction(this);
- // markCompleteAction = new MarkTaskIncompleteAction(this);
openAction = new OpenTaskListElementAction(this.getViewer());
propertiesAction = new TaskListElementPropertiesAction(this.getViewer());
openWithBrowser = new OpenWithBrowserAction();
@@ -1134,8 +1127,12 @@ public class TaskListView extends ViewPart {
filterOnPriority = new PriorityDropDownAction(this);
previousTaskAction = new PreviousTaskDropDownAction(this, TasksUiPlugin.getTaskListManager()
.getTaskActivationHistory());
- // nextTaskAction = new NextTaskDropDownAction(this,
- // TasksUiPlugin.getTaskListManager().getTaskActivationHistory());
+
+ filteredTree.getViewer().addSelectionChangedListener(openWithBrowser);
+ filteredTree.getViewer().addSelectionChangedListener(copyDetailsAction);
+// openWithBrowser.selectionChanged((StructuredSelection) getViewer().getSelection());
+// copyDetailsAction.selectionChanged((StructuredSelection) getViewer().getSelection());
+//
}
// public void toggleNextAction(boolean enable) {
@@ -1278,13 +1275,6 @@ public class TaskListView extends ViewPart {
}
}
- /**
- * HACK: This is used for the copy action
- */
- public Composite getDummyComposite() {
- return filteredTree;
- }
-
private boolean isInRenameAction = false;
public void setInRenameAction(boolean b) {

Back to the top