Search in sources :

Example 36 with ActionHandler

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

the class AlarmCategoryConfigurator method createActions.

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

        /*
          * (non-Javadoc)
          * 
          * @see org.eclipse.jface.action.Action#run()
          */
        @Override
        public void run() {
            dataView.refreshView();
        }
    };
    actionShowFilter = new Action() {

        /*
          * (non-Javadoc)
          * 
          * @see org.eclipse.jface.action.Action#run()
          */
        @Override
        public void run() {
            enableFilter(actionShowFilter.isChecked());
        }
    };
    actionShowFilter.setText("Show filter");
    actionShowFilter.setImageDescriptor(SharedIcons.FILTER);
    actionShowFilter.setChecked(initShowfilter);
    // $NON-NLS-1$
    actionShowFilter.setActionDefinitionId("org.netxms.ui.eclipse.alarmviewer.commands.show_filter_alarm_category");
    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)

Example 37 with ActionHandler

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

the class ScreenshotView method createActions.

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

        @Override
        public void run() {
            refresh();
        }
    };
    actionSave = new Action(Messages.get().ScreenshotView_Save, SharedIcons.SAVE) {

        @Override
        public void run() {
            saveImage();
        }
    };
    // $NON-NLS-1$
    actionSave.setActionDefinitionId("org.netxms.ui.eclipse.agentmanager.commands.save_screenshot");
    handlerService.activateHandler(actionSave.getActionDefinitionId(), new ActionHandler(actionSave));
    actionSave.setEnabled(false);
}
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 38 with ActionHandler

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

the class AbstractCommandResults method createActions.

/**
 * Create actions
 */
protected void createActions() {
    final IHandlerService handlerService = (IHandlerService) getSite().getService(IHandlerService.class);
    actionClear = new Action(Messages.get().LocalCommandResults_ClearConsole, SharedIcons.CLEAR_LOG) {

        @Override
        public void run() {
            console.clear();
        }
    };
    // $NON-NLS-1$
    actionClear.setActionDefinitionId("org.netxms.ui.eclipse.objecttools.commands.clear_output");
    handlerService.activateHandler(actionClear.getActionDefinitionId(), new ActionHandler(actionClear));
    actionScrollLock = new Action(Messages.get().LocalCommandResults_ScrollLock, Action.AS_CHECK_BOX) {

        @Override
        public void run() {
            console.setAutoScroll(!actionScrollLock.isChecked());
        }
    };
    // $NON-NLS-1$
    actionScrollLock.setImageDescriptor(Activator.getImageDescriptor("icons/scroll_lock.gif"));
    actionScrollLock.setChecked(false);
    // $NON-NLS-1$
    actionScrollLock.setActionDefinitionId("org.netxms.ui.eclipse.objecttools.commands.scroll_lock");
    handlerService.activateHandler(actionScrollLock.getActionDefinitionId(), new ActionHandler(actionScrollLock));
    actionCopy = new Action(Messages.get().LocalCommandResults_Copy) {

        @Override
        public void run() {
            console.copy();
        }
    };
    actionCopy.setEnabled(false);
    // $NON-NLS-1$
    actionCopy.setActionDefinitionId("org.netxms.ui.eclipse.objecttools.commands.copy");
    handlerService.activateHandler(actionCopy.getActionDefinitionId(), new ActionHandler(actionCopy));
    actionSelectAll = new Action(Messages.get().LocalCommandResults_SelectAll) {

        @Override
        public void run() {
            console.selectAll();
        }
    };
    // $NON-NLS-1$
    actionSelectAll.setActionDefinitionId("org.netxms.ui.eclipse.objecttools.commands.select_all");
    handlerService.activateHandler(actionSelectAll.getActionDefinitionId(), new ActionHandler(actionSelectAll));
}
Also used : Action(org.eclipse.jface.action.Action) IHandlerService(org.eclipse.ui.handlers.IHandlerService) ActionHandler(org.eclipse.jface.commands.ActionHandler)

Example 39 with ActionHandler

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

the class NodePollerView method createActions.

/**
 * Create actions
 */
