Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 172699 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/mylyn/tasks/ui/TasksUiPlugin.java (-3 / +2 lines)
Lines 58-64 Link Here
58
import org.eclipse.mylyn.internal.tasks.ui.TaskListNotificationReminder;
58
import org.eclipse.mylyn.internal.tasks.ui.TaskListNotificationReminder;
59
import org.eclipse.mylyn.internal.tasks.ui.TaskListSynchronizationScheduler;
59
import org.eclipse.mylyn.internal.tasks.ui.TaskListSynchronizationScheduler;
60
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPreferenceConstants;
60
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPreferenceConstants;
61
import org.eclipse.mylyn.internal.tasks.ui.WorkspaceAwareContextStore;
62
import org.eclipse.mylyn.internal.tasks.ui.util.TaskListSaveManager;
61
import org.eclipse.mylyn.internal.tasks.ui.util.TaskListSaveManager;
63
import org.eclipse.mylyn.internal.tasks.ui.util.TaskListWriter;
62
import org.eclipse.mylyn.internal.tasks.ui.util.TaskListWriter;
64
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiExtensionReader;
63
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiExtensionReader;
Lines 68-75 Link Here
68
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
67
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
69
import org.eclipse.mylyn.tasks.core.AbstractRepositoryQuery;
68
import org.eclipse.mylyn.tasks.core.AbstractRepositoryQuery;
70
import org.eclipse.mylyn.tasks.core.AbstractTask;
69
import org.eclipse.mylyn.tasks.core.AbstractTask;
71
import org.eclipse.mylyn.tasks.core.ITaskActivityListener;
72
import org.eclipse.mylyn.tasks.core.AbstractTaskDataHandler;
70
import org.eclipse.mylyn.tasks.core.AbstractTaskDataHandler;
71
import org.eclipse.mylyn.tasks.core.ITaskActivityListener;
73
import org.eclipse.mylyn.tasks.core.RepositoryTaskAttribute;
72
import org.eclipse.mylyn.tasks.core.RepositoryTaskAttribute;
74
import org.eclipse.mylyn.tasks.core.RepositoryTaskData;
73
import org.eclipse.mylyn.tasks.core.RepositoryTaskData;
75
import org.eclipse.mylyn.tasks.core.RepositoryTemplate;
74
import org.eclipse.mylyn.tasks.core.RepositoryTemplate;
Lines 101-107 Link Here
101
100
102
	public static final String LABEL_VIEW_REPOSITORIES = "Task Repositories view";
101
	public static final String LABEL_VIEW_REPOSITORIES = "Task Repositories view";
103
102
104
	public static final String PLUGIN_ID = "org.eclipse.mylyn.tasklist";
103
	public static final String PLUGIN_ID = "org.eclipse.mylyn.tasks.ui";
105
104
106
	private static final String DIRECTORY_METADATA = ".metadata";
105
	private static final String DIRECTORY_METADATA = ".metadata";
107
106
(-)src/org/eclipse/mylyn/tasks/ui/search/SearchHitCollector.java (+4 lines)
Lines 224-227 Link Here
224
		return taskResults;
224
		return taskResults;
225
	}
225
	}
226
226
227
	public AbstractRepositoryQuery getRepositoryQuery() {
228
		return repositoryQuery;
229
	}	
230
227
}
231
}
(-)src/org/eclipse/mylyn/internal/tasks/ui/search/RepositorySearchResultView.java (-2 / +7 lines)
Lines 75-80 Link Here
75
75
76
	private OpenSearchResultAction openInEditorAction;
76
	private OpenSearchResultAction openInEditorAction;
77
77
78
	private AddTaskListAction addTaskListAction;
79
78
	private static final String[] SHOW_IN_TARGETS = new String[] { IPageLayout.ID_RES_NAV };
80
	private static final String[] SHOW_IN_TARGETS = new String[] { IPageLayout.ID_RES_NAV };
79
81
80
	private static final IShowInTargetList SHOW_IN_TARGET_LIST = new IShowInTargetList() {
82
	private static final IShowInTargetList SHOW_IN_TARGET_LIST = new IShowInTargetList() {
Lines 95-100 Link Here
95
		currentSortOrder = ORDER_DEFAULT;
97
		currentSortOrder = ORDER_DEFAULT;
96
98
97
		openInEditorAction = new OpenSearchResultAction("Open in Editor", this);
99
		openInEditorAction = new OpenSearchResultAction("Open in Editor", this);
100
101
		addTaskListAction = new AddTaskListAction("Add to Task List", this);
98
	}
102
	}
99
103
100
	@Override
104
	@Override
