Search in sources :

Example 6 with ActionHandler

use of org.eclipse.jface.commands.ActionHandler 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 7 with ActionHandler

use of org.eclipse.jface.commands.ActionHandler 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 8 with ActionHandler

use of org.eclipse.jface.commands.ActionHandler 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)

Example 9 with ActionHandler

use of org.eclipse.jface.commands.ActionHandler in project netxms by netxms.

the class EventProcessingPolicyEditor method createActions.

/**
 * Create actions
 */
private void createActions() {
    final IHandlerService handlerService = (IHandlerService) getSite().getService(IHandlerService.class);
    actionHorizontal = new Action(Messages.get().EventProcessingPolicyEditor_LayoutH, Action.AS_RADIO_BUTTON) {

        @Override
        public void run() {
            verticalLayout = false;
            updateLayout();
        }
    };
    actionHorizontal.setChecked(!verticalLayout);
    // $NON-NLS-1$
    actionHorizontal.setImageDescriptor(Activator.getImageDescriptor("icons/h_layout.gif"));
    actionVertical = new Action(Messages.get().EventProcessingPolicyEditor_LayoutV, Action.AS_RADIO_BUTTON) {

        @Override
        public void run() {
            verticalLayout = true;
            updateLayout();
        }
    };
    actionVertical.setChecked(verticalLayout);
    // $NON-NLS-1$
    actionVertical.setImageDescriptor(Activator.getImageDescriptor("icons/v_layout.gif"));
    actionSave = new Action(Messages.get().EventProcessingPolicyEditor_Save) {

        @Override
        public void run() {
            savePolicy();
        }
    };
    actionSave.setImageDescriptor(SharedIcons.SAVE);
    actionSave.setEnabled(false);
    actionCollapseAll = new Action(Messages.get().EventProcessingPolicyEditor_CollapseAll) {

        @Override
        public void run() {
            setAllRulesCollapsed(true);
        }
    };
    actionCollapseAll.setImageDescriptor(SharedIcons.COLLAPSE_ALL);
    actionExpandAll = new Action(Messages.get().EventProcessingPolicyEditor_ExpandAll) {

        @Override
        public void run() {
            setAllRulesCollapsed(false);
        }
    };
    actionExpandAll.setImageDescriptor(SharedIcons.EXPAND_ALL);
    actionDelete = new Action(Messages.get().EventProcessingPolicyEditor_Delete) {

        @Override
        public void run() {
            deleteSelectedRules();
        }
    };
    actionDelete.setImageDescriptor(SharedIcons.DELETE_OBJECT);
    actionDelete.setEnabled(false);
    actionInsertBefore = new Action(Messages.get().EventProcessingPolicyEditor_InsertBefore) {

        @Override
        public void run() {
            insertRule(lastSelectedRule - 1);
        }
    };
    actionInsertAfter = new Action(Messages.get().EventProcessingPolicyEditor_InsertAfter) {

        @Override
        public void run() {
            insertRule(lastSelectedRule);
        }
    };
    actionCut = new Action(Messages.get().EventProcessingPolicyEditor_Cut) {

        @Override
        public void run() {
            cutRules();
        }
    };
    actionCut.setImageDescriptor(SharedIcons.CUT);
    actionCut.setEnabled(false);
    actionCopy = new Action(Messages.get().EventProcessingPolicyEditor_Copy) {

        @Override
        public void run() {
            copyRules();
        }
    };
    actionCopy.setImageDescriptor(SharedIcons.COPY);
    actionCopy.setEnabled(false);
    actionPaste = new Action(Messages.get().EventProcessingPolicyEditor_Paste) {

        @Override
        public void run() {
            pasteRules();
        }
    };
    actionPaste.setImageDescriptor(SharedIcons.PASTE);
    actionPaste.setEnabled(false);
    actionEnableRule = new Action(Messages.get().EventProcessingPolicyEditor_Enable) {

        @Override
        public void run() {
            enableRules(true);
        }
    };
    actionDisableRule = new Action(Messages.get().EventProcessingPolicyEditor_Disable) {

        @Override
        public void run() {
            enableRules(false);
        }
    };
    actionShowFilter = new Action(Messages.get().EventProcessingPolicyEditor_ShowFilter, Action.AS_CHECK_BOX) {

        @Override
        public void run() {
            enableFilter(actionShowFilter.isChecked());
        }
    };
    actionAddRule = new Action("&Add new rule") {

        @Override
        public void run() {
            insertRule(ruleEditors.size());
        }
    };
    actionAddRule.setImageDescriptor(SharedIcons.ADD_OBJECT);
    actionShowFilter.setChecked(filterEnabled);
    // $NON-NLS-1$
    actionShowFilter.setActionDefinitionId("org.netxms.ui.eclipse.epp.commands.show_rule_filter");
    final ActionHandler showFilterHandler = new ActionHandler(actionShowFilter);
    handlerService.activateHandler(actionShowFilter.getActionDefinitionId(), showFilterHandler);
}
Also used : ServerAction(org.netxms.client.ServerAction) Action(org.eclipse.jface.action.Action) IHandlerService(org.eclipse.ui.handlers.IHandlerService) ActionHandler(org.eclipse.jface.commands.ActionHandler)

