Java Code Examples for org.eclipse.swt.widgets.ToolItem#setImage()
The following examples show how to use
org.eclipse.swt.widgets.ToolItem#setImage() .
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: HopGuiPipelineGridDelegate.java From hop with Apache License 2.0 | 6 votes |
@GuiToolbarElement( root = GUI_PLUGIN_TOOLBAR_PARENT_ID, id = TOOLBAR_ICON_SHOW_HIDE_INACTIVE, toolTip = "PipelineLog.Button.ShowOnlyActiveTransforms", i18nPackageClass = HopGui.class, image = "ui/images/show-inactive.svg" ) public void showHideInactive() { hideInactiveTransforms = !hideInactiveTransforms; ToolItem toolItem = toolbarWidget.findToolItem( TOOLBAR_ICON_SHOW_HIDE_INACTIVE ); if ( toolItem != null ) { if ( hideInactiveTransforms ) { toolItem.setImage( GuiResource.getInstance().getImageHideInactive() ); } else { toolItem.setImage( GuiResource.getInstance().getImageShowInactive() ); } } refreshView(); }
Example 2
Source File: HopGuiPipelineGridDelegate.java From hop with Apache License 2.0 | 6 votes |
@GuiToolbarElement( root = GUI_PLUGIN_TOOLBAR_PARENT_ID, id = TOOLBAR_ICON_SHOW_HIDE_SELECTED, toolTip = "PipelineLog.Button.ShowOnlySelectedTransforms", i18nPackageClass = HopGui.class, image = "ui/images/toolbar/show-all.svg" ) public void showHideSelected() { showSelectedTransforms = !showSelectedTransforms; ToolItem toolItem = toolbarWidget.findToolItem( TOOLBAR_ICON_SHOW_HIDE_SELECTED ); if ( toolItem != null ) { if ( showSelectedTransforms ) { toolItem.setImage( GuiResource.getInstance().getImageShowSelected() ); } else { toolItem.setImage( GuiResource.getInstance().getImageShowAll() ); } } refreshView(); }
Example 3
Source File: ExpressionViewer.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
protected ToolItem createEraseToolItem(final ToolBar tb) { eraseControl = new ToolItem(tb, SWT.PUSH | SWT.NO_FOCUS); eraseControl.setImage(Pics.getImage(PicsConstants.clear)); eraseControl.setToolTipText(Messages.eraseExpression); /* For test purpose */ eraseControl.setData(SWTBOT_WIDGET_ID_KEY, SWTBOT_ID_ERASEBUTTON); eraseControl.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(final Event event) { erase(getSelectedExpression()); } }); eraseControl.addDisposeListener(disposeListener); return eraseControl; }
Example 4
Source File: BusinessObjectList.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
protected void createAddDeleteItems(AbstractBdmFormPage formPage, ToolBar toolBar) { addPackageItem = new ToolItem(toolBar, SWT.PUSH); addPackageItem.setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY, ADD_PACKAGE_BUTTON_ID); addPackageItem.setImage(BusinessObjectPlugin.getImage("/icons/addPackageIcon.png")); addPackageItem.setToolTipText(Messages.createPackageTooltip); addPackageItem.addListener(SWT.Selection, e -> addPackage(formPage)); addBoItem = new ToolItem(toolBar, SWT.PUSH); addBoItem.setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY, ADD_BO_BUTTON_ID); addBoItem.setImage(BusinessObjectPlugin.getImage("/icons/addObjectIcon.png")); addBoItem.setToolTipText(Messages.createBoTooltip); addBoItem.addListener(SWT.Selection, e -> addBusinessObject(formPage)); deleteItem = new ToolItem(toolBar, SWT.PUSH); deleteItem.setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY, REMOVE_BUTTON_ID); deleteItem.setImage(BusinessObjectPlugin.getImage("/icons/delete_icon.png")); deleteItem.setToolTipText(Messages.deleteTooltip); deleteItem.addListener(SWT.Selection, e -> remove(formPage)); }
Example 5
Source File: JavaPropertiesViewerDialog.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
private void createToolBar(Composite tparent) { Composite toolBarCmp = new Composite(tparent, SWT.NONE); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(toolBarCmp); GridLayoutFactory.fillDefaults().numColumns(1).applyTo(toolBarCmp); ToolBar toolBar = new ToolBar(toolBarCmp, SWT.NO_FOCUS | SWT.FLAT); ToolItem openItem = new ToolItem(toolBar, SWT.PUSH); openItem.setToolTipText(Messages.getString("dialog.JavaPropertiesViewerDialog.toolBar")); openItem.setImage(new Image(Display.getDefault(), openFilePath)); openItem.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { openFile(); } }); }
Example 6
Source File: HopGuiWorkflowGraph.java From hop with Apache License 2.0 | 6 votes |
public void addAllTabs() { CTabItem tabItemSelection = null; if ( extraViewTabFolder != null && !extraViewTabFolder.isDisposed() ) { tabItemSelection = extraViewTabFolder.getSelection(); } workflowLogDelegate.addJobLog(); workflowGridDelegate.addJobGrid(); if ( tabItemSelection != null ) { extraViewTabFolder.setSelection( tabItemSelection ); } else { extraViewTabFolder.setSelection( workflowGridDelegate.getJobGridTab() ); } ToolItem toolItem = toolBarWidgets.findToolItem( TOOLBAR_ITEM_SHOW_EXECUTION_RESULTS ); toolItem.setToolTipText( BaseMessages.getString( PKG, "HopGui.Tooltip.HideExecutionResults" ) ); toolItem.setImage( GuiResource.getInstance().getImageHideResults() ); }
Example 7
Source File: FindBarDecorator.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
private ToolItem createHistoryToolItem(ToolBar toolbar, final String preferenceName) { ToolItem historyToolItem = new ToolItem(toolbar, SWT.DROP_DOWN); historyToolItem.setImage(FindBarPlugin.getImage(FindBarPlugin.ICON_SEARCH_HISTORY)); historyToolItem.setToolTipText(Messages.FindBarDecorator_TOOLTIP_History); historyToolItem.addSelectionListener(new SelectionAdapter() { Menu menu = null; /* * (non-Javadoc) * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) */ @Override public void widgetSelected(SelectionEvent e) { ToolItem toolItem = (ToolItem) e.widget; menu = createHistoryMenu(toolItem, preferenceName, menu); } }); return historyToolItem; }
Example 8
Source File: RunCoolbarItem.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Override public void fill(final ToolBar toolbar, final int index, final int iconSize) { final ToolItem item = new ToolItem(toolbar, SWT.PUSH); item.setToolTipText(Messages.RunButtonLabel); if (iconSize < 0) { item.setImage(Pics.getImage(PicsConstants.coolbar_run_48)); item.setDisabledImage(Pics.getImage(PicsConstants.coolbar_run_disabled_48)); } else { item.setImage(Pics.getImage(PicsConstants.coolbar_run_16)); item.setDisabledImage(Pics.getImage(PicsConstants.coolbar_run_disabled_16)); } item.setEnabled(false); item.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { final Command cmd = getCommand(); try { cmd.executeWithChecks(new ExecutionEvent()); } catch (final Exception ex) { BonitaStudioLog.error(ex); } } }); }
Example 9
Source File: ParamsAttachManager.java From http4e with Apache License 2.0 | 5 votes |
ParamsAttachManager( final ItemModel model, final StyledText styledText, final ToolBar toolbar) { // this.swtText = swtText; this.toolBar = toolbar; ParamsOpen open = new ParamsOpen(this, model, styledText); i_open = new ToolItem(toolBar, SWT.PUSH); i_open.setImage(ResourceUtils.getImage(CoreConstants.PLUGIN_CORE, CoreImages.FILE_OPEN)); i_open.setDisabledImage(ResourceUtils.getImage(CoreConstants.PLUGIN_CORE, CoreImages.FILE_OPEN_DIS)); i_open.setToolTipText("Add File"); i_open.addSelectionListener(open); }
Example 10
Source File: DeployContributionItem.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override public void fill(ToolBar parent, int index) { item = new ToolItem(parent, SWT.PUSH); item.setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY, ID); item.setText(Messages.deploy); item.setToolTipText(Messages.deploy); item.setImage(BusinessObjectPlugin.getImage("icons/deploy16.png")); item.addListener(SWT.Selection, event -> deploy(false)); item.setEnabled(isEnabled()); }
Example 11
Source File: StatusComposite.java From eclipse-extras with Eclipse Public License 1.0 | 5 votes |
private int computeDefaultTrimHeight() { int result; Shell shell = new Shell( getDisplay(), SWT.NONE ); try { ToolBar toolBar = new ToolBar( shell, SWT.NONE ); ToolItem toolItem = new ToolItem( toolBar, SWT.PUSH ); toolItem.setImage( JFaceResources.getImageRegistry().get( Dialog.DLG_IMG_MESSAGE_INFO ) ); int toolItemHeight = toolBar.computeSize( SWT.DEFAULT, SWT.DEFAULT ).y; result = Math.max( toolItemHeight, measureText( "Wg" ).y ); } finally { shell.dispose(); } return result; }
Example 12
Source File: XFindPanel.java From xds-ide with Eclipse Public License 1.0 | 5 votes |
private ToolItem createTool( final ToolBar bar, final String tip , final String image, final SelectionAdapter listener) { final ToolItem item = new ToolItem(bar, SWT.PUSH); item.setToolTipText(tip); item.setImage(ImageUtils.getImage(image)); item.addSelectionListener(listener); return item; }
Example 13
Source File: TransGraph.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public void addAllTabs() { CTabItem tabItemSelection = null; if ( extraViewTabFolder != null && !extraViewTabFolder.isDisposed() ) { tabItemSelection = extraViewTabFolder.getSelection(); } transHistoryDelegate.addTransHistory(); transLogDelegate.addTransLog(); transGridDelegate.addTransGrid(); transPerfDelegate.addTransPerf(); transMetricsDelegate.addTransMetrics(); transPreviewDelegate.addTransPreview(); List<SpoonUiExtenderPluginInterface> relevantExtenders = SpoonUiExtenderPluginType.getInstance().getRelevantExtenders( TransGraph.class, LOAD_TAB ); for ( SpoonUiExtenderPluginInterface relevantExtender : relevantExtenders ) { relevantExtender.uiEvent( this, LOAD_TAB ); } if ( tabItemSelection != null ) { extraViewTabFolder.setSelection( tabItemSelection ); } else { extraViewTabFolder.setSelection( transGridDelegate.getTransGridTab() ); } XulToolbarbutton button = (XulToolbarbutton) toolbar.getElementById( "trans-show-results" ); button.setTooltiptext( BaseMessages.getString( PKG, "Spoon.Tooltip.HideExecutionResults" ) ); ToolItem toolItem = (ToolItem) button.getManagedObject(); toolItem.setImage( GUIResource.getInstance().getImageHideResults() ); }
Example 14
Source File: AbstractExportContributionItem.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override public void fill(ToolBar parent, int index) { item = new ToolItem(parent, SWT.PUSH); item.setText(Messages.export); item.setToolTipText(Messages.exportTooltips); item.setImage(UIPlugin.getImage("icons/export_16.png")); item.addListener(SWT.Selection, event -> onClick(parent.getShell())); }
Example 15
Source File: TransGraph.java From pentaho-kettle with Apache License 2.0 | 5 votes |
private void disposeExtraView() { extraViewComposite.dispose(); sashForm.layout(); sashForm.setWeights( new int[] { 100, } ); XulToolbarbutton button = (XulToolbarbutton) toolbar.getElementById( "trans-show-results" ); button.setTooltiptext( BaseMessages.getString( PKG, "Spoon.Tooltip.ShowExecutionResults" ) ); ToolItem toolItem = (ToolItem) button.getManagedObject(); toolItem.setImage( GUIResource.getInstance().getImageShowResults() ); }
Example 16
Source File: WizardBaseDialog.java From birt with Eclipse Public License 1.0 | 5 votes |
protected void createTabToolButtons( CTabFolder tabFolder ) { List<IButtonHandler> buttons = wizardBase.getTabToolButtons( ); if ( buttons.size( ) == 0 ) { return; } ToolBar toolbar = new ToolBar( tabFolder, SWT.FLAT | SWT.WRAP ); tabFolder.setTopRight( toolbar ); for ( IButtonHandler btnHandler : buttons ) { ToolItem btn = new ToolItem( toolbar, SWT.NONE ); btn.addSelectionListener( this ); btn.setData( btnHandler ); if ( btnHandler.getLabel( ) != null ) { btn.setText( btnHandler.getLabel( ) ); } if ( btnHandler.getTooltip( ) != null ) { btn.setToolTipText( btnHandler.getTooltip( ) ); } if ( btnHandler.getIcon( ) != null ) { btn.setImage( btnHandler.getIcon( ) ); } } }
Example 17
Source File: MyXViewerTest.java From nebula with Eclipse Public License 2.0 | 4 votes |
public static void createTaskActionBar(Composite parent) { Composite actionComp = new Composite(parent, SWT.NONE); actionComp.setLayout(new GridLayout()); actionComp.setLayoutData(new GridData(GridData.END)); ToolBar toolBar = new ToolBar(actionComp, SWT.FLAT | SWT.RIGHT); GridData gd = new GridData(GridData.FILL_HORIZONTAL); toolBar.setLayoutData(gd); ToolItem refreshItem = new ToolItem(toolBar, SWT.PUSH); refreshItem.setImage(MyImageCache.getImage("refresh.gif")); refreshItem.setToolTipText("Refresh"); refreshItem.addListener(SWT.Selection, e -> { List<Object> tasks = new ArrayList<>(); for (int x = 0; x < 1; x++) { tasks.addAll(getTestTasks()); } /** * Note: setInputXViewer must be called instead of setInput for XViewer to * operate properly */ myXviewer.setInputXViewer(tasks); }); Action dropDownAction = myXviewer.getCustomizeAction(); new ActionContributionItem(dropDownAction).fill(toolBar, 0); ToolItem descriptionItem = new ToolItem(toolBar, SWT.PUSH); descriptionItem.setImage(MyImageCache.getImage("descriptionView.gif")); descriptionItem.setToolTipText("Show Description View"); descriptionItem.addListener(SWT.Selection, e -> { myXviewer.getCustomizeMgr().loadCustomization(MyDefaultCustomizations.getDescriptionCustomization()); myXviewer.refresh(); }); ToolItem completeItem = new ToolItem(toolBar, SWT.PUSH); completeItem.setImage(MyImageCache.getImage("completionView.gif")); completeItem.setToolTipText("Show Completion View"); completeItem.addListener(SWT.Selection, e -> { myXviewer.getCustomizeMgr().loadCustomization(MyDefaultCustomizations.getCompletionCustomization()); myXviewer.refresh(); }); ToolItem refreshSingleColumn = new ToolItem(toolBar, SWT.PUSH); refreshSingleColumn.setImage(MyImageCache.getImage("columnRefresh.gif")); refreshSingleColumn.setToolTipText("Example of Refreshing a Single Column"); refreshSingleColumn.addListener(SWT.Selection, e -> { @SuppressWarnings("unchecked") List<Object> items = (List<Object>) myXviewer.getInput(); for (Object item : items) { SomeTask task = (SomeTask) item; task.setTaskType(TaskType.Refreshed); } String columnId = MyXViewerFactory.Task_Type.getId(); myXviewer.refreshColumn(columnId); }); }
Example 18
Source File: GraphNodeViewer.java From depan with Apache License 2.0 | 4 votes |
private ToolItem createExpandAllPushIcon(ToolBar parent) { ToolItem result = new ToolItem(parent, SWT.PUSH | SWT.FLAT); result.setImage(NodesUIResources.IMAGE_EXPANDALL); return result; }
Example 19
Source File: FooterArea.java From nebula with Eclipse Public License 2.0 | 4 votes |
/** * Create the details section * * @param numberOfColumns */ private void createDetails(final int numberOfColumns) { final ToolItem detailsItem = new ToolItem(toolbar, SWT.NONE); detailsItem.setImage(isExpanded() ? getFewerDetailsImage() : getMoreDetailsImage()); detailsItem.setText(isExpanded() ? expandedLabelText : collapsedLabelText); final int numberOfColumnsParam = numberOfColumns; final Listener listener = new Listener() { @Override public void handleEvent(final Event event) { if (FooterArea.this.parent.getMessageArea().getException() != null) { if (detailsItem.getText().equals(expandedLabelText)) { detailsItem.setText(collapsedLabelText); detailsItem.setImage(FooterArea.this.getMoreDetailsImage()); FooterArea.this.parent.getMessageArea().hideException(); } else { detailsItem.setText(expandedLabelText); detailsItem.setImage(FooterArea.this.getFewerDetailsImage()); FooterArea.this.parent.getMessageArea().showException(); } } else { if (detailsItem.getText().equals(expandedLabelText)) { detailsItem.setText(collapsedLabelText); detailsItem.setImage(FooterArea.this.getMoreDetailsImage()); expandedPanel.dispose(); FooterArea.this.parent.pack(); } else { detailsItem.setText(expandedLabelText); detailsItem.setImage(FooterArea.this.getFewerDetailsImage()); FooterArea.this.createExpandedPanel(numberOfColumnsParam); FooterArea.this.parent.pack(); } } } }; detailsItem.addListener(SWT.Selection, listener); }
Example 20
Source File: AttachManager.java From http4e with Apache License 2.0 | 4 votes |
AttachManager( final ItemModel model, final StyledText swtText, final ToolBar toolbar) { // this.swtText = swtText; this.toolBar = toolbar; Open open = new Open(model, swtText); i_open = new ToolItem(toolBar, SWT.PUSH); i_open.setImage(ResourceUtils.getImage(CoreConstants.PLUGIN_CORE, CoreImages.FILE_OPEN)); i_open.setDisabledImage(ResourceUtils.getImage(CoreConstants.PLUGIN_CORE, CoreImages.FILE_OPEN_DIS)); i_open.setToolTipText("Add File"); i_open.addSelectionListener(open); // i_open.addSelectionListener(new SelectionAdapter() { // public void widgetSelected( SelectionEvent e){ // } // }); // // Menu(bar) // menu = new Menu(toolBar.getShell(), SWT.POP_UP); // // MenuItem m_addBody = new MenuItem(menu, SWT.PUSH); // m_addBody.setText("Add File"); // m_addBody.addSelectionListener(open); // m_attachPart = new MenuItem(menu, SWT.PUSH); // m_attachPart.setText("Attach File"); // m_attachPart.addSelectionListener(open); // // addBody = new ToolItem(toolBar, SWT.DROP_DOWN); // addBody.setImage(ResourceUtils.getImage(CoreImages.ATTACH)); // addBody.setToolTipText("Add Body"); // addBody.addListener(SWT.Selection, new Listener() { // public void handleEvent( Event event){ // if (event.detail == SWT.ARROW) { // Rectangle rect = addBody.getBounds(); // menu.setLocation(toolBar.toDisplay(rect.x, rect.y + rect.height)); // menu.setVisible(true); // } else { // FileDialog fd = new FileDialog(toolBar.getShell(), SWT.OPEN); // fd.setText("Open"); // // fd.setFilterPath("C:/"); // fd.setFilterExtensions(CoreConstants.FILE_FILTER_EXT); // String file = fd.open(); // if (file != null) { // fileReadAction(file); // } // } // } // }); }