use of org.netxms.ui.eclipse.objectview.widgets.helpers.SoftwareInventoryNode in project netxms by netxms.
the class SoftwareInventory method refresh.
/**
* Refresh list
*/
public void refresh() {
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
new ConsoleJob(Messages.get().SoftwareInventory_JobName, viewPart, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
AbstractObject object = session.findObjectById(rootObjectId);
if (object instanceof AbstractNode) {
final List<SoftwarePackage> packages = session.getNodeSoftwarePackages(rootObjectId);
runInUIThread(new Runnable() {
@Override
public void run() {
viewer.setInput(packages.toArray());
}
});
} else {
final List<SoftwareInventoryNode> nodes = new ArrayList<SoftwareInventoryNode>();
for (final AbstractObject o : object.getAllChilds(AbstractObject.OBJECT_NODE)) {
try {
List<SoftwarePackage> packages = session.getNodeSoftwarePackages(o.getObjectId());
nodes.add(new SoftwareInventoryNode((Node) o, packages));
} catch (NXCException e) {
if (e.getErrorCode() != RCC.NO_SOFTWARE_PACKAGE_DATA)
throw e;
}
}
runInUIThread(new Runnable() {
@Override
public void run() {
viewer.setInput(nodes);
}
});
}
}
@Override
protected String getErrorMessage() {
return Messages.get().SoftwareInventory_JobError;
}
}.start();
}
Aggregations