Search in sources :

Example 21 with IHandlerService

use of org.eclipse.ui.handlers.IHandlerService in project tdq-studio-se by Talend.

the class PatternTestView method activateContext.

/**
 * Activate a context that this view uses. It will be tied to this view activation events and will be removed when
 * the view is disposed.
 */
private void activateContext() {
    IContextService contextService = (IContextService) getSite().getService(IContextService.class);
    contextService.activateContext(VIEW_CONTEXT_ID);
    TestRegularAction testRegularAction = new TestRegularAction();
    IHandlerService service = (IHandlerService) getViewSite().getService(IHandlerService.class);
    service.activateHandler(testRegularAction.getActionDefinitionId(), new ActionHandler(testRegularAction));
}
Also used : IHandlerService(org.eclipse.ui.handlers.IHandlerService) IContextService(org.eclipse.ui.contexts.IContextService) ActionHandler(org.eclipse.jface.commands.ActionHandler)

Example 22 with IHandlerService

use of org.eclipse.ui.handlers.IHandlerService in project polymap4-core by Polymap4.

the class CommonNavigatorActionGroup method makeActions.

/**
 */
private void makeActions() {
    FrameList frameList = commonViewer.getFrameList();
    backAction = new BackAction(frameList);
    forwardAction = new ForwardAction(frameList);
    upAction = new UpAction(frameList);
    frameList.addPropertyChangeListener(new IPropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent event) {
            if (event.getProperty().equals(FrameList.P_RESET)) {
                upAction.setEnabled(false);
                backAction.setEnabled(false);
                forwardAction.setEnabled(false);
            }
            commonNavigator.updateTitle();
            IActionBars actionBars = commonNavigator.getViewSite().getActionBars();
            updateToolBar(actionBars.getToolBarManager());
        }
    });
    IHandlerService service = (IHandlerService) commonNavigator.getSite().getService(IHandlerService.class);
    INavigatorViewerDescriptor viewerDescriptor = commonViewer.getNavigatorContentService().getViewerDescriptor();
    boolean hideLinkWithEditorAction = viewerDescriptor.getBooleanConfigProperty(INavigatorViewerDescriptor.PROP_HIDE_LINK_WITH_EDITOR_ACTION);
    if (!hideLinkWithEditorAction) {
        toggleLinkingAction = new LinkEditorAction(commonNavigator, commonViewer, linkHelperService);
        // $NON-NLS-1$
        ImageDescriptor syncIcon = getImageDescriptor("elcl16/synced.gif");
        toggleLinkingAction.setImageDescriptor(syncIcon);
        toggleLinkingAction.setHoverImageDescriptor(syncIcon);
        service.activateHandler(toggleLinkingAction.getActionDefinitionId(), new ActionHandler(toggleLinkingAction));
    }
    boolean hideCollapseAllAction = viewerDescriptor.getBooleanConfigProperty(INavigatorViewerDescriptor.PROP_HIDE_COLLAPSE_ALL_ACTION);
    if (!hideCollapseAllAction) {
        collapseAllAction = new CollapseAllAction(commonViewer);
        // $NON-NLS-1$
        ImageDescriptor collapseAllIcon = getImageDescriptor("elcl16/collapseall.gif");
        collapseAllAction.setImageDescriptor(collapseAllIcon);
        collapseAllAction.setHoverImageDescriptor(collapseAllIcon);
        collapseAllHandler = new CollapseAllHandler(commonViewer);
        service.activateHandler(CollapseAllHandler.COMMAND_ID, collapseAllHandler);
    }
    filterGroup = new FilterActionGroup(commonViewer);
}
Also used : IPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) PropertyChangeEvent(org.eclipse.jface.util.PropertyChangeEvent) UpAction(org.eclipse.ui.internal.navigator.framelist.UpAction) FrameList(org.eclipse.ui.internal.navigator.framelist.FrameList) CollapseAllHandler(org.eclipse.ui.handlers.CollapseAllHandler) LinkEditorAction(org.eclipse.ui.internal.navigator.actions.LinkEditorAction) INavigatorViewerDescriptor(org.eclipse.ui.navigator.INavigatorViewerDescriptor) FilterActionGroup(org.eclipse.ui.internal.navigator.filters.FilterActionGroup) IHandlerService(org.eclipse.ui.handlers.IHandlerService) CollapseAllAction(org.eclipse.ui.internal.navigator.actions.CollapseAllAction) ForwardAction(org.eclipse.ui.internal.navigator.framelist.ForwardAction) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) BackAction(org.eclipse.ui.internal.navigator.framelist.BackAction) ActionHandler(org.eclipse.jface.commands.ActionHandler) IActionBars(org.eclipse.ui.IActionBars)

