Search in sources :

Example 1 with ToolBarManager

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

the class AbstractSQLEditorComposite method createToolBar.

/**
     * qzhang Comment method "createToolBar".
     */
protected void createToolBar() {
    // create coolbar
    coolBar = new CoolBar(this, SWT.NONE);
    coolBarMgr = new CoolBarManager(coolBar);
    GridData gid = new GridData();
    gid.horizontalAlignment = GridData.FILL;
    coolBar.setLayoutData(gid);
    // initialize default actions
    defaultToolBarMgr = new ToolBarManager(SWT.NONE);
    execSQLAction = new ExecSQLAction(SQLResultComposite.getInstance(), this);
    openFileAction = new OpenFileAction();
    openFileAction.setEditor(this);
    saveSQLAction = new SaveSQLAction(getRepositoryNode(), connParam);
    saveSQLAction.setEditor(this);
    saveAsSQLAction = new SaveAsSQLAction(getRepositoryNode(), connParam);
    saveAsSQLAction.setEditor(this);
    exportAction = new SaveFileAsAction();
    exportAction.setEditor(this);
    clearTextAction = new ClearTextAction();
    clearTextAction.setEditor(this);
    guiModificationQueryAction = new GUIModificationQueryAction(getRepositoryNode(), connParam, dialog);
    guiModificationQueryAction.setEditor(this);
    // initialize hyWang's ACTION
    contextModeAction = new ContextModeAction(getRepositoryNode(), connParam);
    addDefaultActions();
    // initialize session actions
    sessionToolBarMgr = new ToolBarManager(SWT.NONE);
    sessionSwitcher = new SQLEditorSessionSwitcher(this);
    sessionToolBarMgr.add(sessionSwitcher);
    // initialize hyWang's BUTTON and TOOLBAR
    contextToolBarMgr = new ToolBarManager(SWT.NONE);
    contextmode = new ContextModeSessionSwitcher(this, contextModeAction);
    contextToolBarMgr.add(contextmode);
    // add all toolbars to parent coolbar
    coolBar.setLocked(true);
    coolBarMgr.add(new ToolBarContributionItem(defaultToolBarMgr));
    coolBarMgr.add(new ToolBarContributionItem(sessionToolBarMgr));
    // add hyWang's toolbar to coolbar
    coolBarMgr.add(new ToolBarContributionItem(contextToolBarMgr));
    coolBarMgr.update(true);
}
Also used : CoolBarManager(org.eclipse.jface.action.CoolBarManager) SaveAsSQLAction(org.talend.sqlbuilder.actions.SaveAsSQLAction) SaveFileAsAction(org.talend.sqlbuilder.actions.SaveFileAsAction) ExecSQLAction(org.talend.sqlbuilder.actions.ExecSQLAction) SaveSQLAction(org.talend.sqlbuilder.actions.SaveSQLAction) SQLEditorSessionSwitcher(org.talend.sqlbuilder.actions.SQLEditorSessionSwitcher) ContextModeSessionSwitcher(org.talend.sqlbuilder.actions.ContextModeSessionSwitcher) ToolBarManager(org.eclipse.jface.action.ToolBarManager) ToolBarContributionItem(org.eclipse.jface.action.ToolBarContributionItem) OpenFileAction(org.talend.sqlbuilder.actions.OpenFileAction) CoolBar(org.eclipse.swt.widgets.CoolBar) ClearTextAction(org.talend.sqlbuilder.actions.ClearTextAction) GridData(org.eclipse.swt.layout.GridData) ContextModeAction(org.talend.sqlbuilder.actions.ContextModeAction) GUIModificationQueryAction(org.talend.sqlbuilder.actions.GUIModificationQueryAction)

Example 2 with ToolBarManager

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

the class DBStructureComposite method createToolbar.

/**
     * create toobar.
     */
private void createToolbar() {
    Label label = new Label(this, SWT.NONE);
    //$NON-NLS-1$ //$NON-NLS-2$
    label.setText("  " + Messages.getString("DBStructureComposite.DatabaseStructure"));
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
    ToolBarManager toolBarMgr = new ToolBarManager(SWT.FLAT);
    toolBarMgr.createControl(this);
    if (listAllConnectionsAction == null) {
        listAllConnectionsAction = new ListAllConnectionAction(SWT.TOGGLE);
    }
    toolBarMgr.add(listAllConnectionsAction);
    if (refreshAllConnectionsAction == null) {
        refreshAllConnectionsAction = new RefreshAllConnectionAction();
    }
    toolBarMgr.add(refreshAllConnectionsAction);
    toolBarMgr.update(true);
    toolBarMgr.getControl().setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
}
Also used : Label(org.eclipse.swt.widgets.Label) GridData(org.eclipse.swt.layout.GridData) ToolBarManager(org.eclipse.jface.action.ToolBarManager)

