Java Code Examples for org.eclipse.jface.action.ToolBarManager#createControl()
The following examples show how to use
org.eclipse.jface.action.ToolBarManager#createControl() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XFilteredTree.java From nebula with Eclipse Public License 2.0 | 6 votes |
/** * Create the button that clears the text. * * @param parent parent <code>Composite</code> of toolbar button */ private void createClearTextOld(Composite parent) { // only create the button if the text widget doesn't support one // natively if ((filterText.getStyle() & SWT.ICON_CANCEL) == 0) { filterToolBar = new ToolBarManager(SWT.FLAT | SWT.HORIZONTAL); filterToolBar.createControl(parent); IAction clearTextAction = new Action("", IAction.AS_PUSH_BUTTON) {//$NON-NLS-1$ /** * @see org.eclipse.jface.action.Action#run() */ @Override public void run() { clearText(); } }; clearTextAction.setToolTipText(XViewerText.get("button.clear")); //$NON-NLS-1$ clearTextAction.setImageDescriptor(JFaceResources.getImageRegistry().getDescriptor(CLEAR_ICON)); clearTextAction.setDisabledImageDescriptor(JFaceResources.getImageRegistry().getDescriptor(DISABLED_CLEAR_ICON)); filterToolBar.add(clearTextAction); } }
Example 2
Source File: FilteredTreeComposite.java From nebula with Eclipse Public License 2.0 | 6 votes |
/** * Create the button that clears the text. * * @param parent parent <code>Composite</code> of toolbar button */ private void createClearText(Composite parent) { // only create the button if the text widget doesn't support one // natively if ((filterText.getStyle() & SWT.CANCEL) == 0) { filterToolBar = new ToolBarManager(SWT.FLAT | SWT.HORIZONTAL); filterToolBar.createControl(parent); IAction clearTextAction = new Action("", IAction.AS_PUSH_BUTTON) {//$NON-NLS-1$ @Override public void run() { clearText(); } }; clearTextAction.setToolTipText(WorkbenchMessages.FilteredTree_ClearToolTip); clearTextAction.setImageDescriptor(XViewerImageCache.getImageDescriptor("clear.gif")); //$NON-NLS-1$ clearTextAction.setDisabledImageDescriptor(JFaceResources.getImageRegistry().getDescriptor(DCLEAR_ICON)); filterToolBar.add(clearTextAction); } }
Example 3
Source File: WebBrowserViewer4Mac.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
private void createNavigationBar(Composite parent) { toolBarManager = new ToolBarManager(SWT.FLAT); // toolBarManager.add(consoleAction); toolBarManager.add(backAction); toolBarManager.add(forwardAction); toolBarManager.add(stopAction); toolBarManager.add(refreshAction); ToolBar toolbar = toolBarManager.createControl(parent); toolbar.setLayoutData(GridDataFactory.fillDefaults().create()); urlCombo = new Combo(parent, SWT.DROP_DOWN); urlCombo.setLayoutData(GridDataFactory.fillDefaults().grab(true, false) .create()); urlCombo.addListener(SWT.DefaultSelection, new Listener() { public void handleEvent(Event e) { setURL(urlCombo.getText()); } }); ToolBarManager toolBarManager2 = new ToolBarManager(SWT.FLAT); toolBarManager2.add(goAction); toolbar = toolBarManager2.createControl(parent); toolbar.setLayoutData(GridDataFactory.fillDefaults().create()); }
Example 4
Source File: WebBrowserViewer.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
private void createNavigationBar(Composite parent) { toolBarManager = new ToolBarManager(SWT.FLAT); toolBarManager.add(consoleAction); toolBarManager.add(backAction); toolBarManager.add(forwardAction); toolBarManager.add(stopAction); toolBarManager.add(refreshAction); ToolBar toolbar = toolBarManager.createControl(parent); toolbar.setLayoutData(GridDataFactory.fillDefaults().create()); urlCombo = new Combo(parent, SWT.DROP_DOWN); urlCombo.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); urlCombo.addListener(SWT.DefaultSelection, new Listener() { @Override public void handleEvent(Event e) { setURL(urlCombo.getText()); } }); ToolBarManager toolBarManager2 = new ToolBarManager(SWT.FLAT); toolBarManager2.add(goAction); toolbar = toolBarManager2.createControl(parent); toolbar.setLayoutData(GridDataFactory.fillDefaults().create()); }
Example 5
Source File: SelectFallDialog.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
@Override protected Control createDialogArea(Composite parent){ Composite ret = new Composite(parent, SWT.None); ret.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true)); GridLayout gl_ret = new GridLayout(1, false); gl_ret.marginWidth = 0; gl_ret.marginHeight = 0; ret.setLayout(gl_ret); list = new List(ret, SWT.BORDER); list.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true)); reloadFaelleList(); ToolBarManager tbManager = new ToolBarManager(SWT.FLAT | SWT.HORIZONTAL | SWT.WRAP); tbManager.add(GlobalActions.neuerFallAction); tbManager.createControl(ret); ElexisEventDispatcher.getInstance().addListeners(updateFallListener); return ret; }
Example 6
Source File: DocumentsFilterBarComposite.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
private void createContent(){ setBackground(UiDesk.getColor(UiDesk.COL_WHITE)); setLayout(new FillLayout()); manager = new ToolBarManager(SWT.WRAP); manager.createControl(this); refresh(); }
Example 7
Source File: CodesSelectionComposite.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
private void createContent(){ setBackground(UiDesk.getColor(UiDesk.COL_WHITE)); setLayout(new FillLayout()); manager = new ToolBarManager(SWT.WRAP); manager.createControl(this); refresh(); }
Example 8
Source File: MedicationTableViewerContentProvider.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
private void createContent(){ currentState = new Label(this, SWT.NONE); toolbarmgr = new ToolBarManager(); toolbarmgr.add(new PreviousPage()); toolbarmgr.add(new NextPage()); toolbarmgr.createControl(this); }
Example 9
Source File: Actions.java From olca-app with Mozilla Public License 2.0 | 5 votes |
/** * Creates buttons for the given actions in a section tool-bar. */ public static void bind(Section section, Action... actions) { ToolBarManager toolBar = new ToolBarManager(); for (Action action : actions) toolBar.add(action); ToolBar control = toolBar.createControl(section); section.setTextClient(control); }
Example 10
Source File: MOOSEFormEditor.java From ice with Eclipse Public License 1.0 | 4 votes |
/** * Creates the content used for the plant view. * * @param section * The {@code Section} that should contain the plant view. * @param toolkit * The {@code FormToolkit} used to decorate widgets as necessary. */ private void populatePlantViewSection(Section section, FormToolkit toolkit) { // Get the background color to use later. Color background = section.getBackground(); // Create an analysis composite to contain a ToolBar and an // analysis-based view. Composite analysisComposite = new Composite(section, SWT.NONE); analysisComposite.setBackground(background); analysisComposite.setLayout(new GridLayout(1, false)); // Set the overall client of the plant view's Section. section.setClient(analysisComposite); // Create a ToolBarManager so we can add JFace Actions to it. ToolBarManager toolBarManager = new ToolBarManager(SWT.RIGHT); // Fill the ToolBar with customized controls. fillPlantViewToolBar(toolBarManager); toolBarManager.update(true); // Add it to the view. ToolBar toolBar = toolBarManager.createControl(analysisComposite); toolBar.setBackground(background); toolBar.setLayoutData( new GridData(SWT.FILL, SWT.BEGINNING, true, false)); // Create the plant composite. TreeComposite components = findComponentBlock(); factory.setTree(components); PlantComposite plant = factory.getPlant(); //Get the factory and create a plant view from the composite ViewFactory viewFactory = new ViewFactory(); viewFactory.setVizServiceFactory((BasicVizServiceFactory) VizServiceFactoryHolder.getFactory()); plantView = viewFactory.createPlantView(plant); // Render the plant view in the analysis Composite. Composite plantComposite = plantView.createComposite(analysisComposite); plantComposite.setBackground(background); plantComposite .setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); // Make sure the factory/plant is reset when the plant view is disposed. plantComposite.addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent e) { factory.setTree(new TreeComposite()); } }); return; }
Example 11
Source File: MakrosComposite.java From elexis-3-core with Eclipse Public License 1.0 | 4 votes |
/** * Create the composite. * * @param parent * @param style */ public MakrosComposite(Composite parent, int style){ super(parent, style); setLayout(new GridLayout(1, false)); CLabel lblHeader = new CLabel(this, SWT.NONE); lblHeader.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1)); lblHeader.setText("Makros des Anwender " + CoreHub.getLoggedInContact().getLabel()); SashForm sash = new SashForm(this, SWT.HORIZONTAL); sash.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); Composite selectionComposite = new Composite(sash, SWT.NONE); selectionComposite.setLayout(new GridLayout(1, true)); ToolBarManager toolbar = new ToolBarManager(); ToolBar toolbarControl = toolbar.createControl(selectionComposite); toolbarControl.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false)); viewer = new TableViewer(selectionComposite, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI); viewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); viewer.setContentProvider(new ArrayContentProvider()); viewer.setLabelProvider(new DefaultLabelProvider()); viewer.setInput(getUserMakros(CoreHub.getLoggedInContact())); viewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event){ StructuredSelection selection = (StructuredSelection) viewer.getSelection(); if (selection != null && !selection.isEmpty()) { detailComposite.setMakro((MakroDTO) selection.getFirstElement()); } else { detailComposite.setMakro(null); } } }); viewer.setComparator(new ViewerComparator()); MenuManager menuManager = new MenuManager(); menuManager.add(new RemoveMakroAction(viewer)); MenuManager subMenu = new MenuManager("Marko zu Anwender kopieren"); subMenu.setRemoveAllWhenShown(true); subMenu.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(IMenuManager manager){ addCopyToUserActions(manager); } }); menuManager.add(subMenu); Menu menu = menuManager.createContextMenu(viewer.getTable()); viewer.getTable().setMenu(menu); toolbar.add(new AddMakroAction(viewer)); toolbar.add(new RemoveMakroAction(viewer)); toolbar.add(new RefreshMakrosAction(viewer)); toolbar.update(true); detailComposite = new MakroDetailComposite(sash, SWT.NONE); // can only be set after child components are available sash.setWeights(new int[] { 1, 4 }); }
Example 12
Source File: SelectorPanel.java From elexis-3-core with Eclipse Public License 1.0 | 4 votes |
public SelectorPanel(Composite parent, IAction... actions){ super(parent, SWT.NONE); setBackground(parent.getBackground()); /* * RowLayout layout = new RowLayout(SWT.HORIZONTAL); layout.fill = true; layout.pack = true; */ FormLayout layout = new FormLayout(); layout.marginLeft = 0; layout.marginRight = 0; setLayout(layout); tActions = new ToolBarManager(SWT.FLAT | SWT.HORIZONTAL | SWT.WRAP); aClr = new Action(Messages.SelectorPanel_clearFields) { { setImageDescriptor(Images.IMG_CLEAR.getImageDescriptor()); } @Override public void run(){ clearValues(); } }; tActions.add(aClr); autoSearchActivatedAction = new Action(Messages.SelectorPanel_automaticSearch, Action.AS_CHECK_BOX) { { setImageDescriptor(Images.IMG_REFRESH.getImageDescriptor()); } @Override public void run(){ autoSearchActivated = !autoSearchActivated; if (autoSearchActivated) contentsChanged(null); super.run(); } }; autoSearchActivatedAction.setToolTipText(Messages.SelectorPanel_activateAutomaticSearch); autoSearchActivatedAction.setChecked(autoSearchActivated); tActions.add(autoSearchActivatedAction); performSearchAction = new Action(Messages.SelectorPanel_performSearch) { { setImageDescriptor(Images.IMG_NEXT.getImageDescriptor()); } @Override public void run(){ boolean oldState = autoSearchActivated; autoSearchActivated = true; contentsChanged(null); autoSearchActivated = oldState; super.run(); } }; performSearchAction.setToolTipText(Messages.SelectorPanel_performSearchTooltip); tActions.add(performSearchAction); for (IAction ac : actions) { if (ac != null) { tActions.add(ac); } else { tActions.add(new Separator()); } } tb = tActions.createControl(this); FormData fdActions = new FormData(); fdActions.top = new FormAttachment(0, 0); fdActions.right = new FormAttachment(100, 0); tb.setLayoutData(fdActions); cFields = new Composite(this, SWT.NONE); FormData fd = new FormData(); fd.left = new FormAttachment(0, 0); fd.top = new FormAttachment(0, 0); fd.right = new FormAttachment(100, 0); cFields.setLayoutData(fd); cFields.setLayout(new FillLayout()); if (parent.getData("TEST_COMP_NAME") != null) { for (int idx = 0; idx < tb.getItemCount(); idx++) { tb.getItem(idx).setData("TEST_COMP_NAME", parent.getData("TEST_COMP_NAME") + "_" + idx + "_tbi"); } } pack(); }
Example 13
Source File: HL7LabImportRulesPreferencePage.java From elexis-3-core with Eclipse Public License 1.0 | 4 votes |
/** * Create contents of the preference page. * * @param parent */ @Override public Control createContents(Composite parent){ Composite container = new Composite(parent, SWT.NULL); container.setLayout(new GridLayout(1, false)); Composite composite = new Composite(container, SWT.NONE); composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); composite.setLayout(new GridLayout(2, false)); Label lblLabNoPathFlagMeansNonPath = new Label(composite, SWT.WRAP); lblLabNoPathFlagMeansNonPath .setText(Messages.HL7LabImportRulesPreferencePage_lblLabImportRulesHeader_text); ToolBarManager toolbarmgr = new ToolBarManager(); toolbarmgr.add(new AddMissingPathFlagMeansNonPathLaboratoryAction()); toolbarmgr.add(new RemoveMissingPathFlagMeansNonPathLaboratoryAction()); ToolBar toolbar = toolbarmgr.createControl(composite); toolbar.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false)); new Label(composite, SWT.NONE); labMPathMNonPathListViewer = new ListViewer(composite, SWT.BORDER | SWT.V_SCROLL); labMPathMNonPathListViewer.setContentProvider(ArrayContentProvider.getInstance()); labMPathMNonPathListViewer.setLabelProvider(new LabelProvider() { @Override public String getText(Object element){ if (element instanceof Kontakt) { return ((Kontakt) element).getLabel(); } return super.getText(element); } }); GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1); gridData.heightHint = 80; labMPathMNonPathListViewer.getList() .setLayoutData(gridData); labMPathMNonPathListViewer.setInput(findAllLabsWithPathFlagMissingMeansNonPathologic()); return container; }