Search in sources :

Example 11 with WorkbenchWindow

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

the class CubridStatusLineContrItem method updateStatusLineForRestoreQueryEditor.

private void updateStatusLineForRestoreQueryEditor() {
    final int countOfRestorableQueryEditors = ApplicationPersistUtil.getInstance().countOfRestorableQueryEditorsAtLastSession();
    if (countOfRestorableQueryEditors <= 0) {
        return;
    }
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    StatusLineManager statusLineManager = null;
    if (window instanceof WorkbenchWindow) {
        statusLineManager = ((WorkbenchWindow) window).getStatusLineManager();
    }
    if (statusLineManager == null) {
        return;
    }
    IContributionItem scaleItem = new ControlContribution(RESTORE_QUERY_EDITORS_CONTR_ID) {

        protected Control createControl(Composite parent) {
            Button btn = new Button(parent, SWT.None);
            String buttonTitle = Messages.bind(Messages.restoreQueryEditorTitle, countOfRestorableQueryEditors);
            btn.setText(buttonTitle);
            btn.addSelectionListener(new SelectionAdapter() {

                public void widgetSelected(SelectionEvent e) {
                    ActionManager manager = ActionManager.getInstance();
                    IAction action = manager.getAction(RestoreQueryEditorAction.ID);
                    if (action != null && action instanceof RestoreQueryEditorAction) {
                        ((RestoreQueryEditorAction) action).run();
                    }
                }
            });
            return btn;
        }

        ;
    };
    statusLineManager.add(scaleItem);
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) WorkbenchWindow(org.eclipse.ui.internal.WorkbenchWindow) IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) Composite(org.eclipse.swt.widgets.Composite) IAction(org.eclipse.jface.action.IAction) StatusLineManager(org.eclipse.jface.action.StatusLineManager) IContributionItem(org.eclipse.jface.action.IContributionItem) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) ControlContribution(org.eclipse.jface.action.ControlContribution) ActionManager(com.cubrid.common.ui.spi.action.ActionManager) RestoreQueryEditorAction(com.cubrid.common.ui.common.action.RestoreQueryEditorAction) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent)

Example 12 with WorkbenchWindow

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

the class CubridStatusLineContrItem method clearStatusLine.

/**
	 *
	 * Clear the status line information of CUBRID Query
	 *
	 */
public void clearStatusLine() {
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (window == null) {
        return;
    }
    if (window instanceof WorkbenchWindow) {
        StatusLineManager statusLineManager = ((WorkbenchWindow) window).getStatusLineManager();
        if (statusLineManager != null) {
            statusLineManager.remove(RESTORE_QUERY_EDITORS_CONTR_ID);
            statusLineManager.remove(UPDATE_APP_CONTR_ID);
            statusLineManager.remove(DB_INFO_CONTR_ID);
            statusLineManager.remove(OBJ_NUM_INFO_CONTR_ID);
            statusLineManager.update(true);
        }
    }
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) WorkbenchWindow(org.eclipse.ui.internal.WorkbenchWindow) IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) StatusLineManager(org.eclipse.jface.action.StatusLineManager)

Example 13 with WorkbenchWindow

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

the class PerspectiveChangedListener method showPerspective.

public void showPerspective(PerspectiveChangeEvent event) {
    WorkbenchWindow window = (WorkbenchWindow) PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (window != null) {
        ICoolBarManager coolBarManager = window.getCoolBarManager2();
        IMenuManager menuManager = window.getMenuBarManager();
        ActionAdvisor.getInstance().showToolbar(coolBarManager);
        ActionAdvisor.getInstance().showMenu(menuManager);
    }
    ActionManager.getInstance().setMenuProvider(menuProvider);
    LayoutManager.getInstance().setStatusLineContrItem(cubridStatusLineContrItem);
    LayoutManager.getInstance().setTitleLineContrItem(cubridTitleLineContrItem);
    cubridTitleLineContrItem.changeTitleForNavigator(null);
    LayoutManager.getInstance().setWorkbenchContrItem(cubridWorkbenchContrItem);
    CubridNavigatorView cubridNavigatorView = CubridNavigatorView.findNavigationView();
    if (cubridNavigatorView != null) {
        cubridNavigatorView.setFocus();
    }
}
Also used : WorkbenchWindow(org.eclipse.ui.internal.WorkbenchWindow) CubridNavigatorView(com.cubrid.common.ui.common.navigator.CubridNavigatorView) IMenuManager(org.eclipse.jface.action.IMenuManager) ICoolBarManager(org.eclipse.jface.action.ICoolBarManager)

