List of usage examples for org.eclipse.jface.action ToolBarManager ToolBarManager
public ToolBarManager(ToolBar toolbar)
From source file:ar.com.fluxit.jqa.wizard.page.LayersDefinitionWizardPage.java
License:Open Source License
private void createLayersGroup(SashForm sash) { final Group layersGroup = new Group(sash, SWT.NONE); final GridLayout layersGroupGridLayout = new GridLayout(); layersGroupGridLayout.verticalSpacing = -1; layersGroup.setLayout(layersGroupGridLayout); layersGroup.setText("Layers"); ViewForm viewForm = new ViewForm(layersGroup, SWT.FLAT | SWT.BORDER); viewForm.setLayout(layersGroupGridLayout); ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT); ToolBar toolBar = toolBarManager.createControl(viewForm); toolBar.setBackground(layersGroup.getBackground()); viewForm.setTopLeft(toolBar);//from w w w . ja va 2 s . c o m viewForm.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); TableViewer layersTable = new TableViewer(layersGroup, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); layersTable.getTable().setLayoutData(new GridData(GridData.FILL_BOTH)); layersTable.setContentProvider(ArrayContentProvider.getInstance()); layersTable.setInput(getWizard().getLayers()); layersTable.setLabelProvider(new ColumnLabelProvider() { @Override public String getText(Object element) { Layer layer = (Layer) element; String result = layer.getName(); if (!layer.getPackages().isEmpty()) { result += " (" + layer.getPackages().size() + ")"; } return result; } }); layersTable.setCellEditors(new CellEditor[] { new TextCellEditor(layersTable.getTable()) }); layersTable.setCellModifier(new LayerCellModifier(layersTable)); layersTable.setColumnProperties(new String[] { "layer" }); toolBarManager.add(new NewLayerAction(getWizard().getLayers(), layersTable)); final EditLayerAction editLayerAction = new EditLayerAction(layersTable); editLayerAction.setEnabled(false); toolBarManager.add(editLayerAction); final RemoveLayerAction removeLayerAction = new RemoveLayerAction(getWizard().getLayers(), layersTable, targetPackagesTable, getContainer()); removeLayerAction.setEnabled(false); toolBarManager.add(removeLayerAction); toolBarManager.update(true); layersTable.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent paramSelectionChangedEvent) { layerSelectionChanged(paramSelectionChangedEvent.getSelection(), editLayerAction, removeLayerAction); } }); layersTable.addDropSupport(DND.DROP_MOVE, getTransferTypes(), new LayersListTableDropListener(layersTable, targetPackagesTable, getDragViewerHolder(), getDragInputHolder(), getContainer())); }
From source file:at.medevit.elexis.inbox.ui.part.InboxView.java
License:Open Source License
@Override public void createPartControl(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(new GridLayout(1, false)); Composite filterComposite = new Composite(composite, SWT.NONE); GridData data = new GridData(GridData.FILL_HORIZONTAL); filterComposite.setLayoutData(data); filterComposite.setLayout(new GridLayout(2, false)); filterText = new Text(filterComposite, SWT.SEARCH); filterText.setMessage("Filter"); data = new GridData(GridData.FILL_HORIZONTAL); filterText.setLayoutData(data);//from ww w.j a va 2 s. c o m filterText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { if (filterText.getText().length() > 1) { filter.setSearchText(filterText.getText()); viewer.refresh(); } else { filter.setSearchText(""); viewer.refresh(); } } }); ToolBarManager menuManager = new ToolBarManager(SWT.FLAT | SWT.HORIZONTAL | SWT.WRAP); menuManager.createControl(filterComposite); viewer = new CheckboxTreeViewer(composite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1); viewer.getControl().setLayoutData(gd); ViewerFilter[] filters = new ViewerFilter[1]; filters[0] = filter; viewer.setFilters(filters); contentProvider = new InboxElementContentProvider(); viewer.setContentProvider(contentProvider); viewer.setLabelProvider(new InboxElementLabelProvider()); viewer.addCheckStateListener(new ICheckStateListener() { public void checkStateChanged(CheckStateChangedEvent event) { if (event.getElement() instanceof PatientInboxElements) { PatientInboxElements patientInbox = (PatientInboxElements) event.getElement(); for (InboxElement inboxElement : patientInbox.getElements()) { if (!filter.isActive() || filter.isSelect(inboxElement)) { State newState = toggleInboxElementState(inboxElement); if (newState == State.NEW) { viewer.setChecked(inboxElement, false); } else { viewer.setChecked(inboxElement, true); } contentProvider.refreshElement(inboxElement); } } contentProvider.refreshElement(patientInbox); } else if (event.getElement() instanceof InboxElement) { InboxElement inboxElement = (InboxElement) event.getElement(); if (!filter.isActive() || filter.isSelect(inboxElement)) { toggleInboxElementState(inboxElement); contentProvider.refreshElement(inboxElement); } } viewer.refresh(false); } }); viewer.addDoubleClickListener(new IDoubleClickListener() { @Override public void doubleClick(DoubleClickEvent event) { StructuredSelection selection = (StructuredSelection) viewer.getSelection(); if (!selection.isEmpty()) { Object selectedObj = selection.getFirstElement(); if (selectedObj instanceof InboxElement) { InboxElementUiExtension extension = new InboxElementUiExtension(); extension.fireDoubleClicked((InboxElement) selectedObj); } } } }); viewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { ISelection selection = event.getSelection(); if (selection instanceof StructuredSelection && !selection.isEmpty()) { if (setAutoSelectPatient) { Object selectedElement = ((StructuredSelection) selection).getFirstElement(); if (selectedElement instanceof InboxElement) { ElexisEventDispatcher.fireSelectionEvent(((InboxElement) selectedElement).getPatient()); } else if (selectedElement instanceof PatientInboxElements) { ElexisEventDispatcher .fireSelectionEvent(((PatientInboxElements) selectedElement).getPatient()); } } } } }); final Transfer[] dropTransferTypes = new Transfer[] { FileTransfer.getInstance() }; viewer.addDropSupport(DND.DROP_COPY, dropTransferTypes, new DropTargetAdapter() { @Override public void dragEnter(DropTargetEvent event) { event.detail = DND.DROP_COPY; } @Override public void drop(DropTargetEvent event) { if (dropTransferTypes[0].isSupportedType(event.currentDataType)) { String[] files = (String[]) event.data; Patient patient = null; if (event.item != null) { Object data = event.item.getData(); if (data instanceof InboxElement) { patient = ((InboxElement) data).getPatient(); } else if (data instanceof PatientInboxElements) { patient = ((PatientInboxElements) data).getPatient(); } } if (patient == null) { // fallback patient = ElexisEventDispatcher.getSelectedPatient(); } if (patient != null) { if (files != null) { for (String file : files) { try { InboxServiceComponent.getService().createInboxElement(patient, ElexisEventDispatcher.getSelectedMandator(), file, true); } catch (Exception e) { LoggerFactory.getLogger(InboxView.class).warn("drop error", e); } } } viewer.refresh(); } else { MessageDialog.openWarning(Display.getCurrent().getActiveShell(), "Warnung", "Bitte whlen Sie zuerst einen Patienten aus."); } } } }); addFilterActions(menuManager); InboxServiceComponent.getService().addUpdateListener(new IInboxUpdateListener() { public void update(final InboxElement element) { Display.getDefault().asyncExec(new Runnable() { public void run() { contentProvider.refreshElement(element); viewer.refresh(); } }); } }); reload(); MenuManager ctxtMenuManager = new MenuManager(); Menu menu = ctxtMenuManager.createContextMenu(viewer.getTree()); viewer.getTree().setMenu(menu); getSite().registerContextMenu(ctxtMenuManager, viewer); ElexisEventDispatcher.getInstance().addListeners(mandantChanged); getSite().setSelectionProvider(viewer); setAutoSelectPatientState(CoreHub.userCfg.get(Preferences.INBOX_PATIENT_AUTOSELECT, false)); }
From source file:at.rc.tacos.client.ApplicationActionBarAdvisor.java
License:Open Source License
/** * Called to fill the cool bar with the main toolbars for the window. *//* ww w . j av a 2 s .c o m*/ @Override protected void fillCoolBar(ICoolBarManager coolBar) { IToolBarManager toolbar = new ToolBarManager(SWT.FLAT | SWT.RIGHT); coolBar.add(new ToolBarContributionItem(toolbar, "main")); }
From source file:bilab.BilabActionBarAdvisor.java
License:Open Source License
@Override protected void fillCoolBar(final ICoolBarManager coolBar) { // IToolBarManager toolbar = new ToolBarManager(SWT.FLAT | SWT.RIGHT); // coolBar.add(new ToolBarContributionItem(toolbar, "main")); // toolbar.add(openViewAction); // toolbar.add(messagePopupAction); // Set up the context Menu final IMenuManager popUpMenu = new MenuManager(); popUpMenu.add(new ActionContributionItem(lockToolBarAction)); popUpMenu.add(new ActionContributionItem(editActionSetAction)); coolBar.setContextMenuManager(popUpMenu); coolBar.add(new GroupMarker(IIDEActionConstants.GROUP_FILE)); { // File Group final IToolBarManager fileToolBar = new ToolBarManager(coolBar.getStyle()); fileToolBar.add(new Separator(IWorkbenchActionConstants.NEW_GROUP)); fileToolBar.add(new GroupMarker(IWorkbenchActionConstants.NEW_EXT)); fileToolBar.add(new GroupMarker(IWorkbenchActionConstants.SAVE_GROUP)); fileToolBar.add(saveAction);/*from w w w .j a v a 2 s. c om*/ fileToolBar.add(new GroupMarker(IWorkbenchActionConstants.SAVE_EXT)); fileToolBar.add(printAction); fileToolBar.add(new GroupMarker(IWorkbenchActionConstants.PRINT_EXT)); fileToolBar.add(new Separator(IWorkbenchActionConstants.BUILD_GROUP)); fileToolBar.add(new GroupMarker(IWorkbenchActionConstants.BUILD_EXT)); fileToolBar.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); // Add to the cool bar manager coolBar.add(new ToolBarContributionItem(fileToolBar, IWorkbenchActionConstants.TOOLBAR_FILE)); } coolBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); coolBar.add(new GroupMarker(IIDEActionConstants.GROUP_NAV)); { // Navigate group final IToolBarManager navToolBar = new ToolBarManager(coolBar.getStyle()); navToolBar.add(new Separator(IWorkbenchActionConstants.HISTORY_GROUP)); navToolBar.add(new GroupMarker(IWorkbenchActionConstants.GROUP_APP)); navToolBar.add(backwardHistoryAction); navToolBar.add(forwardHistoryAction); navToolBar.add(new Separator(IWorkbenchActionConstants.PIN_GROUP)); navToolBar.add(pinEditorContributionItem); // Add to the cool bar manager coolBar.add(new ToolBarContributionItem(navToolBar, IWorkbenchActionConstants.TOOLBAR_NAVIGATE)); } coolBar.add(new GroupMarker(IWorkbenchActionConstants.GROUP_EDITOR)); }
From source file:ca.hc11337.gui.toolbar.HC11337Toolbar.java
License:Open Source License
public HC11337Toolbar(HC11337Controller controller, int style) { tool_bar_manager = new ToolBarManager(style); Action openAction = new OpenFile(controller); Action newAction = new NewFile(controller); Action saveAction = new SaveFile(controller); Action printAction = new Print(controller); Action undoAction = new Undo(controller); Action cutAction = new Cut(controller); Action copyAction = new Copy(controller); Action pasteAction = new Paste(controller); tool_bar_manager.add(newAction);/*from ww w. j av a 2s . c o m*/ tool_bar_manager.add(openAction); tool_bar_manager.add(saveAction); tool_bar_manager.add(printAction); tool_bar_manager.add(new Separator()); tool_bar_manager.add(undoAction); tool_bar_manager.add(cutAction); tool_bar_manager.add(copyAction); tool_bar_manager.add(pasteAction); tool_bar_manager.add(new Separator()); Action resetAction = new Reset(controller); Action runAction = new Run(controller); Action stopAction = new Stop(controller); Action stepAction = new Step(controller); Action buildAction = new Build(controller); tool_bar_manager.add(resetAction); tool_bar_manager.add(runAction); tool_bar_manager.add(stopAction); tool_bar_manager.add(stepAction); tool_bar_manager.add(buildAction); tool_bar_manager.add(new Separator()); Action optionsAction = new Options(controller); tool_bar_manager.add(optionsAction); }
From source file:ca.uvic.cs.tagsea.ui.views.cloudsee.CloudSeeView.java
License:Open Source License
private void makeToolBar(GridData gridData) { ToolBar toolBar = new ToolBar(composite, SWT.HORIZONTAL); toolBar.setLayoutData(gridData);/*from ww w . jav a2 s . c o m*/ ToolBarManager toolBarManager = new ToolBarManager(toolBar); toolBarManager.add(refreshAction); toolBarManager.add(backAction); toolBarManager.add(forwardAction); toolBarManager.update(true); forwardAction.setEnabled(false); backAction.setEnabled(false); }
From source file:ca.uvic.cs.tagsea.ui.views.FilterComposite.java
License:Open Source License
/** * Creates the textbox and clear button which is tied to the given * TreeViewer. Also adds listeners to the textbox so that when the * enter or down arrow key is pressed the tree view gets focus. * The tree filter is also added to the tree viewer. * @param treeViewer/*from w ww. j a v a2 s . c om*/ */ public void createTextFilterControl(TreeViewer treeViewer) { this.treeViewer = treeViewer; treeViewer.addFilter(treeFilter); this.text = new Text(this, SWT.SINGLE | SWT.BORDER); text.setText(INITIAL_TEXT); text.setToolTipText("Tags Filter"); GridData data = new GridData(SWT.LEFT, SWT.FILL, false, false); data.widthHint = 80; text.setLayoutData(data); text.pack(); originalTextColor = text.getForeground(); // create the clear text button this.clearTextAction = new Action("", IAction.AS_PUSH_BUTTON) { public void run() { text.setText(""); text.setFocus(); } }; clearTextAction.setToolTipText("Clear the filter text"); final ImageDescriptor clearDescriptor = TagSEAPlugin.getDefault().getTagseaImages() .getDescriptor(ITagseaImages.IMG_CLEAR); final ImageDescriptor clearDescriptorDisabled = TagSEAPlugin.getDefault().getTagseaImages() .getDescriptor(ITagseaImages.IMG_CLEAR_DISABLED); clearTextAction.setImageDescriptor(clearDescriptor); clearTextAction.setDisabledImageDescriptor(clearDescriptorDisabled); ToolBar toolBar = new ToolBar(this, SWT.FLAT | SWT.HORIZONTAL); ToolBarManager manager = new ToolBarManager(toolBar); manager.add(clearTextAction); manager.update(false); Label spacer = new Label(this, SWT.NONE); data = new GridData(SWT.LEFT, SWT.FILL, false, false); data.widthHint = 8; spacer.setLayoutData(data); // add the textbox listeners text.addModifyListener(this); text.addKeyListener(this); text.addFocusListener(this); }
From source file:ca.uvic.cs.tagsea.ui.views.RoutesComposite.java
License:Open Source License
public RoutesComposite(Composite parent, int style) { super(parent, style); GridLayout layout = new GridLayout(2, false); layout.marginLeft = 0;/*w ww . j ava2s.c om*/ layout.marginRight = 0; layout.marginBottom = 0; layout.marginTop = 0; this.setLayout(layout); GridData data = new GridData(SWT.END, SWT.FILL, false, true); data.widthHint = WIDTH; this.setLayoutData(data); Label header = new Label(this, SWT.LEFT); header.setFont(getHeaderLabelFont()); //@tag bug(177) : use default font size //header.setForeground(getHeaderLabelColor()); header.setText("Routes"); data = new GridData(SWT.LEFT, SWT.CENTER, false, false); //@tag bug(177) : use default font size //data.heightHint = 24; header.setLayoutData(data); toolBar = new ToolBar(this, SWT.FLAT | SWT.LEFT); data = new GridData(SWT.FILL, SWT.CENTER, true, false); data.heightHint = 24; toolBar.setLayoutData(data); barManager = new ToolBarManager(toolBar); fillToolBar(); initTreeViewer(); createContextMenu(); }
From source file:ca.uvic.cs.tagsea.ui.views.TagsComposite.java
License:Open Source License
private void createScanToolBar(Composite parent) { ToolBar toolbar = new ToolBar(parent, SWT.FLAT | SWT.LEFT); GridData data = new GridData(SWT.RIGHT, SWT.CENTER, false, false); toolbar.setLayoutData(data);/*w w w . ja va2 s .co m*/ ToolBarManager manager = new ToolBarManager(toolbar); scanForTagsAction = new Action("Refresh tag database...", TagSEAPlugin.getImageDescriptor("/icons/synch.gif")) { public void run() { new RefreshTagsAction(PlatformUI.getWorkbench().getActiveWorkbenchWindow()).run(); } }; manager.add(scanForTagsAction); manager.update(false); toolbar.setToolTipText("Refresh tag database..."); }
From source file:ca.uvic.cs.tagsea.ui.views.WaypointsComposite.java
License:Open Source License
public WaypointsComposite(Composite parent, int style) { super(parent, style); GridLayout layout = new GridLayout(2, false); layout.marginLeft = 0;/* ww w . j a va 2s. co m*/ layout.marginRight = 0; layout.marginBottom = 0; layout.marginTop = 0; this.setLayout(layout); GridData data = new GridData(SWT.FILL, SWT.FILL, true, true); data.widthHint = WIDTH; this.setLayoutData(data); Label header = new Label(this, SWT.LEFT); header.setText("Waypoints"); data = new GridData(SWT.LEFT, SWT.CENTER, false, false); header.setLayoutData(data); //toolbar toolBar = new ToolBar(this, SWT.FLAT | SWT.LEFT); GridData toolBarData = new GridData(SWT.LEFT, SWT.CENTER, true, false); toolBar.setData(toolBarData); barManager = new ToolBarManager(toolBar); fillToolbar(); //TOGGLER //createToggleRoutesButton(); initTableViewer(); makeActions(); }