List of usage examples for org.eclipse.jface.action CoolBarManager CoolBarManager
public CoolBarManager()
From source file:de.berlios.koalanotes.display.DisplayedDocument.java
License:Open Source License
public DisplayedDocument(Shell shell, Document document) { this.document = document; // ImageRegistry, KoalaStyleManager imageRegistry = new ImageRegistry(shell.getDisplay()); koalaStyleManager = new KoalaStyleManager(); // Shell//from w w w . j a va 2 s .c o m this.shell = shell; shell.setText("Untitled Document - Koala Notes"); shell.setImage(imageRegistry.get(ImageRegistry.IMAGE_KOALA_SMALL)); // Shell Layout GridLayout shellLayout = new GridLayout(1, false); shellLayout.marginWidth = 0; shellLayout.marginHeight = 0; shellLayout.horizontalSpacing = 0; shellLayout.verticalSpacing = 0; shell.setLayout(shellLayout); // Menu Bar menuBar = new MenuManager(); shell.setMenuBar(menuBar.createMenuBar((Decorations) shell)); // Cool Bar coolBar = new CoolBarManager(); GridData coolBarLayoutData = new GridData(); coolBarLayoutData.horizontalAlignment = SWT.FILL; CoolBar coolBarControl = coolBar.createControl(shell); coolBarControl.setLayoutData(coolBarLayoutData); // SashForm SashForm sashForm = new SashForm(shell, SWT.HORIZONTAL); GridData sashFormLayoutData = new GridData(); sashFormLayoutData.horizontalAlignment = SWT.FILL; sashFormLayoutData.verticalAlignment = SWT.FILL; sashFormLayoutData.grabExcessHorizontalSpace = true; sashFormLayoutData.grabExcessVerticalSpace = true; sashForm.setLayoutData(sashFormLayoutData); // Status Bar statusBar = new Label(shell, SWT.NONE); GridData statusBarLayoutData = new GridData(); statusBarLayoutData.horizontalAlignment = SWT.FILL; statusBarLayoutData.verticalIndent = 3; statusBar.setLayoutData(statusBarLayoutData); // Tree and DisplayedNotes this.displayedNotes = new LinkedList<DisplayedNote>(); tree = new NoteTree(sashForm, this); for (Note root : document.getNotes()) { new DisplayedNote(this, tree, root); } // TabFolder tabFolder = new NoteTabFolder(sashForm, this); // Finish SashForm sashForm.setWeights(new int[] { 20, 80 }); // Tree Context Menu treeContextMenu = new MenuManager(); tree.setContextMenu(treeContextMenu); }
From source file:org.eclipse.bpel.common.ui.composite.EditorInViewManager.java
License:Open Source License
/** * Creates an IActionBars2 as a wrapper of an IActionBars. *//*from www. j a v a 2 s. c o m*/ protected IActionBars2 getIActionBars2Wrapper(final IActionBars actionBars) { return new IActionBars2() { public ICoolBarManager getCoolBarManager() { return new CoolBarManager(); } public void clearGlobalActionHandlers() { actionBars.clearGlobalActionHandlers(); } public IAction getGlobalActionHandler(String actionId) { return actionBars.getGlobalActionHandler(actionId); } public IMenuManager getMenuManager() { // Returns the page menu manager so that the editor // can contribute to any menu (Edit, Navigate, etc...). return page.getActionBars().getMenuManager(); } public IStatusLineManager getStatusLineManager() { return actionBars.getStatusLineManager(); } public IToolBarManager getToolBarManager() { return actionBars.getToolBarManager(); } public void setGlobalActionHandler(String actionId, IAction handler) { actionBars.setGlobalActionHandler(actionId, handler); } public void updateActionBars() { actionBars.updateActionBars(); } public IServiceLocator getServiceLocator() { return actionBars.getServiceLocator(); } }; }
From source file:org.eclipse.ui.tests.internal.EditorActionBarsTest.java
License:Open Source License
/** * Tests an edge case in cool bar updating when the cool bar has a single separator * and no other contents (or multiple separators and no other contents). * See bug 239945 for details./*from w w w .j av a2 s.c o m*/ * @throws Throwable */ public void test239945() throws Throwable { // Test a cool bar with a single separator CoolBarManager coolBarManager = new CoolBarManager(); coolBarManager.add(new Separator(CoolBarManager.USER_SEPARATOR)); try { coolBarManager.createControl(fWindow.getShell()); coolBarManager.update(true); } catch (ArrayIndexOutOfBoundsException e) { fail("Exception updating cool bar with a single separator"); } // Test a cool bar with multiple separators CoolBarManager coolBarManager2 = new CoolBarManager(); coolBarManager2.add(new Separator(CoolBarManager.USER_SEPARATOR)); try { coolBarManager2.createControl(fWindow.getShell()); coolBarManager2.update(true); } catch (ArrayIndexOutOfBoundsException e) { fail("Exception updating cool bar with multiple separators"); } }