Search in sources :

Example 31 with ActionHandler

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

the class PersistentStorageView 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("Create new", SharedIcons.ADD_OBJECT) {

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

        @Override
        public void run() {
            editValue();
        }
    };
    // $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() {
            deleteValue();
        }
    };
}
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 32 with ActionHandler

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

the class ServerConfigurationEditor method createActions.

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

        @Override
        public void run() {
            refresh();
        }
    };
    actionAdd = new Action(Messages.get().ServerConfigurationEditor_ActionCreate, SharedIcons.ADD_OBJECT) {

        @Override
        public void run() {
            addVariable();
        }
    };
    // $NON-NLS-1$
    actionAdd.setActionDefinitionId("org.netxms.ui.eclipse.serverconfig.commands.add_config_variable");
    handlerService.activateHandler(actionAdd.getActionDefinitionId(), new ActionHandler(actionAdd));
    actionEdit = new Action(Messages.get().ServerConfigurationEditor_ActionEdit, SharedIcons.EDIT) {

        @Override
        public void run() {
            editVariable();
        }
    };
    actionEdit.setEnabled(false);
    actionDelete = new Action(Messages.get().ServerConfigurationEditor_ActionDelete, SharedIcons.DELETE_OBJECT) {

        @Override
        public void run() {
            deleteVariables();
        }
    };
    actionDelete.setEnabled(false);
    actionShowFilter = new Action("Show filter", 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.serverconfig.commands.show_filter");
    handlerService.activateHandler(actionShowFilter.getActionDefinitionId(), new ActionHandler(actionShowFilter));
    actionDefaultValue = new Action("Set default value") {

        @Override
        public void run() {
            setDefaultValue();
        }
    };
    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 33 with ActionHandler

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

the class SwitchForwardingDatabaseView method createActions.

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

        @Override
        public void run() {
            refresh();
        }
    };
    actionExportToCsv = new ExportToCsvAction(this, viewer, true);
    actionExportAllToCsv = new ExportToCsvAction(this, viewer, false);
    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.topology.commands.show_filter");
    handlerService.activateHandler(actionShowFilter.getActionDefinitionId(), new ActionHandler(actionShowFilter));
}
Also used : ExportToCsvAction(org.netxms.ui.eclipse.actions.ExportToCsvAction) 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) ExportToCsvAction(org.netxms.ui.eclipse.actions.ExportToCsvAction) ActionHandler(org.eclipse.jface.commands.ActionHandler)

Example 34 with ActionHandler

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

the class DashboardView method createActions.

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

        @Override
        public void run() {
            if (dbc.isModified()) {
                if (!MessageDialogHelper.openConfirm(getSite().getShell(), Messages.get().DashboardView_Refresh, Messages.get().DashboardView_Confirmation))
                    return;
            }
            rebuildDashboard(true);
        }
    };
    actionSave = new Action(Messages.get().DashboardView_Save, SharedIcons.SAVE) {

        @Override
        public void run() {
            dbc.saveDashboard(DashboardView.this);
        }
    };
    actionSave.setEnabled(false);
    actionExportValues = new Action(Messages.get().DashboardView_ExportLineChartValues, SharedIcons.CSV) {

        @Override
        public void run() {
            exportLineChartValues();
        }
    };
    // $NON-NLS-1$
    actionExportValues.setActionDefinitionId("org.netxms.ui.eclipse.dashboard.commands.export_line_chart_values");
    handlerService.activateHandler(actionExportValues.getActionDefinitionId(), new ActionHandler(actionExportValues));
    actionEditMode = new Action(Messages.get().DashboardView_EditMode, Action.AS_CHECK_BOX) {

        @Override
        public void run() {
            dbc.setEditMode(!dbc.isEditMode());
            actionEditMode.setChecked(dbc.isEditMode());
            if (!dbc.isEditMode())
                rebuildDashboard(false);
        }
    };
    actionEditMode.setImageDescriptor(SharedIcons.EDIT);
    actionEditMode.setChecked(dbc.isEditMode());
    actionAddSyslogMonitor = new Action("Add s&yslog monitor") {

        @Override
        public void run() {
            dbc.addSyslogMonitor();
        }
    };
    actionAddSnmpTrapMonitor = new Action("Add S&NMP trap monitor") {

        @Override
        public void run() {
            dbc.addSnmpTrapMonitor();
        }
    };
    actionAddEventMonitor = new Action("Add &event monitor") {

        @Override
        public void run() {
            dbc.addEventMonitor();
        }
    };
    actionAddAlarmBrowser = new Action(Messages.get().DashboardView_AddAlarmBrowser) {

        @Override
        public void run() {
            dbc.addAlarmBrowser();
        }
    };
    actionAddLabel = new Action(Messages.get().DashboardView_AddLabel) {

        @Override
        public void run() {
            dbc.addLabel();
        }
    };
    actionAddBarChart = new Action(Messages.get().DashboardView_AddBarChart) {

        @Override
        public void run() {
            dbc.addBarChart();
        }
    };
    actionAddPieChart = new Action(Messages.get().DashboardView_AddPieChart) {

        @Override
        public void run() {
            dbc.addPieChart();
        }
    };
    actionAddTubeChart = new Action(Messages.get().DashboardView_AddTubeChart) {

        @Override
        public void run() {
            dbc.addTubeChart();
        }
    };
    actionAddLineChart = new Action(Messages.get().DashboardView_AddLineChart) {

        @Override
        public void run() {
            dbc.addLineChart();
        }
    };
    actionAddAvailabilityChart = new Action(Messages.get().DashboardView_AddAvailChart) {

        @Override
        public void run() {
            dbc.addAvailabilityChart();
        }
    };
    actionAddDashboard = new Action(Messages.get().DashboardView_AddDashboard) {

        @Override
        public void run() {
            dbc.addEmbeddedDashboard();
        }
    };
    actionAddStatusIndicator = new Action(Messages.get().DashboardView_AddStatusIndicator) {

        @Override
        public void run() {
            dbc.addStatusIndicator();
        }
    };
}
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 35 with ActionHandler

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

the class LocalCommandResults method createActions.

/**
 * Create actions
 */
protected void createActions() {
    super.createActions();
    final IHandlerService handlerService = (IHandlerService) getSite().getService(IHandlerService.class);
    actionTerminate = new Action(Messages.get().LocalCommandResults_Terminate, SharedIcons.TERMINATE) {

        @Override
        public void run() {
            synchronized (mutex) {
                if (running) {
                    process.destroy();
                }
            }
        }
    };
    actionTerminate.setEnabled(false);
    // $NON-NLS-1$
    actionTerminate.setActionDefinitionId("org.netxms.ui.eclipse.objecttools.commands.terminate_process");
    handlerService.activateHandler(actionTerminate.getActionDefinitionId(), new ActionHandler(actionTerminate));
    actionRestart = new Action(Messages.get().LocalCommandResults_Restart, SharedIcons.RESTART) {

        @Override
        public void run() {
            runCommand(lastCommand);
        }
    };
    actionRestart.setEnabled(false);
}
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