})
.addAction(new MenuAction() {
@Override
public void run(final String text) {
virtualDomainInfo.hidePopup();
final DomainInfo vvdi = domainInfo;
final VmsXml vxml = virtualDomainInfo.getVMSXML(getRunningOnHost());
if (vxml != null && vvdi != null) {
final int remotePort = vxml.getRemotePort(vvdi.getName());
final Host host = vxml.getDefinedOnHost();
if (host != null && remotePort > 0) {
application.startTightVncViewer(host, remotePort);
}
}
}});
items.add(tightvncViewerMenu);
}
if (application.isUseUltravnc()) {
/* ultra vnc test menu */
final UpdatableItem ultravncViewerMenu = menuFactory.createMenuItem(
"start ULTRA VNC viewer",
null,
null,
new AccessMode(AccessMode.RO, AccessMode.NORMAL),
new AccessMode(AccessMode.RO, AccessMode.NORMAL))
.enablePredicate(new EnablePredicate() {
@Override
public String check() {
final VmsXml vxml = virtualDomainInfo.getVMSXML(getRunningOnHost());
if (vxml == null || domainInfo == null) {
return "VM is not available";
}
final int remotePort = vxml.getRemotePort(domainInfo.getName());
if (remotePort <= 0) {
return "remote port is not greater than 0";
}
return null;
}})
.addAction(new MenuAction() {
@Override
public void run(final String text) {
virtualDomainInfo.hidePopup();
final DomainInfo vvdi = domainInfo;
final VmsXml vxml = virtualDomainInfo.getVMSXML(getRunningOnHost());
if (vxml != null && vvdi != null) {
final int remotePort = vxml.getRemotePort(vvdi.getName());
final Host host = vxml.getDefinedOnHost();
if (host != null && remotePort > 0) {
application.startUltraVncViewer(host, remotePort);
}
}
}});
items.add(ultravncViewerMenu);
}
if (application.isUseRealvnc()) {
/* real vnc test menu */
final UpdatableItem realvncViewerMenu = menuFactory.createMenuItem(
"start REAL VNC test",
null,
null,
new AccessMode(AccessMode.RO, AccessMode.NORMAL),
new AccessMode(AccessMode.RO, AccessMode.NORMAL))
.enablePredicate(new EnablePredicate() {
@Override
public String check() {
final VmsXml vxml = virtualDomainInfo.getVMSXML(getRunningOnHost());
if (vxml == null || domainInfo == null) {
return "VM is not available";
}
final int remotePort = vxml.getRemotePort(domainInfo.getName());
if (remotePort <= 0) {
return "remote port is not greater than 0";
}
return null;
}})
.addAction(new MenuAction() {
@Override
public void run(final String text) {
virtualDomainInfo.hidePopup();
final DomainInfo vvdi = domainInfo;
final VmsXml vxml = virtualDomainInfo.getVMSXML(getRunningOnHost());
if (vxml != null && vvdi != null) {
final int remotePort = vxml.getRemotePort(vvdi.getName());
final Host host = vxml.getDefinedOnHost();
if (host != null && remotePort > 0) {
application.startRealVncViewer(host, remotePort);
}
}