private void createActions() {
    final IHandlerService handlerService = (IHandlerService) getSite().getService(IHandlerService.class);
    actionRestart = new Action(Messages.get().NodePollerView_ActionRestart, SharedIcons.RESTART) {

        @Override
        public void run() {
            startPoll();
        }
    };
    // $NON-NLS-1$
    actionRestart.setActionDefinitionId("org.netxms.ui.eclipse.objectmanager.commands.restart_poller");
    handlerService.activateHandler(actionRestart.getActionDefinitionId(), new ActionHandler(actionRestart));
    actionClearOutput = new Action(Messages.get().NodePollerView_ActionClear, SharedIcons.CLEAR_LOG) {

        @Override
        public void run() {
            // $NON-NLS-1$
            textArea.setText("");
        }
    };
    // $NON-NLS-1$
    actionClearOutput.setActionDefinitionId("org.netxms.ui.eclipse.objectmanager.commands.clear_output");
    handlerService.activateHandler(actionClearOutput.getActionDefinitionId(), new ActionHandler(actionClearOutput));
}
Also used : Action(org.eclipse.jface.action.Action) IHandlerService(org.eclipse.ui.handlers.IHandlerService) ActionHandler(org.eclipse.jface.commands.ActionHandler)

Example 40 with ActionHandler

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

the class ObjectToolsEditor method createActions.

/**
 * Create actions
 */
private void createActions() {
    final IHandlerService handlerService = (IHandlerService) getSite().getService(IHandlerService.class);
    actionShowFilter = new Action("Show filter", Action.AS_CHECK_BOX) {

        @Override
        public void run() {
            enableFilter(!initShowFilter);
            actionShowFilter.setChecked(initShowFilter);
        }
    };
    actionShowFilter.setChecked(initShowFilter);
    // $NON-NLS-1$
    actionShowFilter.setActionDefinitionId("org.netxms.ui.eclipse.objecttools.commands.showFilter");
    handlerService.activateHandler(actionShowFilter.getActionDefinitionId(), new ActionHandler(actionShowFilter));
    actionRefresh = new RefreshAction() {

        @Override
        public void run() {
            refreshToolList();
        }
    };
    actionNew = new Action(Messages.get().ObjectToolsEditor_New) {

        @Override
        public void run() {
            createTool();
        }
    };
    actionNew.setImageDescriptor(SharedIcons.ADD_OBJECT);
    actionEdit = new PropertyDialogAction(getSite(), viewer) {

        @Override
        public void run() {
            IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
            if (selection.size() != 1)
                return;
            final long toolId = ((ObjectTool) selection.getFirstElement()).getId();
            // If there will be error, adapter factory will show error message to user
            if (Platform.getAdapterManager().getAdapter(selection.getFirstElement(), ObjectToolDetails.class) == null)
                return;
            super.run();
            ObjectToolDetails details = ObjectToolsAdapterFactory.getDetailsFromCache(toolId);
            if ((details != null) && details.isModified()) {
                saveObjectTool(details);
            }
        }
    };
    actionEdit.setImageDescriptor(SharedIcons.EDIT);
    actionDelete = new Action(Messages.get().ObjectToolsEditor_Delete) {

        @Override
        public void run() {
            deleteTools();
        }
    };
    actionDelete.setImageDescriptor(SharedIcons.DELETE_OBJECT);
    actionDisable = new Action(Messages.get().ObjectToolsEditor_Disable) {

        @Override
        public void run() {
            setSelectedDisabled();
        }
    };
    actionEnable = new Action(Messages.get().ObjectToolsEditor_Enable) {

        @Override
        public void run() {
            setSelectedEnabled();
        }
    };
    actionClone = new Action(Messages.get().ObjectToolsEditor_Clone) {

        @Override
        public void run() {
            cloneTool();
        }
    };
}
Also used : PropertyDialogAction(org.eclipse.ui.dialogs.PropertyDialogAction) RefreshAction(org.netxms.ui.eclipse.actions.RefreshAction) Action(org.eclipse.jface.action.Action) IHandlerService(org.eclipse.ui.handlers.IHandlerService) RefreshAction(org.netxms.ui.eclipse.actions.RefreshAction) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ActionHandler(org.eclipse.jface.commands.ActionHandler) ObjectToolDetails(org.netxms.client.objecttools.ObjectToolDetails) PropertyDialogAction(org.eclipse.ui.dialogs.PropertyDialogAction)

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