org.eclipse.swt.widgets.ToolItem Java Examples

The following examples show how to use org.eclipse.swt.widgets.ToolItem. 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: PasteCoolbarItem.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void fill(final ToolBar toolbar, final int index, final int iconSize) {
    item = new ToolItem(toolbar, SWT.PUSH);
    item.setToolTipText(Messages.PasteButtonLabel);
    if (iconSize < 0) {
        item.setImage(Pics.getImage(PicsConstants.coolbar_paste_48));
        item.setDisabledImage(Pics.getImage(PicsConstants.coolbar_paste_disabled_48));
    } else {
        item.setImage(Pics.getImage(PicsConstants.coolbar_paste_16));
        item.setDisabledImage(Pics.getImage(PicsConstants.coolbar_paste_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 #2
Source File: HopGuiWorkflowGraph.java    From hop with Apache License 2.0 6 votes vote down vote up
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 #3
Source File: HopGuiWorkflowLogDelegate.java    From hop with Apache License 2.0 6 votes vote down vote up
@GuiToolbarElement(
  root = GUI_PLUGIN_TOOLBAR_PARENT_ID,
  id = TOOLBAR_ICON_LOG_PAUSE_RESUME,
  // label = "WorkflowLog.Button.Pause",
  toolTip = "WorkflowLog.Button.Pause",
  i18nPackageClass = HopGui.class,
  image = "ui/images/pause-log.svg",
  separator = true
)
public void pauseLog() {
  ToolItem item = toolBarWidgets.findToolItem( TOOLBAR_ICON_LOG_PAUSE_RESUME );
  if ( logBrowser.isPaused() ) {
    logBrowser.setPaused( false );
    item.setImage( GuiResource.getInstance().getImageContinueLog() );
  } else {
    logBrowser.setPaused( true );
    item.setImage( GuiResource.getInstance().getImagePauseLog() );
  }
}
 
Example #4
Source File: JobLogDelegate.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public void pauseLog() {
  XulToolbarbutton pauseContinueButton = (XulToolbarbutton) toolbar.getElementById( "log-pause" );
  ToolItem swtToolItem = (ToolItem) pauseContinueButton.getManagedObject();

  if ( logBrowser.isPaused() ) {
    logBrowser.setPaused( false );
    if ( pauseContinueButton != null ) {
      swtToolItem.setImage( GUIResource.getInstance().getImagePauseLog() );
    }
  } else {
    logBrowser.setPaused( true );
    if ( pauseContinueButton != null ) {
      swtToolItem.setImage( GUIResource.getInstance().getImageContinueLog() );
    }
  }
}
 
Example #5
Source File: HopGuiPipelineGraph.java    From hop with Apache License 2.0 6 votes vote down vote up
@GuiToolbarElement(
  root = GUI_PLUGIN_TOOLBAR_PARENT_ID,
  id = TOOLBAR_ITEM_SHOW_EXECUTION_RESULTS,
  // label = "HopGui.Menu.ShowExecutionResults",
  toolTip = "HopGui.Tooltip.ShowExecutionResults",
  i18nPackageClass = HopGui.class,
  image = "ui/images/show-results.svg",
  separator = true
)
public void showExecutionResults() {
  ToolItem item = toolBarWidgets.findToolItem( TOOLBAR_ITEM_SHOW_EXECUTION_RESULTS );
  if ( isExecutionResultsPaneVisible() ) {
    disposeExtraView();
  } else {
    addAllTabs();
  }
}
 
Example #6
Source File: WelcomeCoolbarItem.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void fill(final ToolBar toolbar, final int index, final int iconSize) {
    final ToolItem item = new ToolItem(toolbar, SWT.PUSH | SWT.RIGHT);
    item.setToolTipText(Messages.WelcomeButtonLabel);
    if (iconSize < 0) {
        item.setImage(Pics.getImage(PicsConstants.coolbar_welcome_48));
        item.setDisabledImage(Pics.getImage(PicsConstants.coolbar_welcome_disabled_48));
    } else {
        item.setImage(Pics.getImage(PicsConstants.coolbar_welcome_16));
        item.setDisabledImage(Pics.getImage(PicsConstants.coolbar_welcome_disabled_16));
    }
    item.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            try {
                handler.execute(new ExecutionEvent());
            } catch (final ExecutionException e1) {
                BonitaStudioLog.error(e1);
            }
        }
    });

}
 
Example #7
Source File: HopGuiPipelineLogDelegate.java    From hop with Apache License 2.0 6 votes vote down vote up
@GuiToolbarElement(
  root = GUI_PLUGIN_TOOLBAR_PARENT_ID,
  id = TOOLBAR_ICON_LOG_PAUSE_RESUME,
  // label = "WorkflowLog.Button.Pause",
  toolTip = "WorkflowLog.Button.Pause",
  i18nPackageClass = HopGui.class,
  image = "ui/images/pause-log.svg",
  separator = true
)
public void pauseLog() {
  ToolItem item = toolBarWidgets.findToolItem( TOOLBAR_ICON_LOG_PAUSE_RESUME );
  if ( logBrowser.isPaused() ) {
    logBrowser.setPaused( false );
    item.setImage( GuiResource.getInstance().getImageContinueLog() );
  } else {
    logBrowser.setPaused( true );
    item.setImage( GuiResource.getInstance().getImagePauseLog() );
  }
}
 
Example #8
Source File: JobGraph.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public void addAllTabs() {

    CTabItem tabItemSelection = null;
    if ( extraViewTabFolder != null && !extraViewTabFolder.isDisposed() ) {
      tabItemSelection = extraViewTabFolder.getSelection();
    }

    jobHistoryDelegate.addJobHistory();
    jobLogDelegate.addJobLog();
    jobGridDelegate.addJobGrid();
    jobMetricsDelegate.addJobMetrics();

    if ( tabItemSelection != null ) {
      extraViewTabFolder.setSelection( tabItemSelection );
    } else {
      extraViewTabFolder.setSelection( jobGridDelegate.getJobGridTab() );
    }

    XulToolbarbutton button = (XulToolbarbutton) toolbar.getElementById( "job-show-results" );
    button.setTooltiptext( BaseMessages.getString( PKG, "Spoon.Tooltip.HideExecutionResults" ) );
    ToolItem swtToolItem = (ToolItem) button.getManagedObject();
    swtToolItem.setImage( GUIResource.getInstance().getImageHideResults() );
  }
 
Example #9
Source File: ExpressionViewer.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
protected void editControlSelected(final ToolBar tb, final Event event, final EditingDomain editingDomain) {
    boolean connectorEdit = false;
    final Expression selectedExpression = getSelectedExpression();
    if (tb != null && withConnector && selectedExpression != null
            && ExpressionConstants.CONNECTOR_TYPE.equals(selectedExpression.getType())) {
        for (final ToolItem ti : tb.getItems()) {
            final Object data = ti.getData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY);
            if (data != null && data.equals(SWTBotConstants.SWTBOT_ID_CONNECTORBUTTON)) {
                connectorEdit = true;
                ti.notifyListeners(SWT.Selection, event);
            }
        }
    }
    if (!connectorEdit) {
        final EditExpressionDialog dialog = createEditDialog();
        openEditDialog(dialog);
    }
}
 
