Search in sources :

Example 91 with IAction

use of org.eclipse.jface.action.IAction in project jbosstools-hibernate by jbosstools.

the class DiagramViewer method configureGraphicalViewer.

protected void configureGraphicalViewer() {
    super.configureGraphicalViewer();
    // 
    loadProperties();
    // Actions
    IAction showRulers = new ToggleRulerVisibilityAction(getGraphicalViewer());
    getActionRegistry().registerAction(showRulers);
    IAction snapAction = new ToggleSnapToGeometryAction(getGraphicalViewer());
    getActionRegistry().registerAction(snapAction);
    IAction showGrid = new ToggleGridAction(getGraphicalViewer());
    getActionRegistry().registerAction(showGrid);
}
Also used : ToggleSnapToGeometryAction(org.eclipse.gef.ui.actions.ToggleSnapToGeometryAction) IAction(org.eclipse.jface.action.IAction) ToggleGridAction(org.eclipse.gef.ui.actions.ToggleGridAction) ToggleRulerVisibilityAction(org.eclipse.gef.ui.actions.ToggleRulerVisibilityAction)

Example 92 with IAction

use of org.eclipse.jface.action.IAction in project org.csstudio.display.builder by kasemir.

the class DataBrowserEditor method fillContextMenu.

/**
 * Dynamically fill context menu
 *  @param manager
 */
private void fillContextMenu(final IMenuManager manager) {
    final Activator activator = Activator.getDefault();
    final Shell shell = getSite().getShell();
    final UndoableActionManager op_manager = plot.getPlot().getUndoableActionManager();
    manager.add(toggle_toolbar);
    manager.add(toggle_legend);
    manager.add(new Separator());
    manager.add(new AddPVAction(op_manager, shell, model, false));
    manager.add(new AddPVAction(op_manager, shell, model, true));
    final boolean is_rcp = SingleSourcePlugin.getUIHelper().getUI() == UI.RCP;
    if (is_rcp) {
        try {
            for (IAction imp : SampleImporters.createImportActions(op_manager, shell, model)) manager.add(imp);
        } catch (Exception ex) {
            ExceptionDetailsErrorDialog.openError(shell, Messages.Error, ex);
        }
    }
    manager.add(new RemoveUnusedAxesAction(op_manager, model));
    manager.add(new RefreshAction(controller));
    manager.add(new Separator());
    manager.add(new OpenPropertiesAction());
    manager.add(new OpenViewAction(SearchView.ID, Messages.OpenSearchView, activator.getImageDescriptor("icons/search.gif")));
    if (is_rcp)
        manager.add(new OpenViewAction(ExportView.ID, Messages.OpenExportView, activator.getImageDescriptor("icons/export.png")));
    manager.add(new OpenViewAction(SampleView.ID, Messages.InspectSamples, activator.getImageDescriptor("icons/inspect.gif")));
    manager.add(new OpenPerspectiveAction(activator.getImageDescriptor("icons/databrowser.png"), Messages.OpenDataBrowserPerspective, Perspective.ID));
    manager.add(new OpenViewAction(WaveformView.ID, Messages.OpenWaveformView, activator.getImageDescriptor("icons/wavesample.gif")));
    manager.add(new Separator());
    manager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
    if (is_rcp) {
        manager.add(new Separator());
        manager.add(snapshot);
        if (EMailSender.isEmailSupported())
            manager.add(new SendEMailAction(shell, plot.getPlot()));
        manager.add(new PrintAction(shell, plot.getPlot()));
        if (SendToElogAction.isElogAvailable())
            manager.add(new SendToElogAction(shell, plot.getPlot()));
    }
}
Also used : OpenPerspectiveAction(org.csstudio.ui.util.perspective.OpenPerspectiveAction) IAction(org.eclipse.jface.action.IAction) OpenViewAction(org.csstudio.apputil.ui.workbench.OpenViewAction) PartInitException(org.eclipse.ui.PartInitException) Shell(org.eclipse.swt.widgets.Shell) RemoveUnusedAxesAction(org.csstudio.trends.databrowser3.propsheet.RemoveUnusedAxesAction) RefreshAction(org.csstudio.trends.databrowser3.ui.RefreshAction) Activator(org.csstudio.trends.databrowser3.Activator) UndoableActionManager(org.csstudio.display.builder.util.undo.UndoableActionManager) AddPVAction(org.csstudio.trends.databrowser3.ui.AddPVAction) GroupMarker(org.eclipse.jface.action.GroupMarker) Separator(org.eclipse.jface.action.Separator)

Example 93 with IAction

