blob: b70476c43845456351898cda3d084757ac81440d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
/*******************************************************************************
* Copyright (c) 2000, 2005 IBM Corporation 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:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.search2.internal.ui;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.window.Window;
import org.eclipse.search.internal.ui.SearchPlugin;
import org.eclipse.search.ui.ISearchQuery;
import org.eclipse.search.ui.ISearchResult;
/**
* Invoke the resource creation wizard selection Wizard.
* This action will retarget to the active view.
*/
class ShowSearchesAction extends Action {
private SearchView fSearchView;
/*
* Create a new instance of this class
*/
public ShowSearchesAction(SearchView searchView) {
super(SearchMessages.ShowSearchesAction_label);
setToolTipText(SearchMessages.ShowSearchesAction_tooltip);
fSearchView= searchView;
}
public void run() {
QueryManager sm= InternalSearchUI.getInstance().getSearchManager();
ISearchQuery[] queries= sm.getQueries();
ArrayList input= new ArrayList();
for (int j= 0; j < queries.length; j++) {
ISearchResult search= queries[j].getSearchResult();
input.add(search);
}
SearchesDialog dlg= new SearchesDialog(SearchPlugin.getActiveWorkbenchShell(),input);
ISearchResult current= fSearchView.getCurrentSearchResult();
if (current != null) {
Object[] selected= new Object[1];
selected[0]= current;
dlg.setInitialSelections(selected);
}
if (dlg.open() == Window.OK) {
List result= Arrays.asList(dlg.getResult());
if (result != null && result.size() == 1) {
fSearchView.showSearchResult((ISearchResult) result.get(0));
}
}
}
}
|