org.eclipse.swt.widgets.ToolBar Java Examples

The following examples show how to use org.eclipse.swt.widgets.ToolBar. 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: 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 #2
Source File: HelpCoolbarItem.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.HelpButtonLabel);
    if (iconSize < 0) {
        item.setImage(Pics.getImage(PicsConstants.coolbar_help_48));
        item.setDisabledImage(Pics.getImage(PicsConstants.coolbar_help_disabled_48));
    } else {
        item.setImage(Pics.getImage(PicsConstants.coolbar_help_16));
        item.setDisabledImage(Pics.getImage(PicsConstants.coolbar_help_disabled_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 #3
Source File: JavaStructureDiffViewer.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void setSmartButtonVisible(boolean visible) {
	if (fSmartActionItem == null)
		return;
	Control c= getControl();
	if (c == null || c.isDisposed())
		return;

	fSmartActionItem.setVisible(visible);
	ToolBarManager tbm= CompareViewerPane.getToolBarManager(c.getParent());
	if (tbm != null) {
		tbm.update(true);
		ToolBar tb= tbm.getControl();
		if (!tb.isDisposed())
			tb.getParent().layout(true);
	}
}
 
Example #4
Source File: OpenUIDesignerCoolBarItem.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.openUIDesigner);
    configureItemImage(item, iconSize < 0 ? "ui_designer_48x48.png" : "ui_designer_24x24.png");
    item.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            openInformationDialogOnUiDesigner();
            try {
                getHandler().execute();
            } catch (final ExecutionException ex) {
                BonitaStudioLog.error("Failed to open ui designer", ex);
            }
        }

    });
}
 
Example #5
Source File: TypeSelectionComponent.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void createViewMenu(Composite parent) {
	fToolBar= new ToolBar(parent, SWT.FLAT);
	fToolItem= new ToolItem(fToolBar, SWT.PUSH, 0);

	GridData data= new GridData();
	data.horizontalAlignment= GridData.END;
	fToolBar.setLayoutData(data);

	fToolItem.setImage(JavaPluginImages.get(JavaPluginImages.IMG_ELCL_VIEW_MENU));
	fToolItem.setDisabledImage(JavaPluginImages.get(JavaPluginImages.IMG_DLCL_VIEW_MENU));
	fToolItem.setToolTipText(JavaUIMessages.TypeSelectionComponent_menu);
	fToolItem.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			showViewMenu();
		}
	});
	
	fMenuManager= new MenuManager();
	fillViewMenu(fMenuManager);

	// ICommandService commandService= (ICommandService)PlatformUI.getWorkbench().getAdapter(ICommandService.class);
	// IHandlerService handlerService= (IHandlerService)PlatformUI.getWorkbench().getAdapter(IHandlerService.class);
}
 
Example #6
Source File: HopGuiWorkflowGraph.java    From hop with Apache License 2.0 6 votes vote down vote up
private void addToolBar() {

    try {
      // Create a new toolbar at the top of the main composite...
      //
      toolBar = new ToolBar( this, SWT.WRAP | SWT.LEFT | SWT.HORIZONTAL );
      toolBarWidgets = new GuiToolbarWidgets();
      toolBarWidgets.registerGuiPluginObject( this );
      toolBarWidgets.createToolbarWidgets( toolBar, GUI_PLUGIN_TOOLBAR_PARENT_ID );
      FormData layoutData = new FormData();
      layoutData.left = new FormAttachment( 0, 0 );
      layoutData.top = new FormAttachment( 0, 0 );
      layoutData.right = new FormAttachment( 100, 0 );
      toolBar.setLayoutData( layoutData );
      toolBar.pack();

      // enable / disable the icons in the toolbar too.
      //
      updateGui();

    } catch ( Throwable t ) {
      log.logError( "Error setting up the navigation toolbar for HopUI", t );
      new ErrorDialog( hopShell(), "Error", "Error setting up the navigation toolbar for HopGUI", new Exception( t ) );
    }
  }
 
