use of org.netxms.ui.eclipse.topology.views.VlanView in project netxms by netxms.
the class ShowVlans method run.
/* (non-Javadoc)
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
*/
@Override
public void run(IAction action) {
IViewReference vr = window.getActivePage().findViewReference(VlanView.ID, Long.toString(objectId));
if (vr != null) {
VlanView view = (VlanView) vr.getView(true);
if (view != null) {
window.getActivePage().activate(view);
}
} else {
final NXCSession session = (NXCSession) ConsoleSharedData.getSession();
new ConsoleJob(Messages.get().ShowVlans_JobTitle, null, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
final List<VlanInfo> vlans = session.getVlans(objectId);
runInUIThread(new Runnable() {
@Override
public void run() {
try {
VlanView view = (VlanView) window.getActivePage().showView(VlanView.ID, Long.toString(objectId), IWorkbenchPage.VIEW_ACTIVATE);
view.setVlans(vlans);
} catch (PartInitException e) {
MessageDialogHelper.openError(window.getShell(), Messages.get().ShowVlans_Error, Messages.get().ShowVlans_CannotOpenView + e.getLocalizedMessage());
}
}
});
}
@Override
protected String getErrorMessage() {
return Messages.get().ShowVlans_JobError;
}
}.start();
}
}
Aggregations