Search in sources :

Example 1 with IPageListener

use of org.eclipse.ui.IPageListener in project core by jcryptool.

the class EditorsManager method addListenerToPage.

private void addListenerToPage(IWorkbenchWindow window) {
    if (window.getPages().length > 0) {
        IWorkbenchPage page = window.getActivePage();
        if (page == null)
            page = window.getPages()[0];
        addPartListener(page);
        return;
    }
    window.addPageListener(new IPageListener() {

        public void pageOpened(IWorkbenchPage page) {
            addPartListener(page);
        }

        public void pageActivated(IWorkbenchPage page) {
        }

        public void pageClosed(IWorkbenchPage page) {
        }
    });
}
Also used : IPageListener(org.eclipse.ui.IPageListener) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage)

Example 2 with IPageListener

use of org.eclipse.ui.IPageListener in project yamcs-studio by yamcs.

the class RunOPIAction method createRuntimePage.

private IWorkbenchPage createRuntimePage() throws Exception {
    IWorkbenchPage page = RunModeService.createNewWorkbenchPage(Optional.empty());
    page.getWorkbenchWindow().addPageListener(new IPageListener() {

        @Override
        public void pageClosed(IWorkbenchPage page) {
            if (page == runtime_page) {
                runtime_page = null;
            }
        }

        @Override
        public void pageActivated(IWorkbenchPage page) {
        // NOP
        }

        @Override
        public void pageOpened(IWorkbenchPage page) {
        // NOP
        }
    });
    return page;
}
Also used : IPageListener(org.eclipse.ui.IPageListener) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage)

Example 3 with IPageListener

use of org.eclipse.ui.IPageListener in project xtext-eclipse by eclipse.

the class DefaultMergeViewer method setActionsActivated.

@Override
protected void setActionsActivated(SourceViewer sourceViewer, boolean state) {
    DefaultMergeEditor mergeEditor = getEditor(sourceViewer);
    if (mergeEditor != null) {
        mergeEditor.setActionsActivated(state);
        IAction saveAction = mergeEditor.getAction(ITextEditorActionConstants.SAVE);
        if (saveAction instanceof IPageListener) {
            PartEventAction partEventAction = (PartEventAction) saveAction;
            IWorkbenchPart compareEditorPart = getCompareConfiguration().getContainer().getWorkbenchPart();
            if (state) {
                partEventAction.partActivated(compareEditorPart);
            } else {
                partEventAction.partDeactivated(compareEditorPart);
            }
        }
    }
}
Also used : IAction(org.eclipse.jface.action.IAction) PartEventAction(org.eclipse.ui.actions.PartEventAction) IWorkbenchPart(org.eclipse.ui.IWorkbenchPart) IPageListener(org.eclipse.ui.IPageListener)

Aggregations

IPageListener (org.eclipse.ui.IPageListener)3 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)2 IAction (org.eclipse.jface.action.IAction)1 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)1 PartEventAction (org.eclipse.ui.actions.PartEventAction)1