Search in sources :

Example 36 with IHandlerService

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

the class ScriptLibrary method createActions.

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

        @Override
        public void run() {
            refreshScriptList();
        }
    };
    actionNew = new // $NON-NLS-1$
    Action(// $NON-NLS-1$
    Messages.get().ScriptLibrary_New, // $NON-NLS-1$
    Activator.getImageDescriptor("icons/new.png")) {

        @Override
        public void run() {
            createNewScript();
        }
    };
    actionEdit = new // $NON-NLS-1$
    Action(// $NON-NLS-1$
    Messages.get().ScriptLibrary_Edit, // $NON-NLS-1$
    Activator.getImageDescriptor("icons/edit.png")) {

        @Override
        public void run() {
            editScript();
        }
    };
    actionEdit.setEnabled(false);
    actionRename = new Action(Messages.get().ScriptLibrary_Rename) {

        @Override
        public void run() {
            renameScript();
        }
    };
    actionRename.setEnabled(false);
    actionDelete = new // $NON-NLS-1$
    Action(// $NON-NLS-1$
    Messages.get().ScriptLibrary_Delete, // $NON-NLS-1$
    Activator.getImageDescriptor("icons/delete.png")) {

        @Override
        public void run() {
            deleteScript();
        }
    };
    actionDelete.setEnabled(false);
    actionCopyName = new Action("Copy name", SharedIcons.COPY) {

        @Override
        public void run() {
            copyNameToClipboard();
        }
    };
    actionCopyName.setActionDefinitionId("org.netxms.ui.eclipse.nxsl.commands.CopyNameToClipboard");
    handlerService.activateHandler(actionCopyName.getActionDefinitionId(), new ActionHandler(actionCopyName));
}
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.ui.commands.ActionHandler)

Example 37 with IHandlerService

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

the class ObjectFinder method createActions.

/**
 * Create actions
 */
private void createActions() {
    final IHandlerService handlerService = (IHandlerService) getSite().getService(IHandlerService.class);
    actionStartSearch = new Action("&Search", Activator.getImageDescriptor("icons/find.gif")) {

        @Override
        public void run() {
            startSearch();
        }
    };
    // $NON-NLS-1$
    actionStartSearch.setId("org.netxms.ui.eclipse.objectbrowser.actions.startSearch");
    // $NON-NLS-1$
    actionStartSearch.setActionDefinitionId("org.netxms.ui.eclipse.objectbrowser.commands.start_search");
    final ActionHandler showFilterHandler = new ActionHandler(actionStartSearch);
    handlerService.activateHandler(actionStartSearch.getActionDefinitionId(), showFilterHandler);
    actionShowObjectDetails = new Action("Show object details") {

        @Override
        public void run() {
            showObjectDetails();
        }
    };
}
Also used : Action(org.eclipse.jface.action.Action) IHandlerService(org.eclipse.ui.handlers.IHandlerService) ActionHandler(org.eclipse.jface.commands.ActionHandler)

Example 38 with IHandlerService

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

the class WorldMap method createActions.

/* (non-Javadoc)
	 * @see org.netxms.ui.eclipse.osm.views.AbstractGeolocationView#createActions()
	 */
