Search in sources :

Example 1 with IEditorActionBarContributor

use of org.eclipse.ui.IEditorActionBarContributor in project webtools.sourceediting by eclipse.

the class GotoAnnotationAction method getStatusLineManager.

private IStatusLineManager getStatusLineManager() {
    // The original JavaEditor M7 implementation made use of an adapter,
    // but that approach
    // fails with a MultiPageEditorSite
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (window == null)
        return null;
    IWorkbenchPage page = window.getActivePage();
    if (page == null)
        return null;
    IEditorPart editor = page.getActiveEditor();
    if (editor == null)
        return null;
    IEditorActionBarContributor contributor = editor.getEditorSite().getActionBarContributor();
    if (contributor instanceof EditorActionBarContributor) {
        return ((EditorActionBarContributor) contributor).getActionBars().getStatusLineManager();
    }
    return null;
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IEditorActionBarContributor(org.eclipse.ui.IEditorActionBarContributor) EditorActionBarContributor(org.eclipse.ui.part.EditorActionBarContributor) IEditorPart(org.eclipse.ui.IEditorPart) IEditorActionBarContributor(org.eclipse.ui.IEditorActionBarContributor)

Example 2 with IEditorActionBarContributor

use of org.eclipse.ui.IEditorActionBarContributor in project webtools.sourceediting by eclipse.

the class StructuredTextEditor method addExtendedContextMenuActions.

private void addExtendedContextMenuActions(IMenuManager menu) {
    IEditorActionBarContributor c = getEditorSite().getActionBarContributor();
    if (c instanceof IPopupMenuContributor) {
        ((IPopupMenuContributor) c).contributeToPopupMenu(menu);
    } else {
        ExtendedEditorActionBuilder builder = new ExtendedEditorActionBuilder();
        IExtendedContributor pmc = builder.readActionExtensions(getConfigurationPoints());
        if (pmc != null) {
            pmc.setActiveEditor(this);
            pmc.contributeToPopupMenu(menu);
        }
    }
}
Also used : ExtendedEditorActionBuilder(org.eclipse.wst.sse.ui.internal.ExtendedEditorActionBuilder) IExtendedContributor(org.eclipse.wst.sse.ui.internal.IExtendedContributor) IEditorActionBarContributor(org.eclipse.ui.IEditorActionBarContributor) IPopupMenuContributor(org.eclipse.wst.sse.ui.internal.IPopupMenuContributor)

Example 3 with IEditorActionBarContributor

use of org.eclipse.ui.IEditorActionBarContributor in project webtools.sourceediting by eclipse.

the class XMLMultiPageEditorPart method createPages.

/**
 * Creates the pages of this multi-page editor.
 * <p>
 * Subclasses of <code>MultiPageEditor</code> must implement this method.
 * </p>
 */
protected void createPages() {
    try {
        // source page MUST be created before design page, now
        createSourcePage();
        createAndAddDesignPage();
        addSourcePage();
        connectDesignPage();
        // set the active editor in the action bar contributor first
        // before setactivepage calls action bar contributor's
        // setactivepage (bug141013 - remove when bug151488 is fixed)
        IEditorActionBarContributor contributor = getEditorSite().getActionBarContributor();
        if (contributor instanceof MultiPageEditorActionBarContributor) {
            ((MultiPageEditorActionBarContributor) contributor).setActiveEditor(this);
        }
        // $NON-NLS-1$;
        int activePageIndex = getPreferenceStore().getInt(getEditorSite().getId() + "." + IXMLPreferenceNames.LAST_ACTIVE_PAGE);
        if ((activePageIndex >= 0) && (activePageIndex < getPageCount())) {
            setActivePage(activePageIndex);
        } else {
            setActivePage(fSourcePageIndex);
        }
    } catch (PartInitException e) {
        Logger.logException(e);
        throw new RuntimeException(e);
    }
}
Also used : MultiPageEditorActionBarContributor(org.eclipse.ui.part.MultiPageEditorActionBarContributor) IEditorActionBarContributor(org.eclipse.ui.IEditorActionBarContributor) PartInitException(org.eclipse.ui.PartInitException) Point(org.eclipse.swt.graphics.Point)

Example 4 with IEditorActionBarContributor

use of org.eclipse.ui.IEditorActionBarContributor in project eclipse-integration-commons by spring-projects.

the class EditorToolkit method getContributor.

protected ActionContributorProxy getContributor() {
    if (contributor == null) {
        IEditorActionBarContributor editorContributor = editorSite.getActionBarContributor();
        if (editorContributor instanceof StsTaskEditorActionContributor) {
            final StsTaskEditorActionContributor actionContributor = (StsTaskEditorActionContributor) editorContributor;
            contributor = new ActionContributorProxy() {

                @Override
                public void contextMenuAboutToShow(IMenuManager manager, boolean addClipboard) {
                    actionContributor.contextMenuAboutToShow(manager, addClipboard);
                }

                @Override
                public void forceActionsEnabled() {
                    actionContributor.forceActionsEnabled();
                }

                @Override
                public ISelectionChangedListener getSelectionChangedListener() {
                    return actionContributor;
                }

                @Override
                public void updateSelectableActions(ISelection selection) {
                    actionContributor.updateSelectableActions(selection);
                }
            };
        } else if (editorContributor instanceof TaskEditorActionContributor) {
            final TaskEditorActionContributor actionContributor = (TaskEditorActionContributor) editorContributor;
            contributor = new ActionContributorProxy() {

                @Override
                public void contextMenuAboutToShow(IMenuManager manager, boolean addClipboard) {
                    actionContributor.contextMenuAboutToShow(manager, addClipboard);
                }

                @Override
                public void forceActionsEnabled() {
                    actionContributor.forceActionsEnabled();
                }

                @Override
                public ISelectionChangedListener getSelectionChangedListener() {
                    return actionContributor;
                }

                @Override
                public void updateSelectableActions(ISelection selection) {
                    actionContributor.updateSelectableActions(selection);
                }
            };
        } else {
            contributor = new ActionContributorProxy();
        }
    }
    return contributor;
}
Also used : ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) TaskEditorActionContributor(org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorActionContributor) ISelection(org.eclipse.jface.viewers.ISelection) IEditorActionBarContributor(org.eclipse.ui.IEditorActionBarContributor) IMenuManager(org.eclipse.jface.action.IMenuManager)

