diff options
Diffstat (limited to 'NET/worlds/scape/EditTile.java')
| -rw-r--r-- | NET/worlds/scape/EditTile.java | 709 |
1 files changed, 709 insertions, 0 deletions
diff --git a/NET/worlds/scape/EditTile.java b/NET/worlds/scape/EditTile.java new file mode 100644 index 0000000..863196a --- /dev/null +++ b/NET/worlds/scape/EditTile.java @@ -0,0 +1,709 @@ +/* */ package NET.worlds.scape; +/* */ +/* */ import NET.worlds.console.Console; +/* */ import NET.worlds.console.DialogDisabled; +/* */ import NET.worlds.console.DialogReceiver; +/* */ import NET.worlds.console.ExposedPanel; +/* */ import NET.worlds.console.GammaFrame; +/* */ import NET.worlds.console.Main; +/* */ import NET.worlds.console.MainCallback; +/* */ import NET.worlds.console.PolledDialog; +/* */ import NET.worlds.console.RenderCanvas; +/* */ import NET.worlds.console.SnapTool; +/* */ import NET.worlds.console.Tree; +/* */ import NET.worlds.console.TreeCallback; +/* */ import NET.worlds.network.URL; +/* */ import java.awt.Button; +/* */ import java.awt.Component; +/* */ import java.awt.Event; +/* */ import java.awt.GridBagConstraints; +/* */ import java.awt.GridBagLayout; +/* */ import java.awt.Label; +/* */ import java.awt.Point; +/* */ import java.io.IOException; +/* */ import java.text.MessageFormat; +/* */ import java.util.Vector; +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public class EditTile +/* */ extends ExposedPanel +/* */ implements DialogReceiver, TreeCallback, MainCallback, DialogDisabled +/* */ { +/* */ private static final long serialVersionUID = 1L; +/* 84 */ private Button editButton = new Button(Console.message("Edit")); +/* 85 */ private Button addButton = new Button(Console.message("Add")); +/* 86 */ private Button delButton = new Button(Console.message("Delete")); +/* 87 */ private Button helpButton = new Button(Console.message("Help")); +/* 88 */ private ToolBar toolbar = new ToolBar(); +/* 89 */ private Label title = new Label(); +/* 90 */ private String titleText = ""; +/* */ private boolean usingTitleAsPrompt; +/* 92 */ private PropList props = new PropList(); +/* 93 */ private int queuedFunction = 0; +/* */ private Object queuedObject; +/* */ private Tree tree; +/* */ private PolledDialog activePopup; +/* 97 */ private boolean startup = true; +/* 98 */ private World rootWorld = null; +/* */ +/* */ private boolean isDialogDisabled; +/* */ +/* */ private static final int NONE = 0; +/* */ private static final int DELETE = 1; +/* */ private static final int ADD = 2; +/* */ private static final int CHANGE = 3; +/* */ private static final int UPDATE = 4; +/* */ private static final int CUT = 5; +/* */ private static final int COPY = 6; +/* */ private static final int PASTE = 7; +/* */ private static final int UNDO = 8; +/* */ private static final int EDIT = 9; +/* */ private static final int DROP = 10; +/* */ private static final int HELP = 11; +/* */ private static ClipboardEntry clipboard; +/* 115 */ private static UndoStack undoStack = new UndoStack(); +/* */ private Undoable preAddStackTop; +/* */ +/* 118 */ public void viewProperties(Object obj) { Console.getFrame().setShaperVisible(true); +/* 119 */ queue(3, obj); +/* */ } +/* */ +/* */ public void libraryDrop(URL url, String propertyName, Component comp, Point location) { +/* 123 */ queue(10, new DropInfo(url, propertyName, comp, location)); +/* */ } +/* */ +/* */ public EditTile(Tree tree) { +/* 127 */ this.tree = tree; +/* 128 */ tree.setOwner(this); +/* 129 */ GridBagLayout gbag = new GridBagLayout(); +/* 130 */ setLayout(gbag); +/* 131 */ GridBagConstraints c = new GridBagConstraints(); +/* 132 */ c.fill = 2; +/* 133 */ c.gridwidth = 0; +/* 134 */ c.weightx = 1.0D; +/* 135 */ c.weighty = 0.0D; +/* 136 */ c.anchor = 18; +/* 137 */ add(gbag, this.toolbar, c); +/* 138 */ add(gbag, this.title, c); +/* 139 */ c.weighty = 1.0D; +/* 140 */ c.fill = 1; +/* 141 */ c.gridwidth = 2; +/* 142 */ c.gridheight = 0; +/* 143 */ add(gbag, this.props, c); +/* 144 */ c.weightx = 0.0D; +/* 145 */ c.weighty = 0.0D; +/* 146 */ c.gridwidth = 0; +/* 147 */ c.gridheight = 1; +/* 148 */ c.fill = 2; +/* 149 */ add(gbag, this.editButton, c); +/* 150 */ add(gbag, this.addButton, c); +/* 151 */ add(gbag, this.delButton, c); +/* 152 */ add(gbag, this.helpButton, c); +/* 153 */ Main.register(this); +/* */ } +/* */ +/* */ public void update() { +/* 157 */ queue(4); +/* */ } +/* */ +/* */ private void add(GridBagLayout gbag, Component comp, GridBagConstraints c) { +/* 161 */ gbag.setConstraints(comp, c); +/* 162 */ add(comp); +/* */ } +/* */ +/* */ private boolean queue(int function) { +/* 166 */ return queue(function, null); +/* */ } +/* */ +/* */ private synchronized boolean queue(int function, Object obj) { +/* 170 */ if ((this.queuedFunction == 0) && (this.activePopup == null)) { +/* 171 */ this.queuedFunction = function; +/* 172 */ this.queuedObject = obj; +/* 173 */ setEnabled(false); +/* */ } +/* 175 */ return true; +/* */ } +/* */ +/* */ public synchronized void mainCallback() { +/* 179 */ if (this.startup) { +/* 180 */ World w = Pilot.getActiveWorld(); +/* 181 */ if (w != null) { +/* 182 */ change(w); +/* 183 */ this.startup = false; +/* */ } +/* */ } +/* */ +/* */ +/* 188 */ if (this.rootWorld != null) { +/* 189 */ this.rootWorld.incRef(); +/* */ } +/* 191 */ boolean enable = true; +/* 192 */ switch (this.queuedFunction) { +/* */ case 0: +/* 194 */ return; +/* */ case 1: +/* 196 */ delete(false); +/* 197 */ break; +/* */ case 5: +/* 199 */ delete(true); +/* 200 */ break; +/* */ case 2: +/* 202 */ enable = doAdd(); +/* 203 */ break; +/* */ case 9: +/* 205 */ enable = doEdit(); +/* 206 */ break; +/* */ case 3: +/* 208 */ change(this.queuedObject); +/* 209 */ break; +/* */ case 4: +/* 211 */ this.tree.update(); +/* 212 */ break; +/* */ case 8: +/* 214 */ doUndo(); +/* 215 */ break; +/* */ case 6: +/* 217 */ doCopy(); +/* 218 */ break; +/* */ case 7: +/* 220 */ doPaste(); +/* 221 */ break; +/* */ case 10: +/* 223 */ if (!drop((DropInfo)this.queuedObject)) { +/* 224 */ Object[] arguments = { new String(((DropInfo)this.queuedObject).url) }; +/* 225 */ Console.println(MessageFormat.format(Console.message("Target-doesnt"), arguments)); +/* */ } +/* 227 */ break; +/* */ case 11: +/* 229 */ doHelp(); +/* */ } +/* */ +/* 232 */ setEnabled(enable); +/* 233 */ this.queuedFunction = 0; +/* 234 */ this.queuedObject = null; +/* */ } +/* */ +/* */ private void delete(boolean isCut) { +/* 238 */ if (this.delButton.isEnabled()) { +/* 239 */ PropTreeNode e = (PropTreeNode)this.tree.getSelectedNode(); +/* 240 */ if ((e != null) && (this.tree.hasFocus())) { +/* 241 */ addUndoable(e.delete(isCut)); +/* */ } else { +/* 243 */ Property p = this.props.getSelectedProperty(); +/* 244 */ assert ((p.canSetNull()) && (p.get() != null)); +/* 245 */ addUndoableSet(p, null); +/* */ } +/* 247 */ this.tree.update(); +/* */ } +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public static void adjustDroppedSource(SuperRoot sr) +/* */ { +/* 258 */ if ((sr != null) && ( +/* 259 */ (!(sr instanceof WObject)) || (!((WObject)sr).isDynamic()))) +/* 260 */ sr.setSourceURL(null); +/* */ } +/* */ +/* */ private boolean drop(DropInfo info) { +/* 264 */ Object dropped = info.url; +/* */ +/* */ +/* 267 */ if ((info.url.endsWith(".class")) || (info.url.endsWith("." + WObject.getSaveExtension()))) { +/* 268 */ SuperRoot sr = WobLoader.immediateLoad(info.url); +/* 269 */ adjustDroppedSource(sr); +/* */ +/* 271 */ dropped = sr; +/* */ } +/* 273 */ return drop(dropped, info.propertyName, false, info.comp, info.location); +/* */ } +/* */ +/* */ private boolean drop(Object obj, String propertyName, boolean isPaste) { +/* 277 */ return drop(obj, propertyName, isPaste, null, null); +/* */ } +/* */ +/* */ private boolean drop(Object obj, String propertyName, boolean isPaste, Component comp, Point location) { +/* 281 */ if (obj == null) +/* 282 */ return false; +/* 283 */ PropTreeNode e = null; +/* 284 */ Point3Temp dropPoint = null; +/* 285 */ if ((comp == null) && (this.tree.hasFocus())) { +/* 286 */ e = (PropTreeNode)this.tree.getSelectedNode(); +/* 287 */ } else if (comp == this.tree) { +/* 288 */ e = (PropTreeNode)this.tree.elementAt(location); +/* 289 */ } else if ((comp instanceof RenderCanvas)) { +/* 290 */ Camera c = ((RenderCanvas)comp).getCamera(); +/* 291 */ dropPoint = Point3Temp.make(); +/* 292 */ WObject picked = c.getObjectAt(location.x, location.y, false, dropPoint); +/* 293 */ if (picked != null) { +/* 294 */ if ((obj instanceof WObject)) +/* 295 */ picked = picked.getRoom(); +/* */ } else { +/* 297 */ Pilot pilot = Pilot.getActive(); +/* 298 */ picked = pilot.getRoom(); +/* 299 */ dropPoint.set(0.0F, 180.0F, 0.0F); +/* 300 */ dropPoint.times(pilot); +/* */ } +/* 302 */ if (picked != null) { +/* 303 */ change(picked); +/* 304 */ e = (PropTreeNode)this.tree.getSelectedNode(); +/* */ } +/* */ } +/* 307 */ if (e == null) { +/* 308 */ return false; +/* */ } +/* */ +/* 311 */ boolean success = false; +/* 312 */ VectorProperty vp; PropAdder adder; if (((vp = e.getContainingVectorProperty()) != null) && ((adder = vp.getAdder()) != null)) +/* 313 */ success = adder.libraryDrop(this, obj, isPaste, true); +/* 314 */ if (!success) { +/* 315 */ Object top = null; +/* 316 */ while (e != null) { +/* 317 */ top = e.getObject(); +/* 318 */ if ((top instanceof Properties)) +/* */ break; +/* 320 */ if ((top instanceof Property)) +/* */ { +/* 322 */ top = ((Property)top).get(); +/* 323 */ if ((top instanceof Properties)) +/* */ break; +/* */ } +/* 326 */ e = (PropTreeNode)e.getParent(); +/* */ } +/* 328 */ if (e != null) +/* */ { +/* */ +/* */ +/* 332 */ Vector<LibraryDrop> targets = new Vector(); +/* 333 */ int topLevelTargets = recurseFindDropTargets(targets, obj, propertyName, isPaste, +/* 334 */ new EnumProperties(top), 0, 10); +/* 335 */ if ((topLevelTargets == 1) || ((topLevelTargets == 0) && (targets.size() == 1))) { +/* 336 */ success = ((LibraryDrop)targets.elementAt(0)).libraryDrop(this, obj, isPaste, true); +/* */ } +/* */ } +/* */ } +/* 340 */ if (success) { +/* 341 */ if ((obj instanceof Properties)) { +/* 342 */ change(obj); +/* */ } else +/* 344 */ this.tree.update(); +/* */ } +/* */ WObject wobj; +/* 347 */ if ((dropPoint != null) && ((obj instanceof WObject)) && (!(obj instanceof Room)) && +/* 348 */ ((wobj = (WObject)obj).isActive())) { +/* 349 */ dropPoint.z = wobj.getZ(); +/* 350 */ wobj.moveTo(SnapTool.snapTool().snapTo(dropPoint)); +/* */ } +/* 352 */ return success; +/* */ } +/* */ +/* */ private int recurseFindDropTargets(Vector<LibraryDrop> targets, Object obj, String propertyName, boolean isPaste, EnumProperties enumProperties, int level, int maxLevel) +/* */ { +/* 357 */ int firstLevelMatches = 0; +/* 358 */ if (level > maxLevel) { +/* 359 */ return 0; +/* */ } +/* 361 */ while (enumProperties.hasMoreElements()) { +/* 362 */ Property p = (Property)enumProperties.nextElement(); +/* 363 */ boolean propMatch = (propertyName == null) || (propertyName.equals(p.getName())); +/* 364 */ if (propMatch) { +/* 365 */ LibraryDrop target = null; +/* 366 */ if ((p instanceof VectorProperty)) { +/* 367 */ target = ((VectorProperty)p).getAdder(); +/* */ } else +/* 369 */ target = p.getEditor(); +/* 370 */ if ((target != null) && (target.libraryDrop(this, obj, isPaste, false))) { +/* 371 */ if (level == 0) { +/* 372 */ targets.insertElementAt(target, firstLevelMatches++); continue; +/* */ } +/* 374 */ targets.addElement(target); +/* 375 */ continue; +/* */ } +/* */ } +/* 378 */ if (!(p instanceof VectorProperty)) { +/* 379 */ int err = recurseFindDropTargets(targets, obj, propertyName, isPaste, new EnumProperties(p.get()), +/* 380 */ level + 1, maxLevel); +/* 381 */ if (err != 0) +/* 382 */ return err; +/* */ } +/* */ } +/* 385 */ return firstLevelMatches; +/* */ } +/* */ +/* */ +/* */ private boolean change(Object obj) +/* */ { +/* 391 */ Object parent = obj; +/* */ +/* */ +/* 394 */ Vector<Object> lineage = new Vector(); +/* 395 */ Object p; while (((parent instanceof Properties)) && ((p = ((Properties)parent).propertyParent()) != null)) { Object p; +/* 396 */ if (lineage != null) +/* */ { +/* */ +/* 399 */ EnumProperties e = new EnumProperties(p); +/* 400 */ boolean found = false; +/* 401 */ while (e.hasMoreElements()) { +/* 402 */ Property prop = (Property)e.nextElement(); +/* 403 */ Object o = prop.get(); +/* 404 */ boolean isVector = prop instanceof VectorProperty; +/* 405 */ if ((o == parent) || ((isVector) && (o != null) && (((Vector)o).indexOf(parent) != -1))) { +/* 406 */ if (isVector) { +/* 407 */ lineage.insertElementAt(parent, 0); +/* */ } +/* 409 */ lineage.insertElementAt(prop, 0); +/* 410 */ found = true; +/* 411 */ break; +/* */ } +/* */ } +/* 414 */ if (!found) +/* 415 */ lineage = null; +/* */ } +/* 417 */ parent = p; +/* */ } +/* 419 */ this.rootWorld = null; +/* 420 */ if ((parent instanceof World)) +/* 421 */ this.rootWorld = ((World)parent); +/* 422 */ PropTreeNode root = new PropTreeNode(parent); +/* 423 */ if (lineage != null) { +/* 424 */ this.tree.change(root, lineage); +/* */ } else +/* 426 */ this.tree.change(root, obj); +/* 427 */ return true; +/* */ } +/* */ +/* */ public void treeFocusChanged(boolean hasFocus) { +/* 431 */ if (hasFocus) { +/* 432 */ this.props.deselect(this.props.getSelectedIndex()); +/* 433 */ adjustButtons(); +/* */ } +/* */ } +/* */ +/* */ public void treeChange(Object obj) { +/* 438 */ if (((obj instanceof Property)) && (!(obj instanceof VectorProperty))) +/* 439 */ obj = ((Property)obj).get(); +/* 440 */ this.props.setObject(obj); +/* 441 */ this.toolbar.setCurrentObject(obj); +/* 442 */ String name = obj.getClass().getName(); +/* */ int index; +/* 444 */ if ((index = name.lastIndexOf('.')) != -1) +/* 445 */ name = name.substring(index + 1); +/* 446 */ setTitle(name + " " + Console.message("Properties")); +/* 447 */ adjustButtons(); +/* */ } +/* */ +/* */ private void setTitle(String titleText) { +/* 451 */ this.titleText = titleText; +/* 452 */ if (!this.usingTitleAsPrompt) +/* 453 */ this.title.setText(titleText); +/* */ } +/* */ +/* */ public void setPrompt(String promptText) { +/* 457 */ this.title.setText((this.usingTitleAsPrompt = promptText != null ? 1 : 0) != 0 ? promptText : this.titleText); +/* */ } +/* */ +/* */ private void adjustButtons() { +/* 461 */ PropTreeNode e = (PropTreeNode)this.tree.getSelectedNode(); +/* 462 */ if ((e != null) && (this.tree.hasFocus())) { +/* 463 */ this.editButton.setEnabled(e.canEdit()); +/* 464 */ this.delButton.setEnabled(e.canDelete()); +/* 465 */ this.addButton.setEnabled(e.canAdd()); +/* 466 */ this.helpButton.setEnabled(true); +/* */ } else { +/* 468 */ Property p = this.props.getSelectedProperty(); +/* 469 */ if (p != null) { +/* 470 */ Object obj = p.get(); +/* 471 */ this.editButton.setEnabled(p.getEditor() != null); +/* 472 */ this.delButton.setEnabled((p.canSetNull()) && (obj != null)); +/* 473 */ this.addButton.setEnabled((p.canSetNull()) && (p.getEditor() != null) && (obj == null)); +/* 474 */ this.helpButton.setEnabled(p.helpExists); +/* */ } else { +/* 476 */ this.editButton.setEnabled(false); +/* 477 */ this.delButton.setEnabled(false); +/* 478 */ this.addButton.setEnabled(false); +/* 479 */ this.helpButton.setEnabled(false); +/* */ } +/* */ } +/* */ } +/* */ +/* */ public void dialogDisable(boolean disable) { +/* 485 */ this.isDialogDisabled = disable; +/* 486 */ this.toolbar.dialogDisable(disable); +/* */ } +/* */ +/* */ @Deprecated +/* */ public boolean handleEvent(Event event) { +/* 491 */ if (event.id == 701) { +/* 492 */ if (event.target == this.props) +/* 493 */ this.tree.setFocus(false); +/* 494 */ adjustButtons(); +/* */ } +/* */ +/* 497 */ if (this.isDialogDisabled) { +/* 498 */ return false; +/* */ } +/* 500 */ return super.handleEvent(event); +/* */ } +/* */ +/* */ @Deprecated +/* */ public boolean action(Event event, Object what) { +/* 505 */ Object target = event.target; +/* 506 */ if (target == this.delButton) +/* 507 */ return queue(1); +/* 508 */ if (target == this.addButton) +/* 509 */ return queue(2); +/* 510 */ if ((target == this.editButton) || ((target == this.props) && (this.editButton.isEnabled()))) +/* 511 */ return queue(9); +/* 512 */ if (target == this.helpButton) +/* 513 */ return queue(11); +/* 514 */ return false; +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ private boolean isAdd; +/* */ +/* */ +/* */ +/* */ public void dialogDone(Object who, boolean confirmed) +/* */ { +/* 526 */ if (who == this.activePopup) { +/* 527 */ this.activePopup = null; +/* 528 */ this.tree.setEnabled(true); +/* 529 */ if (confirmed) { +/* */ Undoable u; +/* */ Object obj; +/* 532 */ if ((this.isAdd) && ((u = undoStack.peek()) != this.preAddStackTop) && ((u instanceof UndoablAdd)) && +/* 533 */ (((obj = ((UndoablAdd)u).getObject()) instanceof Properties))) { +/* 534 */ change(obj); +/* */ } else +/* 536 */ this.tree.update(); +/* */ } +/* 538 */ setEnabled(true); +/* */ } +/* */ } +/* */ +/* */ private boolean doEdit() { +/* 543 */ Property p = this.props.getSelectedProperty(); +/* */ PropEditor editor; +/* 545 */ if ((p != null) && ((editor = p.getEditor()) != null)) { +/* 546 */ this.isAdd = false; +/* 547 */ this.activePopup = editor.edit(this, "Edit " + p.getName()); +/* 548 */ this.tree.setEnabled(false); +/* 549 */ return false; +/* */ } +/* 551 */ return true; +/* */ } +/* */ +/* */ private boolean doAdd() { +/* 555 */ PropTreeNode e = (PropTreeNode)this.tree.getSelectedNode(); +/* */ PropAdder adder; +/* 557 */ if ((e != null) && (this.tree.hasFocus()) && ((adder = e.getAdder()) != null)) { +/* 558 */ this.preAddStackTop = undoStack.peek(); +/* 559 */ this.isAdd = true; +/* 560 */ this.activePopup = adder.add(this, "Add to " + e.getContainerName()); +/* 561 */ this.tree.setEnabled(false); +/* 562 */ return false; +/* */ } +/* 564 */ return true; +/* */ } +/* */ +/* */ public void cut() { +/* 568 */ queue(5); +/* */ } +/* */ +/* */ public void paste() { +/* 572 */ queue(7); +/* */ } +/* */ +/* */ private boolean doPaste() { +/* 576 */ if (clipboard != null) { +/* 577 */ SuperRoot obj = clipboard.paste(); +/* 578 */ if (drop(obj, null, true)) +/* 579 */ return true; +/* 580 */ clipboard.unPaste(obj); +/* 581 */ Console.println(Console.message("Clip-contents")); +/* */ } else { +/* 583 */ Console.println(Console.message("Clip-empty")); } +/* 584 */ return false; +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* 592 */ private SendURLAction helpAction = new SendURLAction(); +/* */ private Persister helpBrowser; +/* */ +/* */ private boolean doHelp() { +/* 596 */ this.helpAction.showDialog = false; +/* 597 */ if ((this.tree.hasFocus()) && (this.props.getSelectedProperty() == null)) { +/* */ try { +/* 599 */ SuperRoot s = (SuperRoot)((PropTreeNode)this.tree.getSelectedNode()).getObject(); +/* */ +/* */ +/* */ +/* */ +/* 604 */ if (s == null) break label141; +/* 605 */ this.helpAction.setDestination(s.getHelpURL()); +/* */ } +/* */ catch (ClassCastException e) { +/* 608 */ Console.println(Console.message("No-help")); +/* */ } +/* */ } else { +/* 611 */ Property p = this.props.getSelectedProperty(); +/* */ +/* 613 */ if ((p != null) && (p.helpExists)) { +/* */ try { +/* 615 */ SuperRoot s = (SuperRoot)((PropTreeNode)this.tree.getSelectedNode()).getObject(); +/* */ +/* */ +/* */ +/* 619 */ if (s != null) { +/* 620 */ this.helpAction.setDestination(s.getHelpURL(p)); +/* */ } +/* */ } catch (ClassCastException e) { +/* 623 */ Console.println(Console.message("No-help")); +/* */ } +/* */ } +/* */ } +/* */ label141: +/* 628 */ this.helpBrowser = this.helpAction.trigger(null, this.helpBrowser); +/* 629 */ return true; +/* */ } +/* */ +/* */ public void copy() { +/* 633 */ queue(6); +/* */ } +/* */ +/* */ private void doCopy() { +/* 637 */ SuperRoot item = getCurSuperRoot(true); +/* 638 */ if (item != null) { +/* 639 */ ClipboardEntry newClip = new ClipboardEntry(); +/* 640 */ if (newClip.copy(item)) +/* 641 */ addUndoable(new UndoabCopy(newClip)); +/* */ } +/* */ } +/* */ +/* */ public boolean save(String fileName) { +/* 646 */ SuperRoot item = getCurSuperRoot(true); +/* */ try { +/* 648 */ item.saveFile(new URL(URL.getCurDir(), fileName)); +/* 649 */ return true; +/* */ } catch (IOException e) {} +/* 651 */ return false; +/* */ } +/* */ +/* */ private SuperRoot getCurSuperRoot(boolean allowContainers) +/* */ { +/* 656 */ Object obj = this.props.getObject(); +/* 657 */ if ((obj instanceof SuperRoot)) +/* 658 */ return (SuperRoot)obj; +/* 659 */ return null; +/* */ } +/* */ +/* */ public void addUndoable(Undoable u) { +/* 663 */ undoStack.push(u); +/* */ } +/* */ +/* */ public void addUndoableSet(Property prop, Object obj) { +/* 667 */ addUndoable(new UndoablSet(prop, obj)); +/* */ } +/* */ +/* */ public void addUndoableAdd(VectorProperty prop, Object obj, boolean changeTree) { +/* 671 */ addUndoable(new UndoablAdd(prop, obj)); +/* 672 */ if (!changeTree) +/* 673 */ this.preAddStackTop = undoStack.peek(); +/* */ } +/* */ +/* */ public void addUndoablePaste(VectorProperty prop, Object obj) { +/* */ try { +/* 678 */ addUndoable(new UndoablPaste(prop, clipboard, obj)); +/* */ } catch (Error e) { +/* 680 */ Console.println(e.getMessage()); +/* */ } +/* */ } +/* */ +/* */ public void undo() { +/* 685 */ if (Main.isMainThread()) { +/* 686 */ doUndo(); +/* */ } else +/* 688 */ queue(8); +/* */ } +/* */ +/* */ private void doUndo() { +/* 692 */ if (undoStack.undo()) +/* 693 */ this.tree.update(); +/* */ } +/* */ +/* */ public static void setClipboard(ClipboardEntry clip) { +/* 697 */ clipboard = clip; +/* */ } +/* */ +/* */ public static ClipboardEntry getClipboard() { +/* 701 */ return clipboard; +/* */ } +/* */ } + + +/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\EditTile.class + * Java compiler version: 6 (50.0) + * JD-Core Version: 0.7.1 + */
\ No newline at end of file |