package NET.worlds.scape; import NET.worlds.console.Console; import NET.worlds.network.URL; import java.net.MalformedURLException; import java.util.Vector; class URLEditorDialog extends FieldWithListEditorDialog { Property property; FileList extChecker; URLEditorDialog(EditTile parent, String title, Property property, Vector files, FileList extChecker) { super(parent, title + " dir: " + URL.getBestContainer((SuperRoot)property.getOwner()), files); this.property = property; this.extChecker = extChecker; this.ready(); } @Override protected String getValue() { SuperRoot context = (SuperRoot)this.property.getOwner(); if (context != null && this.property.getName().equals("Source URL")) { context = context.getOwner(); } String s = URL.getRelativeTo((URL)this.property.get(), context); return s == null ? "" : s; } @Override protected boolean setValue(String text) { URL url = null; if (text.length() == 0) { if (!this.property.canSetNull()) { return false; } } else { if (this.extChecker != null && !this.extChecker.extMatches(text)) { Console.println(Console.message("extension-match") + this.extChecker.getExtList()); return false; } try { url = new URL((SuperRoot)this.property.getOwner(), text); } catch (MalformedURLException var4) { Console.println(Console.message("Illegal-URL") + var4); return false; } } this.parent.addUndoableSet(this.property, url); return true; } }