Example 14 with WorkbenchWindow

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

the class PerspectiveChangedListener method hidePerspectiveHide.

public void hidePerspectiveHide(PerspectiveChangeEvent event) {
    WorkbenchWindow window = (WorkbenchWindow) PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (window != null) {
        ICoolBarManager coolBarManager = window.getCoolBarManager2();
        IMenuManager menuManager = window.getMenuBarManager();
        ActionAdvisor.getInstance().hideToolbar(coolBarManager);
        ActionAdvisor.getInstance().hideMenu(menuManager);
    }
}
Also used : WorkbenchWindow(org.eclipse.ui.internal.WorkbenchWindow) IMenuManager(org.eclipse.jface.action.IMenuManager) ICoolBarManager(org.eclipse.jface.action.ICoolBarManager)

Example 15 with WorkbenchWindow

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

the class PerspectiveChangedListener method showPerspective.

public void showPerspective(PerspectiveChangeEvent event) {
    WorkbenchWindow window = (WorkbenchWindow) PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (window != null) {
        ICoolBarManager coolBarManager = window.getCoolBarManager2();
        IMenuManager menuManager = window.getMenuBarManager();
        ActionAdvisor.getInstance().showToolbar(coolBarManager);
        ActionAdvisor.getInstance().showMenu(menuManager);
    }
    ActionManager.getInstance().setMenuProvider(menuProvider);
    LayoutManager.getInstance().setStatusLineContrItem(cubridStatusLineContrItem);
    LayoutManager.getInstance().setTitleLineContrItem(cubridTitleLineContrItem);
    cubridTitleLineContrItem.changeTitleForNavigator(null);
    LayoutManager.getInstance().setWorkbenchContrItem(cubridWorkbenchContrItem);
    CubridNavigatorView navigatorView = CubridNavigatorView.findNavigationView();
    if (navigatorView != null) {
        navigatorView.setFocus();
        if (navigatorView.getViewer() != null) {
            navigatorView.getViewer().refresh(true);
        }
    }
}
Also used : WorkbenchWindow(org.eclipse.ui.internal.WorkbenchWindow) CubridNavigatorView(com.cubrid.common.ui.common.navigator.CubridNavigatorView) IMenuManager(org.eclipse.jface.action.IMenuManager) ICoolBarManager(org.eclipse.jface.action.ICoolBarManager)

Aggregations

WorkbenchWindow (org.eclipse.ui.internal.WorkbenchWindow)15 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)8 StatusLineManager (org.eclipse.jface.action.StatusLineManager)6 IMenuManager (org.eclipse.jface.action.IMenuManager)5 CubridNavigatorView (com.cubrid.common.ui.common.navigator.CubridNavigatorView)4 ICoolBarManager (org.eclipse.jface.action.ICoolBarManager)4 RestoreQueryEditorAction (com.cubrid.common.ui.common.action.RestoreQueryEditorAction)2 ActionManager (com.cubrid.common.ui.spi.action.ActionManager)2 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)2 ControlContribution (org.eclipse.jface.action.ControlContribution)2 IAction (org.eclipse.jface.action.IAction)2 IContributionItem (org.eclipse.jface.action.IContributionItem)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)2 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2 Button (org.eclipse.swt.widgets.Button)2 Composite (org.eclipse.swt.widgets.Composite)2 CubridServer (com.cubrid.common.ui.spi.model.CubridServer)1 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1