Search in sources :

Example 1 with StatusLineManager

use of org.eclipse.jface.action.StatusLineManager in project tdi-studio-se by Talend.

the class SQLBuilderEditorComposite method createStatusArea.

/**
     * Creates UI for status bar.
     * 
     * @param parent
     */
private void createStatusArea(Composite parent) {
    // create bottom status bar
    Composite statusBar = new Composite(parent, SWT.NULL);
    GridLayout statusBarLayout = new GridLayout();
    statusBarLayout.numColumns = 3;
    statusBarLayout.verticalSpacing = 0;
    statusBarLayout.marginHeight = 0;
    statusBarLayout.marginWidth = 0;
    statusBarLayout.marginTop = 0;
    statusBarLayout.marginBottom = 0;
    statusBarLayout.marginRight = 5;
    statusBarLayout.horizontalSpacing = 5;
    statusBarLayout.verticalSpacing = 0;
    statusBar.setLayout(statusBarLayout);
    GridData statusBarGridData = new GridData(SWT.FILL, SWT.BOTTOM, true, false);
    statusBarGridData.verticalIndent = 0;
    statusBarGridData.horizontalIndent = 0;
    statusBar.setLayoutData(statusBarGridData);
    // add status line manager
    StatusLineManager statusMgr = new StatusLineManager();
    statusMgr.createControl(statusBar);
    GridData c1Grid = new GridData();
    c1Grid.horizontalAlignment = SWT.FILL;
    c1Grid.verticalAlignment = SWT.BOTTOM;
    c1Grid.grabExcessHorizontalSpace = true;
    c1Grid.grabExcessVerticalSpace = false;
    statusMgr.getControl().setLayoutData(c1Grid);
    // add checkbox for limiting results
    GridData c2Grid = new GridData();
    c2Grid.horizontalAlignment = SWT.RIGHT;
    c2Grid.verticalAlignment = SWT.CENTER;
    c2Grid.grabExcessHorizontalSpace = false;
    c2Grid.grabExcessVerticalSpace = false;
    final Button limitResults = new Button(statusBar, SWT.CHECK);
    //$NON-NLS-1$
    limitResults.setText(Messages.getString("SQL_Limit_Rows_2"));
    limitResults.setSelection(true);
    limitResults.setLayoutData(c2Grid);
    // add input field for result limit
    GridData c3Grid = new GridData();
    c3Grid.horizontalAlignment = SWT.RIGHT;
    c3Grid.verticalAlignment = SWT.CENTER;
    c3Grid.grabExcessHorizontalSpace = false;
    c3Grid.grabExcessVerticalSpace = false;
    c3Grid.widthHint = 30;
    maxResultText = new Text(statusBar, SWT.BORDER | SWT.SINGLE);
    maxResultText.setText(IConstants.MAX_SQL_ROWS);
    maxResultText.setLayoutData(c3Grid);
    limitResults.addMouseListener(new MouseAdapter() {

        // enable/disable input field when checkbox is clicked
        @Override
        public void mouseUp(MouseEvent e) {
            maxResultText.setEnabled(limitResults.getSelection());
            ifLimit = limitResults.getSelection();
        }
    });
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) MouseEvent(org.eclipse.swt.events.MouseEvent) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) StatusLineManager(org.eclipse.jface.action.StatusLineManager) GridData(org.eclipse.swt.layout.GridData) MouseAdapter(org.eclipse.swt.events.MouseAdapter) StyledText(org.eclipse.swt.custom.StyledText) ColorStyledText(org.talend.commons.ui.swt.colorstyledtext.ColorStyledText) Text(org.eclipse.swt.widgets.Text)

Example 2 with StatusLineManager

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

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

Example 5 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