Example #10
Source File: OpenPortalCoolbarItem.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void fill(final ToolBar toolbar, final int index, final int iconSize) {
    final ToolItem item = new ToolItem(toolbar, SWT.PUSH);
    item.setToolTipText(Messages.OpenUserXPButtonLabel);
    if (iconSize < 0) {
        item.setImage(Pics.getImage(PicsConstants.coolbar_portal_48));
        item.setDisabledImage(Pics.getImage(PicsConstants.coolbar_portal_disabled_48));
    } else {
        item.setImage(Pics.getImage(PicsConstants.coolbar_portal_16));
        item.setDisabledImage(Pics.getImage(PicsConstants.coolbar_portal_16));
    }
    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 #11
Source File: JavaPropertiesViewerDialog.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
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 #12
Source File: DeployCoolbarItem.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void fill(final ToolBar toolbar, final int index, final int iconSize) {
    item = new ToolItem(toolbar, SWT.PUSH);
    item.setToolTipText(Messages.DeployButtonLabel);
    item.setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY, SWTBotConstants.SWTBOT_ID_DEPLOY_TOOLITEM);
    if (iconSize < 0) {
        item.setImage(Pics.getImage("deploy48.png", ApplicationPlugin.getDefault()));
    } else {
        item.setImage(Pics.getImage("deploy24.png", ApplicationPlugin.getDefault()));
    }
    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 #13
Source File: QueryDetailsControl.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void createToolbar(Composite parent) {
    ToolBar toolBar = new ToolBar(parent, SWT.HORIZONTAL | SWT.LEFT | SWT.NO_FOCUS | SWT.FLAT);
    formPage.getToolkit().adapt(toolBar);

    addParameterItem = new ToolItem(toolBar, SWT.PUSH);
    addParameterItem.setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY, ADD_PARAM_BUTTON_ID);
    addParameterItem.setImage(BusinessObjectPlugin.getImage("/icons/add.png"));
    addParameterItem.setToolTipText(Messages.addParameterTooltip);
    addParameterItem.addListener(SWT.Selection, e -> addParameter());

    deleteParameterItem = new ToolItem(toolBar, SWT.PUSH);
    deleteParameterItem.setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY, REMOVE_PARAM_BUTTON_ID);
    deleteParameterItem.setImage(BusinessObjectPlugin.getImage("/icons/delete_icon.png"));
    deleteParameterItem.setToolTipText(Messages.deleteParameterTooltip);
    deleteParameterItem.addListener(SWT.Selection, e -> removeParameter());
}
 
