List of usage examples for org.eclipse.jface.action ToolBarContributionItem ToolBarContributionItem
public ToolBarContributionItem(IToolBarManager toolBarManager)
ToolBarContributionItem(toolBarManager, null). From source file:com.amalto.workbench.editors.TdEditorToolBar.java
License:Open Source License
public TdEditorToolBar(Composite parent) { // create coolbar coolBar = new CoolBar(parent, SWT.FLAT); coolBarMgr = new CoolBarManager(coolBar); GridData gid = new GridData(); gid.horizontalAlignment = GridData.FILL; coolBar.setLayoutData(gid);/* www .j a v a 2 s. c om*/ // initialize default actions defaultToolBarMgr = new ToolBarManager(SWT.FLAT | SWT.RIGHT); for (Action action : actions) { defaultToolBarMgr.add(action); } // add all toolbars to parent coolbar coolBarMgr.add(new ToolBarContributionItem(defaultToolBarMgr)); coolBarMgr.update(true); }
From source file:fable.imageviewer.rcp.ApplicationActionBarAdvisor.java
License:Open Source License
/** * Create and fill coolbar./*from www . jav a2 s . co m*/ * */ protected void fillCoolBar(ICoolBarManager coolBar) { IToolBarManager toolbar = new ToolBarManager(coolBar.getStyle()); coolBar.add(new ToolBarContributionItem(toolbar)); }
From source file:net.timedoctor.internal.ui.TraceEditorActionBars.java
License:Open Source License
@Override public void contributeToToolBar(IToolBarManager toolBarManager) { super.contributeToToolBar(toolBarManager); ToolBarContributionItem traceToolBar = new ToolBarContributionItem(toolBarManager); traceToolBar.getToolBarManager().add(zoomInAction); traceToolBar.getToolBarManager().add(zoomOutAction); traceToolBar.getToolBarManager().add(zoomBackAction); traceToolBar.getToolBarManager().add(zoomFitAction); traceToolBar.getToolBarManager().add(nextAction); traceToolBar.getToolBarManager().add(previousAction); traceToolBar.getToolBarManager().add(goToTimeAction); }
From source file:org.dafoe.application.ApplicationActionBarAdvisor.java
License:Open Source License
@Override protected void fillCoolBar(ICoolBarManager coolBar) { IToolBarManager toolbar = new ToolBarManager(coolBar.getStyle() | SWT.BOTTOM); coolBar.add(toolbar);//from www. ja v a 2 s . c o m IThemeManager themeManager = PlatformUI.getWorkbench().getThemeManager(); final Color DAFOE_LEVEL_COLOR = themeManager.getTheme("org.dafoe.application.themeId").getColorRegistry() //$NON-NLS-1$ .get("org.dafoe.application.backcolor"); //$NON-NLS-1$ final Color CORPUS_LEVEL_COLOR = themeManager.getTheme("org.dafoe.corpuslevel.themeId").getColorRegistry() //$NON-NLS-1$ .get("org.dafoe.application.backcolor"); //$NON-NLS-1$ final Color TERMINOLOGIC_LEVEL_COLOR = themeManager.getTheme("org.dafoe.terminologiclevel.themeId") //$NON-NLS-1$ .getColorRegistry().get("org.dafoe.application.backcolor"); //$NON-NLS-1$ final Color TERMINO_ONTOLOGIC_LEVEL_COLOR = themeManager.getTheme("org.dafoe.terminoontologiclevel.themeId") //$NON-NLS-1$ .getColorRegistry().get("org.dafoe.application.backcolor"); //$NON-NLS-1$ final Color ONTOLOGIC_LEVEL_COLOR = themeManager.getTheme("org.dafoe.ontologiclevel.themeId") //$NON-NLS-1$ .getColorRegistry().get("org.dafoe.application.backcolor"); //$NON-NLS-1$ // ToolBarContributionItem. IContributionItem myCont = new ToolBarContributionItem(toolbar) { public void fill(CoolBar coolBar, int index) { CoolItem item = new CoolItem(coolBar, SWT.NONE); CoolBarButton myButton = new CoolBarButton(coolBar, SWT.PUSH, Messages.getString("ApplicationActionBarAdvisor.9"), "welcome", //$NON-NLS-1$ //$NON-NLS-2$ DAFOE_LEVEL_COLOR, Display.getDefault().getSystemColor(SWT.COLOR_WHITE)); //$NON-NLS-1$ //$NON-NLS-2$ coolBar.setLocked(true); Point size = new Point(165, 40); item.setPreferredSize(item.computeSize(size.x, size.y)); item.setControl(myButton.getButton()); } }; coolBar.add(myCont); myCont = new ToolBarContributionItem(toolbar) { public void fill(CoolBar coolBar, int index) { CoolItem item = new CoolItem(coolBar, SWT.NONE); CoolBarButton myButton = new CoolBarButton(coolBar, SWT.PUSH, Messages.getString("ApplicationActionBarAdvisor.11"), "corpus", //$NON-NLS-1$ //$NON-NLS-2$ CORPUS_LEVEL_COLOR, Display.getDefault().getSystemColor(SWT.COLOR_WHITE)); //$NON-NLS-1$ //$NON-NLS-2$ coolBar.setLocked(true); Point size = new Point(165, 40); item.setPreferredSize(item.computeSize(size.x, size.y)); item.setControl(myButton.getButton()); } }; coolBar.add(myCont); myCont = new ToolBarContributionItem(toolbar) { public void fill(CoolBar coolBar, int index) { CoolItem item = new CoolItem(coolBar, SWT.NONE); CoolBarButton myButton = new CoolBarButton(coolBar, SWT.PUSH, Messages.getString("ApplicationActionBarAdvisor.13"), "terminologic", //$NON-NLS-1$ //$NON-NLS-2$ TERMINOLOGIC_LEVEL_COLOR, Display.getDefault().getSystemColor(SWT.COLOR_WHITE)); //$NON-NLS-1$ //$NON-NLS-2$ coolBar.setLocked(true); Point size = new Point(165, 40); item.setPreferredSize(item.computeSize(size.x, size.y)); item.setControl(myButton.getButton()); } }; coolBar.add(myCont); myCont = new ToolBarContributionItem(toolbar) { public void fill(CoolBar coolBar, int index) { CoolItem item = new CoolItem(coolBar, SWT.NONE); CoolBarButton myButton = new CoolBarButton(coolBar, SWT.PUSH, Messages.getString("ApplicationActionBarAdvisor.15"), "terminoontologic", //$NON-NLS-1$ //$NON-NLS-2$ TERMINO_ONTOLOGIC_LEVEL_COLOR, Display.getDefault().getSystemColor(SWT.COLOR_WHITE)); //$NON-NLS-1$ //$NON-NLS-2$ coolBar.setLocked(true); Point size = new Point(165, 40); item.setPreferredSize(item.computeSize(size.x, size.y)); item.setControl(myButton.getButton()); } }; coolBar.add(myCont); myCont = new ToolBarContributionItem(toolbar) { public void fill(CoolBar coolBar, int index) { CoolItem item = new CoolItem(coolBar, SWT.NONE); CoolBarButton myButton = new CoolBarButton(coolBar, SWT.PUSH, Messages.getString("ApplicationActionBarAdvisor.17"), "ontologic", //$NON-NLS-1$ //$NON-NLS-2$ ONTOLOGIC_LEVEL_COLOR, Display.getDefault().getSystemColor(SWT.COLOR_WHITE)); //$NON-NLS-1$ //$NON-NLS-2$ coolBar.setLocked(true); Point size = new Point(165, 40); item.setPreferredSize(item.computeSize(size.x, size.y)); item.setControl(myButton.getButton()); } }; coolBar.add(myCont); myCont = new ToolBarContributionItem(toolbar) { public void fill(CoolBar coolBar, int index) { CoolItem item = new CoolItem(coolBar, SWT.NONE); Label myButton = new Label(coolBar, SWT.PUSH); coolBar.setLocked(true); Point size = new Point(165, 40); item.setPreferredSize(item.computeSize(size.x, size.y)); item.setControl(myButton); myButton.addPaintListener(new PaintListener() { public void paintControl(PaintEvent e) { // System.out.println(name+" "+(isin?"in":"out")); GC gc = e.gc; Font font = new Font(Display.getDefault(), "Verdana", 9, SWT.BOLD | SWT.CENTER); //$NON-NLS-1$ gc.setFont(font); // gc.fillRectangle(0, 0, e.width, e.height-10); //VT Project currentProject = ControlerFactoryImpl.getPlatformControler().getCurrentProject(); Point pt = gc.stringExtent(currentProject.getName());//"Jean Charlet"); //$NON-NLS-1$ Image image = Activator.getDefault().getImageRegistry().get(Activator.DRAPEAU); gc.drawString(currentProject.getName()/*"Jean Charlet"*/, (e.width - pt.x - 5) - image.getImageData().width - 10, (e.height - pt.y - 6) / 2, true); //$NON-NLS-1$ gc.drawImage(image, (e.width - image.getImageData().width - 10), (e.height - pt.y - 6) / 2); IThemeManager themeManager = PlatformUI.getWorkbench().getThemeManager(); Color col = themeManager.getCurrentTheme().getColorRegistry() .get("org.dafoe.application.backcolor"); //$NON-NLS-1$ gc.setBackground(col); gc.fillRectangle(0, e.height - 10, e.width, 10); gc.setForeground(new Color(Display.getDefault(), 0, 0, 0)); gc.drawLine(0, e.height - 10, e.width, e.height - 10); } }); } }; coolBar.add(myCont); }
From source file:org.eclipse.ui.internal.CoolBarToTrimManager.java
License:Open Source License
public void add(final IToolBarManager toolBarManager) { if (toolBarManager instanceof ToolBarManager) { add(new ToolBarContributionItem(toolBarManager)); }/*from w w w.ja va 2 s .co m*/ }
From source file:org.jlibrary.client.JLibraryActionBarAdvisor.java
License:Open Source License
protected void fillCoolBar(ICoolBarManager coolBar) { IToolBarManager tBarMgr = new ToolBarManager(coolBar.getStyle()); tBarMgr.add(newWizardMenu.getNewRepositoryAction()); tBarMgr.add(openAction);/*from ww w . j a v a2 s .c o m*/ tBarMgr.add(newWizardMenu.getNewDirectoryAction()); tBarMgr.add(newWizardMenu.getNewDocumentAction()); tBarMgr.add(newWizardMenu.getNewResourceAction()); tBarMgr.add(new Separator()); tBarMgr.add(addDirectoriesAction); tBarMgr.add(addResourcesAction); coolBar.add(new ToolBarContributionItem(tBarMgr)); tBarMgr = new ToolBarManager(coolBar.getStyle()); tBarMgr.add(closeAction); tBarMgr.add(importAction); tBarMgr.add(exportAction); tBarMgr.add(exportHTMLAction); tBarMgr.add(new Separator());/* tBarMgr.add(saveAction); tBarMgr.add(saveallAction);*/ tBarMgr.add(saveAction); tBarMgr.add(saveAllAction); coolBar.add(new ToolBarContributionItem(tBarMgr)); tBarMgr = new ToolBarManager(coolBar.getStyle()); tBarMgr.add(new Separator()); tBarMgr.add(cutAction); tBarMgr.add(copyAction); tBarMgr.add(pasteAction); tBarMgr.add(deleteAction); tBarMgr.add(refreshAction); coolBar.add(new ToolBarContributionItem(tBarMgr)); tBarMgr = new ToolBarManager(coolBar.getStyle()); tBarMgr.add(saveContentAction); tBarMgr.add(loadContentAction); tBarMgr.add(lockAction); tBarMgr.add(unlockAction); tBarMgr.add(addFavoritesAction); tBarMgr.add(addFavoritesDefaultAction); tBarMgr.add(restoreVersionAction); coolBar.add(new ToolBarContributionItem(tBarMgr)); //tBarMgr.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); }
From source file:org.talend.dataprofiler.core.ui.editor.TdEditorToolBar.java
License:Open Source License
public TdEditorToolBar(Composite parent, TdEditorBarWrapper editorBarWrap) { this.editorBarWrap = editorBarWrap; // create coolbar coolBar = new CoolBar(parent, SWT.FLAT); coolBarMgr = new CoolBarManager(coolBar); GridData gid = new GridData(); gid.horizontalAlignment = GridData.FILL; coolBar.setLayoutData(gid);/* ww w . j a va 2s. c o m*/ // initialize default actions defaultToolBarMgr = new ToolBarManager(SWT.FLAT); actions.add(new ExpandSectionAction(editorBarWrap)); actions.add(new CollapseSectionAction(editorBarWrap)); for (Action action : actions) { defaultToolBarMgr.add(action); } // add all toolbars to parent coolbar coolBarMgr.add(new ToolBarContributionItem(defaultToolBarMgr)); coolBarMgr.update(true); }
From source file:org.talend.sqlbuilder.ui.AbstractSQLEditorComposite.java
License:Open Source License
/** * qzhang Comment method "createToolBar". *//*from w ww . j ava 2s . co m*/ 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); contextModeAction = new ContextModeAction(getRepositoryNode(), connParam); // initialize hyWang's ACTION 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)); coolBarMgr.add(new ToolBarContributionItem(contextToolBarMgr)); // add hyWang's toolbar to coolbar coolBarMgr.update(true); }
From source file:zigen.plugin.db.ui.editors.sql.SourceEditor.java
License:Open Source License
public void createToolbarPart(final Composite parent) { // coolBar = new CoolBar(parent, SWT.FLAT); coolBar = new CoolBar(parent, SWT.NONE); FormData data = new FormData(); data.top = new FormAttachment(0, 0); data.left = new FormAttachment(0, 0); data.right = new FormAttachment(100, 0); coolBar.setLayoutData(data);// w ww . j a v a 2 s . c om CoolBarManager coolBarMgr = new CoolBarManager(coolBar); // GridData gid = new GridData(); // gid.horizontalAlignment = GridData.FILL; // coolBar.setLayoutData(gid); ToolBarManager toolBarMgr1 = new ToolBarManager(SWT.FLAT); toolBarMgr1.add(execScriptAction); ToolBarManager toolBarMgr2 = new ToolBarManager(SWT.FLAT); toolBarMgr2.add(openSQLAction); toolBarMgr2.add(saveSQLAction); coolBarMgr.add(new ToolBarContributionItem(toolBarMgr2)); coolBarMgr.add(new ToolBarContributionItem(toolBarMgr1)); coolBarMgr.update(true); coolBar.addControlListener(new ControlListener() { public void controlMoved(ControlEvent e) { } public void controlResized(ControlEvent e) { parent.getParent().layout(true); parent.layout(true); } }); }
From source file:zigen.plugin.db.ui.views.internal.DDLToolBar.java
License:Open Source License
public DDLToolBar(final Composite parent, IEditorPart editor) { this.fEditor = editor; // this.coolBar = new CoolBar(parent, SWT.FLAT); this.coolBar = new CoolBar(parent, SWT.NONE); FormData data = new FormData(); data.top = new FormAttachment(0, 0); data.left = new FormAttachment(0, 0); data.right = new FormAttachment(100, 0); coolBar.setLayoutData(data);/*from ww w . j a v a 2 s . c om*/ CoolBarManager coolBarMgr = new CoolBarManager(coolBar); ToolBarManager toolBarMgr1 = new ToolBarManager(SWT.FLAT); toolBarMgr1.add(saveAction); coolBarMgr.add(new ToolBarContributionItem(toolBarMgr1)); coolBarMgr.update(true); coolBar.addControlListener(new ControlListener() { public void controlMoved(ControlEvent e) { } public void controlResized(ControlEvent e) { parent.getParent().layout(true); parent.layout(true); } }); }