Java Code Examples for org.eclipse.jface.action.IAction#setToolTipText()

The following examples show how to use org.eclipse.jface.action.IAction#setToolTipText() . 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 vote down vote up
/**
 * 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 vote down vote up
/**
 * 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: TexOutlinePage.java    From texlipse with Eclipse Public License 1.0 6 votes vote down vote up
private IAction createHideAction(String desc, final int nodeType, ImageDescriptor img) {
    IAction action = new Action(desc, IAction.AS_CHECK_BOX) {
        public void run() {
            boolean oldState = filter.isTypeVisible(nodeType);
            filter.toggleType(nodeType, !oldState);
            TreeViewer viewer = getTreeViewer();
            if (oldState == false) {
                revealNodes(nodeType);
            }
            viewer.refresh();
        }
    };
    action.setToolTipText(desc);
    action.setImageDescriptor(img);
    return action;
}
 
Example 4
Source File: ControlFlowView.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
private IAction createHierarchicalAction() {
    IAction action = new Action(Messages.ControlFlowView_hierarchicalViewLabel, IAction.AS_RADIO_BUTTON) {
        @Override
        public void run() {
            ITmfTrace parentTrace = getTrace();
            synchronized (fFlatTraces) {
                fFlatTraces.remove(parentTrace);
                List<@NonNull TimeGraphEntry> entryList = getEntryList(parentTrace);
                if (entryList != null) {
                    for (TimeGraphEntry traceEntry : entryList) {
                        Collection<TimeGraphEntry> controlFlowEntries = fEntries.row(getProvider(traceEntry)).values();
                        controlFlowEntries.forEach(e -> e.setParent(null));
                        addEntriesToHierarchicalTree(controlFlowEntries, traceEntry);
                    }
                }
            }
            refresh();
        }
    };
    action.setChecked(true);
    action.setToolTipText(Messages.ControlFlowView_hierarchicalViewToolTip);
    return action;
}
 
Example 5
Source File: CriticalPathView.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
@Override
protected void fillLocalToolBar(@Nullable IToolBarManager manager) {
    super.fillLocalToolBar(manager);
    if (manager == null) {
        return;
    }
    IAction followArrowBwdAction = getTimeGraphViewer().getFollowArrowBwdAction();
    followArrowBwdAction.setText(Messages.CriticalPathView_followArrowBwdText);
    followArrowBwdAction.setToolTipText(Messages.CriticalPathView_followArrowBwdText);
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, followArrowBwdAction);

    IAction followArrowFwdAction = getTimeGraphViewer().getFollowArrowFwdAction();
    followArrowFwdAction.setText(Messages.CriticalPathView_followArrowFwdText);
    followArrowFwdAction.setToolTipText(Messages.CriticalPathView_followArrowFwdText);
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, followArrowFwdAction);
}
 
Example 6
Source File: Utilities.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
public static void initToggleAction(IAction a, ResourceBundle bundle, String prefix, boolean checked) {

		String tooltip= null;
		if (checked)
			tooltip= getString(bundle, prefix + "tooltip.checked", null);	//$NON-NLS-1$
		else
			tooltip= getString(bundle, prefix + "tooltip.unchecked", null);	//$NON-NLS-1$
		if (tooltip == null)
			tooltip= getString(bundle, prefix + "tooltip", null);	//$NON-NLS-1$
		
		if (tooltip != null)
			a.setToolTipText(tooltip);
			
		String description= null;
		if (checked)
			description= getString(bundle, prefix + "description.checked", null);	//$NON-NLS-1$
		else
			description= getString(bundle, prefix + "description.unchecked", null);	//$NON-NLS-1$
		if (description == null)
			description= getString(bundle, prefix + "description", null);	//$NON-NLS-1$
		
		if (description != null)
			a.setDescription(description);
			
	}
 
Example 7
Source File: JavaCompareUtilities.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
static void initToggleAction(IAction a, ResourceBundle bundle, String prefix, boolean checked) {

		String tooltip= null;
		if (checked)
			tooltip= getString(bundle, prefix + "tooltip.checked", null);	//$NON-NLS-1$
		else
			tooltip= getString(bundle, prefix + "tooltip.unchecked", null);	//$NON-NLS-1$
		if (tooltip == null)
			tooltip= getString(bundle, prefix + "tooltip", null);	//$NON-NLS-1$

		if (tooltip != null)
			a.setToolTipText(tooltip);

		String description= null;
		if (checked)
			description= getString(bundle, prefix + "description.checked", null);	//$NON-NLS-1$
		else
			description= getString(bundle, prefix + "description.unchecked", null);	//$NON-NLS-1$
		if (description == null)
			description= getString(bundle, prefix + "description", null);	//$NON-NLS-1$

		if (description != null)
			a.setDescription(description);
	}
 
Example 8
Source File: ControlFlowView.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
private IAction createFlatAction() {
    IAction action = new Action(Messages.ControlFlowView_flatViewLabel, IAction.AS_RADIO_BUTTON) {
        @Override
        public void run() {
            applyFlatPresentation();
            refresh();
        }
    };
    action.setChecked(true);
    action.setToolTipText(Messages.ControlFlowView_flatViewToolTip);
    return action;
}
 
Example 9
Source File: StackWindowAction.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected void changeLabel( IAction action )
{
	Command undoCmd = getCommandStack( ).getUndoCommand( );
	action.setToolTipText( MessageFormat.format( Messages.getString( "UndoAction_Tooltip" ), //$NON-NLS-1$
			new Object[]{
				getLabelForCommand( undoCmd )
			} )
			.trim( ) );
}
 
Example 10
Source File: StackWindowAction.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected void changeLabel( IAction action )
{
	Command redoCmd = getCommandStack( ).getRedoCommand( );
	action.setToolTipText( MessageFormat.format( Messages.getString( "RedoAction_Tooltip" ), //$NON-NLS-1$
			new Object[]{
				getLabelForCommand( redoCmd )
			} )
			.trim( ) );
}
 
Example 11
Source File: ControlFlowView.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
@Override
protected void fillLocalToolBar(IToolBarManager manager) {
    // add "Optimization" Button to local tool bar of Controlflow
    IAction optimizationAction = getOptimizationAction();
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, optimizationAction);

    // add a separator to local tool bar
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, new Separator());

    super.fillLocalToolBar(manager);
    IDialogSettings settings = Activator.getDefault().getDialogSettings();
    IDialogSettings section = settings.getSection(getClass().getName());
    if (section == null) {
        section = settings.addNewSection(getClass().getName());
    }

    IAction hideArrowsAction = getTimeGraphViewer().getHideArrowsAction(section);
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, hideArrowsAction);

    IAction followArrowBwdAction = getTimeGraphViewer().getFollowArrowBwdAction();
    followArrowBwdAction.setText(Messages.ControlFlowView_followCPUBwdText);
    followArrowBwdAction.setToolTipText(Messages.ControlFlowView_followCPUBwdText);
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, followArrowBwdAction);

    IAction followArrowFwdAction = getTimeGraphViewer().getFollowArrowFwdAction();
    followArrowFwdAction.setText(Messages.ControlFlowView_followCPUFwdText);
    followArrowFwdAction.setToolTipText(Messages.ControlFlowView_followCPUFwdText);
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, followArrowFwdAction);

    IAction previousEventAction = new SearchEventAction(false, PackageMessages.ControlFlowView_PreviousEventJobName);
    previousEventAction.setText(PackageMessages.ControlFlowView_PreviousEventActionName);
    previousEventAction.setToolTipText(PackageMessages.ControlFlowView_PreviousEventActionTooltip);
    previousEventAction.setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(PREV_EVENT_ICON_PATH));
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, previousEventAction);

    IAction nextEventAction = new SearchEventAction(true, PackageMessages.ControlFlowView_NextEventJobName);
    nextEventAction.setText(PackageMessages.ControlFlowView_NextEventActionName);
    nextEventAction.setToolTipText(PackageMessages.ControlFlowView_NextEventActionTooltip);
    nextEventAction.setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(NEXT_EVENT_ICON_PATH));
    manager.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, nextEventAction);
}
 
Example 12
Source File: JavaCompareUtilities.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
static void initAction(IAction a, ResourceBundle bundle, String prefix) {

		String labelKey= "label"; //$NON-NLS-1$
		String tooltipKey= "tooltip"; //$NON-NLS-1$
		String imageKey= "image"; //$NON-NLS-1$
		String descriptionKey= "description"; //$NON-NLS-1$

		if (prefix != null && prefix.length() > 0) {
			labelKey= prefix + labelKey;
			tooltipKey= prefix + tooltipKey;
			imageKey= prefix + imageKey;
			descriptionKey= prefix + descriptionKey;
		}

		a.setText(getString(bundle, labelKey, labelKey));
		a.setToolTipText(getString(bundle, tooltipKey, null));
		a.setDescription(getString(bundle, descriptionKey, null));

		String relPath= getString(bundle, imageKey, null);
		if (relPath != null && relPath.trim().length() > 0) {

			String dPath;
			String ePath;

			if (relPath.indexOf("/") >= 0) { //$NON-NLS-1$
				String path= relPath.substring(1);
				dPath= 'd' + path;
				ePath= 'e' + path;
			} else {
				dPath= "dlcl16/" + relPath; //$NON-NLS-1$
				ePath= "elcl16/" + relPath; //$NON-NLS-1$
			}

			ImageDescriptor id= JavaCompareUtilities.getImageDescriptor(dPath);	// we set the disabled image first (see PR 1GDDE87)
			if (id != null)
				a.setDisabledImageDescriptor(id);
			id= JavaCompareUtilities.getImageDescriptor(ePath);
			if (id != null) {
				a.setImageDescriptor(id);
				a.setHoverImageDescriptor(id);
			}
		}
	}
 
Example 13
Source File: LaborView.java    From elexis-3-core with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void createPartControl(final Composite parent){
	setTitleImage(Images.IMG_VIEW_LABORATORY.getImage());
	
	tabFolder = new CTabFolder(parent, SWT.TOP);
	tabFolder.setLayout(new FillLayout());
	
	final CTabItem resultsTabItem = new CTabItem(tabFolder, SWT.NULL);
	resultsTabItem.setText("Resultate");
	resultsComposite = new LaborResultsComposite(tabFolder, SWT.NONE);
	resultsTabItem.setControl(resultsComposite);
	
	final CTabItem ordersTabItem = new CTabItem(tabFolder, SWT.NULL);
	ordersTabItem.setText("Verordnungen");
	ordersComposite = new LaborOrdersComposite(tabFolder, SWT.NONE);
	ordersTabItem.setControl(ordersComposite);
	
	tabFolder.setSelection(0);
	tabFolder.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e){
			resultsComposite.reload();
			ordersComposite.reload();
		}
	});
	makeActions();
	menu = new ViewMenus(getViewSite());
	menu.createMenu(newAction, backAction, fwdAction, printAction, importAction, xmlAction);
	// Orders
	final LaborOrderPulldownMenuCreator menuCreator =
		new LaborOrderPulldownMenuCreator(parent.getShell());
	if (menuCreator.getSelected() != null) {
		IAction dropDownAction = menuCreator.getAction();
		
		IActionBars actionBars = getViewSite().getActionBars();
		IToolBarManager toolbar = actionBars.getToolBarManager();
		
		toolbar.add(dropDownAction);
		
		// Set data
		dropDownAction.setText(menuCreator.getSelected().getText());
		dropDownAction.setToolTipText(menuCreator.getSelected().getToolTipText());
		dropDownAction.setImageDescriptor(menuCreator.getSelected().getImageDescriptor());
	}
	// Importers
	IToolBarManager tm = getViewSite().getActionBars().getToolBarManager();
	List<IAction> importers =
		Extensions.getClasses(
			Extensions.getExtensions(ExtensionPointConstantsUi.LABORDATENIMPORT),
			"ToolbarAction", //$NON-NLS-1$ //$NON-NLS-2$
			false);
	for (IAction ac : importers) {
		tm.add(ac);
	}
	if (importers.size() > 0) {
		tm.add(new Separator());
	}
	tm.add(refreshAction);
	tm.add(newColumnAction);
	tm.add(newAction);
	tm.add(backAction);
	tm.add(fwdAction);
	tm.add(expandAllAction);
	tm.add(collapseAllAction);
	tm.add(printAction);
	
	// register event listeners
	ElexisEventDispatcher.getInstance().addListeners(eeli_labitem, eeli_laborder,
		eeli_labresult, eeli_pat);
	Patient act = (Patient) ElexisEventDispatcher.getSelected(Patient.class);
	if ((act != null && act != resultsComposite.getPatient())) {
		resultsComposite.selectPatient(act);
	}
	getSite().getPage().addPartListener(udpateOnVisible);
}