private void initializeToolBar() { IToolBarManager tbm = getViewSite().getActionBars().getToolBarManager(); createToolBarGroups(tbm); tbm.appendToGroup(IContextMenuConstants.GROUP_SEARCH, fSearchAgainAction); tbm.appendToGroup(IContextMenuConstants.GROUP_SEARCH, fCancelAction); tbm.appendToGroup(IContextMenuConstants.GROUP_SEARCH, fSearchesDropDownAction); getViewSite().getActionBars().updateActionBars(); }
/* (non-Javadoc) * @see org.eclipse.debug.ui.AbstractDebugView#configureToolBar(org.eclipse.jface.action.IToolBarManager) */ protected void configureToolBar(IToolBarManager toolBarMgr) { toolBarMgr.add(new Separator(IPTPDebugUIConstants.VAR_GROUP)); toolBarMgr.appendToGroup(IPTPDebugUIConstants.VAR_GROUP, getAction(AddPExpressionAction.name)); toolBarMgr.appendToGroup(IPTPDebugUIConstants.VAR_GROUP, getAction(EditPExpressionAction.name)); toolBarMgr.appendToGroup( IPTPDebugUIConstants.VAR_GROUP, getAction(DeletePExpressionAction.name)); toolBarMgr.appendToGroup( IPTPDebugUIConstants.VAR_GROUP, getAction(UpdatePExpressionAction.name)); toolBarMgr.add(new Separator()); toolBarMgr.appendToGroup(IPTPDebugUIConstants.VAR_GROUP, getAction(CompareValueAction.name)); }
/* * (non-Javadoc) * * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) */ public void createPartControl(Composite parent) { PlatformUI.getWorkbench() .getHelpSystem() .setHelp(parent, ChartHelpContextIds.VIEW_CHART_EXAMPLE); instance = new ChartExamples(parent); final IActionBars actionBars = getViewSite().getActionBars(); IToolBarManager toolbarManager = actionBars.getToolBarManager(); Tools tools[] = ChartExamples.tools; String group = tools[0].group; toolbarManager.add(new GroupMarker(group)); for (int i = 0; i < tools.length; i++) { Tools tool = tools[i]; if (!tool.group.equals(group)) { toolbarManager.add(new Separator()); toolbarManager.add(new GroupMarker(tool.group)); } group = tool.group; toolbarManager.appendToGroup(group, initActions(tool, parent)); } actionBars.updateActionBars(); }
public void init(IPageBookViewPage page, IConsole console) { closeAction = new CloseConsoleAction(console); IToolBarManager manager = page.getSite().getActionBars().getToolBarManager(); manager.appendToGroup(IConsoleConstants.LAUNCH_GROUP, closeAction); }
/** @since 3.0 */ public void updateHeaderToolBar() { if (isHeaderFormDisposed()) { return; } final Form form = getHeaderForm().getForm().getForm(); toolBarManager = form.getToolBarManager(); toolBarManager.removeAll(); // toolBarManager.update(true); TaskRepository outgoingNewRepository = TasksUiUtil.getOutgoingNewTaskRepository(task); final TaskRepository taskRepository = (outgoingNewRepository != null) ? outgoingNewRepository : taskEditorInput.getTaskRepository(); ControlContribution repositoryLabelControl = new ControlContribution(Messages.AbstractTaskEditorPage_Title) { @Override protected Control createControl(Composite parent) { FormToolkit toolkit = getHeaderForm().getToolkit(); Composite composite = toolkit.createComposite(parent); RowLayout layout = new RowLayout(); if (PlatformUiUtil.hasNarrowToolBar()) { layout.marginTop = 0; layout.marginBottom = 0; layout.center = true; } composite.setLayout(layout); composite.setBackground(null); String label = taskRepository.getRepositoryLabel(); if (label.indexOf("//") != -1) { // $NON-NLS-1$ label = label.substring( (taskRepository.getRepositoryUrl().indexOf("//") + 2)); // $NON-NLS-1$ } ImageHyperlink link = new ImageHyperlink(composite, SWT.NONE); link.setText(label); link.setFont(JFaceResources.getBannerFont()); link.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); link.setToolTipText(Messages.TaskEditor_Edit_Task_Repository_ToolTip); link.addHyperlinkListener( new HyperlinkAdapter() { @Override public void linkActivated(HyperlinkEvent e) { TasksUiUtil.openEditRepositoryWizard(taskRepository); } }); return composite; } }; toolBarManager.add(repositoryLabelControl); toolBarManager.add(new GroupMarker("repository")); // $NON-NLS-1$ toolBarManager.add(new GroupMarker("new")); // $NON-NLS-1$ toolBarManager.add(new GroupMarker("open")); // $NON-NLS-1$ toolBarManager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); openWithBrowserAction = new OpenWithBrowserAction(); openWithBrowserAction.selectionChanged(new StructuredSelection(task)); if (openWithBrowserAction.isEnabled()) { // ImageDescriptor overlay = // TasksUiPlugin.getDefault().getOverlayIcon(taskRepository.getConnectorKind()); // ImageDescriptor compositeDescriptor = new // TaskListImageDescriptor(TasksUiImages.REPOSITORY_SMALL_TOP, // overlay, false, true); openWithBrowserAction.setImageDescriptor(CommonImages.WEB); // openWithBrowserAction.setImageDescriptor(CommonImages.BROWSER_OPEN_TASK); openWithBrowserAction.setToolTipText(Messages.AbstractTaskEditorPage_Open_with_Web_Browser); toolBarManager.appendToGroup("open", openWithBrowserAction); // $NON-NLS-1$ } else { openWithBrowserAction = null; } if (activateAction == null) { activateAction = new ToggleTaskActivationAction(task) { @Override public void run() { TaskList taskList = TasksUiPlugin.getTaskList(); if (taskList.getTask(task.getRepositoryUrl(), task.getTaskId()) == null) { setMessage( Messages.TaskEditor_Task_added_to_the_Uncategorized_container, IMessageProvider.INFORMATION); } super.run(); } }; } toolBarManager.add(new Separator("planning")); // $NON-NLS-1$ disposeScheduleAction(); scheduleAction = new TaskEditorScheduleAction(task); toolBarManager.add(scheduleAction); toolBarManager.add(new GroupMarker("page")); // $NON-NLS-1$ for (IFormPage page : getPages()) { if (page instanceof TaskFormPage) { TaskFormPage taskEditorPage = (TaskFormPage) page; taskEditorPage.fillToolBar(toolBarManager); } } toolBarManager.add(new Separator("activation")); // $NON-NLS-1$ // ContributionItem spacer = new ContributionItem() { // @Override // public void fill(ToolBar toolbar, int index) { // ToolItem item = new ToolItem(toolbar, SWT.NONE); // int scaleHeight = 42; // if (PlatformUtil.needsCarbonToolBarFix()) { // scaleHeight = 32; // } // final Image image = new Image(toolbar.getDisplay(), // CommonImages.getImage(CommonImages.BLANK) // .getImageData() // .scaledTo(1, scaleHeight)); // item.setImage(image); // item.addDisposeListener(new DisposeListener() { // public void widgetDisposed(DisposeEvent e) { // image.dispose(); // } // }); // item.setWidth(5); // item.setEnabled(false); // } // }; // toolBarManager.add(spacer); // for (IFormPage page : getPages()) { // if (page instanceof AbstractTaskEditorPage) { // AbstractTaskEditorPage taskEditorPage = (AbstractTaskEditorPage) page; // taskEditorPage.fillLeftHeaderToolBar(toolBarManager); // } else if (page instanceof TaskPlanningEditor) { // TaskPlanningEditor taskEditorPage = (TaskPlanningEditor) page; // taskEditorPage.fillLeftHeaderToolBar(toolBarManager); // } // } // add external contributions menuService = (IMenuService) getSite().getService(IMenuService.class); if (menuService != null && toolBarManager instanceof ContributionManager) { menuService.populateContributionManager( (ContributionManager) toolBarManager, "toolbar:" //$NON-NLS-1$ + ID_TOOLBAR_HEADER + "." + taskRepository.getConnectorKind()); // $NON-NLS-1$ menuService.populateContributionManager( (ContributionManager) toolBarManager, "toolbar:" //$NON-NLS-1$ + ID_TOOLBAR_HEADER); } toolBarManager.update(true); // XXX move this call updateLeftHeaderToolBar(); updateHeader(); }
@Override public void contributeToToolBar(IToolBarManager toolBarManager) { super.contributeToToolBar(toolBarManager); toolBarManager.appendToGroup(GROUP_TOOLBAR_END, getAction(ResetAspectRatioAction.ID)); }
/** Contribute actions to the toolbar */ protected void configureToolBar(final IToolBarManager mgr) { mgr.appendToGroup(IConsoleConstants.LAUNCH_GROUP, fTerminate); mgr.appendToGroup(IConsoleConstants.LAUNCH_GROUP, fRemoveTerminated); mgr.appendToGroup(IConsoleConstants.LAUNCH_GROUP, fRemoveAllTerminated); mgr.appendToGroup(IConsoleConstants.OUTPUT_GROUP, fStdOut); }