Search in sources :

Example 1 with EditActionDlg

use of org.netxms.ui.eclipse.actionmanager.dialogs.EditActionDlg in project netxms by netxms.

the class ActionManager method createAction.

/**
 * Create new action
 */
private void createAction() {
    final ServerAction action = new ServerAction(0);
    final EditActionDlg dlg = new EditActionDlg(getSite().getShell(), action, true);
    if (dlg.open() == Window.OK) {
        new ConsoleJob(Messages.get().ActionManager_CreateJobName, this, Activator.PLUGIN_ID, Activator.PLUGIN_ID) {

            @Override
            protected String getErrorMessage() {
                return Messages.get().ActionManager_CreateJobError;
            }

            @Override
            protected void runInternal(IProgressMonitor monitor) throws Exception {
                long id = session.createAction(action.getName());
                action.setId(id);
                session.modifyAction(action);
            }
        }.start();
    }
}
Also used : EditActionDlg(org.netxms.ui.eclipse.actionmanager.dialogs.EditActionDlg) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) ConsoleJob(org.netxms.ui.eclipse.jobs.ConsoleJob) ServerAction(org.netxms.client.ServerAction)

Example 2 with EditActionDlg

use of org.netxms.ui.eclipse.actionmanager.dialogs.EditActionDlg in project netxms by netxms.

the class ActionManager method editAction.

/**
 * Edit currently selected action
 */
private void editAction() {
    IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
    if (selection.size() != 1)
        return;
    final ServerAction action = (ServerAction) selection.getFirstElement();
    final EditActionDlg dlg = new EditActionDlg(getSite().getShell(), action, false);
    if (dlg.open() == Window.OK) {
        new ConsoleJob(Messages.get().ActionManager_UpdateJobName, this, Activator.PLUGIN_ID, Activator.PLUGIN_ID) {

            @Override
            protected String getErrorMessage() {
                return Messages.get().ActionManager_UpdateJobError;
            }

            @Override
            protected void runInternal(IProgressMonitor monitor) throws Exception {
                session.modifyAction(action);
            }
        }.start();
    }
}
Also used : EditActionDlg(org.netxms.ui.eclipse.actionmanager.dialogs.EditActionDlg) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ConsoleJob(org.netxms.ui.eclipse.jobs.ConsoleJob) ServerAction(org.netxms.client.ServerAction)

Aggregations

IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2 ServerAction (org.netxms.client.ServerAction)2 EditActionDlg (org.netxms.ui.eclipse.actionmanager.dialogs.EditActionDlg)2 ConsoleJob (org.netxms.ui.eclipse.jobs.ConsoleJob)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1