Example 5 with IEditorActionBarContributor

use of org.eclipse.ui.IEditorActionBarContributor in project webtools.sourceediting by eclipse.

the class DebugTextEditor method editorContextMenuAboutToShow.

/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.ui.texteditor.AbstractTextEditor#editorContextMenuAboutToShow(org.eclipse.jface.action.IMenuManager)
	 */
protected void editorContextMenuAboutToShow(IMenuManager menu) {
    super.editorContextMenuAboutToShow(menu);
    IEditorActionBarContributor c = getEditorSite().getActionBarContributor();
    if (c instanceof IPopupMenuContributor) {
        ((IPopupMenuContributor) c).contributeToPopupMenu(menu);
    } else {
        ExtendedEditorActionBuilder builder = new ExtendedEditorActionBuilder();
        IExtendedContributor pmc = builder.readActionExtensions(getConfigurationPoints());
        if (pmc != null) {
            pmc.setActiveEditor(this);
            pmc.contributeToPopupMenu(menu);
        }
    }
}
Also used : ExtendedEditorActionBuilder(org.eclipse.wst.sse.ui.internal.ExtendedEditorActionBuilder) IExtendedContributor(org.eclipse.wst.sse.ui.internal.IExtendedContributor) IEditorActionBarContributor(org.eclipse.ui.IEditorActionBarContributor) IPopupMenuContributor(org.eclipse.wst.sse.ui.internal.IPopupMenuContributor)

Aggregations

IEditorActionBarContributor (org.eclipse.ui.IEditorActionBarContributor)6 EditorActionBarContributor (org.eclipse.ui.part.EditorActionBarContributor)2 ExtendedEditorActionBuilder (org.eclipse.wst.sse.ui.internal.ExtendedEditorActionBuilder)2 IExtendedContributor (org.eclipse.wst.sse.ui.internal.IExtendedContributor)2 IPopupMenuContributor (org.eclipse.wst.sse.ui.internal.IPopupMenuContributor)2 IMenuManager (org.eclipse.jface.action.IMenuManager)1 ISelection (org.eclipse.jface.viewers.ISelection)1 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)1 TaskEditorActionContributor (org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorActionContributor)1 Point (org.eclipse.swt.graphics.Point)1 IActionBars (org.eclipse.ui.IActionBars)1 IEditorPart (org.eclipse.ui.IEditorPart)1 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)1 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)1 PartInitException (org.eclipse.ui.PartInitException)1 MultiPageEditorActionBarContributor (org.eclipse.ui.part.MultiPageEditorActionBarContributor)1