Lines 212-219 Link Here
212
			throws PartInitException {
216
			throws PartInitException {
213
		AbstractTask repositoryHit = (AbstractTask) match.getElement();
217
		AbstractTask repositoryHit = (AbstractTask) match.getElement();
214
218
215
		TasksUiUtil.openRepositoryTask(repositoryHit.getRepositoryUrl(), repositoryHit.getTaskId(), repositoryHit
219
		TasksUiUtil.openRepositoryTask(repositoryHit.getRepositoryUrl(), repositoryHit.getTaskId(),
216
				.getTaskUrl());
220
				repositoryHit.getTaskUrl());
217
	}
221
	}
218
222
219
	@Override
223
	@Override
Lines 231-236 Link Here
231
		// Add the new context menu items
235
		// Add the new context menu items
232
		mgr.appendToGroup(IContextMenuConstants.GROUP_VIEWER_SETUP, sortMenu);
236
		mgr.appendToGroup(IContextMenuConstants.GROUP_VIEWER_SETUP, sortMenu);
233
		mgr.appendToGroup(IContextMenuConstants.GROUP_OPEN, openInEditorAction);
237
		mgr.appendToGroup(IContextMenuConstants.GROUP_OPEN, openInEditorAction);
238
		mgr.appendToGroup(IContextMenuConstants.GROUP_ADDITIONS, addTaskListAction);
234
	}
239
	}
235
240
236
	class SearchViewTableLabelProvider extends TaskTableLabelProvider {
241
	class SearchViewTableLabelProvider extends TaskTableLabelProvider {
(-)src/org/eclipse/mylyn/internal/tasks/ui/search/AddTaskListAction.java (+84 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2004 - 2007 Mylyn committers and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *******************************************************************************/
8
9
package org.eclipse.mylyn.internal.tasks.ui.search;
10
11
import org.eclipse.jface.action.Action;
12
import org.eclipse.jface.dialogs.InputDialog;
13
import org.eclipse.jface.viewers.ISelection;
14
import org.eclipse.jface.viewers.IStructuredSelection;
15
import org.eclipse.jface.window.Window;
16
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
17
import org.eclipse.mylyn.tasks.core.AbstractRepositoryQuery;
18
import org.eclipse.mylyn.tasks.core.AbstractTask;
19
import org.eclipse.mylyn.tasks.ui.TasksUiPlugin;
20
import org.eclipse.mylyn.tasks.ui.search.SearchHitCollector;
21
import org.eclipse.search.ui.ISearchQuery;
22
import org.eclipse.search.ui.NewSearchUI;
23
import org.eclipse.ui.PlatformUI;
24
25
/**
26
 * Used for add the last search result to the Task List.
27
 * 
28
 * @author Balazs Brinkus (bug 172699)
29
 */
30
public class AddTaskListAction extends Action {
31
32
	/** The view this action works on */
33
	private RepositorySearchResultView resultView;
34
35
	/** The path of the icon */
36
	private final String iconPath = "icons/etool16/query-new.gif";
37
38
	/**
39
	 * Constructor
40
	 * 
41
	 * @param text
42
	 *            The text for this action
43
	 * @param resultView
44
	 *            The <code>RepositorySearchResultView</code> this action works on
45
	 */
46
	public AddTaskListAction(String text, RepositorySearchResultView resultView) {
47
		setText(text);
48
		setImageDescriptor(TasksUiPlugin.imageDescriptorFromPlugin(TasksUiPlugin.PLUGIN_ID, iconPath));
49
		this.resultView = resultView;
50
	}
51
52
	/**
53
	 * Add the search result to the Task List.
54
	 */
55
	public void run() {
56
		ISelection s = resultView.getViewer().getSelection();
57
		if (s instanceof IStructuredSelection) {
58
			IStructuredSelection selection = (IStructuredSelection) s;
59
			if (selection.getFirstElement() instanceof AbstractTask) {
60
				ISearchQuery[] queries = NewSearchUI.getQueries();
61
				AbstractTask task = (AbstractTask) selection.getFirstElement();
62
				AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager().getRepositoryConnector(
63
						task.getRepositoryKind());
64
				if (queries.length != 0 && connector != null) {
65
					SearchHitCollector searchHitCollector = (SearchHitCollector) queries[0];
66
					AbstractRepositoryQuery query = (AbstractRepositoryQuery) searchHitCollector.getRepositoryQuery();
67
68
					InputDialog dialog = new InputDialog(PlatformUI.getWorkbench()
69
							.getActiveWorkbenchWindow()
70
							.getShell(), "Enter query name", "Enter the name for the Query: ", "", null);
71
					int dialogResult = dialog.open();
72
					if (dialogResult == Window.OK) {
73
						query.setHandleIdentifier(dialog.getValue());
74
						TasksUiPlugin.getTaskListManager().getTaskList().addQuery(query);
75
						TasksUiPlugin.getSynchronizationManager().synchronize(connector, query, null, true);
76
					}
77
78
				}
79
80
			}
81
		}
82
	}
83
84
}

Return to bug 172699