Search in sources :

Example 6 with StatusLineManager

use of org.eclipse.jface.action.StatusLineManager 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 7 with StatusLineManager

use of org.eclipse.jface.action.StatusLineManager 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(com.cubrid.common.ui.common.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) {
                        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 8 with StatusLineManager

use of org.eclipse.jface.action.StatusLineManager in project ACS by ACS-Community.

the class MyStatusBar method createControls.

@PostConstruct
void createControls(Composite parent, MToolControl toolControl) {
    if (!toolControl.isVisible()) {
        System.out.println("Skipping creation of status bar as it is marked invisible in the model.");
        return;
    }
    slm = new StatusLineManager();
    slm.createControl(parent);
    slm.setMessage("Refresh service data to get correct supplier/consumer info.");
}
Also used : StatusLineManager(org.eclipse.jface.action.StatusLineManager) PostConstruct(javax.annotation.PostConstruct)

Aggregations

StatusLineManager (org.eclipse.jface.action.StatusLineManager)8 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)6 WorkbenchWindow (org.eclipse.ui.internal.WorkbenchWindow)6 Button (org.eclipse.swt.widgets.Button)3 Composite (org.eclipse.swt.widgets.Composite)3 RestoreQueryEditorAction (com.cubrid.common.ui.common.action.RestoreQueryEditorAction)2 CubridNavigatorView (com.cubrid.common.ui.common.navigator.CubridNavigatorView)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 CubridServer (com.cubrid.common.ui.spi.model.CubridServer)1 ServerInfo (com.cubrid.cubridmanager.core.common.model.ServerInfo)1 PostConstruct (javax.annotation.PostConstruct)1 StyledText (org.eclipse.swt.custom.StyledText)1 MouseAdapter (org.eclipse.swt.events.MouseAdapter)1