summaryrefslogtreecommitdiff
path: root/NET/worlds/console/WorldsMarkPart.java
diff options
context:
space:
mode:
Diffstat (limited to 'NET/worlds/console/WorldsMarkPart.java')
-rw-r--r--NET/worlds/console/WorldsMarkPart.java860
1 files changed, 860 insertions, 0 deletions
diff --git a/NET/worlds/console/WorldsMarkPart.java b/NET/worlds/console/WorldsMarkPart.java
new file mode 100644
index 0000000..8d6b3ab
--- /dev/null
+++ b/NET/worlds/console/WorldsMarkPart.java
@@ -0,0 +1,860 @@
+/* */ package NET.worlds.console;
+/* */
+/* */ import NET.worlds.core.IniFile;
+/* */ import NET.worlds.network.NetUpdate;
+/* */ import NET.worlds.network.RemoteFileConst;
+/* */ import NET.worlds.network.URL;
+/* */ import NET.worlds.scape.FrameEvent;
+/* */ import NET.worlds.scape.Pilot;
+/* */ import NET.worlds.scape.Restorer;
+/* */ import NET.worlds.scape.Room;
+/* */ import NET.worlds.scape.Saver;
+/* */ import NET.worlds.scape.TeleportAction;
+/* */ import NET.worlds.scape.TeleportStatus;
+/* */ import NET.worlds.scape.World;
+/* */ import java.awt.Container;
+/* */ import java.awt.Event;
+/* */ import java.awt.Font;
+/* */ import java.awt.Menu;
+/* */ import java.awt.MenuItem;
+/* */ import java.awt.PopupMenu;
+/* */ import java.io.File;
+/* */ import java.io.PrintStream;
+/* */ import java.util.Hashtable;
+/* */ import java.util.Locale;
+/* */ import java.util.Vector;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public class WorldsMarkPart
+/* */ implements FramePart, DialogReceiver, TeleportStatus, RemoteFileConst
+/* */ {
+/* */ private static final String worldsMarksFileName = "Gamma.worldsmarks";
+/* */ private static final int MAX_HISTORY = 10;
+/* 111 */ private static URL userMarksURL = URL.make("home:Gamma.worldsmarks");
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ private String name;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ private Menu menu;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ private Menu letsMenu;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* 144 */ private MenuItem addItem = new MenuItem(Console.message("Add-WorldsMark"));
+/* 145 */ private MenuItem deleteItem = new MenuItem(
+/* 146 */ Console.message("Delete-WorldsMark"));
+/* 147 */ private MenuItem editItem = new MenuItem(Console.message("Edit-WorldsMark"));
+/* 148 */ private MenuItem locationItem = new MenuItem(
+/* 149 */ Console.message("Change-Location"));
+/* 150 */ private Menu historyMenu = new Menu(Console.message("Back"));
+/* */
+/* */
+/* */ private static Font font;
+/* */
+/* 155 */ private boolean teleporting = false;
+/* 156 */ private boolean startLocationDialog = false;
+/* */ static Vector<String> systemMarksNames;
+/* */ private static Vector<Vector<BookmarkMenuItem>> systemMarks;
+/* */ private static Vector<BookmarkMenuItem> userMarks;
+/* */ private static Vector<BookmarkMenuItem> historyItems;
+/* */ private static int firstUserItem;
+/* */ private static Hashtable<String, String> renamed;
+/* */ private static Vector<String> excludes;
+/* */ private static Vector<String> sequence;
+/* */
+/* */ static
+/* */ {
+/* 115 */ Locale currentLocale = Locale.getDefault();
+/* 116 */ System.out.println("System Locale is " + currentLocale);
+/* */
+/* 118 */ String defLang = IniFile.gamma().getIniString("DEFAULTLANGUAGE", "");
+/* 119 */ if (!defLang.equals(""))
+/* */ {
+/* 121 */ String code1 = null;
+/* 122 */ String code2 = null;
+/* */
+/* 124 */ if (defLang.length() >= 2) {
+/* 125 */ code1 = defLang.substring(0, 2);
+/* */ }
+/* 127 */ if (defLang.length() >= 5) {
+/* 128 */ code2 = defLang.substring(3, 5);
+/* */ }
+/* 130 */ if ((code1 == null) || (code2 == null)) {
+/* 131 */ System.out.println("ERROR: DEFAULTLANGUAGE mustbe in the form xx_XX");
+/* */ }
+/* */ else {
+/* 134 */ Locale.setDefault(new Locale(code1, code2));
+/* 135 */ currentLocale = Locale.getDefault();
+/* 136 */ System.out.println("New Locale is " + currentLocale);
+/* */ }
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* 152 */ font = new Font(Console.message("MenuFont"),
+/* 153 */ 0, 12);
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* 163 */ historyItems = new Vector();
+/* */
+/* 165 */ historyItems.addElement(new BookmarkMenuItem(
+/* 166 */ Console.message("end-of-last"), "world:restart"));
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* 177 */ renamed = new Hashtable();
+/* 178 */ renamed.put("lets", "Hang");
+/* 179 */ renamed.put("worldschat", "WorldsCenter");
+/* 180 */ renamed.put("polygram", "WorldsStore.com");
+/* 181 */ renamed.put("stadium", "NY Yankees");
+/* 182 */ renamed.put("bowie", "Bowie I");
+/* 183 */ renamed.put("texas", "Texas");
+/* 184 */ renamed.put("hanson", "Hanson I");
+/* */
+/* */
+/* 187 */ excludes = new Vector();
+/* 188 */ excludes.addElement("funhouse");
+/* 189 */ excludes.addElement("chaos");
+/* */
+/* */
+/* */
+/* 193 */ sequence = new Vector();
+/* 194 */ sequence.addElement(getFirstWorld().toLowerCase());
+/* 195 */ sequence.addElement("avatargallery");
+/* 196 */ sequence.addElement("dressingroom");
+/* */ }
+/* */
+/* */ public WorldsMarkPart() {
+/* 200 */ this(null);
+/* */ }
+/* */
+/* */ public WorldsMarkPart(String name) {
+/* 204 */ this.name = name;
+/* */ }
+/* */
+/* */ public boolean isTeleporting()
+/* */ {
+/* 209 */ return this.teleporting;
+/* */ }
+/* */
+/* */ public static String getExternalName(String name)
+/* */ {
+/* 214 */ String extName = (String)renamed.get(name.toLowerCase());
+/* 215 */ return extName != null ? extName : name;
+/* */ }
+/* */
+/* */ public Menu getMenu() {
+/* 219 */ if (this.menu == null) {
+/* 220 */ if (this.name != null) {
+/* 221 */ this.menu = new Menu(this.name);
+/* */ } else {
+/* 223 */ this.menu = new PopupMenu();
+/* */ }
+/* 225 */ this.letsMenu = new PopupMenu();
+/* 226 */ this.historyMenu.setFont(font);
+/* 227 */ this.letsMenu.add(this.historyMenu);
+/* 228 */ this.letsMenu.addSeparator();
+/* */
+/* 230 */ if (userMarks == null) {
+/* 231 */ loadMarks();
+/* */ }
+/* 233 */ if (systemMarks.size() != 0) {
+/* 234 */ for (int i = 0; i < systemMarks.size(); i++) {
+/* 235 */ String subName = (String)systemMarksNames.elementAt(i);
+/* */
+/* 237 */ Menu subMenu = new Menu(getExternalName(subName));
+/* 238 */ addItems(subMenu, (Vector)systemMarks.elementAt(i));
+/* 239 */ subMenu.setFont(font);
+/* 240 */ this.letsMenu.add(subMenu);
+/* */ }
+/* */ }
+/* 243 */ addMainMenuItem(this.addItem);
+/* 244 */ addMainMenuItem(this.deleteItem);
+/* */
+/* */
+/* 247 */ addMainMenuItem(this.editItem);
+/* 248 */ addMainMenuItem(this.locationItem);
+/* */
+/* 250 */ addMainMenuSeparator();
+/* */
+/* 252 */ addItems(this.menu, userMarks);
+/* 253 */ addItems(this.historyMenu, historyItems);
+/* */ }
+/* 255 */ return this.menu;
+/* */ }
+/* */
+/* */
+/* */
+/* */ public Menu getLetsMenu()
+/* */ {
+/* 262 */ if (this.letsMenu == null) {
+/* 263 */ getMenu();
+/* */ }
+/* 265 */ return this.letsMenu;
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public static PopupMenu getPackageMenu(String pname)
+/* */ {
+/* 277 */ int p = findPackageNum(pname);
+/* 278 */ if (p < 0) {
+/* 279 */ return null;
+/* */ }
+/* 281 */ PopupMenu m = new PopupMenu();
+/* 282 */ Vector<BookmarkMenuItem> v = (Vector)systemMarks.elementAt(p);
+/* 283 */ for (int i = 0; i < v.size(); i++) {
+/* 284 */ MenuItem mi = (MenuItem)v.elementAt(i);
+/* 285 */ if ((mi instanceof BookmarkMenuItem)) {
+/* 286 */ BookmarkMenuItem bmi = (BookmarkMenuItem)v.elementAt(i);
+/* */
+/* */
+/* 289 */ String name = bmi.getLabel();
+/* 290 */ String targ = bmi.getTarget();
+/* 291 */ URL u = URL.make(TeleportAction.toURLString(targ));
+/* 292 */ String pkg = TeleportAction.getPackageNameOfWorld(u);
+/* 293 */ if ((pkg != null) && (findPackage(pkg) == null))
+/* */ {
+/* */
+/* 296 */ String dirName = URL.make("home:" + pkg).unalias();
+/* 297 */ if (!new File(dirName).isDirectory()) {
+/* 298 */ name = "Download " + name;
+/* */ }
+/* */ }
+/* 301 */ m.add(new BookmarkMenuItem(name, targ));
+/* */ }
+/* */ }
+/* */
+/* */
+/* 306 */ boolean isFirst = true;
+/* 307 */ for (int i = 0; i < userMarks.size(); i++) {
+/* 308 */ URL u = URL.make(TeleportAction.toURLString(getBookmarkTarget(i)));
+/* 309 */ String s = TeleportAction.getPackageNameOfWorld(u);
+/* 310 */ if ((s != null) && (s.equalsIgnoreCase(pname))) {
+/* 311 */ if (isFirst) {
+/* 312 */ isFirst = false;
+/* 313 */ m.addSeparator();
+/* */ }
+/* 315 */ BookmarkMenuItem item = new BookmarkMenuItem(
+/* 316 */ getBookmarkName(i), getBookmarkTarget(i));
+/* 317 */ m.add(item);
+/* */ }
+/* */ }
+/* */
+/* 321 */ return m;
+/* */ }
+/* */
+/* */ private static void addItems(Menu m, Vector<BookmarkMenuItem> v) {
+/* 325 */ for (int i = 0; i < v.size(); i++) {
+/* 326 */ MenuItem mItem = (MenuItem)v.elementAt(i);
+/* 327 */ mItem.setFont(font);
+/* 328 */ m.add(mItem);
+/* */ }
+/* */ }
+/* */
+/* */ private void addMainMenuItem(MenuItem item) {
+/* 333 */ item.setFont(font);
+/* 334 */ this.menu.add(item);
+/* 335 */ firstUserItem += 1;
+/* */ }
+/* */
+/* */ private void addMainMenuSeparator() {
+/* 339 */ this.menu.addSeparator();
+/* 340 */ firstUserItem += 1;
+/* */ }
+/* */
+/* */ public static String getFirstWorld() {
+/* 344 */ IniFile ini = new IniFile("InstalledWorlds");
+/* 345 */ return ini.getIniString("InstalledWorld0", "");
+/* */ }
+/* */
+/* */
+/* */
+/* */ public static String getFirstSystemMarkURL()
+/* */ {
+/* 352 */ if (userMarks == null) {
+/* 353 */ loadMarks();
+/* */ }
+/* 355 */ for (int i = 0; i < systemMarks.size(); i++) {
+/* 356 */ Vector<BookmarkMenuItem> v = (Vector)systemMarks.elementAt(i);
+/* 357 */ if (v.size() > 0) {
+/* 358 */ return ((BookmarkMenuItem)v.elementAt(0)).getTarget();
+/* */ }
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* 369 */ return ((BookmarkMenuItem)userMarks.elementAt(0)).getTarget();
+/* */ }
+/* */
+/* */ private static void shortenNames(String prefix, Vector<BookmarkMenuItem> v) {
+/* 373 */ int count = v.size();
+/* 374 */ int pfxlen = prefix.length();
+/* 375 */ for (int i = 0; i < count; i++) {
+/* 376 */ MenuItem item = (MenuItem)v.elementAt(i);
+/* 377 */ String label = item.getLabel();
+/* 378 */ if (label.startsWith(prefix)) {
+/* 379 */ item.setLabel(label.substring(pfxlen).trim());
+/* */ }
+/* */ }
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */ private static int findPackageNum(String pname)
+/* */ {
+/* 389 */ Vector<String> v = systemMarksNames;
+/* 390 */ if (v != null) {
+/* 391 */ int i = v.size();
+/* 392 */ do { String s = (String)v.elementAt(i);
+/* 393 */ if (s.equalsIgnoreCase(pname)) {
+/* 394 */ return i;
+/* */ }
+/* 391 */ i--; } while (i >= 0);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* 397 */ return -1;
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public static String findPackage(String pname)
+/* */ {
+/* 406 */ int i = findPackageNum(pname);
+/* 407 */ if (i < 0) {
+/* 408 */ return null;
+/* */ }
+/* 410 */ return (String)systemMarksNames.elementAt(i);
+/* */ }
+/* */
+/* */ private static void loadMarks()
+/* */ {
+/* 415 */ systemMarks = new Vector();
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* 423 */ systemMarksNames = new Vector();
+/* 424 */ IniFile ini = new IniFile("InstalledWorlds");
+/* */
+/* 426 */ String[] sequenced = new String[sequence.size()];
+/* 427 */ for (int count = 0; count < NetUpdate.maxInstalledWorlds(); count++) {
+/* 428 */ String curvalue = ini.getIniString("InstalledWorld" + count, "");
+/* 429 */ if (!curvalue.equals("")) {
+/* 430 */ NetUpdate.maxInstalledWorld(count);
+/* 431 */ String pkgLower = curvalue.toLowerCase();
+/* 432 */ if ((!excludes.contains(pkgLower)) && (
+/* 433 */ (!pkgLower.equals("polygram")) ||
+/* 434 */ (!World.isWorldsStoreProscribed()))) {
+/* 435 */ int index = sequence.indexOf(pkgLower);
+/* 436 */ if (index != -1) {
+/* 437 */ sequenced[index] = curvalue;
+/* */ } else {
+/* 439 */ systemMarksNames.addElement(curvalue);
+/* */ }
+/* */ }
+/* */ }
+/* */ }
+/* */
+/* 445 */ for (int i = sequenced.length - 1; i >= 0; i--) {
+/* 446 */ if (sequenced[i] != null)
+/* 447 */ systemMarksNames.insertElementAt(sequenced[i], 0);
+/* */ }
+/* 449 */ for (int i = 0; i < systemMarksNames.size();) {
+/* 450 */ String worldName = (String)systemMarksNames.elementAt(i);
+/* 451 */ Vector<BookmarkMenuItem> v = loadVector(URL.make("home:" + worldName + "/" +
+/* 452 */ "Gamma.worldsmarks"));
+/* */
+/* */
+/* 455 */ if (v.size() != 0) {
+/* 456 */ shortenNames(worldName, v);
+/* 457 */ systemMarks.addElement(v);
+/* 458 */ i++;
+/* */ } else {
+/* 460 */ systemMarksNames.removeElementAt(i);
+/* */ } }
+/* 462 */ userMarks = loadVector(userMarksURL);
+/* */ }
+/* */
+/* */ private static Vector<?> loadVector(URL url)
+/* */ {
+/* 467 */ Vector<?> v = null;
+/* */ try {
+/* 469 */ Restorer r = new Restorer(url);
+/* 470 */ v = r.restoreVector();
+/* 471 */ r.done();
+/* */
+/* */ }
+/* */ catch (Exception ex)
+/* */ {
+/* */
+/* 477 */ if (v != null) {
+/* 478 */ saveVector(url, v);
+/* */ } else
+/* 480 */ v = new Vector();
+/* */ }
+/* 482 */ return v;
+/* */ }
+/* */
+/* */ private static void saveMarks() {
+/* 486 */ saveVector(userMarksURL, userMarks);
+/* */ }
+/* */
+/* */ private static void saveVector(URL url, Vector<BookmarkMenuItem> v) {
+/* */ try {
+/* 491 */ Saver s = new Saver(url);
+/* 492 */ s.saveVector(v);
+/* 493 */ s.done();
+/* */ }
+/* */ catch (Exception localException) {}
+/* */ }
+/* */
+/* */ static void gotoBookmark(int index) {
+/* 499 */ TeleportAction.teleport(getBookmarkTarget(index), null);
+/* */ }
+/* */
+/* */ static int getBookmarkCount() {
+/* 503 */ return userMarks.size();
+/* */ }
+/* */
+/* */ private static BookmarkMenuItem getBookmark(int index) {
+/* 507 */ return (BookmarkMenuItem)userMarks.elementAt(index);
+/* */ }
+/* */
+/* */ static String getBookmarkName(int index) {
+/* 511 */ return getBookmark(index).getLabel();
+/* */ }
+/* */
+/* */ static String getBookmarkTarget(int index) {
+/* 515 */ return getBookmark(index).getTarget();
+/* */ }
+/* */
+/* */ void addBookmark(String name, String target) {
+/* 519 */ BookmarkMenuItem item = new BookmarkMenuItem(name, target);
+/* 520 */ this.menu.add(item);
+/* 521 */ userMarks.addElement(item);
+/* 522 */ saveMarks();
+/* */ }
+/* */
+/* */ void removeBookmark(int index) {
+/* 526 */ userMarks.removeElementAt(index);
+/* 527 */ this.menu.remove(index + firstUserItem);
+/* 528 */ saveMarks();
+/* */ }
+/* */
+/* */ void changeBookmark(int index, String name, String target) {
+/* 532 */ BookmarkMenuItem item = getBookmark(index);
+/* 533 */ item.setLabel(name);
+/* 534 */ item.setTarget(target);
+/* 535 */ saveMarks();
+/* */ }
+/* */
+/* */ public void dialogDone(Object who, boolean confirmed)
+/* */ {
+/* 540 */ if (confirmed) {
+/* 541 */ if ((who instanceof LocationDialog)) {
+/* 542 */ LocationDialog locationDialog = (LocationDialog)who;
+/* 543 */ String location = locationDialog.getLocationURL();
+/* 544 */ if (location.length() != 0)
+/* 545 */ TeleportAction.teleport(location, null);
+/* */ } else {
+/* 547 */ BookmarkAddDialog adder = (BookmarkAddDialog)who;
+/* 548 */ BookmarkEditDialog editor = adder.getEditor();
+/* 549 */ addBookmark(editor.getName(), editor.getTarget());
+/* */ }
+/* */ }
+/* */ }
+/* */
+/* */ private static BookmarkMenuItem getHistory(int index) {
+/* 555 */ return (BookmarkMenuItem)historyItems.elementAt(index);
+/* */ }
+/* */
+/* */ private static BookmarkMenuItem getItemFromTarget(String target, Vector<BookmarkMenuItem> vec) {
+/* 559 */ for (int i = 0; i < vec.size(); i++) {
+/* 560 */ BookmarkMenuItem item = (BookmarkMenuItem)vec.elementAt(i);
+/* 561 */ if (item.getTarget().equals(target))
+/* 562 */ return item;
+/* */ }
+/* 564 */ return null;
+/* */ }
+/* */
+/* */ private static BookmarkMenuItem getItemFromName(String name, Vector<BookmarkMenuItem> vec) {
+/* 568 */ for (int i = 0; i < vec.size(); i++) {
+/* 569 */ BookmarkMenuItem item = (BookmarkMenuItem)vec.elementAt(i);
+/* 570 */ if (item.getLabel().equals(name))
+/* 571 */ return item;
+/* */ }
+/* 573 */ return null;
+/* */ }
+/* */
+/* */ private static String getWorldName(String url) {
+/* 577 */ int rindex = url.toLowerCase().lastIndexOf(".world");
+/* 578 */ if (rindex != -1) {
+/* */ int windex;
+/* 580 */ if (((windex = url.lastIndexOf('/', rindex)) != -1) ||
+/* 581 */ ((windex = url.lastIndexOf(':', rindex)) != -1))
+/* 582 */ return url.substring(windex + 1, rindex);
+/* */ }
+/* 584 */ return null;
+/* */ }
+/* */
+/* */ public static String getCurrentPackageName() {
+/* 588 */ Pilot pilot = Pilot.getActive();
+/* 589 */ if (pilot == null) {
+/* 590 */ return null;
+/* */ }
+/* 592 */ World world = pilot.getWorld();
+/* 593 */ if (world == null) {
+/* 594 */ return null;
+/* */ }
+/* 596 */ URL url = world.getSourceURL();
+/* 597 */ if (url == null) {
+/* 598 */ return null;
+/* */ }
+/* 600 */ return TeleportAction.getPackageNameOfWorld(url);
+/* */ }
+/* */
+/* */ private static String getCurrentURLName() {
+/* 604 */ String name = "";
+/* 605 */ Pilot pilot = Pilot.getActive();
+/* 606 */ if (pilot != null) {
+/* 607 */ World world = pilot.getWorld();
+/* 608 */ if (world != null) {
+/* 609 */ URL url = world.getSourceURL();
+/* 610 */ if (url != null) {
+/* 611 */ String worldFileName = getWorldName(url.getAbsolute());
+/* 612 */ if (worldFileName != null)
+/* 613 */ name = worldFileName;
+/* */ }
+/* 615 */ String worldName = world.getName();
+/* 616 */ if (worldName != null) {
+/* 617 */ if (!name.equals(""))
+/* 618 */ name = name + " ";
+/* 619 */ name = name + worldName;
+/* */ }
+/* 621 */ Room room = pilot.getRoom();
+/* 622 */ if (room != null) {
+/* 623 */ String roomName = room.getName();
+/* 624 */ if (roomName != null) {
+/* 625 */ if (!name.equals(""))
+/* 626 */ name = name + " ";
+/* 627 */ name = name + roomName;
+/* */ }
+/* */ }
+/* */ }
+/* */ }
+/* 632 */ return name;
+/* */ }
+/* */
+/* */ static String getCurrentPositionName() {
+/* 636 */ return getCurrentPositionName(userMarks);
+/* */ }
+/* */
+/* */ static String getCurrentPositionName(Vector<BookmarkMenuItem> v) {
+/* 640 */ String position = getCurrentPositionURL(false);
+/* */
+/* */
+/* */
+/* */
+/* 645 */ int count = systemMarks.size();
+/* 646 */ for (int i = 0; i < count; i++) { BookmarkMenuItem item;
+/* 647 */ if ((item = getItemFromTarget(position,
+/* 648 */ (Vector)systemMarks.elementAt(i))) != null)
+/* 649 */ return
+/* 650 */ (String)systemMarksNames.elementAt(i) + " " + item.getLabel(); }
+/* 651 */ BookmarkMenuItem item; if (((item = getItemFromTarget(position, userMarks)) != null) ||
+/* 652 */ ((item = getItemFromTarget(position, historyItems)) != null)) {
+/* 653 */ return item.getLabel();
+/* */ }
+/* 655 */ String defaultName = getCurrentURLName();
+/* */
+/* 657 */ String name = defaultName;
+/* 658 */ int number = 1;
+/* */
+/* */ for (;;)
+/* */ {
+/* 662 */ if (getItemFromName(name, v) == null)
+/* 663 */ return name;
+/* 664 */ number++;
+/* 665 */ name = defaultName + "-" + number;
+/* */ }
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ static String getCurrentPositionURL(boolean mustHaveChannel)
+/* */ {
+/* 678 */ Pilot pilot = Pilot.getActive();
+/* 679 */ if (pilot == null) {
+/* 680 */ return "";
+/* */ }
+/* 682 */ String newURL = pilot.getURL();
+/* 683 */ if (newURL == null) {
+/* 684 */ return "";
+/* */ }
+/* 686 */ if (!mustHaveChannel) {
+/* 687 */ int dynamicChannelIndex = newURL.indexOf("<dimension-");
+/* 688 */ if (dynamicChannelIndex < 0)
+/* 689 */ dynamicChannelIndex = newURL.indexOf("<>@");
+/* 690 */ int channelEndIndex = newURL.indexOf(">@");
+/* 691 */ if ((dynamicChannelIndex > 0) &&
+/* 692 */ (dynamicChannelIndex < channelEndIndex)) {
+/* 693 */ newURL =
+/* 694 */ newURL.substring(0, dynamicChannelIndex) + newURL.substring(channelEndIndex + 1);
+/* */ }
+/* */ }
+/* */
+/* 698 */ return newURL;
+/* */ }
+/* */
+/* */
+/* */ public void teleportStatus(String err, String url)
+/* */ {
+/* 704 */ this.teleporting = ((err != null) && (err.length() == 0));
+/* */
+/* 706 */ if (err == null)
+/* */ {
+/* */
+/* */
+/* 710 */ url = getCurrentPositionURL(true);
+/* 711 */ if (url.length() == 0) {
+/* 712 */ return;
+/* */ }
+/* */
+/* */
+/* 716 */ Menu menu = getMenu();
+/* */
+/* */
+/* 719 */ for (int i = 0; i < historyItems.size(); i++) {
+/* 720 */ if (getHistory(i).getTarget().equals(url)) {
+/* 721 */ historyItems.removeElementAt(i);
+/* 722 */ this.historyMenu.remove(i);
+/* 723 */ break;
+/* */ }
+/* */ }
+/* */
+/* */
+/* 728 */ BookmarkMenuItem item = new BookmarkMenuItem(
+/* 729 */ getCurrentPositionName(historyItems), url);
+/* 730 */ historyItems.insertElementAt(item, 0);
+/* 731 */ this.historyMenu.insert(item, 0);
+/* */
+/* */
+/* 734 */ while (historyItems.size() > 10) {
+/* 735 */ historyItems.removeElementAt(10);
+/* 736 */ this.historyMenu.remove(10);
+/* */ }
+/* */ }
+/* */ }
+/* */
+/* */
+/* */ public void activate(Console c, Container f, Console prev) {}
+/* */
+/* */
+/* */ public void deactivate()
+/* */ {
+/* 747 */ if (this.menu != null)
+/* 748 */ this.menu.removeAll();
+/* 749 */ this.menu = null;
+/* 750 */ this.letsMenu = null;
+/* 751 */ firstUserItem = 0;
+/* */ }
+/* */
+/* */ @Deprecated
+/* */ public boolean action(Event event, Object what)
+/* */ {
+/* 757 */ Object target = event.target;
+/* 758 */ if (this.menu != null) {
+/* 759 */ if (target == this.addItem) {
+/* 760 */ if (Pilot.getActive().getRoom().getAllowTeleport()) {
+/* 761 */ new BookmarkAddDialog(Console.getFrame(), this);
+/* */ } else
+/* 763 */ Console.println(Console.message("no-teleport"));
+/* 764 */ } else if (target == this.deleteItem) {
+/* 765 */ new BookmarkDeleteDialog(this);
+/* 766 */ } else if (target == this.editItem) {
+/* 767 */ new BookmarkListDialog(this);
+/* 768 */ } else if (target == this.locationItem) {
+/* 769 */ this.startLocationDialog = true;
+/* 770 */ } else if ((target instanceof BookmarkMenuItem)) {
+/* 771 */ TeleportAction.teleport(
+/* 772 */ ((BookmarkMenuItem)target).getTarget(), null);
+/* */ } else
+/* 774 */ return false;
+/* 775 */ return true;
+/* */ }
+/* 777 */ return false;
+/* */ }
+/* */
+/* */ public boolean handle(FrameEvent f)
+/* */ {
+/* 782 */ if (this.startLocationDialog) {
+/* 783 */ this.startLocationDialog = false;
+/* */
+/* 785 */ String url = "";
+/* 786 */ Pilot pilot = Pilot.getActive();
+/* 787 */ if (pilot != null) {
+/* 788 */ url = pilot.getURL();
+/* */ }
+/* 790 */ new LocationDialog(Console.getFrame(), this,
+/* 791 */ Console.message("Change-Location"), url);
+/* */ }
+/* */
+/* 794 */ return true;
+/* */ }
+/* */ }
+
+
+/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\console\WorldsMarkPart.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 0.7.1
+ */ \ No newline at end of file