Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDani Megert2001-10-30 10:12:14 -0500
committerDani Megert2001-10-30 10:12:14 -0500
commit3509e6ce0a2127102e1f96c40c66c6668c303eb6 (patch)
tree02838961329e30eea959bfb07a865232dd679484
parenta007c2be39016679574dfc604687730a63966140 (diff)
downloadeclipse.platform.text-3509e6ce0a2127102e1f96c40c66c6668c303eb6.tar.gz
eclipse.platform.text-3509e6ce0a2127102e1f96c40c66c6668c303eb6.tar.xz
eclipse.platform.text-3509e6ce0a2127102e1f96c40c66c6668c303eb6.zip
Enable / disable perform action
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SearchDialog.java7
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchPage.java4
-rw-r--r--org.eclipse.search/search/org/eclipse/search/ui/ISearchPageContainer.java7
3 files changed, 16 insertions, 2 deletions
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchDialog.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchDialog.java
index a76149d48..0fb3ddc01 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchDialog.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchDialog.java
@@ -315,6 +315,13 @@ class SearchDialog extends ExtendedDialogWindow implements ISearchPageContainer
/*
* Implements method from ISearchPageContainer
*/
+ public boolean hasValidScope() {
+ return getSelectedScope() != WORKING_SET_SCOPE || getSelectedWorkingSet() != null;
+ }
+
+ /*
+ * Implements method from ISearchPageContainer
+ */
public void setSelectedWorkingSet(IWorkingSet workingSet) {
fScopePart.setSelectedWorkingSet(workingSet);
}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchPage.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchPage.java
index cb1ff7d3e..dbc4c4060 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchPage.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchPage.java
@@ -220,7 +220,7 @@ public class TextSearchPage extends DialogPage implements ISearchPage {
initializePatternControl();
}
fPattern.setFocus();
- getContainer().setPerformActionEnabled(fPattern.getText().length() > 0);
+ getContainer().setPerformActionEnabled(fPattern.getText().length() > 0 && getContainer().hasValidScope());
}
super.setVisible(visible);
}
@@ -258,7 +258,7 @@ public class TextSearchPage extends DialogPage implements ISearchPage {
});
fPattern.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
- getContainer().setPerformActionEnabled(getPattern().length() > 0);
+ getContainer().setPerformActionEnabled(getPattern().length() > 0 && getContainer().hasValidScope());
}
});
diff --git a/org.eclipse.search/search/org/eclipse/search/ui/ISearchPageContainer.java b/org.eclipse.search/search/org/eclipse/search/ui/ISearchPageContainer.java
index ff9289b8d..876b15912 100644
--- a/org.eclipse.search/search/org/eclipse/search/ui/ISearchPageContainer.java
+++ b/org.eclipse.search/search/org/eclipse/search/ui/ISearchPageContainer.java
@@ -74,6 +74,13 @@ public interface ISearchPageContainer {
public void setSelectedScope(int scope);
/**
+ * Tells whether a valid scope is selected.
+ *
+ * @return a <code>true</code> if a valid scope is selected in this search page container
+ */
+ public boolean hasValidScope();
+
+ /**
* Returns the selected working set of this container.
* <p>
* This method is for internal use only due to issue below. Once

Back to the top