use of org.netxms.client.PhysicalComponent in project netxms by netxms.
the class ComponentsTab method objectChanged.
/* (non-Javadoc)
* @see org.netxms.ui.eclipse.objectview.objecttabs.ObjectTab#objectChanged(org.netxms.client.objects.AbstractObject)
*/
@Override
public void objectChanged(final AbstractObject object) {
viewer.setInput(new Object[0]);
if (object == null)
return;
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
ConsoleJob job = new ConsoleJob(Messages.get().ComponentsTab_JobName, getViewPart(), Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
try {
final PhysicalComponent root = session.getNodePhysicalComponents(object.getObjectId());
runInUIThread(new Runnable() {
@Override
public void run() {
if (viewer.getTree().isDisposed())
return;
if ((ComponentsTab.this.getObject() != null) && (ComponentsTab.this.getObject().getObjectId() == object.getObjectId())) {
viewer.setInput(new Object[] { root });
viewer.expandAll();
}
}
});
} catch (NXCException e) {
if (e.getErrorCode() != RCC.NO_COMPONENT_DATA)
throw e;
runInUIThread(new Runnable() {
@Override
public void run() {
if (viewer.getTree().isDisposed())
return;
if ((ComponentsTab.this.getObject() != null) && (ComponentsTab.this.getObject().getObjectId() == object.getObjectId())) {
viewer.setInput(new Object[0]);
}
}
});
}
}
@Override
protected String getErrorMessage() {
return String.format(Messages.get().ComponentsTab_JobError, object.getObjectName());
}
};
job.setUser(false);
job.start();
}
Aggregations