use of org.eclipse.jface.action.IAction in project org.csstudio.display.builder by kasemir.

the class DisplayEditorToolbarContributor method setActiveEditor.

@Override
public void setActiveEditor(final IEditorPart part) {
    if (!(part instanceof DisplayEditorPart))
        return;
    final DisplayEditorPart editor = (DisplayEditorPart) part;
    final IActionBars bars = getActionBars();
    if (bars == null)
        return;
    // otherwise the global action remains disabled.
    for (IAction action : global_actions) bars.setGlobalActionHandler(action.getId(), editor.getRetargetActionHandler(action.getId()));
    bars.updateActionBars();
}
Also used : IAction(org.eclipse.jface.action.IAction) IActionBars(org.eclipse.ui.IActionBars)

Example 94 with IAction

use of org.eclipse.jface.action.IAction in project eclipse-cs by checkstyle.

the class MarkerStatsView method hookContextMenu.

/**
 * Adds the actions to the tableviewer context menu.
 *
 * @param actions
 *          a collection of IAction objets
 */
private void hookContextMenu(final Collection<Object> actions, StructuredViewer viewer) {
    MenuManager menuMgr = new MenuManager();
    menuMgr.setRemoveAllWhenShown(true);
    menuMgr.addMenuListener(new IMenuListener() {

        @Override
        public void menuAboutToShow(IMenuManager manager) {
            for (Iterator<Object> iter = actions.iterator(); iter.hasNext(); ) {
                Object item = iter.next();
                if (item instanceof IContributionItem) {
                    manager.add((IContributionItem) item);
                } else if (item instanceof IAction) {
                    manager.add((IAction) item);
                }
            }
            manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
        }
    });
    Menu menu = menuMgr.createContextMenu(viewer.getControl());
    viewer.getControl().setMenu(menu);
    getSite().registerContextMenu(menuMgr, viewer);
}
Also used : IAction(org.eclipse.jface.action.IAction) IContributionItem(org.eclipse.jface.action.IContributionItem) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) Iterator(java.util.Iterator) IMenuManager(org.eclipse.jface.action.IMenuManager) Menu(org.eclipse.swt.widgets.Menu) IMenuListener(org.eclipse.jface.action.IMenuListener) Separator(org.eclipse.jface.action.Separator)

Example 95 with IAction

use of org.eclipse.jface.action.IAction in project mylyn.docs by eclipse.

the class MarkupEditor method createActions.

@Override
protected void createActions() {
    super.createActions();
    IAction action;
    // action = new ShowCheatSheetAction(this);
    // setAction(action.getId(),action);
    // $NON-NLS-1$
    action = new ContentAssistAction(new NlsResourceBundle(Messages.class), "ContentAssistProposal_", this);
    action.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
    // $NON-NLS-1$
    setAction("ContentAssistProposal", action);
    // $NON-NLS-1$
    markAsStateDependentAction("ContentAssistProposal", true);
}
Also used : NlsResourceBundle(org.eclipse.mylyn.internal.wikitext.ui.util.NlsResourceBundle) IAction(org.eclipse.jface.action.IAction) ContentAssistAction(org.eclipse.ui.texteditor.ContentAssistAction)

Aggregations

IAction (org.eclipse.jface.action.IAction)387 Action (org.eclipse.jface.action.Action)147 ImageDescriptor (org.eclipse.jface.resource.ImageDescriptor)79 IWorkbenchAction (org.eclipse.ui.actions.ActionFactory.IWorkbenchAction)57 Separator (org.eclipse.jface.action.Separator)55 WebLaunchAction (com.centurylink.mdw.plugin.actions.WebLaunchActions.WebLaunchAction)50 MenuManager (org.eclipse.jface.action.MenuManager)39 IMenuManager (org.eclipse.jface.action.IMenuManager)37 ArrayList (java.util.ArrayList)36 ActionContributionItem (org.eclipse.jface.action.ActionContributionItem)35 IContributionItem (org.eclipse.jface.action.IContributionItem)31 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)26 WorkflowElement (com.centurylink.mdw.plugin.designer.model.WorkflowElement)22 WorkflowProject (com.centurylink.mdw.plugin.project.model.WorkflowProject)18 ActionRegistry (org.eclipse.gef.ui.actions.ActionRegistry)16 IToolBarManager (org.eclipse.jface.action.IToolBarManager)16 IEditorPart (org.eclipse.ui.IEditorPart)15 Point (org.eclipse.swt.graphics.Point)14 Iterator (java.util.Iterator)13 Menu (org.eclipse.swt.widgets.Menu)13