Example 3 with ToolBarManager

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

the class ApplicationActionBarAdvisor method fillCoolBar.

/**
	 * Fills the cool bar with the main toolbars for the window.
	 *
	 * @param coolBar the cool bar manager
	 */
protected void fillCoolBar(ICoolBarManager coolBarManager) {
    ActionManager manager = ActionManager.getInstance();
    coolBarManager.setLockLayout(true);
    IToolBarManager toolbarManager = new ToolBarManager(SWT.FLAT | SWT.WRAP | SWT.BOTTOM);
    coolBarManager.add(new ToolBarContributionItem(toolbarManager, IActionConstants.TOOL_NEW1));
    Bundle cqbBundle = Platform.getBundle(ApplicationUtil.CQB_PLUGIN_ID);
    /* Active the CQB plugin */
    if (cqbBundle != null) {
        try {
            cqbBundle.start();
        } catch (Exception e) {
            LOGGER.error(e.getMessage());
        }
    }
    Bundle cmBundle = Platform.getBundle(ApplicationUtil.CM_PLUGIN_ID);
    /* Active the CM plugin */
    if (cmBundle != null) {
        try {
            cmBundle.start();
        } catch (Exception e) {
            LOGGER.error(e.getMessage());
        }
    }
    // Change view actions
    if (cqbBundle != null) {
        DropDownAction viewAction = new DropDownAction(Messages.modeActionBig, IAction.AS_DROP_DOWN_MENU, CubridManagerAppPlugin.getImageDescriptor("icons/cubridmanager32.gif"));
        viewAction.setDisabledImageDescriptor(CubridManagerAppPlugin.getImageDescriptor("icons/cubridmanager32.gif"));
        MenuManager viewActionManager = viewAction.getMenuManager();
        viewActionManager.add(manager.getAction(OpenCMPerspectiveAction.ID));
        viewActionManager.add(manager.getAction(OpenCQBPerspectiveAction.ID));
        ActionContributionItem viewItems = new ActionContributionItem(viewAction);
        viewItems.setMode(ActionContributionItem.MODE_FORCE_TEXT);
        viewItems.setId(IPerspectiveConstance.PERSPECTIVE_ACTION_CONTRIBUTION_ID);
        toolbarManager.add(viewItems);
        toolbarManager.add(new Separator());
    }
    /*TOOLS-3988 There still is the install option after installing cmt plugin.*/
    Bundle bundle = Platform.getBundle(ApplicationUtil.CMT_PLUGIN_ID);
    if (bundle == null) {
        toolbarManager.add(new Separator());
        IAction action = ActionManager.getInstance().getAction(InstallMigrationToolkitAction.ID);
        if (action != null) {
            ActionContributionItem item = new ActionContributionItem(action);
            item.setMode(ActionContributionItem.MODE_FORCE_TEXT);
            toolbarManager.add(item);
            item.setId(IPerspectiveConstance.MIGRATION_ACTION_CONTRIBUTION_ID);
        }
    } else {
        /*Active the CMT plugin */
        try {
            bundle.start();
        } catch (Exception e) {
            LOGGER.error(e.getMessage());
        }
    }
    // Help
    toolbarManager.add(new Separator());
    DropDownAction helpDropAction = new DropDownAction(Messages.helpActionNameBig, IAction.AS_DROP_DOWN_MENU, CubridManagerUIPlugin.getImageDescriptor("icons/action/help_big.png"));
    helpDropAction.setDisabledImageDescriptor(CubridManagerUIPlugin.getImageDescriptor("icons/action/help_big.png"));
    MenuManager helpActionManager = helpDropAction.getMenuManager();
    helpActionManager.add(manager.getAction(HelpDocumentAction.ID));
    if ("ko".equals(Messages.language)) {
        helpActionManager.add(newFeatureAction);
    }
    helpActionManager.add(new Separator());
    helpActionManager.add(createItem(ReportBugAction.ID));
    helpActionManager.add(new Separator());
    helpActionManager.add(manager.getAction(ViewServerVersionAction.ID));
    helpActionManager.add(clientVersionAction);
    ActionContributionItem helpItems = new ActionContributionItem(helpDropAction);
    helpItems.setMode(ActionContributionItem.MODE_FORCE_TEXT);
    helpItems.setId(IPerspectiveConstance.HELP_ACTION_CONTRIBUTION_ID);
    toolbarManager.add(helpItems);
    ControlContribution searchContribution = new ControlContribution(SearchContributionComposite.class.getName()) {

        protected Control createControl(Composite parent) {
            return new SearchContributionComposite(parent, SWT.None);
        }
    };
    searchContribution.setId(IPerspectiveConstance.SEARCH_ACTION_CONTRIBUTION_ID);
    toolbarManager.add(new Separator());
    toolbarManager.add(searchContribution);
}
Also used : IAction(org.eclipse.jface.action.IAction) SearchContributionComposite(com.cubrid.common.ui.common.control.SearchContributionComposite) Composite(org.eclipse.swt.widgets.Composite) Bundle(org.osgi.framework.Bundle) ControlContribution(org.eclipse.jface.action.ControlContribution) IToolBarManager(org.eclipse.jface.action.IToolBarManager) ToolBarManager(org.eclipse.jface.action.ToolBarManager) ActionManager(com.cubrid.common.ui.spi.action.ActionManager) ToolBarContributionItem(org.eclipse.jface.action.ToolBarContributionItem) ActionContributionItem(org.eclipse.jface.action.ActionContributionItem) DropDownAction(com.cubrid.common.ui.common.action.DropDownAction) IToolBarManager(org.eclipse.jface.action.IToolBarManager) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) SearchContributionComposite(com.cubrid.common.ui.common.control.SearchContributionComposite) Separator(org.eclipse.jface.action.Separator)