Example #7
Source File: HopGui.java    From hop with Apache License 2.0 6 votes vote down vote up
protected void addPerspectivesToolbar() {
  // We can't mix horizontal and vertical toolbars so we need to add a composite.
  //
  shell.setLayout( new FormLayout() );
  mainHopGuiComposite = new Composite( shell, SWT.NO_BACKGROUND );
  mainHopGuiComposite.setLayout( new FormLayout() );
  FormData formData = new FormData();
  formData.left = new FormAttachment( 0, 0 );
  formData.right = new FormAttachment( 100, 0 );
  formData.top = new FormAttachment( mainToolbar, 0 );
  formData.bottom = new FormAttachment( 100, 0 );
  mainHopGuiComposite.setLayoutData( formData );

  perspectivesToolbar = new ToolBar( mainHopGuiComposite, SWT.WRAP | SWT.RIGHT | SWT.VERTICAL );
  props.setLook( perspectivesToolbar, PropsUi.WIDGET_STYLE_TOOLBAR );
  FormData fdToolBar = new FormData();
  fdToolBar.left = new FormAttachment( 0, 0 );
  fdToolBar.top = new FormAttachment( 0, 0 );
  fdToolBar.bottom = new FormAttachment( 100, 0 );
  perspectivesToolbar.setLayoutData( fdToolBar );

  perspectivesToolbarWidgets = new GuiToolbarWidgets();
  perspectivesToolbarWidgets.registerGuiPluginObject( this );
  perspectivesToolbarWidgets.createToolbarWidgets( perspectivesToolbar, GUI_PLUGIN_PERSPECTIVES_PARENT_ID );
  perspectivesToolbar.pack();
}
 
Example #8
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 #9
Source File: ExpressionViewer.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
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 #10
Source File: DashboardComposite.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
private void createToolbarActions(ToolBar bar) {
	createAction(bar, SWT.PUSH,
			"Snapshot",
			"Take a data snapshot.",
			Activator.getInstance().ICON_SNAPSHOT,
			this::takeSnapshot);
	createAction(bar, SWT.PUSH,
			"Snapshot and Save",
			"Take a data snapshot and save it as CSV file.",
			Activator.getInstance().ICON_SNAPSHOT_SAVE,
			this::takeSnapshotAndSave);
	createAction(bar, SWT.PUSH,
			"Delete",
			"Delete selected snapshots from history.",
			PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_DELETE),
			this::deleteCurrentSelection);
}
 
Example #11
Source File: FindBarDecorator.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
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 #12
Source File: RunCoolbarItem.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.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 #13
Source File: DataViewer.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
protected void createTitle(Composite parent) {
    Composite titleComposite = widgetFactory.createComposite(parent);
    titleComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).create());
    titleComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());

    Label label = widgetFactory.createLabel(titleComposite, getTitle(), SWT.NONE);
    label.setLayoutData(GridDataFactory.swtDefaults().grab(false, false).create());

    ControlDecoration controlDecoration = new ControlDecoration(label, SWT.RIGHT, titleComposite);
    controlDecoration.setShowOnlyOnFocus(false);
    controlDecoration.setDescriptionText(getTitleDescripiton());
    controlDecoration.setImage(Pics.getImage(PicsConstants.hint));

    Composite toolBarComposite = widgetFactory.createComposite(titleComposite);
    toolBarComposite.setLayout(GridLayoutFactory.fillDefaults().create());
    toolBarComposite.setLayoutData(GridDataFactory.fillDefaults().align(SWT.END, SWT.FILL).grab(true, false).create());
    ToolBar toolBar = new ToolBar(toolBarComposite, SWT.HORIZONTAL | SWT.RIGHT | SWT.NO_FOCUS | SWT.FLAT);
    widgetFactory.adapt(toolBar);
    toolBar.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND));
    createToolItems(toolBar);
}
 
Example #14
Source File: GraphNodeViewer.java    From depan with Apache License 2.0 6 votes vote down vote up
private Composite setupOptions(Composite parent) {
  Composite result = new Composite(parent, SWT.NONE);
  GridLayout layout = Widgets.buildContainerLayout(1);

  Composite leftCmds = createCommands(result);
  if (null != leftCmds) {
    leftCmds.setLayoutData(Widgets.buildHorzFillData());
    layout.numColumns = 2;
  }
  result.setLayout(layout);

  ToolBar rightOptions = createToolBar(result);
  rightOptions.setLayoutData(Widgets.buildTrailFillData());

  return result;
}
 
Example #15
Source File: QuickLinksView.java    From BiglyBT with GNU General Public License v2.0 6 votes vote down vote up
private static void
addItem(
	BaseMDI					mdi,
	ToolBar					toolBar,
	Map<String,Object>		map )
{
	QuickLinkItem qli = new QuickLinkItem( map );
	
	if ( qli != null ){
		
		synchronized( qlItems ){
			
			qlItems.add( qli );
		}

		addItem(mdi, toolBar, qli  );
	}
}
 