Example 23 with IHandlerService

use of org.eclipse.ui.handlers.IHandlerService in project netxms by netxms.

the class AbstractTraceWidget method createActions.

/**
 * Create actions
 */
protected void createActions() {
    final IHandlerService handlerService = (IHandlerService) PlatformUI.getWorkbench().getService(IHandlerService.class);
    actionPause = new Action(Messages.get().AbstractTraceView_Pause, Action.AS_CHECK_BOX) {

        @Override
        public void run() {
            setPaused(actionPause.isChecked());
        }
    };
    // $NON-NLS-1$
    actionPause.setImageDescriptor(Activator.getImageDescriptor("icons/pause.png"));
    // $NON-NLS-1$
    actionPause.setActionDefinitionId("org.netxms.ui.eclipse.library.commands.pause_trace");
    final ActionHandler pauseHandler = new ActionHandler(actionPause);
    handlerService.activateHandler(actionPause.getActionDefinitionId(), pauseHandler);
}
Also used : Action(org.eclipse.jface.action.Action) IHandlerService(org.eclipse.ui.handlers.IHandlerService) ActionHandler(org.eclipse.jface.commands.ActionHandler)

Example 24 with IHandlerService

use of org.eclipse.ui.handlers.IHandlerService in project netxms by netxms.

the class RepositoryManager method createActions.

/**
 * Create actions
 */
private void createActions() {
    final IHandlerService handlerService = (IHandlerService) getSite().getService(IHandlerService.class);
    actionRefresh = new RefreshAction(this) {

        @Override
        public void run() {
            refreshRepositoryList();
        }
    };
    actionShowFilter = new Action("Show &filter", Action.AS_CHECK_BOX) {

        @Override
        public void run() {
            enableFilter(!filterEnabled);
            actionShowFilter.setChecked(filterEnabled);
        }
    };
    actionShowFilter.setChecked(filterEnabled);
    // $NON-NLS-1$
    actionShowFilter.setActionDefinitionId("org.netxms.ui.eclipse.market.commands.showFilter");
    handlerService.activateHandler(actionShowFilter.getActionDefinitionId(), new ActionHandler(actionShowFilter));
    actionAddRepository = new Action("&Add repository...", SharedIcons.ADD_OBJECT) {

        @Override
        public void run() {
            addRepository();
        }
    };
    actionDelete = new Action("&Delete", SharedIcons.DELETE_OBJECT) {

        @Override
        public void run() {
            deleteRepository();
        }
    };
    actionMark = new Action("&Mark for installation") {

        @Override
        public void run() {
            markForInstallation(true);
        }
    };
    // $NON-NLS-1$
    actionMark.setActionDefinitionId("org.netxms.ui.eclipse.market.commands.mark");
    handlerService.activateHandler(actionMark.getActionDefinitionId(), new ActionHandler(actionMark));
    actionUnmark = new Action("&Unmark for installation") {

        @Override
        public void run() {
            markForInstallation(false);
        }
    };
    // $NON-NLS-1$
    actionUnmark.setActionDefinitionId("org.netxms.ui.eclipse.market.commands.unmark");
    handlerService.activateHandler(actionUnmark.getActionDefinitionId(), new ActionHandler(actionUnmark));
    actionInstall = new Action("&Install", Activator.getImageDescriptor("icons/install.gif")) {

        @Override
        public void run() {
            install();
        }
    };
    // $NON-NLS-1$
    actionInstall.setActionDefinitionId("org.netxms.ui.eclipse.market.commands.install");
    handlerService.activateHandler(actionInstall.getActionDefinitionId(), new ActionHandler(actionInstall));
}
Also used : Action(org.eclipse.jface.action.Action) RefreshAction(org.netxms.ui.eclipse.actions.RefreshAction) IHandlerService(org.eclipse.ui.handlers.IHandlerService) RefreshAction(org.netxms.ui.eclipse.actions.RefreshAction) ActionHandler(org.eclipse.jface.commands.ActionHandler)

