Search in sources :

Example 1 with IPartListener

use of org.eclipse.ui.IPartListener in project knime-core by knime.

the class AbstractRepositoryView method init.

/**
 * {@inheritDoc}
 */
@Override
public void init(final IViewSite site) throws PartInitException {
    super.init(site);
    // Bug#5807 set the initial focus on the search field.
    site.getPage().addPartListener(new IPartListener() {

        @Override
        public void partOpened(final IWorkbenchPart part) {
        }

        @Override
        public void partDeactivated(final IWorkbenchPart part) {
        }

        @Override
        public void partClosed(final IWorkbenchPart part) {
        }

        @Override
        public void partBroughtToTop(final IWorkbenchPart part) {
        }

        @Override
        public void partActivated(final IWorkbenchPart part) {
            if (part == AbstractRepositoryView.this) {
                m_toolbarSearchText.getText().setFocus();
            }
        }
    });
}
Also used : IWorkbenchPart(org.eclipse.ui.IWorkbenchPart) IPartListener(org.eclipse.ui.IPartListener)

Example 2 with IPartListener

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

the class ApplicationWorkbenchAdvisor method postStartup.

/**
 * Performs arbitrary actions after the workbench windows have been opened (or restored), but before the main event
 * loop is run.
 *
 * Specifically a part listener is added to the workbench page. The algorithm actions will be enabled if at least
 * the text or hex editor is active. Otherwise the will be disabled.
 */
public void postStartup() {
    super.postStartup();
    if (OperationsPlugin.getDefault().getAlgorithmsManager() != null) {
        IWorkbenchPage activePage = getWorkbenchConfigurer().getWorkbench().getActiveWorkbenchWindow().getActivePage();
        activePage.addPartListener(new IPartListener() {

            public void partActivated(IWorkbenchPart part) {
                setAlgorithmActionStatus(part);
            }

            public void partBroughtToTop(IWorkbenchPart part) {
            }

            public void partClosed(IWorkbenchPart part) {
            }

            public void partDeactivated(IWorkbenchPart part) {
                setAlgorithmActionStatus(part);
            }

            public void partOpened(IWorkbenchPart part) {
            }
        });
        if (getWorkbenchConfigurer().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor() != null) {
            OperationsPlugin.getDefault().getAlgorithmsManager().setCommandsEnabled(true);
        }
    }
}
Also used : IWorkbenchPart(org.eclipse.ui.IWorkbenchPart) IPartListener(org.eclipse.ui.IPartListener) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage)

Example 3 with IPartListener

use of org.eclipse.ui.IPartListener in project tdq-studio-se by Talend.

the class TOPRepositoryService method addPartListener.

public void addPartListener() {
    IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    // Calculate the extensions to register partListener.
    IPartListener listener = PartListener.getPartListener();
    if (listener != null) {
        activePage.addPartListener(listener);
    }
}
Also used : IPartListener(org.eclipse.ui.IPartListener) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage)

Example 4 with IPartListener

use of org.eclipse.ui.IPartListener in project cubrid-manager by CUBRID.

the class ERSchemaEditor method init.

public void init(IEditorSite site, IEditorInput input) throws PartInitException {
    String name = input.getName();
    if (input instanceof SchemaEditorInput) {
        name += "@" + ((SchemaEditorInput) input).getDatabase().getName();
    }
    this.setPartName(name);
    // store site and input
    setSite(site);
    setInput(input);
    getEditDomain().setPaletteRoot(getPaletteRoot());
    setTitleImage(input.getImageDescriptor().createImage());
    getCommandStack().addCommandStackListener(this);
    getSite().getWorkbenchWindow().getSelectionService().addSelectionListener(this);
    createActions();
    this.getSite().getPage().addPartListener(new IPartListener() {

        public void partOpened(IWorkbenchPart part) {
            if (part == ERSchemaEditor.this) {
                CommonUITool.activeView(ERDThumbnailViewPart.ID);
            }
        }

        public void partDeactivated(IWorkbenchPart part) {
        }

        public void partClosed(IWorkbenchPart part) {
            if (part == ERSchemaEditor.this) {
                ERDThumbnailViewPart view = (ERDThumbnailViewPart) CommonUITool.findView(ERDThumbnailViewPart.ID);
                if (view != null) {
                    view.redraw(null);
                }
            }
        }

        public void partBroughtToTop(IWorkbenchPart part) {
        }

        public void partActivated(IWorkbenchPart part) {
            if (part == ERSchemaEditor.this) {
                ERDThumbnailViewPart view = (ERDThumbnailViewPart) CommonUITool.findView(ERDThumbnailViewPart.ID);
                if (view != null) {
                    view.redraw(getRootEditPart());
                }
            }
        }
    });
    if (database != null && !database.isVirtual()) {
        CubridNodeManager.getInstance().addCubridNodeChangeListener(this);
    }
}
Also used : IWorkbenchPart(org.eclipse.ui.IWorkbenchPart) IPartListener(org.eclipse.ui.IPartListener) SchemaEditorInput(com.cubrid.common.ui.er.SchemaEditorInput)

Example 5 with IPartListener

use of org.eclipse.ui.IPartListener in project cubrid-manager by CUBRID.

the class QueryEditorPart method init.

public void init(IEditorSite site, IEditorInput input) throws PartInitException {
    super.init(site, input);
    currentEditorIndex = lastEditorIndex++;
    this.setSite(site);
    this.setInput(input);
    this.setPartName(input.getName());
    this.setTitleToolTip(input.getToolTipText());
    if (input.getImageDescriptor() != null) {
        this.setTitleImage(input.getImageDescriptor().createImage());
    }
    hookRetragetActions();
    this.getSite().getPage().addPartListener(new IPartListener() {

        public void partOpened(IWorkbenchPart part) {
        }

        public void partDeactivated(IWorkbenchPart part) {
            InfoWindowManager.setVisible(false);
        }

        public void partClosed(IWorkbenchPart part) {
            InfoWindowManager.setVisible(false);
        }

        public void partBroughtToTop(IWorkbenchPart part) {
        }

        public void partActivated(IWorkbenchPart part) {
            QueryEditorPart queryEditor = CommonUITool.getActiveQueryEditorPart();
            InfoWindowManager.getInstance().updateContent(queryEditor);
        }
    });
}
Also used : IWorkbenchPart(org.eclipse.ui.IWorkbenchPart) IPartListener(org.eclipse.ui.IPartListener)

Aggregations

IPartListener (org.eclipse.ui.IPartListener)13 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)12 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)2 IEditorPart (org.eclipse.ui.IEditorPart)2 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)2 SchemaEditorInput (com.cubrid.common.ui.er.SchemaEditorInput)1 Node (com.liferay.ide.kaleo.core.model.Node)1 HiddenFileEditorInput (com.liferay.ide.kaleo.ui.editor.HiddenFileEditorInput)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 IFile (org.eclipse.core.resources.IFile)1 IProject (org.eclipse.core.resources.IProject)1 WorkspaceJob (org.eclipse.core.resources.WorkspaceJob)1 CoreException (org.eclipse.core.runtime.CoreException)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 IStatus (org.eclipse.core.runtime.IStatus)1 DiagramGlobalActionHandler (org.eclipse.gmf.runtime.diagram.ui.providers.DiagramGlobalActionHandler)1 IMenuListener (org.eclipse.jface.action.IMenuListener)1 IMenuManager (org.eclipse.jface.action.IMenuManager)1 MenuManager (org.eclipse.jface.action.MenuManager)1 ActionHandler (org.eclipse.jface.commands.ActionHandler)1