Search in sources :

Example 1 with ISearchResultPage

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()));
}
Also used : ISearchResultPage(org.eclipse.search.ui.ISearchResultPage) IMemento(org.eclipse.ui.IMemento)

Example 2 with ISearchResultPage

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);
}
Also used : ISearchResultPage(org.eclipse.search.ui.ISearchResultPage)

Example 3 with ISearchResultPage

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;
}
Also used : ISafeRunnable(org.eclipse.core.runtime.ISafeRunnable) SafeRunnable(org.eclipse.jface.util.SafeRunnable) ISearchResultPage(org.eclipse.search.ui.ISearchResultPage) ISafeRunnable(org.eclipse.core.runtime.ISafeRunnable)

Example 4 with ISearchResultPage

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);
}
Also used : ISearchResultPage(org.eclipse.search.ui.ISearchResultPage)

Example 5 with ISearchResultPage

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);
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) ISearchResultPage(org.eclipse.search.ui.ISearchResultPage)

Aggregations

ISearchResultPage (org.eclipse.search.ui.ISearchResultPage)9 IStatus (org.eclipse.core.runtime.IStatus)2 IMemento (org.eclipse.ui.IMemento)2 CoreException (org.eclipse.core.runtime.CoreException)1 ISafeRunnable (org.eclipse.core.runtime.ISafeRunnable)1 Status (org.eclipse.core.runtime.Status)1 SafeRunnable (org.eclipse.jface.util.SafeRunnable)1 ISearchResultViewPart (org.eclipse.search.ui.ISearchResultViewPart)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Composite (org.eclipse.swt.widgets.Composite)1 Label (org.eclipse.swt.widgets.Label)1 Link (org.eclipse.swt.widgets.Link)1 IActionBars (org.eclipse.ui.IActionBars)1