Example 25 with IHandlerService

use of org.eclipse.ui.handlers.IHandlerService in project netxms by netxms.

the class TunnelManager method createActions.

/**
 * Create actions
 */
private void createActions() {
    actionRefresh = new RefreshAction(this) {

        @Override
        public void run() {
            refresh();
        }
    };
    actionCreateNode = new Action("&Create node and bind...") {

        @Override
        public void run() {
            createNode();
        }
    };
    actionBind = new Action("&Bind to...") {

        @Override
        public void run() {
            bindTunnel();
        }
    };
    actionUnbind = new Action("&Unbind") {

        @Override
        public void run() {
            unbindTunnel();
        }
    };
    actionShowFilter = new Action("&Show filter") {

        /*
          * (non-Javadoc)
          * 
          * @see org.eclipse.jface.action.Action#run()
          */
        @Override
        public void run() {
            enableFilter(actionShowFilter.isChecked());
        }
    };
    actionShowFilter.setImageDescriptor(SharedIcons.FILTER);
    actionShowFilter.setChecked(initShowfilter);
    // $NON-NLS-1$
    actionShowFilter.setActionDefinitionId("org.netxms.ui.eclipse.agentmanager.commands.show_filter");
    final IHandlerService handlerService = (IHandlerService) getSite().getService(IHandlerService.class);
    handlerService.activateHandler(actionShowFilter.getActionDefinitionId(), new ActionHandler(actionShowFilter));
}
Also used : Action(org.eclipse.jface.action.Action) RefreshAction(org.netxms.ui.eclipse.actions.RefreshAction) RefreshAction(org.netxms.ui.eclipse.actions.RefreshAction) IHandlerService(org.eclipse.ui.handlers.IHandlerService) ActionHandler(org.eclipse.jface.commands.ActionHandler)

Aggregations

IHandlerService (org.eclipse.ui.handlers.IHandlerService)107 ActionHandler (org.eclipse.jface.commands.ActionHandler)45 Action (org.eclipse.jface.action.Action)41 RefreshAction (org.netxms.ui.eclipse.actions.RefreshAction)25 IEvaluationContext (org.eclipse.core.expressions.IEvaluationContext)19 Command (org.eclipse.core.commands.Command)18 ICommandService (org.eclipse.ui.commands.ICommandService)18 ExecutionEvent (org.eclipse.core.commands.ExecutionEvent)16 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)15 AbstractHandler (org.eclipse.core.commands.AbstractHandler)11 ParameterizedCommand (org.eclipse.core.commands.ParameterizedCommand)10 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)10 SelectionEvent (org.eclipse.swt.events.SelectionEvent)10 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)10 EvaluationContext (org.eclipse.core.expressions.EvaluationContext)9 IHandler (org.eclipse.core.commands.IHandler)8 IAction (org.eclipse.jface.action.IAction)8 GridLayout (org.eclipse.swt.layout.GridLayout)8 IContextService (org.eclipse.ui.contexts.IContextService)8 ArrayList (java.util.ArrayList)7