Example 4 with ToolBarManager

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

the class ActionBuilder method buildToolBar.

/**
	 * Build CUBRID Manager toolBar
	 *
	 * @param parent the coolbar manager
	 * @return the toolbar manager
	 */
public IToolBarManager[] buildToolBar(ICoolBarManager parent) {
    IToolBarManager newToolbarManager = new ToolBarManager(SWT.FLAT | SWT.RIGHT);
    newToolbarManager.add(ActionManager.getInstance().getAction(AddHostAction.ID));
    newToolbarManager.add(ActionManager.getInstance().getAction(CreateDatabaseAction.ID));
    newToolbarManager.add(ActionManager.getInstance().getAction(QueryNewAction.ID));
    parent.add(newToolbarManager);
    IToolBarManager statusToolbarManager = new ToolBarManager(SWT.FLAT | SWT.RIGHT);
    statusToolbarManager.add(ActionManager.getInstance().getAction(StartRetargetAction.ID));
    statusToolbarManager.add(ActionManager.getInstance().getAction(StopRetargetAction.ID));
    parent.add(statusToolbarManager);
    return new IToolBarManager[] { newToolbarManager, statusToolbarManager };
}
Also used : IToolBarManager(org.eclipse.jface.action.IToolBarManager) IToolBarManager(org.eclipse.jface.action.IToolBarManager) ToolBarManager(org.eclipse.jface.action.ToolBarManager)

Example 5 with ToolBarManager

use of org.eclipse.jface.action.ToolBarManager in project translationstudio8 by heartsome.

the class ApplicationActionBarAdvisor method createToolItem.

private IToolBarManager createToolItem(ICoolBarManager coolBar) {
    IToolBarManager toolBar = new ToolBarManager(coolBar.getStyle());
    coolBar.add(new ToolBarContributionItem(toolBar, "findreplace"));
    toolBar.add(findAction);
    return toolBar;
}
Also used : ToolBarContributionItem(org.eclipse.jface.action.ToolBarContributionItem) IToolBarManager(org.eclipse.jface.action.IToolBarManager) IToolBarManager(org.eclipse.jface.action.IToolBarManager) ToolBarManager(org.eclipse.jface.action.ToolBarManager)

Aggregations

ToolBarManager (org.eclipse.jface.action.ToolBarManager)71 GridData (org.eclipse.swt.layout.GridData)35 ToolBar (org.eclipse.swt.widgets.ToolBar)33 Composite (org.eclipse.swt.widgets.Composite)29 GridLayout (org.eclipse.swt.layout.GridLayout)26 Action (org.eclipse.jface.action.Action)24 IToolBarManager (org.eclipse.jface.action.IToolBarManager)22 DisposeEvent (org.eclipse.swt.events.DisposeEvent)19 DisposeListener (org.eclipse.swt.events.DisposeListener)19 IAction (org.eclipse.jface.action.IAction)18 Cursor (org.eclipse.swt.graphics.Cursor)16 Section (org.eclipse.ui.forms.widgets.Section)15 FillLayout (org.eclipse.swt.layout.FillLayout)14 Control (org.eclipse.swt.widgets.Control)13 ExpandableComposite (org.eclipse.ui.forms.widgets.ExpandableComposite)12 FocusEvent (org.eclipse.swt.events.FocusEvent)11 KeyEvent (org.eclipse.swt.events.KeyEvent)11 Event (org.eclipse.swt.widgets.Event)11 Group (org.eclipse.swt.widgets.Group)11 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)10