Search in sources :

Example 31 with IToolBarManager

use of org.eclipse.jface.action.IToolBarManager in project GT by Tencent.

the class StubAnalysisView method createLocalToolBar.

private void createLocalToolBar() {
    IActionBars bars = getViewSite().getActionBars();
    IToolBarManager manager = bars.getToolBarManager();
    manager.add(openLogOnPCAction);
    manager.add(openLogOnPhoneAction);
}
Also used : IToolBarManager(org.eclipse.jface.action.IToolBarManager) IActionBars(org.eclipse.ui.IActionBars)

Example 32 with IToolBarManager

use of org.eclipse.jface.action.IToolBarManager in project dbeaver by serge-rider.

the class BaseBrowserView method createBrowser.

private Browser createBrowser(Composite parent, final IActionBars actionBars) {
    GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 1;
    parent.setLayout(gridLayout);
    browser = new Browser(parent, SWT.NONE);
    GridData data = new GridData();
    data.horizontalAlignment = GridData.FILL;
    data.verticalAlignment = GridData.FILL;
    data.grabExcessHorizontalSpace = true;
    data.grabExcessVerticalSpace = true;
    browser.setLayoutData(data);
    browser.addProgressListener(new ProgressAdapter() {

        IProgressMonitor monitor = actionBars.getStatusLineManager().getProgressMonitor();

        boolean working = false;

        int workedSoFar;

        @Override
        public void changed(ProgressEvent event) {
            if (event.total == 0)
                return;
            if (!working) {
                if (event.current == event.total)
                    return;
                //$NON-NLS-1$
                monitor.beginTask("", event.total);
                workedSoFar = 0;
                working = true;
            }
            monitor.worked(event.current - workedSoFar);
            workedSoFar = event.current;
        }

        @Override
        public void completed(ProgressEvent event) {
            monitor.done();
            working = false;
        }
    });
    browser.addStatusTextListener(new StatusTextListener() {

        IStatusLineManager status = actionBars.getStatusLineManager();

        @Override
        public void changed(StatusTextEvent event) {
            status.setMessage(event.text);
        }
    });
    browser.addLocationListener(new LocationAdapter() {

        @Override
        public void changed(LocationEvent event) {
            backAction.setEnabled(browser.isBackEnabled());
            forwardAction.setEnabled(browser.isForwardEnabled());
        //                if (event.top)
        //                    location.setText(event.location);
        }
    });
    browser.addTitleListener(new TitleListener() {

        @Override
        public void changed(TitleEvent event) {
            setPartName(event.title);
        }
    });
    /*
        browser.addOpenWindowListener(new OpenWindowListener() {
            public void open(WindowEvent event) {
                BaseBrowserView.this.openWindow(event);
            }
        });
*/
    // TODO: should handle VisibilityWindowListener.show and .hide events
    browser.addCloseWindowListener(new CloseWindowListener() {

        @Override
        public void close(WindowEvent event) {
            BaseBrowserView.this.close();
        }
    });
    /*
        location.addSelectionListener(new SelectionAdapter() {
            public void widgetDefaultSelected(SelectionEvent e) {
                browser.setUrl(location.getText());
            }
        });
*/
    // Hook the navigation actons as handlers for the retargetable actions
    // defined in BrowserActionBuilder.
    //$NON-NLS-1$
    actionBars.setGlobalActionHandler("back", backAction);
    //$NON-NLS-1$
    actionBars.setGlobalActionHandler("forward", forwardAction);
    //$NON-NLS-1$
    actionBars.setGlobalActionHandler("stop", stopAction);
    //$NON-NLS-1$
    actionBars.setGlobalActionHandler("refresh", refreshAction);
    IToolBarManager toolBarManager = actionBars.getToolBarManager();
    toolBarManager.add(backAction);
    toolBarManager.add(forwardAction);
    toolBarManager.add(stopAction);
    toolBarManager.add(refreshAction);
    backAction.setEnabled(false);
    forwardAction.setEnabled(false);
    return browser;
}
Also used : IStatusLineManager(org.eclipse.jface.action.IStatusLineManager) GridLayout(org.eclipse.swt.layout.GridLayout) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) IToolBarManager(org.eclipse.jface.action.IToolBarManager) GridData(org.eclipse.swt.layout.GridData)

Example 33 with IToolBarManager

use of org.eclipse.jface.action.IToolBarManager in project cubrid-manager by CUBRID.

the class BrokerDashboardViewPart method makeActions.

/**
	 * This method is to create actions at tool bar
	 * 
	 */
