LOG.debug1("quickClusterButton: BUTTON: quick cluster");
final Thread t = new Thread(new Runnable() {
@Override
public void run() {
final String clusterName = clusterTF.getText();
final Cluster cluster = clusterProvider.get();
final String newClusterName;
if (CLUSTER_NAME_PLACE_HOLDER.equals(clusterName)) {
newClusterName = DEFAULT_CLUSTER_NAME;
} else {
newClusterName = clusterName;
}
if (allClusters.isClusterName(newClusterName)) {
cluster.setName(allClusters.getNextClusterName(newClusterName + ' '));
} else {
cluster.setName(newClusterName);
}
application.addClusterToClusters(cluster);
addClusterBox(cluster);
addCheckboxListener(cluster);
for (final JTextField hostTF : hostsTF) {
final String entered = hostTF.getText();
String hostName;
String username = null;
final int a = entered.indexOf('@');
if (a > 0) {
username = entered.substring(0, a);
hostName = entered.substring(a + 1, entered.length());
} else {
hostName = entered;
}
final int p = hostName.indexOf(':');
String port = null;
if (p > 0) {
port = hostName.substring(p + 1, hostName.length());
hostName = hostName.substring(0, p);
}
final Host host = hostFactory.createInstance(hostName);
if (username == null) {
host.setUsername(Host.ROOT_USER);
} else {
host.setUseSudo(true);
host.setUsername(username);
}
if (port == null) {
host.setSSHPort(Host.DEFAULT_SSH_PORT);
} else {
host.setSSHPort(port);
}
host.setCluster(cluster);
host.setHostname(hostName);
cluster.addHost(host);
application.addHostToHosts(host);
guiData.allHostsUpdate();
}
application.addClusterToClusters(cluster);
final Collection<Cluster> selectedClusters = new ArrayList<Cluster>();