Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Maeder2004-02-17 09:06:58 +0000
committerThomas Maeder2004-02-17 09:06:58 +0000
commiteca6ed340bff1013637a9480d5fbd7f7336eed44 (patch)
tree2654d3bd90a0647ec0cfcbd1de668d73941ea110
parent7defb442de602ea4167fe6cc6cfc56c919ad4e73 (diff)
downloadeclipse.platform.text-eca6ed340bff1013637a9480d5fbd7f7336eed44.tar.gz
eclipse.platform.text-eca6ed340bff1013637a9480d5fbd7f7336eed44.tar.xz
eclipse.platform.text-eca6ed340bff1013637a9480d5fbd7f7336eed44.zip
Adde cancel action to search view toolbar
-rw-r--r--org.eclipse.search/icons/full/clcl16/stop_nav.gifbin0 -> 163 bytes
-rw-r--r--org.eclipse.search/icons/full/dlcl16/stop_nav.gifbin0 -> 91 bytes
-rw-r--r--org.eclipse.search/icons/full/elcl16/stop_nav.gifbin0 -> 120 bytes
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/CancelSearchAction.java31
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchMessages.properties2
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchView.java8
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPluginImages.java1
7 files changed, 41 insertions, 1 deletions
diff --git a/org.eclipse.search/icons/full/clcl16/stop_nav.gif b/org.eclipse.search/icons/full/clcl16/stop_nav.gif
new file mode 100644
index 000000000..4eb53ec41
--- /dev/null
+++ b/org.eclipse.search/icons/full/clcl16/stop_nav.gif
Binary files differ
diff --git a/org.eclipse.search/icons/full/dlcl16/stop_nav.gif b/org.eclipse.search/icons/full/dlcl16/stop_nav.gif
new file mode 100644
index 000000000..7f0f9b925
--- /dev/null
+++ b/org.eclipse.search/icons/full/dlcl16/stop_nav.gif
Binary files differ
diff --git a/org.eclipse.search/icons/full/elcl16/stop_nav.gif b/org.eclipse.search/icons/full/elcl16/stop_nav.gif
new file mode 100644
index 000000000..a519f44d4
--- /dev/null
+++ b/org.eclipse.search/icons/full/elcl16/stop_nav.gif
Binary files differ
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/CancelSearchAction.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/CancelSearchAction.java
new file mode 100644
index 000000000..46b42bffe
--- /dev/null
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/CancelSearchAction.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.search2.internal.ui;
+
+import org.eclipse.jface.action.Action;
+
+import org.eclipse.search.internal.ui.SearchPluginImages;
+
+public class CancelSearchAction extends Action {
+
+ private SearchView fView;
+
+ public CancelSearchAction(SearchView view) {
+ super(SearchMessages.getString("CancelSearchAction.label")); //$NON-NLS-1$
+ fView= view;
+ setToolTipText(SearchMessages.getString("CancelSearchAction.tooltip")); //$NON-NLS-1$
+ SearchPluginImages.setImageDescriptors(this, SearchPluginImages.T_LCL, SearchPluginImages.IMG_LCL_SEARCH_CANCEL);
+ }
+
+ public void run() {
+ InternalSearchUI.getInstance().cancelSearch(fView.getCurrentSearchResult().getQuery());
+ }
+}
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchMessages.properties b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchMessages.properties
index 11cca0a02..f6f6873dc 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchMessages.properties
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchMessages.properties
@@ -32,3 +32,5 @@ AbstractTextSearchViewPage.flat_layout.tooltip=Set Flat Layout
AbstractTextSearchViewPage.hierarchical_layout.label=Hierarchical
AbstractTextSearchViewPage.hierarchical_layout.tooltip=Set Hierarchical Layout
AbstractTextSearchViewPage.layout.label=Layout
+CancelSearchAction.label=Cancel
+CancelSearchAction.tooltip=Cancel the current search
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchView.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchView.java
index 87ba4c1ca..67f571708 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchView.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchView.java
@@ -60,6 +60,7 @@ public class SearchView extends PageBookView implements ISearchResultViewPart, I
private DummyPart fDefaultPart;
private long fLastUpdateTime= 0;
private SearchAgainAction fSearchAgainAction;
+ private CancelSearchAction fCancelAction;
class DummyPart implements IWorkbenchPart {
public void addPropertyListener(IPropertyListener listener) {/*dummy*/}
@@ -211,7 +212,9 @@ public class SearchView extends PageBookView implements ISearchResultViewPart, I
private void updateTitle(ISearchResult search) {
String label= SearchMessages.getString("SearchView.title.search"); //$NON-NLS-1$
if (search != null) {
- if (InternalSearchUI.getInstance().isQueryRunning(search.getQuery())) {
+ boolean queryRunning= InternalSearchUI.getInstance().isQueryRunning(search.getQuery());
+ fCancelAction.setEnabled(queryRunning);
+ if (queryRunning) {
label= label+SearchMessages.getString("SearchView.title.running"); //$NON-NLS-1$
}
label= label+" ("+search.getText()+")"; //$NON-NLS-1$ //$NON-NLS-2$
@@ -245,6 +248,7 @@ public class SearchView extends PageBookView implements ISearchResultViewPart, I
tbm.add(new Separator("ViewSpecificGroup")); //$NON-NLS-1$
tbm.add(new Separator("SearchesGroup")); //$NON-NLS-1$
tbm.appendToGroup("SearchesGroup", fSearchesDropDownAction); //$NON-NLS-1$
+ tbm.appendToGroup("SearchesGroup", fCancelAction); //$NON-NLS-1$
getViewSite().getActionBars().updateActionBars();
}
@@ -252,6 +256,8 @@ public class SearchView extends PageBookView implements ISearchResultViewPart, I
fSearchesDropDownAction= new SearchDropDownAction(this);
fSearchesDropDownAction.setEnabled(NewSearchUI.getSearchManager().getSearchResults().length != 0);
fSearchAgainAction= new SearchAgainAction(this);
+ fCancelAction= new CancelSearchAction(this);
+ fCancelAction.setEnabled(false);
}
public void dispose() {
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPluginImages.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPluginImages.java
index f0f9c2b09..da6d28b53 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPluginImages.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPluginImages.java
@@ -62,6 +62,7 @@ public class SearchPluginImages {
public static final String IMG_LCL_SEARCH_HISTORY= NAME_PREFIX + "search_history.gif"; //$NON-NLS-1$
public static final String IMG_LCL_SEARCH_FLAT_LAYOUT= NAME_PREFIX + "flatLayout.gif"; //$NON-NLS-1$
public static final String IMG_LCL_SEARCH_HIERARCHICAL_LAYOUT= NAME_PREFIX + "hierarchicalLayout.gif"; //$NON-NLS-1$
+ public static final String IMG_LCL_SEARCH_CANCEL= NAME_PREFIX + "stop_nav.gif"; //$NON-NLS-1$
public static final String IMG_VIEW_SEARCHRES= NAME_PREFIX + "searchres.gif"; //$NON-NLS-1$

Back to the top