Example #14
Source File: FrequencyController.java    From gama with GNU General Public License v3.0 6 votes vote down vote up
/**
 * @param tb
 */
private void createPauseItem(final GamaToolbar2 tb) {

	pauseItem = tb.check(IGamaIcons.DISPLAY_TOOLBAR_PAUSE, "Pause", "Pause or resume the current view", e -> {
		final IOutput output = view.getOutput();
		if (!internalChange) {

			if (output != null) {
				if (output.isPaused()) {
					output.setPaused(false);
				} else {
					output.setPaused(true);
				}
			}
		}
		togglePause((ToolItem) e.widget, output);
	}, SWT.RIGHT);

}
 
Example #15
Source File: EditorToolbar.java    From gama with GNU General Public License v3.0 6 votes vote down vote up
private void hookToCommands(final ToolItem lastEdit, final ToolItem nextEdit) {
	WorkbenchHelper.runInUI("Hooking to commands", 0, m -> {
		final Command nextCommand = getCommand(NAVIGATE_FORWARD_HISTORY);
		nextEdit.setEnabled(nextCommand.isEnabled());
		final ICommandListener nextListener = e -> nextEdit.setEnabled(searching || nextCommand.isEnabled());
		nextCommand.addCommandListener(nextListener);
		final Command lastCommand = getCommand(NAVIGATE_BACKWARD_HISTORY);
		final ICommandListener lastListener = e -> lastEdit.setEnabled(searching || lastCommand.isEnabled());
		lastEdit.setEnabled(lastCommand.isEnabled());
		lastCommand.addCommandListener(lastListener);
		// Attaching dispose listeners to the toolItems so that they remove the
		// command listeners properly
		lastEdit.addDisposeListener(e -> lastCommand.removeCommandListener(lastListener));
		nextEdit.addDisposeListener(e -> nextCommand.removeCommandListener(nextListener));
	});

}
 
Example #16
Source File: PulldownHandler.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 6 votes vote down vote up
public Object execute(ExecutionEvent event) throws ExecutionException {
  // open the button's dropdown menu
  Object trigger = event.getTrigger();
  if (trigger instanceof Event) {
    Widget widget = ((Event) trigger).widget;
    if (widget instanceof ToolItem) {
      ToolItem toolItem = (ToolItem) widget;
      Listener[] listeners = toolItem.getListeners(SWT.Selection);
      if (listeners.length > 0) {
        Listener listener = listeners[0]; // should be only one listener
        // send an event to the widget to open the menu
        // see CommandContributionItem.openDropDownMenu(Event)
        Event e = new Event();
        e.type = SWT.Selection;
        e.widget = widget;
        e.detail = 4; // dropdown detail
        e.y = toolItem.getBounds().height; // position menu
        listener.handleEvent(e);
      }
    }
  }
  return null;
}
 
Example #17
Source File: DefaultNavigatorContributionItem.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void fill(final ToolBar parent, int index)
{
	toolItem = new ToolItem(parent, SWT.DROP_DOWN);
	toolItem.setImage(actionProvider.getImage());
	// toolItem.setDisabledImage(actionProvider.getDisabledImage());
	// toolItem.setHotImage(actionProvider.getHotImage());
	toolItem.setToolTipText(actionProvider.getToolTip());

	toolItem.addSelectionListener(new SelectionAdapter()
	{

		@Override
		public void widgetSelected(SelectionEvent selectionEvent)
		{
			actionProvider.run(parent);
		}
	});
}
 
