Search in sources :

Example 21 with ActionHandler

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

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

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

Example 24 with ActionHandler

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

the class ExportFileBuilder method createActions.

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

        @Override
        public void run() {
            save();
        }
    };
    // $NON-NLS-1$
    actionSave.setActionDefinitionId("org.netxms.ui.eclipse.serverconfig.commands.save_exported_config");
    handlerService.activateHandler(actionSave.getActionDefinitionId(), new ActionHandler(actionSave));
    actionPublish = new Action("&Publish...", Activator.getImageDescriptor("icons/publish.gif")) {

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

use of org.eclipse.jface.commands.ActionHandler in project tdi-studio-se by Talend.

the class BindingActions method registerActions.

/**
     * DOC smallet Comment method "registerActions".
     */
private void registerActions() {
    IContextService contextService = (IContextService) PlatformUI.getWorkbench().getAdapter(IContextService.class);
    //$NON-NLS-1$
    contextService.activateContext("talend.global");
    IWorkbench workbench = PlatformUI.getWorkbench();
    IHandlerService handlerService = (IHandlerService) workbench.getService(IHandlerService.class);
    IHandler handler;
    for (IAction action : actions) {
        handler = new ActionHandler(action);
        handlerService.activateHandler(action.getActionDefinitionId(), handler);
    }
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) IHandlerService(org.eclipse.ui.handlers.IHandlerService) IAction(org.eclipse.jface.action.IAction) IHandler(org.eclipse.core.commands.IHandler) IContextService(org.eclipse.ui.contexts.IContextService) 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