Example 10 with ActionHandler

use of org.eclipse.jface.commands.ActionHandler in project netxms by netxms.

the class LastValues method createActions.

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

        @Override
        public void run() {
            dataView.refresh();
        }
    };
    actionAutoUpdate = new Action(Messages.get().LastValues_AutoRefresh, Action.AS_CHECK_BOX) {

        @Override
        public void run() {
            dataView.setAutoRefreshEnabled(actionAutoUpdate.isChecked());
        }
    };
    actionAutoUpdate.setChecked(dataView.isAutoRefreshEnabled());
    actionShowFilter = new Action(Messages.get().LastValues_ShowFilter, Action.AS_CHECK_BOX) {

        @Override
        public void run() {
            dataView.enableFilter(!dataView.isFilterEnabled());
            actionShowFilter.setChecked(dataView.isFilterEnabled());
        }
    };
    actionShowFilter.setImageDescriptor(SharedIcons.FILTER);
    actionShowFilter.setChecked(initShowFilter);
    // $NON-NLS-1$
    actionShowFilter.setActionDefinitionId("org.netxms.ui.eclipse.datacollection.commands.show_dci_filter");
    handlerService.activateHandler(actionShowFilter.getActionDefinitionId(), new ActionHandler(actionShowFilter));
}
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)

Aggregations

ActionHandler (org.eclipse.jface.commands.ActionHandler)47 IHandlerService (org.eclipse.ui.handlers.IHandlerService)45 Action (org.eclipse.jface.action.Action)36 RefreshAction (org.netxms.ui.eclipse.actions.RefreshAction)23 IAction (org.eclipse.jface.action.IAction)6 IContextService (org.eclipse.ui.contexts.IContextService)5 ExportToCsvAction (org.netxms.ui.eclipse.actions.ExportToCsvAction)5 ArrayList (java.util.ArrayList)3 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)3 FocusEvent (org.eclipse.swt.events.FocusEvent)3 FocusListener (org.eclipse.swt.events.FocusListener)3 ActiveShellExpression (org.eclipse.ui.ActiveShellExpression)3 IHandlerActivation (org.eclipse.ui.handlers.IHandlerActivation)3 IActionBars (org.eclipse.ui.IActionBars)2 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)2 ServerAction (org.netxms.client.ServerAction)2 BorderColorAction (com.archimatetool.editor.diagram.actions.BorderColorAction)1 BringForwardAction (com.archimatetool.editor.diagram.actions.BringForwardAction)1 BringToFrontAction (com.archimatetool.editor.diagram.actions.BringToFrontAction)1 ConnectionLineWidthAction (com.archimatetool.editor.diagram.actions.ConnectionLineWidthAction)1