use of org.yamcs.api.YamcsConnectionProperties in project yamcs-studio by yamcs.
the class ConnectHandler method doConnect.
private void doConnect(Shell shell, YamcsConfiguration conf) {
// FIXME get the password out before doing this
ConnectionPreferences.setLastUsedConfiguration(conf);
YamcsConnectionProperties yprops = conf.getPrimaryConnectionProperties();
ConnectionUIHelper.connectWithProgressDialog(shell, yprops);
}
use of org.yamcs.api.YamcsConnectionProperties in project yamcs-studio by yamcs.
the class ConnectHandler method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
boolean singleConnectionMode = YamcsUIPlugin.getDefault().getPreferenceStore().getBoolean("singleConnectionMode");
if (singleConnectionMode) {
String connectionString = YamcsUIPlugin.getDefault().getPreferenceStore().getString("connectionString");
try {
Shell shell = HandlerUtil.getActiveShell(event);
YamcsConnectionProperties yprops = YamcsConnectionProperties.parse(connectionString);
ConnectionUIHelper.connectWithProgressDialog(shell, yprops);
} catch (URISyntaxException e) {
log.log(Level.SEVERE, "Invalid URL " + connectionString, e);
return null;
}
} else {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
ConnectionsDialog dialog = new ConnectionsDialog(window.getShell());
if (dialog.open() == Dialog.OK) {
YamcsConfiguration conf = dialog.getChosenConfiguration();
doConnect(HandlerUtil.getActiveShell(event), conf);
}
}
return null;
}
use of org.yamcs.api.YamcsConnectionProperties in project yamcs-studio by yamcs.
the class YamcsConfiguration method getPrimaryConnectionProperties.
public YamcsConnectionProperties getPrimaryConnectionProperties() {
YamcsConnectionProperties yprops = new YamcsConnectionProperties(primaryHost, primaryPort, instance);
yprops.setProtocol(Protocol.http);
if (!isAnonymous()) {
yprops.setAuthenticationToken(new UsernamePasswordToken(user, password));
}
return yprops;
}
use of org.yamcs.api.YamcsConnectionProperties in project yamcs-studio by yamcs.
the class ManagementCatalogue method getCurrentYamcsInstance.
// Careful we must support the case where Yamcs itself changes the instance of our client
// TODO maybe remove this and instead just store an instance field in YamcsClient ?
public static String getCurrentYamcsInstance() {
ManagementCatalogue catalogue = getInstance();
if (catalogue == null) {
return null;
}
ClientInfo ci = catalogue.getCurrentClientInfo();
if (ci != null) {
return ci.getInstance();
} else {
// Fallback (initial connection properties
YamcsClient yamcsClient = YamcsPlugin.getYamcsClient();
YamcsConnectionProperties props = yamcsClient.getYamcsConnectionProperties();
return (props != null) ? props.getInstance() : null;
}
}
Aggregations