Search in sources :

Example 1 with IPartService

use of org.eclipse.ui.IPartService in project tdi-studio-se by Talend.

the class TalendPaletteHelper method checkAndInitToolBar.

public static void checkAndInitToolBar() {
    if (talendPartListener == null) {
        talendPartListener = new TalendPartAdapter2() {

            @Override
            public void partActivated(IWorkbenchPartReference partRef) {
                checkAndInitToolBar();
            }

            @Override
            public void partOpened(IWorkbenchPartReference partRef) {
                checkAndInitToolBar();
            }
        };
        IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
        if (activeWorkbenchWindow != null) {
            IPartService partService = activeWorkbenchWindow.getPartService();
            partService.addPartListener(talendPartListener);
        }
    }
    // check every time
    checkAndInitToolBar2();
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) TalendPartAdapter2(org.talend.designer.core.TalendPartAdapter2) IPartService(org.eclipse.ui.IPartService) IWorkbenchPartReference(org.eclipse.ui.IWorkbenchPartReference)

Aggregations

IPartService (org.eclipse.ui.IPartService)1 IWorkbenchPartReference (org.eclipse.ui.IWorkbenchPartReference)1 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)1 TalendPartAdapter2 (org.talend.designer.core.TalendPartAdapter2)1