Example #18
Source File: AttributeEditionControl.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void createToolbar(Composite parent) {
    ToolBar toolBar = new ToolBar(parent, SWT.HORIZONTAL | SWT.LEFT | SWT.NO_FOCUS | SWT.FLAT);
    formPage.getToolkit().adapt(toolBar);

    ToolItem addFieldItem = new ToolItem(toolBar, SWT.PUSH);
    addFieldItem.setImage(BusinessObjectPlugin.getImage("/icons/add.png"));
    addFieldItem.setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY, ADD_ATTRIBUTE_BUTTON_ID);
    addFieldItem.setToolTipText(Messages.addFieldTooltip);
    addFieldItem.addListener(SWT.Selection, e -> addAttribute());

    deleteFieldItem = new ToolItem(toolBar, SWT.PUSH);
    deleteFieldItem.setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY, REMOVE_ATTRIBUTE_BUTTON_ID);
    deleteFieldItem.setImage(BusinessObjectPlugin.getImage("/icons/delete_icon.png"));
    deleteFieldItem.setToolTipText(Messages.deleteFieldTooltip);
    deleteFieldItem.addListener(SWT.Selection, e -> removeSelectedAttribute());

    upFieldItem = new ToolItem(toolBar, SWT.PUSH);
    upFieldItem.setImage(BusinessObjectPlugin.getImage("/icons/up.png"));
    upFieldItem.setToolTipText(Messages.up);
    upFieldItem.addListener(SWT.Selection, e -> upSelectedAttribute());

    downFieldItem = new ToolItem(toolBar, SWT.PUSH);
    downFieldItem.setImage(BusinessObjectPlugin.getImage("/icons/down.png"));
    downFieldItem.setToolTipText(Messages.down);
    downFieldItem.addListener(SWT.Selection, e -> downSelectedAttribute());
}
 
Example #19
Source File: XFindPanel.java    From xds-ide with Eclipse Public License 1.0 6 votes vote down vote up
protected ToolItem createClose(final ToolBar bar) {
    final ToolItem close = new ToolItem(bar, SWT.PUSH);
    final ImageDescriptor image = PlatformUI.getWorkbench()
            .getSharedImages()
            .getImageDescriptor(ISharedImages.IMG_TOOL_DELETE);
    if (image != null)
        close.setImage(image.createImage());
    close.setToolTipText(Messages.XFindPanel_Close_tooltip); //$NON-NLS-1$
    close.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent e) {
            hidePanel();
        }
    });
    return close;
}
 
Example #20
Source File: LogAnalysis.java    From AndroidRobot with Apache License 2.0 5 votes vote down vote up
private void createStatusBar() {
    coolBar1 = new CoolBar(shell, SWT.NONE);
    FormData formData1 = new FormData();
    formData1.left = new FormAttachment(0, 0);
    formData1.right = new FormAttachment(100, 0);
    formData1.top = new FormAttachment(100, -24);
    formData1.bottom = new FormAttachment(100, 0);
    coolBar1.setLayoutData(formData1);
    CoolItem coolItem1 = new CoolItem(coolBar1, SWT.NONE);
    toolBar1 = new ToolBar(coolBar1, SWT.NONE);

    ToolItem tiStatusBarTotal = new ToolItem(toolBar1, SWT.NONE);
    ToolItem tiStatusBarPass = new ToolItem(toolBar1, SWT.NONE);
    ToolItem tiStatusBarFail = new ToolItem(toolBar1, SWT.NONE);
    ToolItem tiStatusBarRate = new ToolItem(toolBar1, SWT.NONE);

    tiStatusBarPass.setText("通过:0");
    tiStatusBarFail.setText("失败:0");
    tiStatusBarRate.setText("通过率:0%");
    tiStatusBarTotal.setText("总用例数:0");

    coolItem1.setControl(toolBar1);

    Control control = coolItem1.getControl();
    Point pt = control.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    pt = coolItem1.computeSize(pt.x, pt.y);
    coolItem1.setSize(pt);

    coolBar1.pack();
}
 
Example #21
Source File: SWTEnvironment.java    From tuxguitar with GNU Lesser General Public License v2.1 5 votes vote down vote up
public int getToolItemWidth(ToolItem control) {
	int style = control.getStyle();
	if((style & SWT.SEPARATOR) == 0 && PLATFORM_COCOA.equals(SWT.getPlatform())) {
		return ((style & SWT.HORIZONTAL) != 0 ? control.getBounds().width : control.getBounds().height);
	}
	return control.getWidth();
}
 
Example #22
Source File: OpenUIDesignerCoolBarItemTest.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void create_a_toolItem_to_open_ui_designer() throws Exception {
    final OpenUIDesignerCoolBarItem openUIDesignerCoolBarItem = new OpenUIDesignerCoolBarItem();

    final ToolBar toolbar = new ToolBar(realmWithDisplay.createComposite(), SWT.NONE);
    openUIDesignerCoolBarItem.fill(toolbar, 0, -1);

    assertThat(toolbar.getItemCount()).isEqualTo(1);
    final ToolItem toolItem = toolbar.getItem(0);
    assertThat(openUIDesignerCoolBarItem.getText()).isEqualTo(Messages.uiDesignerLabel);
}
 
