}
WGARemoteServer server = _remoteLocationPage.getRemoteServer();
try {
server.connectToServer();
} catch (Exception e) {
WorkbenchUtils.showErrorDialog(WGADesignerPlugin.getDefault(), getShell(), "Server connection failed.", "Unable to connect to WGA server '" + server.getUrl().toString() + "'.", e);
return false;
}
// check local and remote runtime version
de.innovationgate.wga.common.beans.csconfig.v1.Version localWGAVersion = null;
WGADeployment deployment = WGADesignerPlugin.getDefault().getWGADeploymentManager().getDeployment(_runtime.getWGADistributionName());
if (deployment != null) {
localWGAVersion = deployment.getWGAVersion();
}
Version remoteWGAVersion = null;
try {
remoteWGAVersion = server.getServices().getWGAVersion(server.getSession());
}
catch (Exception e) {
// this might happen if server version is < 5.3
}
if (localWGAVersion.isAtLeast(5, 3)) {
if (remoteWGAVersion == null || !remoteWGAVersion.isAtLeast(5, 3)) {
MessageDialog.openWarning(getShell(), "Synchronization warning", "The remote server version is too low (< 5.3) to support all synchronization features. Synchronization will only affect designs but not plugins.");
} else if (remoteWGAVersion != null && remoteWGAVersion.isAtLeast(5, 3) && !TomcatUtils.getInstance().isRunning(_runtime)) {
boolean startRuntime = MessageDialog.openConfirm(getShell(), "Synchronization warning", "To provide all synchronization features local runtime need to be started. Start runtime now?.");
if (startRuntime) {
StartWGARuntime.call(_runtime, true);
}
}
}
try {
WGARemoteServerSynchronizationParticipant participant = new WGARemoteServerSynchronizationParticipant(server, _runtime);
ISynchronizeManager manager = TeamUI.getSynchronizeManager();
manager.addSynchronizeParticipants(new ISynchronizeParticipant[] {participant});
ISynchronizeView view = manager.showSynchronizeViewInActivePage();
view.display(participant);
return true;
} catch (Throwable e) {
WorkbenchUtils.showErrorDialog(WGADesignerPlugin.getDefault(), getShell(), "Unable to initialize synchronization", "Unable to initialize synchronization with WGA server '" + server.getUrl().toString() + "'.", e);
return false;
}
}