Search in sources :

Example 1 with TaskEditorActionContributor

use of org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorActionContributor 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)

Aggregations

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 IEditorActionBarContributor (org.eclipse.ui.IEditorActionBarContributor)1