Example #23
Source File: WizardBaseDialog.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
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 #24
Source File: ExpressionBuilder.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private ToolItem createToolItem( ToolBar toolBar, final int operationType )
{
	final ToolItem item = new ToolItem( toolBar, SWT.NONE );
	toolItemType.put( item, operationType );
	item.addSelectionListener( new SelectionAdapter( ) {

		public void widgetSelected( SelectionEvent e )
		{
			sourceViewer.doOperation( operationType );
			updateToolItems( );
		}
	} );
	return item;
}
 
Example #25
Source File: BufferedToolItem.java    From BiglyBT with GNU General Public License v2.0 5 votes vote down vote up
public
BufferedToolItem(
	ToolBar		tool_bar,
	int			attributes )
{
	super( new ToolItem( tool_bar, attributes ));

	item = (ToolItem)getWidget();
}
 
Example #26
Source File: MigrationStatusView.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private void createHelpButton(final Composite bottomComposite) {
    final ToolBar helpToolbar = new ToolBar(bottomComposite, SWT.NONE);
    helpToolbar.setLayoutData(GridDataFactory.swtDefaults().align(SWT.LEFT, SWT.CENTER).grab(false, false).create());
    final ToolItem helpItem = new ToolItem(helpToolbar, SWT.PUSH);
    helpItem.setImage(JFaceResources.getImage(Dialog.DLG_IMG_HELP));
    helpItem.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            new WizardDialog(Display.getDefault().getActiveShell(), new MigrationWarningWizard()).open();
        }
    });
}
 
Example #27
Source File: AnalysisToolComposite.java    From ice with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates the Menu that stores each of the available IAnalysisViews for
 * each of the data sources.
 */
private void createViewMenu() {
	// Instantiate viewMenu. POP_UP menus are used for context menus and
	// drop-downs from ToolItems.
	Menu menu = new Menu(this.getShell(), SWT.POP_UP);

	// Create the top-level of the view menu with a button for each possible
	// data source.
	for (DataSource dataSource : DataSource.values()) {
		// Create a disabled MenuItem with dataSource as its text.
		MenuItem item = new MenuItem(menu, SWT.CASCADE);
		item.setText(dataSource.toString());
		item.setEnabled(false);

		// Create the sub-menu that will show the view types for this data
		// source.
		Menu subMenu = new Menu(menu);
		item.setMenu(subMenu);

		// Put the MenuItem into a Map for quick access (it will need to be
		// enabled/disabled depending on whether or not there are views
		// available for the data source.
		dataSourceItems.put(dataSource, item);
	}

	// Add the view ToolItem that should make the view menu appear.
	final ToolItem viewItem = new ToolItem(rightToolBar, SWT.DROP_DOWN);
	viewItem.setText("Views");
	viewItem.setToolTipText("Select the view displayed below.");

	// We also need to add a listener to make viewMenu appear.
	viewItem.addListener(SWT.Selection,
			new ToolItemMenuListener(viewItem, menu));

	return;
}
 
Example #28
Source File: HexManager.java    From http4e with Apache License 2.0 5 votes vote down vote up
HexManager(final StyledText swtText, ToolItem swtItem){
   this.swtText = swtText;
   this.swtItem = swtItem;      
   this.swtItem.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected( SelectionEvent e){
         if(!isHex){
            asHex();
            isHex = true; 
         } else {    
            asString(); 
            isHex = false;          
         }
      }
   });
}
 
Example #29
Source File: IndexControl.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private void createToolbar(Composite parent) {
    ToolBar toolBar = new ToolBar(parent, SWT.HORIZONTAL | SWT.LEFT | SWT.NO_FOCUS | SWT.FLAT);
    formPage.getToolkit().adapt(toolBar);

    ToolItem addIndexItem = new ToolItem(toolBar, SWT.PUSH);
    addIndexItem.setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY, ADD_INDEX_BUTTON_ID);
    addIndexItem.setImage(BusinessObjectPlugin.getImage("/icons/add.png"));
    addIndexItem.setToolTipText(Messages.addIndexTooltip);
    addIndexItem.addListener(SWT.Selection, e -> addIndex());

    deleteIndexItem = new ToolItem(toolBar, SWT.PUSH);
    deleteIndexItem.setImage(BusinessObjectPlugin.getImage("/icons/delete_icon.png"));
    deleteIndexItem.setToolTipText(Messages.deleteIndexTooltip);
    deleteIndexItem.addListener(SWT.Selection, e -> removeIndex());
}
 
Example #30
Source File: DeployContributionItem.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@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());
}