Example #16
Source File: ImportRulesDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void addToolBar() {

    try {
      XulLoader loader = new KettleXulLoader();
      loader.setSettingsManager( XulSpoonSettingsManager.getInstance() );
      ResourceBundle bundle = new XulSpoonResourceBundle( Spoon.class );
      XulDomContainer xulDomContainer = loader.loadXul( XUL_FILE_TOOLBAR, bundle );
      xulDomContainer.addEventHandler( this );
      toolbar = (XulToolbar) xulDomContainer.getDocumentRoot().getElementById( "import-rules-toolbar" );

      ToolBar swtToolbar = (ToolBar) toolbar.getManagedObject();
      swtToolbar.layout( true, true );
    } catch ( Throwable t ) {
      LogChannel.GENERAL.logError( Const.getStackTracker( t ) );
      new ErrorDialog( shell,
        BaseMessages.getString( PKG, "ImportRulesDialog.Exception.ErrorReadingXULFile.Title" ),
        BaseMessages.getString( PKG, "ImportRulesDialog.Exception.ErrorReadingXULFile.Message", XUL_FILE_TOOLBAR ),
        new Exception( t ) );
    }
  }
 
Example #17
Source File: JavaPropertiesViewerDialog.java    From tmxeditor8 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 #18
Source File: TypeHierarchyViewPart.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void updateMainToolbar(boolean horizontal) {
	IActionBars actionBars= getViewSite().getActionBars();
	IToolBarManager tbmanager= actionBars.getToolBarManager();

	if (horizontal) {
		clearMainToolBar(tbmanager);
		ToolBar typeViewerToolBar= new ToolBar(fTypeViewerViewForm, SWT.FLAT | SWT.WRAP);
		fillMainToolBar(new ToolBarManager(typeViewerToolBar));
		fTypeViewerViewForm.setTopLeft(typeViewerToolBar);
	} else {
		fTypeViewerViewForm.setTopLeft(null);
		fillMainToolBar(tbmanager);
	}
}
 
Example #19
Source File: DialogPackageExplorerActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Create a toolbar manager for a given
 * <code>ViewerPane</code>
 *
 * @param pane the pane to create the help toolbar for
 * @return the created <code>ToolBarManager</code>
 */
public ToolBarManager createLeftToolBar(ViewerPane pane) {
    ToolBar tb= new ToolBar(pane, SWT.FLAT);
    pane.setTopRight(tb);
    ToolBarManager tbm= new ToolBarManager(tb);

    tbm.add(fCreateLinkedSourceFolderAction);
    tbm.add(fCreateSourceFolderAction);
    tbm.add(fResetAllAction);
    tbm.add(new HelpAction());

    tbm.update(true);
    return tbm;
}
 
Example #20
Source File: FindBarOption.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public ToolItem createToolItem(ToolBar optionsToolBar)
{
	if (!canCreateItem())
	{
		return null;
	}
	ToolItem item = isCheckable() ? new ToolItem(optionsToolBar, SWT.CHECK)
			: new ToolItem(optionsToolBar, SWT.PUSH);

	item.setImage(FindBarPlugin.getImage(this.image));
	if (imageDisabled != null)
	{
		item.setDisabledImage(FindBarPlugin.getImage(this.imageDisabled));
	}
	item.setToolTipText(this.initialText);
	if (preferencesKey != null)
	{
		IPreferenceStore preferenceStore = FindBarPlugin.getDefault().getPreferenceStore();
		item.setSelection(preferenceStore.getBoolean(preferencesKey));
	}
	item.addSelectionListener(this);
	if (!this.initiallyEnabled)
	{
		item.setEnabled(false);
	}
	setToolItemInDecorator(item);
	return item;
}
 
Example #21
Source File: RevTab.java    From Rel with Apache License 2.0 5 votes vote down vote up
@Override
public ToolBar getToolBar(Composite parent) {
	RelvarEditorPanel relvarEditorView = rev.getCmdPanelOutput().getRelvarEditorView();
	if (relvarEditorView != null)
		return new VarEditorToolbar(parent, relvarEditorView.getRelvarEditor());
	else
		return new CmdPanelToolbar(parent, rev.getCmdPanelOutput());
}
 
Example #22
Source File: EditExpressionDialog.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
protected void updateTrayVisibility() {
    if (helpControl != null) {
        helpControl.setVisible(false);
        if (currentExpressionEditor != null && currentExpressionEditor.provideDialogTray()) {
            final ToolItem item = ((ToolBar) helpControl).getItem(0);
            item.setSelection(true);
            openTrayListener.handleEvent(new Event());
        } else if (getTray() != null) {
            closeTray();
        }
    }
}
 
