Search in sources :

Example 1 with IShowInSource

use of org.eclipse.ui.part.IShowInSource in project egit by eclipse.

the class CommitEditor method getShowInContext.

@Override
public ShowInContext getShowInContext() {
    IFormPage currentPage = getActivePageInstance();
    IShowInSource showInSource = AdapterUtils.adapt(currentPage, IShowInSource.class);
    if (showInSource != null) {
        return showInSource.getShowInContext();
    }
    return null;
}
Also used : IShowInSource(org.eclipse.ui.part.IShowInSource) IFormPage(org.eclipse.ui.forms.editor.IFormPage)

Example 2 with IShowInSource

use of org.eclipse.ui.part.IShowInSource in project eclipse.platform.text by eclipse.

the class SearchView method fillContextMenu.

@Override
public void fillContextMenu(IMenuManager menuManager) {
    ISearchResult result = getCurrentSearchResult();
    if (result != null) {
        // first check if we have a selection for the show in mechanism, bugzilla 127718
        IShowInSource showInSource = getAdapter(IShowInSource.class);
        if (showInSource != null) {
            ShowInContext context = showInSource.getShowInContext();
            if (context != null) {
                ISelection sel = context.getSelection();
                if (sel != null && !sel.isEmpty()) {
                    MenuManager showInSubMenu = new MenuManager(getShowInMenuLabel());
                    showInSubMenu.add(ContributionItemFactory.VIEWS_SHOW_IN.create(getViewSite().getWorkbenchWindow()));
                    menuManager.appendToGroup(IContextMenuConstants.GROUP_OPEN, showInSubMenu);
                }
            }
        }
    }
}
Also used : ISearchResult(org.eclipse.search.ui.ISearchResult) ShowInContext(org.eclipse.ui.part.ShowInContext) IShowInSource(org.eclipse.ui.part.IShowInSource) ISelection(org.eclipse.jface.viewers.ISelection) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager)

Aggregations

IShowInSource (org.eclipse.ui.part.IShowInSource)2 IMenuManager (org.eclipse.jface.action.IMenuManager)1 MenuManager (org.eclipse.jface.action.MenuManager)1 ISelection (org.eclipse.jface.viewers.ISelection)1 ISearchResult (org.eclipse.search.ui.ISearchResult)1 IFormPage (org.eclipse.ui.forms.editor.IFormPage)1 ShowInContext (org.eclipse.ui.part.ShowInContext)1