use of org.netxms.client.agent.config.ConfigListElement in project netxms by netxms.
the class ServerStoredAgentConfigEditorView method createNewConfig.
/**
* Creates new config that is sent to server on save
*/
private void createNewConfig() {
modified = true;
firePropertyChange(PROP_DIRTY);
actionSave.setEnabled(true);
ConfigListElement newElement = new ConfigListElement();
elements.add(newElement);
configList.setInput(elements.toArray(new ConfigListElement[elements.size()]));
reselection = true;
StructuredSelection selection = new StructuredSelection(newElement);
previousSelection = selection;
configList.setSelection(selection);
content = new ConfigContent();
updateContent();
}
use of org.netxms.client.agent.config.ConfigListElement in project netxms by netxms.
the class ServerStoredAgentConfigEditorView method getConfigList.
/**
* Gets config list from server and sets editable fields to nothing
*/
public void getConfigList() {
IStructuredSelection selection = (IStructuredSelection) configList.getSelection();
final ConfigListElement element = selection == null ? null : (ConfigListElement) selection.getFirstElement();
new ConsoleJob(Messages.get().PackageManager_OpenDatabase, this, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
elements = session.getConfigList();
runInUIThread(new Runnable() {
@Override
public void run() {
configList.setInput(elements.toArray(new ConfigListElement[elements.size()]));
if (element == null && elements.size() > 0) {
StructuredSelection selection = new StructuredSelection(elements.get(0));
configList.setSelection(selection);
}
if (element != null) {
long id = element.getId();
if (id == 0)
id = elements.get(elements.size() - 1).getId();
for (int i = 0; i < elements.size(); i++) {
if (elements.get(i).getId() == id) {
StructuredSelection selection = new StructuredSelection(elements.get(i));
configList.setSelection(selection);
}
}
}
}
});
}
@Override
protected String getErrorMessage() {
return Messages.get().ServerStoredAgentConfigEditorView_JobError_GetList;
}
}.start();
}
Aggregations