in remoting/ide/api/src/org/netbeans/modules/jackpot30/remotingapi/options/CustomizeRemoteIndex.java [356:430]
public void run() {
checkingIndexURL.set(true);
checkingIndexURLError.set(null);
indexRandomFiles.set(null);
SwingUtilities.invokeLater(new Runnable() {
public void run() {
updateErrors();
}
});
String urlText = checkingIndexURLContentCopy.get();
Collection<? extends String> subindices = null;
try {
URL url = new URL(urlText);
if (!url.getPath().endsWith("/"))
url = new URL(url.getProtocol(), url.getHost(), url.getPort(), url.getPath() + "/" + (url.getQuery() != null ? "?" + url.getQuery() : ""));
subindices = new ArrayList<String>(WebUtilities.requestStringArrayResponse(url.toURI().resolve("list"), new AtomicBoolean()));
for (Iterator<? extends String> it = subindices.iterator(); it.hasNext();) {
String idx = it.next();
if (idx.trim().isEmpty() || !idx.contains(":")) it.remove();
}
if (subindices.isEmpty()) {
checkingIndexURLError.set("Not an index.");
}
} catch (URISyntaxException ex) {
checkingIndexURLError.set(ex.getLocalizedMessage());
} catch (MalformedURLException ex) {
checkingIndexURLError.set(ex.getLocalizedMessage());
} catch (ThreadDeath td) {
throw td;
} catch (Throwable t) {//#6541019
checkingIndexURLError.set("Invalid URL");
}
checkingIndexURL.set(false);
final Collection<? extends String> subindicesFinal = subindices;
SwingUtilities.invokeLater(new Runnable() {
public void run() {
updateErrors();
if (subindicesFinal == null || subindicesFinal.isEmpty()) return;
DefaultComboBoxModel model = (DefaultComboBoxModel) subIndex.getModel();
String selected = getSubIndexSelectedItem();
tempSubIndexSelection = null;
model.removeAllElements();
boolean containsSelection = false;
Map<String, String> displayNames = new HashMap<String, String>();
for (String subindex : subindicesFinal) {
String[] subindexSplit = subindex.split(":", 2);
if (subindexSplit[0].equals(selected)) containsSelection = true;
model.addElement(subindexSplit[0]);
displayNames.put(subindexSplit[0], subindexSplit[1]);
}
if (containsSelection) {
model.setSelectedItem(selected);
}
subindexSelectionUpdated();
subIndex.setRenderer(new RendererImpl(displayNames));
}
});
}