use of org.eclipse.search.ui.ISearchResultPage in project eclipse.platform.text by eclipse.
the class SearchView method saveState.
// Methods related to saving page state. -------------------------------------------
@Override
public void saveState(IMemento memento) {
for (Entry<ISearchResultPage, DummyPart> entry : fPagesToParts.entrySet()) {
ISearchResultPage page = entry.getKey();
DummyPart part = entry.getValue();
IMemento child = memento.createChild(MEMENTO_TYPE, page.getID());
page.saveState(child);
child.putInteger(MEMENTO_KEY_LAST_ACTIVATION, part.getLastActivation());
}
memento.putString(MEMENTO_KEY_IS_PINNED, String.valueOf(isPinned()));
}
use of org.eclipse.search.ui.ISearchResultPage in project eclipse.platform.text by eclipse.
the class SearchView method internalShowSearchPage.
private void internalShowSearchPage(ISearchResultPage page, ISearchResult search) {
// detach the previous page.
ISearchResultPage currentPage = (ISearchResultPage) getCurrentPage();
if (fCurrentSearch != null && currentPage != null) {
fSearchViewStates.put(fCurrentSearch, currentPage.getUIState());
currentPage.setInput(null, null);
}
fCurrentSearch = search;
if (page != null) {
if (page != currentPage) {
DummyPart part = fPagesToParts.get(page);
if (part == null) {
part = new DummyPart(getSite());
fPagesToParts.put(page, part);
fPartsToPages.put(part, page);
page.setViewPart(this);
}
part.setLastActivation(++fActivationCount);
partActivated(part);
page.setFocus();
}
// connect to the new pages
Object uiState = search != null ? fSearchViewStates.get(search) : null;
page.setInput(search, uiState);
}
updatePartName();
updateLabel();
updateCancelAction();
updateHelpContextID(page);
}
use of org.eclipse.search.ui.ISearchResultPage in project eclipse.platform.text by eclipse.
the class SearchPageRegistry method getSearchResultPage.
private ISearchResultPage getSearchResultPage(final IConfigurationElement configElement, boolean create) {
ISearchResultPage instance = fExtensionToInstance.get(configElement);
if (instance == null && create) {
final Object[] result = new Object[1];
ISafeRunnable safeRunnable = new SafeRunnable(SearchMessages.SearchPageRegistry_error_creating_extensionpoint) {
@Override
public void run() throws Exception {
// $NON-NLS-1$
result[0] = configElement.createExecutableExtension("class");
}
@Override
public void handleException(Throwable e) {
// invalid contribution
SearchPlugin.log(e);
}
};
SafeRunner.run(safeRunnable);
if (result[0] instanceof ISearchResultPage) {
instance = (ISearchResultPage) result[0];
instance.setID(configElement.getAttribute(ATTRIB_ID));
fExtensionToInstance.put(configElement, instance);
}
}
return instance;
}
use of org.eclipse.search.ui.ISearchResultPage in project eclipse.platform.text by eclipse.
the class SearchView method showEmptySearchPage.
public void showEmptySearchPage(String pageId) {
ISearchResultPage newPage = fSearchViewPageService.findPageForPageId(pageId, true);
internalShowSearchPage(newPage, null);
}
use of org.eclipse.search.ui.ISearchResultPage in project eclipse.platform.text by eclipse.
the class SearchView method showSearchResult.
public void showSearchResult(ISearchResult search) {
ISearchResultPage newPage = null;
if (search != null) {
newPage = fSearchViewPageService.findPageForSearchResult(search, true);
if (newPage == null) {
String format = SearchMessages.SearchView_error_noResultPage;
String message = MessageFormat.format(format, new Object[] { search.getClass().getName() });
SearchPlugin.log(new Status(IStatus.ERROR, SearchPlugin.getID(), 0, message, null));
return;
}
}
internalShowSearchPage(newPage, search);
}
Aggregations