use of org.eclipse.search.ui.ISearchResultPage in project eclipse.platform.text by eclipse.
the class TextSearchPage method performReplace.
@Override
public boolean performReplace() {
try {
IStatus status = NewSearchUI.runQueryInForeground(getContainer().getRunnableContext(), newQuery());
if (status.matches(IStatus.CANCEL)) {
return false;
}
if (!status.isOK()) {
ErrorDialog.openError(getShell(), SearchMessages.TextSearchPage_replace_searchproblems_title, SearchMessages.TextSearchPage_replace_runproblem_message, status);
}
Display.getCurrent().asyncExec(() -> {
ISearchResultViewPart view = NewSearchUI.activateSearchResultView();
if (view != null) {
ISearchResultPage page = view.getActivePage();
if (page instanceof FileSearchPage) {
FileSearchPage filePage = (FileSearchPage) page;
new ReplaceAction(filePage.getSite().getShell(), (FileSearchResult) filePage.getInput(), null).run();
}
}
});
return true;
} catch (CoreException e) {
ErrorDialog.openError(getShell(), SearchMessages.TextSearchPage_replace_searchproblems_title, SearchMessages.TextSearchPage_replace_querycreationproblem_message, e.getStatus());
return false;
}
}
use of org.eclipse.search.ui.ISearchResultPage in project eclipse.platform.text by eclipse.
the class SearchView method updateLabel.
@Override
public void updateLabel() {
ISearchResultPage page = getActivePage();
// $NON-NLS-1$
String label = "";
if (page != null) {
label = LegacyActionTools.escapeMnemonics(page.getLabel());
}
if (!fPageContent.isDisposed()) {
if (label.length() == 0) {
if (fDescriptionComposite != null) {
fDescriptionComposite.dispose();
fDescriptionComposite = null;
fPageContent.layout();
}
} else {
if (fDescriptionComposite == null) {
fDescriptionComposite = new Composite(fPageContent, SWT.NONE);
fDescriptionComposite.moveAbove(null);
GridLayout layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.verticalSpacing = 0;
fDescriptionComposite.setLayout(layout);
fDescriptionComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
fDescription = new Link(fDescriptionComposite, SWT.NONE);
GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
gridData.horizontalIndent = 5;
fDescription.setLayoutData(gridData);
fDescription.setText(label);
Label separator = new Label(fDescriptionComposite, SWT.SEPARATOR | SWT.HORIZONTAL);
separator.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
fPageContent.layout();
} else {
fDescription.setText(label);
}
}
}
}
use of org.eclipse.search.ui.ISearchResultPage in project eclipse.platform.text by eclipse.
the class SearchView method initPage.
@Override
protected void initPage(IPageBookViewPage page) {
super.initPage(page);
IActionBars actionBars = page.getSite().getActionBars();
actionBars.setGlobalActionHandler(ActionFactory.REFRESH.getId(), fSearchAgainAction);
actionBars.updateActionBars();
fUndoRedoActionGroup.fillActionBars(actionBars);
ISearchResultPage srPage = (ISearchResultPage) page;
IMemento memento = null;
if (fPageState != null) {
IMemento[] mementos = fPageState.getChildren(MEMENTO_TYPE);
for (IMemento memento2 : mementos) {
if (memento2.getID().equals(srPage.getID())) {
memento = memento2;
break;
}
}
}
srPage.restoreState(memento);
}
use of org.eclipse.search.ui.ISearchResultPage in project eclipse.platform.text by eclipse.
the class SearchView method createDefaultPage.
@Override
protected IPage createDefaultPage(PageBook book) {
ISearchResultPage page = new EmptySearchView();
page.createControl(book);
initPage(page);
DummyPart part = new DummyPart(getSite());
fPartsToPages.put(part, page);
fPagesToParts.put(page, part);
fDefaultPart = part;
return page;
}
Aggregations