use of org.netxms.client.server.ServerVariable in project netxms by netxms.
the class ServerConfigurationEditor method setDefaultValue.
/**
* Reset variable values to default
*/
@SuppressWarnings("unchecked")
private void setDefaultValue() {
IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
final List<ServerVariable> list = selection.toList();
new ConsoleJob("Set default server config values", this, Activator.PLUGIN_ID, ServerConfigurationEditor.JOB_FAMILY) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
session.setDefaultServerValues(list);
varList = session.getServerVariables();
runInUIThread(new Runnable() {
@Override
public void run() {
synchronized (varList) {
viewer.setInput(varList.values().toArray());
}
}
});
}
@Override
protected String getErrorMessage() {
return "Error setting default server config values";
}
}.start();
}
use of org.netxms.client.server.ServerVariable 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();
}
}
use of org.netxms.client.server.ServerVariable in project netxms by netxms.
the class ServerConfigurationEditor method deleteVariables.
/**
* Delete selected variables
*/
private void deleteVariables() {
IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
if ((selection == null) || (selection.size() == 0))
return;
if (!MessageDialogHelper.openQuestion(getSite().getShell(), Messages.get().ServerConfigurationEditor_DeleteConfirmation, Messages.get().ServerConfigurationEditor_DeleteConfirmationText))
return;
final List<String> names = new ArrayList<String>(selection.size());
for (Object o : selection.toList()) {
if (o instanceof ServerVariable)
names.add(((ServerVariable) o).getName());
}
new ConsoleJob(Messages.get().ServerConfigurationEditor_DeleteJobName, this, Activator.PLUGIN_ID, ServerConfigurationEditor.JOB_FAMILY) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
for (String n : names) {
session.deleteServerVariable(n);
}
runInUIThread(new Runnable() {
@Override
public void run() {
refresh();
}
});
}
@Override
protected String getErrorMessage() {
return Messages.get().ServerConfigurationEditor_DeleteJobError;
}
}.start();
}
Aggregations