Search in sources :

Example 16 with ActionHandler

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

the class ServerFileManager method createActions.

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

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

        @Override
        public void run() {
            createFile();
        }
    };
    actionNew.setImageDescriptor(SharedIcons.ADD_OBJECT);
    actionDelete = new Action(Messages.get().ViewServerFile_DeleteFileOnServerAction) {

        @Override
        public void run() {
            deleteFile();
        }
    };
    actionDelete.setImageDescriptor(SharedIcons.DELETE_OBJECT);
    actionShowFilter = new Action(Messages.get().ViewServerFile_ShowFilterAction, Action.AS_CHECK_BOX) {

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

Example 17 with ActionHandler

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

the class LogViewer method createActions.

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

        @Override
        public void run() {
            refreshData();
        }
    };
    actionRefresh.setEnabled(false);
    actionExecute = new Action(Messages.get().LogViewer_ActionExec, SharedIcons.EXECUTE) {

        @Override
        public void run() {
            doQuery();
        }
    };
    // $NON-NLS-1$
    actionExecute.setActionDefinitionId("org.netxms.ui.eclipse.logviewer.commands.execute");
    handlerService.activateHandler(actionExecute.getActionDefinitionId(), new ActionHandler(actionExecute));
    actionClearFilter = new Action(Messages.get().LogViewer_ActionClearFilter, SharedIcons.CLEAR_LOG) {

        @Override
        public void run() {
            filterBuilder.clearFilter();
        }
    };
    actionGetMoreData = new // $NON-NLS-1$
    Action(// $NON-NLS-1$
    Messages.get().LogViewer_ActionGetMoreData, // $NON-NLS-1$
    Activator.getImageDescriptor("icons/get_more_data.png")) {

        @Override
        public void run() {
            getMoreData();
        }
    };
    actionGetMoreData.setEnabled(false);
    // $NON-NLS-1$
    actionGetMoreData.setActionDefinitionId("org.netxms.ui.eclipse.logviewer.commands.get_more_data");
    handlerService.activateHandler(actionGetMoreData.getActionDefinitionId(), new ActionHandler(actionGetMoreData));
    actionShowFilter = new Action(Messages.get().LogViewer_ActionShowFilter, Action.AS_CHECK_BOX) {

        @Override
        public void run() {
            showFilter(actionShowFilter.isChecked());
        }
    };
    actionShowFilter.setChecked(true);
    // $NON-NLS-1$
    actionShowFilter.setActionDefinitionId("org.netxms.ui.eclipse.logviewer.commands.show_filter");
    handlerService.activateHandler(actionShowFilter.getActionDefinitionId(), new ActionHandler(actionShowFilter));
    actionExportToCsv = new ExportToCsvAction(this, viewer, true);
    actionExportAllToCsv = new ExportToCsvAction(this, viewer, false);
}
Also used : ExportToCsvAction(org.netxms.ui.eclipse.actions.ExportToCsvAction) 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) ActionHandler(org.eclipse.jface.commands.ActionHandler) ExportToCsvAction(org.netxms.ui.eclipse.actions.ExportToCsvAction)

Example 18 with ActionHandler

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

the class ExtendedGraphViewer method createZoomActions.

/**
 * Create zoom actions
 * @return
 */
public Action[] createZoomActions(IHandlerService handlerService) {
    final ZoomManager zoomManager = getZoomManager();
    final Action[] actions = new Action[zoomLevels.length];
    for (int i = 0; i < zoomLevels.length; i++) {
        actions[i] = new ZoomAction(zoomLevels[i], zoomManager);
        if (zoomLevels[i] == 1.00) {
            actions[i].setChecked(true);
            // $NON-NLS-1$
            actions[i].setId("org.netxms.ui.eclipse.networkmaps.localActions.AbstractMap.Zoom100Pct");
            // $NON-NLS-1$
            actions[i].setActionDefinitionId("org.netxms.ui.eclipse.networkmaps.localCommands.AbstractMap.Zoom100Pct");
            handlerService.activateHandler(actions[i].getActionDefinitionId(), new ActionHandler(actions[i]));
        }
    }
    return actions;
}
Also used : Action(org.eclipse.jface.action.Action) ZoomManager(org.eclipse.gef4.zest.core.widgets.zooming.ZoomManager) ActionHandler(org.eclipse.jface.commands.ActionHandler) Point(org.eclipse.swt.graphics.Point)

Example 19 with ActionHandler

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

the class ScriptExecutor method createActions.

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

        @Override
        public void run() {
            intermediateSave(false);
        }
    };
    // $NON-NLS-1$
    actionSave.setActionDefinitionId("org.netxms.ui.eclipse.nxsl.commands.save");
    handlerService.activateHandler(actionSave.getActionDefinitionId(), new ActionHandler(actionSave));
    actionSaveAs = new Action(Messages.get().ScriptExecutor_SaveAs, SharedIcons.SAVE_AS) {

        @Override
        public void run() {
            createNewScript(false);
        }
    };
    // $NON-NLS-1$
    actionSaveAs.setActionDefinitionId("org.netxms.ui.eclipse.nxsl.commands.save_as");
    handlerService.activateHandler(actionSaveAs.getActionDefinitionId(), new ActionHandler(actionSaveAs));
    actionClear = new Action(Messages.get().ScriptExecutor_Clear, SharedIcons.CLEAR) {

        @Override
        public void run() {
            if (modified) {
                if (saveIfRequired(false))
                    return;
            }
            scriptCombo.deselectAll();
            scriptCombo.clearSelection();
            // $NON-NLS-1$
            scriptEditor.setText("");
            output.clear();
            form.setText(Messages.get().ScriptExecutor_Noname);
        }
    };
    actionClearOutput = new Action(Messages.get().ScriptExecutor_ClearOutput, SharedIcons.CLEAR_LOG) {

        @Override
        public void run() {
            output.clear();
        }
    };
    // $NON-NLS-1$
    actionClearOutput.setActionDefinitionId("org.netxms.ui.eclipse.nxsl.commands.clear_output");
    handlerService.activateHandler(actionClearOutput.getActionDefinitionId(), new ActionHandler(actionClearOutput));
    actionReload = new RefreshAction(this) {

        @Override
        public void run() {
            if (modified) {
                if (saveIfRequired(false))
                    return;
            }
            updateScriptList(null);
            getScriptContent();
            output.clear();
        }
    };
    actionReload.setText(Messages.get().ScriptExecutor_Reload);
    actionExecute = new Action(Messages.get().ScriptExecutor_Execute, SharedIcons.EXECUTE) {

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

Example 20 with ActionHandler

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

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