use of org.eclipse.ui.dialogs.IWorkingSetSelectionDialog in project eclipse.platform.text by eclipse.
the class FindInWorkingSetActionDelegate method createQuery.
@Override
protected ISearchQuery createQuery(TextSearchQueryProvider provider, String searchForString) throws CoreException {
IWorkbenchPage page = getWorkbenchPage();
if (page != null) {
IWorkingSetManager manager = PlatformUI.getWorkbench().getWorkingSetManager();
IWorkingSetSelectionDialog dialog = manager.createWorkingSetSelectionDialog(page.getWorkbenchWindow().getShell(), true);
if (dialog.open() == Window.OK) {
IWorkingSet[] workingSets = dialog.getSelection();
if (workingSets != null) {
return provider.createQuery(searchForString, workingSets);
}
}
}
throw new OperationCanceledException();
}
use of org.eclipse.ui.dialogs.IWorkingSetSelectionDialog in project eclipse.platform.text by eclipse.
the class ScopePart method handleChooseWorkingSet.
private boolean handleChooseWorkingSet() {
IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager();
IWorkingSetSelectionDialog dialog = workingSetManager.createWorkingSetSelectionDialog(fUseSelection.getShell(), true);
if (fWorkingSets != null)
dialog.setSelection(fWorkingSets);
if (dialog.open() == Window.OK) {
Object[] result = dialog.getSelection();
if (result.length > 0) {
setSelectedWorkingSets((IWorkingSet[]) result);
return true;
}
// $NON-NLS-1$
fWorkingSetText.setText("");
fWorkingSets = null;
if (fScope == ISearchPageContainer.WORKING_SET_SCOPE)
setSelectedScope(ISearchPageContainer.WORKSPACE_SCOPE);
return false;
}
if (fWorkingSets != null) {
// test if selected working set has been removed
int i = 0;
while (i < fWorkingSets.length) {
IWorkingSet workingSet = fWorkingSets[i];
if (!workingSet.isAggregateWorkingSet() && workingSetManager.getWorkingSet(workingSet.getName()) == null)
break;
i++;
}
if (i < fWorkingSets.length) {
// $NON-NLS-1$
fWorkingSetText.setText("");
fWorkingSets = null;
updateSearchPageContainerActionPerformedEnablement();
}
}
return false;
}
Aggregations