Search in sources :

Example 1 with VariableEditDialog

use of org.netxms.ui.eclipse.serverconfig.dialogs.VariableEditDialog in project netxms by netxms.

the class ServerConfigurationEditor method editVariable.

/**
 * Edit currently selected variable
 * @param var
 */
private void editVariable() {
    IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
    if ((selection == null) || (selection.size() != 1))
        return;
    final ServerVariable var = (ServerVariable) selection.getFirstElement();
    final VariableEditDialog dlg = new VariableEditDialog(getSite().getShell(), var);
    if (dlg.open() == Window.OK) {
        new ConsoleJob(Messages.get().ServerConfigurationEditor_ModifyJobName, this, Activator.PLUGIN_ID, JOB_FAMILY) {

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

            @Override
            protected void runInternal(IProgressMonitor monitor) throws Exception {
                session.setServerVariable(dlg.getVarName(), dlg.getVarValue());
                runInUIThread(new Runnable() {

                    @Override
                    public void run() {
                        refresh();
                    }
                });
            }
        }.start();
    }
}
Also used : IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) VariableEditDialog(org.netxms.ui.eclipse.serverconfig.dialogs.VariableEditDialog) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ConsoleJob(org.netxms.ui.eclipse.jobs.ConsoleJob) ServerVariable(org.netxms.client.server.ServerVariable) PartInitException(org.eclipse.ui.PartInitException)

Aggregations

IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 PartInitException (org.eclipse.ui.PartInitException)1 ServerVariable (org.netxms.client.server.ServerVariable)1 ConsoleJob (org.netxms.ui.eclipse.jobs.ConsoleJob)1 VariableEditDialog (org.netxms.ui.eclipse.serverconfig.dialogs.VariableEditDialog)1