Example #23
Source File: SamplePart.java    From codeexamples-eclipse with Eclipse Public License 1.0 5 votes vote down vote up
@PostConstruct
public void createComposite(Composite parent, IPresentationEngine presentationEngine, EModelService modelService, MApplication app, IEclipseContext context) {
	List<MTrimContribution> trimContributions = app.getTrimContributions();
	
	Optional<MTrimElement> findAny = trimContributions.stream().flatMap(tbc -> tbc.getChildren().stream()).filter(tbe -> "com.vogella.e4.renderer.toolbar".equals(tbe.getElementId())).findAny();

	findAny.ifPresent(uiElement -> {
		ToolBar toolBar = new ToolBar(parent, SWT.NONE);
		presentationEngine.createGui(uiElement, toolBar, context);
	});
}
 
Example #24
Source File: RepositorySpoonPlugin.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Override
public void applyToContainer( String category, XulDomContainer container ) throws XulException {
  if ( category.equals( SPOON_CATEGORY ) ) {
    XulToolbar toolbar = (XulToolbar) container.getDocumentRoot().getElementById( "main-toolbar" );
    RepositoryConnectMenu repoConnectMenu =
      new RepositoryConnectMenu( Spoon.getInstance(), (ToolBar) toolbar.getManagedObject(),
        repositoryConnectController );
    repoConnectMenu.render();
  }
}
 
Example #25
Source File: ExpressionResultViewerTab.java    From Rel with Apache License 2.0 5 votes vote down vote up
public ToolBar getToolBar(Composite parent) {
	return (new CmdPanelToolbar(parent, cmdPanel) {
		protected void addAdditionalItemsAfter(CmdPanelToolbar toolbar) {
			super.addAdditionalItemsAfter(toolbar);
			new CommandActivator(Commands.Do.Refresh, this, "arrow_refresh", SWT.PUSH, "Refresh", e -> evaluate());
		}
	});
}
 
Example #26
Source File: XFindPanel.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
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 #27
Source File: ComponentTitledFolder.java    From arx with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the button item for the given text.
 *
 * @param text
 * @return
 */
public ToolItem getButtonItem(String text) {
    Control c = folder.getTopRight();
    if (c == null) return null;
    if (!(c instanceof ToolBar)) return null;
    ToolBar t = (ToolBar)c;
    for (ToolItem i : t.getItems()){
        if (i.getToolTipText().equals(text)) return i;
    }
    return null;
}
 
Example #28
Source File: Sorter.java    From Rel with Apache License 2.0 5 votes vote down vote up
public Sorter(FilterSorter filterSorter, Composite contentPanel) {
	super(contentPanel, SWT.NONE);
	
	this.filterSorter = filterSorter;
	
	GridLayout layout = new GridLayout(2, false);
	layout.horizontalSpacing = 0;
	layout.verticalSpacing = 0;
	layout.marginWidth = 0;
	layout.marginHeight = 0;
	setLayout(layout);		

	sortSpec = new Label(this, SWT.NONE);
	sortSpec.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true, 1, 1));
	
	sortSpec.addListener(SWT.MouseUp, e -> popup());
	sortSpec.setText(emptySortPrompt);
	
	ToolBar toolBar = new ToolBar(this, SWT.NONE);
	
	ToolItem clear = new ToolItem(toolBar, SWT.PUSH);
	clear.addListener(SWT.Selection, e -> {
		sortSpec.setText(emptySortPrompt);
		filterSorter.refresh();
	});
	clear.setText("Clear");
	
	toolBar.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
	
	this.addListener(SWT.Show, e -> {
		if (sortSpec.getText().equals(emptySortPrompt))
			popup();
	});
	
	createPopup();
}
 
Example #29
Source File: XFindPanel.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
protected ToolItem createNextItem(final ToolBar bar) {
    bNext = createTool(bar, Messages.XFindPanel_FindNext_tooltip,
            ImageUtils.FIND_NEXT, new SelectionAdapter() {
                @Override
                public void widgetSelected(final SelectionEvent e) {
                    findNext();
                }
            });
    bNext.setEnabled(false);
    return bNext;
}
 
Example #30
Source File: XFindPanel.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
protected ToolItem createSearchHistoryMenu(final ToolBar bar) {
    bHistory = new ToolItem(bar, SWT.PUSH);
    bHistory.setImage(ImageUtils.getImage(ImageUtils.FIND_HISTORY));
    bHistory.setToolTipText(Messages.XFindPanel_ShowHistory_tooltip);
    bHistory.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent e) {
            showHistoryMenu();
        }
    });
    bHistory.setEnabled(!history.isEmpty());
    return bHistory;
}