@Override
protected void createActions() {
    super.createActions();
    actionPlaceObject = new Action(Messages.get().WorldMap_PlaceObject) {

        /* (non-Javadoc)
			 * @see org.eclipse.jface.action.Action#run()
			 */
        @Override
        public void run() {
            placeObject();
        }
    };
    actionShowFilter = new Action("Show filter", Action.AS_CHECK_BOX) {

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

Example 39 with IHandlerService

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

the class PredefinedGraphTree method createActions.

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

        @Override
        public void run() {
            reloadGraphList();
        }
    };
    actionDelete = new Action(Messages.get().PredefinedGraphTree_Delete, SharedIcons.DELETE_OBJECT) {

        @Override
        public void run() {
            deletePredefinedGraph();
        }
    };
    actionOpen = new Action() {

        @SuppressWarnings("rawtypes")
        @Override
        public void run() {
            IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
            Iterator it = selection.iterator();
            while (it.hasNext()) {
                Object o = it.next();
                if (o instanceof GraphSettings) {
                    showPredefinedGraph((GraphSettings) o);
                }
            }
        }
    };
    actionOpen.setText(Messages.get().PredefinedGraphTree_Open);
    actionProperties = new Action(Messages.get().PredefinedGraphTree_Properties) {

        @Override
        public void run() {
            editPredefinedGraph();
        }
    };
    actionShowFilter = new Action(Messages.get().PredefinedGraphTree_ShowFilter, Action.AS_CHECK_BOX) {

        @Override
        public void run() {
            enableFilter(!initShowFilter);
            actionShowFilter.setChecked(initShowFilter);
        }
    };
    // $NON-NLS-1$
    actionShowFilter.setId("org.netxms.ui.eclipse.perfview.actions.showFilter");
    actionShowFilter.setChecked(initShowFilter);
    // $NON-NLS-1$
    actionShowFilter.setActionDefinitionId("org.netxms.ui.eclipse.perfview.commands.show_graph_filter");
    final ActionHandler showFilterHandler = new ActionHandler(actionShowFilter);
    handlerService.activateHandler(actionShowFilter.getActionDefinitionId(), showFilterHandler);
}
Also used : 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) GraphSettings(org.netxms.client.datacollection.GraphSettings) Iterator(java.util.Iterator) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ActionHandler(org.eclipse.jface.commands.ActionHandler)

Example 40 with IHandlerService

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

the class ScheduledTaskView method createActions.

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

        @Override
        public void run() {
            refresh();
        }
    };
    actionCreate = new Action("New scheduled task...", SharedIcons.ADD_OBJECT) {

        @Override
        public void run() {
            createTask();
        }
    };
    // $NON-NLS-1$
    actionCreate.setActionDefinitionId("org.netxms.ui.eclipse.serverconfig.commands.new_task");
    handlerService.activateHandler(actionCreate.getActionDefinitionId(), new ActionHandler(actionCreate));
    actionEdit = new Action("Edit...", SharedIcons.EDIT) {

        @Override
        public void run() {
            editTask();
        }
    };
    // $NON-NLS-1$
    actionEdit.setActionDefinitionId("org.netxms.ui.eclipse.serverconfig.commands.edit_task");
    handlerService.activateHandler(actionEdit.getActionDefinitionId(), new ActionHandler(actionEdit));
    actionDelete = new Action("Delete", SharedIcons.DELETE_OBJECT) {

        @Override
        public void run() {
            deleteTask();
        }
    };
    actionDisable = new Action("Disable") {

        @Override
        public void run() {
            setScheduledTaskEnabled(false);
        }
    };
    // $NON-NLS-1$
    actionDisable.setActionDefinitionId("org.netxms.ui.eclipse.serverconfig.commands.disable_task");
    handlerService.activateHandler(actionDisable.getActionDefinitionId(), new ActionHandler(actionDisable));
    actionEnable = new Action("Enable") {

        @Override
        public void run() {
            setScheduledTaskEnabled(true);
        }
    };
    // $NON-NLS-1$
    actionEnable.setActionDefinitionId("org.netxms.ui.eclipse.serverconfig.commands.enable_task");
    handlerService.activateHandler(actionEnable.getActionDefinitionId(), new ActionHandler(actionEnable));
    actionReschedule = new Action("Reschedule...", SharedIcons.EXECUTE) {

        @Override
        public void run() {
            rescheduleTask();
        }
    };
    // $NON-NLS-1$
    actionReschedule.setActionDefinitionId("org.netxms.ui.eclipse.serverconfig.commands.reschedule_task");
    handlerService.activateHandler(actionReschedule.getActionDefinitionId(), new ActionHandler(actionReschedule));
}
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

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