private void makeActions() {
    Action columnAction = new Action() {

        public void run() {
            BrokerStatusSettingDlg settingDlg = new BrokerStatusSettingDlg(null);
            ServerInfo serverInfo = brokerNode.getParent().getServerInfo();
            settingDlg.setServerInfo(serverInfo);
            settingDlg.setAppendDiag(true);
            if (settingDlg.open() == Dialog.OK) {
                refreshLayout();
            }
        }

        /**
			 * refresh table layout
			 */
        private void refreshLayout() {
            //refresh basic info table
            TableLayout basicLayout = new TableLayout();
            brokerTablePart.setBasicLayout(basicLayout);
            basicTableViewer.getTable().setLayout(basicLayout);
            basicTableViewer.getTable().layout();
            //refresh apply server table
            TableLayout asLayout = new TableLayout();
            brokerTablePart.setAsLayout(asLayout);
            asTableViewer.getTable().setLayout(asLayout);
            asTableViewer.getTable().layout();
            //refresh job queue table
            TableLayout jqLayout = new TableLayout();
            brokerTablePart.setJqLayout(jqLayout);
            jqTableViewer.getTable().setLayout(jqLayout);
            jqTableViewer.getTable().layout();
        }
    };
    columnAction.setText(Messages.columnSettingTxt);
    columnAction.setImageDescriptor(CubridManagerUIPlugin.getImageDescriptor("icons/action/setting-small.png"));
    IActionBars bars = getViewSite().getActionBars();
    IToolBarManager manager = bars.getToolBarManager();
    manager.add(columnAction);
}
Also used : Action(org.eclipse.jface.action.Action) BrokerStatusSettingDlg(com.cubrid.cubridmanager.ui.broker.editor.internal.BrokerStatusSettingDlg) IToolBarManager(org.eclipse.jface.action.IToolBarManager) ServerInfo(com.cubrid.cubridmanager.core.common.model.ServerInfo) ApplyServerInfo(com.cubrid.cubridmanager.core.broker.model.ApplyServerInfo) TableLayout(org.eclipse.jface.viewers.TableLayout) IActionBars(org.eclipse.ui.IActionBars)

Example 34 with IToolBarManager

use of org.eclipse.jface.action.IToolBarManager in project cubrid-manager by CUBRID.

the class DbDashboardHistoryViewPart method makeActions.

/**
	 * This method is to create actions at tool bar
	 *
	 */
private void makeActions() {
    Action settingAction = new Action() {

        public void run() {
            fireChartSetting();
        }
    };
    settingAction.setText(Messages.chartSettingTxt);
    settingAction.setToolTipText(Messages.chartSettingTxt);
    settingAction.setImageDescriptor(CubridManagerUIPlugin.getImageDescriptor("icons/action/setting-small.png"));
    final IActionBars bars = getViewSite().getActionBars();
    IToolBarManager manager = bars.getToolBarManager();
    manager.add(settingAction);
}
Also used : Action(org.eclipse.jface.action.Action) IToolBarManager(org.eclipse.jface.action.IToolBarManager) IActionBars(org.eclipse.ui.IActionBars)

Example 35 with IToolBarManager

use of org.eclipse.jface.action.IToolBarManager in project cubrid-manager by CUBRID.

the class HostDashboardViewPart method makeActions.

/**
	 * This method is to create actions at tool bar
	 *
	 */
private void makeActions() {
    Action settingAction = new Action() {

        public void run() {
            fireChartSetting();
        }
    };
    settingAction.setText(Messages.chartSettingTxt);
    settingAction.setToolTipText(Messages.chartSettingTxt);
    settingAction.setImageDescriptor(CubridManagerUIPlugin.getImageDescriptor("icons/action/setting-small.png"));
    final IActionBars bars = getViewSite().getActionBars();
    IToolBarManager manager = bars.getToolBarManager();
    manager.add(settingAction);
    RecordAction recordAction = new RecordAction();
    recordAction.setRecorder(this);
    recordAction.setPrepareTooltip(Messages.hostDashboardMonitorStartRecordTooltip);
    recordAction.setRecordTooltip(Messages.hostDashboardRecordingTooltip);
    recordAction.setImageDescriptor(CubridManagerUIPlugin.getImageDescriptor("icons/monitor/prepare_record.png"));
    recordAction.setToolTipText(Messages.hostDashboardMonitorStartRecordTooltip);
    manager.add(recordAction);
}
Also used : RecordAction(com.cubrid.cubridmanager.ui.monitoring.editor.internal.RecordAction) Action(org.eclipse.jface.action.Action) IToolBarManager(org.eclipse.jface.action.IToolBarManager) RecordAction(com.cubrid.cubridmanager.ui.monitoring.editor.internal.RecordAction) IActionBars(org.eclipse.ui.IActionBars)

Aggregations

IToolBarManager (org.eclipse.jface.action.IToolBarManager)58 IActionBars (org.eclipse.ui.IActionBars)20 Action (org.eclipse.jface.action.Action)18 Separator (org.eclipse.jface.action.Separator)10 IMenuManager (org.eclipse.jface.action.IMenuManager)9 ActionContributionItem (org.eclipse.jface.action.ActionContributionItem)8 IAction (org.eclipse.jface.action.IAction)7 RecordAction (com.cubrid.cubridmanager.ui.monitoring.editor.internal.RecordAction)6 ToolBarManager (org.eclipse.jface.action.ToolBarManager)6 IContributionItem (org.eclipse.jface.action.IContributionItem)5 ToolBarContributionItem (org.eclipse.jface.action.ToolBarContributionItem)5 GridData (org.eclipse.swt.layout.GridData)5 MenuManager (org.eclipse.jface.action.MenuManager)4 ISelection (org.eclipse.jface.viewers.ISelection)4 DropDownAction (com.cubrid.common.ui.common.action.DropDownAction)3 ActionManager (com.cubrid.common.ui.spi.action.ActionManager)3 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)3 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)3 TableLayout (org.eclipse.jface.viewers.TableLayout)3 Composite (org.eclipse.swt.widgets.Composite)3