Search in sources :

Example 1 with WorkbenchWindow

use of org.eclipse.ui.internal.WorkbenchWindow in project GT by Tencent.

the class StatusBar method init.

@SuppressWarnings("restriction")
public void init() {
    WorkbenchWindow curworkbenchWindow = (WorkbenchWindow) PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    curworkbenchWindow.setStatusLineVisible(true);
    lineManager = curworkbenchWindow.getStatusLineManager();
    statusItem = new StatusLineContributionItem("APT", 100);
    lineManager.add(statusItem);
}
Also used : WorkbenchWindow(org.eclipse.ui.internal.WorkbenchWindow) StatusLineContributionItem(org.eclipse.jface.action.StatusLineContributionItem)

Example 2 with WorkbenchWindow

use of org.eclipse.ui.internal.WorkbenchWindow in project translationstudio8 by heartsome.

the class OpenToolBarHandler method execute.

public Object execute(ExecutionEvent event) throws ExecutionException {
    final IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindowChecked(event);
    if (activeWorkbenchWindow instanceof WorkbenchWindow) {
        WorkbenchWindow window = (WorkbenchWindow) activeWorkbenchWindow;
        window.toggleToolbarVisibility();
    }
    ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
    commandService.refreshElements(event.getCommand().getId(), null);
    return null;
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) WorkbenchWindow(org.eclipse.ui.internal.WorkbenchWindow) IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) ICommandService(org.eclipse.ui.commands.ICommandService)

Example 3 with WorkbenchWindow

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

the class CubridStatusLineContrItem method changeStuatusLineForNavigator.

/**
	 *
	 * Change status line for navigator selection
	 *
	 * @param selection the ISelection object
	 */
public void changeStuatusLineForNavigator(ISelection selection) {
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (window == null) {
        return;
    }
    WorkbenchWindow workbenchWindow = null;
    StatusLineManager statusLineManager = null;
    if (window instanceof WorkbenchWindow) {
        workbenchWindow = (WorkbenchWindow) window;
        statusLineManager = workbenchWindow.getStatusLineManager();
    }
    //workbenchWindow.setStatus("");
    clearStatusLine();
    updateStatusLineForRestoreQueryEditor();
    if (selection == null || selection.isEmpty()) {
        return;
    }
    Object obj = ((IStructuredSelection) selection).getFirstElement();
    if (!(obj instanceof ICubridNode)) {
        return;
    }
    CubridNavigatorView navigatorView = CubridNavigatorView.findNavigationView();
    boolean isShowGroup = navigatorView == null ? false : navigatorView.savedIsShowGroup();
    ICubridNode cubridNode = (ICubridNode) obj;
    String nodePath = cubridNode.getLabel();
    ICubridNode parent = cubridNode.getParent();
    while (parent != null) {
        if (!isShowGroup && NodeType.GROUP.equals(parent.getType())) {
            break;
        }
        nodePath = parent.getLabel() + "/" + nodePath;
        parent = parent.getParent();
    }
    //workbenchWindow.setStatus(nodePath);
    CubridServer server = cubridNode.getServer();
    ServerInfo serverInfo = server == null ? null : server.getServerInfo();
    if (serverInfo == null || !serverInfo.isConnected()) {
        return;
    }
    if (statusLineManager != null) {
        updateStatusLine(statusLineManager, cubridNode);
    }
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) WorkbenchWindow(org.eclipse.ui.internal.WorkbenchWindow) IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) CubridNavigatorView(com.cubrid.common.ui.common.navigator.CubridNavigatorView) StatusLineManager(org.eclipse.jface.action.StatusLineManager) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode) CubridServer(com.cubrid.common.ui.spi.model.CubridServer)

Example 4 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 Manager
	 *
	 */
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(SERVER_INFO_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 5 with WorkbenchWindow

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

the class CubridStatusLineContrItem method changeStuatusLineForNavigator.

/**
	 *
	 * Change status line for navigator selection
	 *
	 * @param selection the ISelection object
	 */
public void changeStuatusLineForNavigator(ISelection selection) {
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (window == null) {
        return;
    }
    //window.setStatus("");
    clearStatusLine();
    updateStatusLineForRestoreQueryEditor();
    if (selection == null || selection.isEmpty()) {
        return;
    }
    Object obj = ((IStructuredSelection) selection).getFirstElement();
    if (!(obj instanceof ICubridNode)) {
        return;
    }
    CubridNavigatorView navigatorView = CubridNavigatorView.getNavigatorView(CubridQueryNavigatorView.ID);
    boolean isShowGroup = false;
    if (navigatorView != null) {
        isShowGroup = navigatorView.isShowGroup();
    }
    ICubridNode cubridNode = (ICubridNode) obj;
    String nodePath = cubridNode.getLabel();
    ICubridNode parent = cubridNode.getParent();
    while (parent != null) {
        if (!isShowGroup && NodeType.GROUP.equals(parent.getType())) {
            break;
        }
        nodePath = parent.getLabel() + "/" + nodePath;
        parent = parent.getParent();
    }
    //window.setStatus(nodePath);
    if (window instanceof WorkbenchWindow) {
        StatusLineManager statusLineManager = ((WorkbenchWindow) window).getStatusLineManager();
        if (statusLineManager != null) {
            updateStatusLine(statusLineManager, cubridNode);
        }
    }
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) WorkbenchWindow(org.eclipse.ui.internal.WorkbenchWindow) IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) CubridNavigatorView(com.cubrid.common.ui.common.navigator.CubridNavigatorView) StatusLineManager(org.eclipse.jface.action.StatusLineManager) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ICubridNode(com.cubrid.common.ui.spi.model.ICubridNode)

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