Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDani Megert2001-10-30 05:00:29 -0500
committerDani Megert2001-10-30 05:00:29 -0500
commitc10d333fb4b1bcd2927a2afae9ed1f07850c5f2d (patch)
tree31daef5668877889927291ad1308047689712ef4
parentbbf3204d63b65b5b6bdf53bbbc134792c199a157 (diff)
downloadeclipse.platform.text-c10d333fb4b1bcd2927a2afae9ed1f07850c5f2d.tar.gz
eclipse.platform.text-c10d333fb4b1bcd2927a2afae9ed1f07850c5f2d.tar.xz
eclipse.platform.text-c10d333fb4b1bcd2927a2afae9ed1f07850c5f2d.zip
Working set scope always enabled
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/ScopePart.java33
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SearchDialog.java5
2 files changed, 29 insertions, 9 deletions
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/ScopePart.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/ScopePart.java
index a808bc31e..203d1ba61 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/ScopePart.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/ScopePart.java
@@ -21,6 +21,7 @@ import org.eclipse.jface.util.Assert;
import org.eclipse.search.internal.ui.util.SWTUtil;
import org.eclipse.search.internal.workingsets.WorkingSet;
+import org.eclipse.search.ui.ISearchPageContainer;
import org.eclipse.search.ui.IWorkingSet;
import org.eclipse.search.ui.SearchUI;
@@ -42,6 +43,9 @@ public class ScopePart {
private int fScope;
private Text fWorkingSetText;
private IWorkingSet fWorkingSet;
+
+ // Reference to its search page container (can be null)
+ private ISearchPageContainer fSearchPageContainer;
/**
* Returns a new scope part with workspace as initial scope.
@@ -52,6 +56,15 @@ public class ScopePart {
}
/**
+ * Returns a new scope part with workspace as initial scope.
+ * The part is not yet created.
+ */
+ public ScopePart(ISearchPageContainer searchPageContainer) {
+ this(WORKSPACE_SCOPE);
+ fSearchPageContainer= searchPageContainer;
+ }
+
+ /**
* Returns a new scope part with an initial scope.
* The part is not yet created.
*
@@ -115,9 +128,11 @@ public class ScopePart {
fUseWorkspace.setSelection(false);
fUseSelection.setSelection(false);
fUseWorkingSet.setSelection(true);
- fUseWorkingSet.setEnabled(true);
break;
}
+
+ if (fSearchPageContainer != null)
+ fSearchPageContainer.setPerformActionEnabled(fScope != WORKING_SET_SCOPE || fWorkingSet != null);
}
/**
@@ -143,10 +158,17 @@ public class ScopePart {
public void setSelectedWorkingSet(IWorkingSet workingSet) {
Assert.isNotNull(workingSet);
setSelectedScope(WORKING_SET_SCOPE);
- fgLRUsedWorkingSetName= workingSet.getName();
- fWorkingSet= workingSet;
+ String name= workingSet.getName();
+ workingSet= SearchUI.findWorkingSet(name);
+ if (workingSet != null) {
+ fWorkingSet= workingSet;
+ fgLRUsedWorkingSetName= name;
+ } else {
+ name= "";
+ fWorkingSet= null;
+ }
if (fWorkingSetText != null)
- fWorkingSetText.setText(workingSet.getName());
+ fWorkingSetText.setText(name);
}
/**
@@ -178,7 +200,6 @@ public class ScopePart {
fUseWorkingSet= new Button(group, SWT.RADIO);
fUseWorkingSet.setData(new Integer(WORKING_SET_SCOPE));
fUseWorkingSet.setText(SearchMessages.getString("ScopePart.workingSetScope.text")); //$NON-NLS-1$
- fUseWorkingSet.setEnabled(fWorkingSet != null);
fWorkingSetText= new Text(group, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
Button chooseWorkingSet= new Button(group, SWT.PUSH);
chooseWorkingSet.setLayoutData(new GridData());
@@ -221,7 +242,7 @@ public class ScopePart {
if (source instanceof Button) {
Button button= (Button)source;
if (button.getSelection())
- fScope= ((Integer)button.getData()).intValue();
+ setSelectedScope(((Integer)button.getData()).intValue());
}
}
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 2764f0683..a76149d48 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
@@ -144,11 +144,12 @@ class SearchDialog extends ExtendedDialogWindow implements ISearchPageContainer
fCurrentPage= getDescriptorAt(pageIndex).createObject();
fCurrentPage.setContainer(this);
+ fScopePart= new ScopePart(this);
+
if (numPages == 1) {
Control control= getControl(fCurrentPage, parent);
if (control instanceof Composite) {
// Search scope
- fScopePart= new ScopePart();
fScopePart.createPart((Composite)control);
}
return control;
@@ -161,7 +162,6 @@ class SearchDialog extends ExtendedDialogWindow implements ISearchPageContainer
border.setLayout(layout);
CTabFolder folder= new CTabFolder(border, SWT.BORDER | SWT.FLAT);
-// folder.setBackground(folder.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));
folder.setLayoutData(new GridData(GridData.FILL_BOTH));
folder.setLayout(new TabFolderLayout());
@@ -195,7 +195,6 @@ class SearchDialog extends ExtendedDialogWindow implements ISearchPageContainer
folder.setSelection(pageIndex);
// Search scope
- fScopePart= new ScopePart();
fScopePart.createPart(border);
return border;

Back to the top