Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDani Megert2002-08-20 09:03:00 +0000
committerDani Megert2002-08-20 09:03:00 +0000
commit66767361b5c0d81d7ae27891e34044ae713e9d2d (patch)
tree611e270277d1cc502ce9be222b848b1706540a44
parent2c6a1a4eab42202d7f7b61657e25975362ff61e7 (diff)
downloadeclipse.platform.text-66767361b5c0d81d7ae27891e34044ae713e9d2d.tar.gz
eclipse.platform.text-66767361b5c0d81d7ae27891e34044ae713e9d2d.tar.xz
eclipse.platform.text-66767361b5c0d81d7ae27891e34044ae713e9d2d.zip
Added Select All actionv20020820
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/ISearchHelpContextIds.java2
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SearchMessages.properties5
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultView.java20
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SelectAllAction.java52
4 files changed, 77 insertions, 2 deletions
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/ISearchHelpContextIds.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/ISearchHelpContextIds.java
index 75ff05f3a..42cd9e145 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/ISearchHelpContextIds.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/ISearchHelpContextIds.java
@@ -18,4 +18,6 @@ public interface ISearchHelpContextIds {
public static final String SEARCH_VIEW= PREFIX + "search_view_context"; //$NON-NLS-1$
public static final String SEARCH_PREFERENCE_PAGE= PREFIX + "search_preference_page_context"; //$NON-NLS-1$
+
+ public static final String SELECT_ALL_ACTION = PREFIX + "select_all_action_context"; //$NON-NLS-1$
}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchMessages.properties b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchMessages.properties
index 2fabe9752..26e4a519f 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchMessages.properties
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchMessages.properties
@@ -183,4 +183,7 @@ ReplaceDialog.error.reenable_auto_build_failed=Couldn\'t reactivate auto buildin
ReplaceDialog.error.auto_building= Couldn\'t disable auto building.
ReplaceDialog.error.no_matches= Couldn\'t find first match.
ReplaceDialog.error.no_file_for_marker=Current match is not associated with a file. It is not possible to open an editor.
-ReplaceDialog.error.unable_to_open_text_editor=It is not possible to open the built-in text editor for file ''{0}''. \ No newline at end of file
+ReplaceDialog.error.unable_to_open_text_editor=It is not possible to open the built-in text editor for file ''{0}''.
+
+SelectAllAction.label= Select A&ll
+SelectAllAction.toolTip= Select All
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultView.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultView.java
index 81496495d..5d0b328a8 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultView.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultView.java
@@ -1,5 +1,5 @@
/*
- * (c) Copyright IBM Corp. 2000, 2001.
+ * (c) Copyright IBM Corp. 2000, 2002.
* All Rights Reserved.
*/
package org.eclipse.search.internal.ui;
@@ -25,12 +25,14 @@ import org.eclipse.jface.viewers.DecoratingLabelProvider;
import org.eclipse.jface.viewers.IBaseLabelProvider;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.IViewSite;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.help.WorkbenchHelp;
+import org.eclipse.ui.part.CellEditorActionHandler;
import org.eclipse.ui.part.ViewPart;
import org.eclipse.search.ui.IActionGroupFactory;
@@ -48,6 +50,8 @@ public class SearchResultView extends ViewPart implements ISearchResultView {
private Map fResponse;
private IMemento fMemento;
private IPropertyChangeListener fPropertyChangeListener;
+ private CellEditorActionHandler fCellEditorActionHandler;
+ private SelectAllAction fSelectAllAction;
/*
* Implements method from IViewPart.
@@ -85,6 +89,12 @@ public class SearchResultView extends ViewPart implements ISearchResultView {
fViewer.setPageId(search.getPageId());
fViewer.setInput(SearchManager.getDefault().getCurrentResults());
fillToolBar(getViewSite().getActionBars().getToolBarManager());
+
+ // Add selectAll action handlers.
+ fCellEditorActionHandler = new CellEditorActionHandler(getViewSite().getActionBars());
+ fSelectAllAction= new SelectAllAction(fViewer);
+ fCellEditorActionHandler.setSelectAllAction(fSelectAllAction);
+ getViewSite().getSelectionProvider().addSelectionChangedListener(fSelectAllAction);
fPropertyChangeListener= new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
@@ -120,6 +130,14 @@ public class SearchResultView extends ViewPart implements ISearchResultView {
}
if (fPropertyChangeListener != null)
SearchPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(fPropertyChangeListener);
+ if (fCellEditorActionHandler != null) {
+ fCellEditorActionHandler.dispose();
+ fCellEditorActionHandler= null;
+ }
+ ISelectionProvider selectionProvider= getViewSite().getSelectionProvider();
+ if (selectionProvider != null && fSelectAllAction != null)
+ selectionProvider.removeSelectionChangedListener(fSelectAllAction);
+
super.dispose();
}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/SelectAllAction.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/SelectAllAction.java
new file mode 100644
index 000000000..5f84a0a08
--- /dev/null
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/SelectAllAction.java
@@ -0,0 +1,52 @@
+/*
+ * (c) Copyright IBM Corp. 2000, 2002.
+ * All Rights Reserved.
+ */
+package org.eclipse.search.internal.ui;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+
+import org.eclipse.ui.help.WorkbenchHelp;
+
+/**
+ * This action selects all entries currently showing in view.
+ */
+class SelectAllAction extends Action implements ISelectionChangedListener {
+
+ private SearchResultViewer fViewer;
+
+ /**
+ * Creates the action.
+ */
+ SelectAllAction(SearchResultViewer viewer) {
+ super("selectAll"); //$NON-NLS-1$
+ setText(SearchMessages.getString("SelectAllAction.text")); //$NON-NLS-1$
+ setToolTipText(SearchMessages.getString("SelectAllAction.tooltip")); //$NON-NLS-1$
+ updateEnablement();
+ WorkbenchHelp.setHelp(this, ISearchHelpContextIds.SELECT_ALL_ACTION);
+ fViewer= viewer;
+ }
+
+ /**
+ * Selects all resources in the view.
+ */
+ public void run() {
+ fViewer.getTable().selectAll();
+ // force viewer selection change
+ fViewer.setSelection(fViewer.getSelection());
+ }
+
+ /* (non-Javadoc)
+ * Method declared on ISelectionChangedListener.
+ */
+ public void selectionChanged(SelectionChangedEvent event) {
+ updateEnablement();
+ }
+
+ private void updateEnablement() {
+ boolean enabled= SearchManager.getDefault().getCurrentItemCount() > 0;
+ setEnabled(enabled);
+ }
+} \ No newline at end of file

Back to the top