From: <ox-...@us...> - 2003-06-12 05:13:52
|
Update of /cvsroot/sheets/sheets In directory sc8-pr-cvs1:/tmp/cvs-serv27839 Modified Files: .sheetsrc Sheets.sheets todo.txt Log Message: 1. Made all HistoryManager objects persistent. This way it is safe to sync the database during a change command (which occassionally happens for a good reason) 2. Improved the error message printed out if HistoryManager objects are not empty when a new change command is started. 3. Added a new line-terminator variable that can be used to force unix or windows linefeeds (or add some very creative borders to a file) 4. New version of OX with the following stability improvements: a. Fixed a bug with SerializableArchivalObject that breaks the database format (again) b. Improved debugging message for marking of released objects IMPORTANT: Please regenerate your database!!! Index: .sheetsrc =================================================================== RCS file: /cvsroot/sheets/sheets/.sheetsrc,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** .sheetsrc 8 Jun 2003 17:14:34 -0000 1.14 --- .sheetsrc 12 Jun 2003 05:13:16 -0000 1.15 *************** *** 12,16 **** #set screen-insets 0 108 0 0 ! set web-browser "konqueror" # Use this instead for *nix systems: #set web-browser "mozilla" --- 12,16 ---- #set screen-insets 0 108 0 0 ! set web-browser "explorer" # Use this instead for *nix systems: #set web-browser "mozilla" Index: Sheets.sheets =================================================================== RCS file: /cvsroot/sheets/sheets/Sheets.sheets,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** Sheets.sheets 11 Jun 2003 19:14:33 -0000 1.57 --- Sheets.sheets 12 Jun 2003 05:13:16 -0000 1.58 *************** *** 8393,8396 **** --- 8393,8397 ---- ram:1501 ram:1707 + schin:1276 nkramer:8556 nkramer:15089 *************** *** 8636,8639 **** --- 8637,8643 ---- } else if (name.equals("diff-command")) { diffCommand = getString(stream); + } else if (name.equals("line-terminator")) { + lineTerminator = getString(stream); + System.setProperty("line.separator", lineTerminator); } else if (name.equals("debugger-command-line")) { debuggerCommandLine = getString(stream); *************** *** 10378,10381 **** --- 10382,10387 ---- diff3Command = "diff3 -m "; diffCommand = "diff -u "; + lineTerminator = System.getProperty("line.separator"); + System.out.println("we got a line terminator of length: " + lineTerminator.length() + lineTerminator); debuggerCommandLine = ""; debugCommandLine = ""; *************** *** 32028,32032 **** String wrapperTag = old.wrapperTag(); if (wrapperTag != null) ! System.out.println(text = "<" + wrapperTag + ">" + text + "</" + wrapperTag + ">"); return replaceWithDoc(old, text, force, extend, container); --- 32034,32038 ---- String wrapperTag = old.wrapperTag(); if (wrapperTag != null) ! text = "<" + wrapperTag + ">" + text + "</" + wrapperTag + ">"; return replaceWithDoc(old, text, force, extend, container); *************** *** 36372,36377 **** --- 36378,36386 ---- section exports ram:29 ram:43 + schin:1273 ram2:48 + schin:1274 ram2:49 + schin:1275 ram:31 ram:760 *************** *** 36416,36421 **** } else if (!HistoryManager.changeCommandStack.peek().equals("Undo Dialog")) { if (event.replacements.length >= 1) { ! HistoryManager.deadFragments.removeElement(comp); ! HistoryManager.replacedFragments.addElement(comp); } } --- 36425,36430 ---- } else if (!HistoryManager.changeCommandStack.peek().equals("Undo Dialog")) { if (event.replacements.length >= 1) { ! HistoryManager.getDeadFragments().removeElement(comp); ! HistoryManager.getReplacedFragments().addElement(comp); } } *************** *** 36440,36445 **** // Don't bother checkpointing things that have already been checkpointed. ArchivalReference compID = comp.getArchivalReference(); ! for (int i = 0; i < HistoryManager.changeHistory.size(); i++) ! if (((Checkpoint)HistoryManager.changeHistory.elementAt(i)).containerID.equals(compID)) return; switch (event.id) { --- 36449,36455 ---- // Don't bother checkpointing things that have already been checkpointed. ArchivalReference compID = comp.getArchivalReference(); ! PVector ch = HistoryManager.getChangeHistory(); ! for (int i = 0; i < ch.size(); i++) ! if (((Checkpoint)ch.elementAt(i)).containerID.equals(compID)) return; switch (event.id) { *************** *** 36455,36459 **** UndoDialog.maybeFinishUndo(); Checkpoint ckp = comp.getCheckpoint(); ! if (ckp != null) HistoryManager.changeHistory.addElement(ckp); } break; --- 36465,36469 ---- UndoDialog.maybeFinishUndo(); Checkpoint ckp = comp.getCheckpoint(); ! if (ckp != null) ch.addElement(ckp); } break; *************** *** 36467,36472 **** // Buffer we use to log the container modifications that happen within a given // ChangeContainerCommand. ! static Vector /* of Checkpoint */ HistoryManager.changeHistory ! = new Vector(20, 20); object ram:64 pkg=org.browsecode.sheets --- 36477,36481 ---- // Buffer we use to log the container modifications that happen within a given // ChangeContainerCommand. ! private static PVector /* of Checkpoint */ HistoryManager.changeHistory; object ram:64 pkg=org.browsecode.sheets *************** *** 37220,37268 **** return; } ! boolean somethingHappened = false; ! if (changeHistory.size() > 0) { ! somethingHappened = true; ! ArchivalReference[] undoIDs = new ArchivalReference[changeHistory.size()]; for (int i = 0; i < undoIDs.length; i++) ! undoIDs[i] = ((Checkpoint)(changeHistory.elementAt(i))).getArchivalReference(); CommandCheckpoints ckp = new CommandCheckpoints(State.getObjectDatabase()); ckp.undoIDs = undoIDs; ckp.cmd = cmd; ! String[] dnames = new String[deadFragments.size()]; ! for (int i = 0; i<deadFragments.size(); i++) dnames[i] = ((Fragment) ! (deadFragments.elementAt(i))).toString(Fragment.NAME); ckp.deletedNames = dnames; ! String[] rnames = new String[replacedFragments.size()]; ! for (int i = 0; i<replacedFragments.size(); i++) ! rnames[i] = ((Fragment) ! (replacedFragments.elementAt(i))).toString(Fragment.NAME); ckp.replacedNames = rnames; ckp.getArchivalReference().objectModified(); ! PVector ch = getCommandHistory(); ! if (ch.size() >= Profile.globalUndoHistorySize) ! ch.removeElementAt(0); ! ch.addElement(ckp); } ! replacedFragments.setSize(0); ! changeHistory.setSize(0); ! if (deadFragments.size() > 0) { ! somethingHappened = true; ! Fragment[] dead = new Fragment[deadFragments.size()]; for (int i = 0; i < dead.length; i++) ! dead[i] = (Fragment)(deadFragments.elementAt(i)); ! deadFragments.setSize(0); // If nothing in the changeHistory, no sheets modified, so can't undo. Last ref // must have been transient. Treat like lethal. ! if (lethalIntent || changeHistory.size() == 0) { ! StringBuffer sb ! = new StringBuffer("Deleted " + dead[0].toString(Fragment.SHORT_NAME)); for (int i = 1; i < dead.length; i++) { sb.append(", "); --- 37229,37278 ---- return; } + + PVector ch = getChangeHistory(); + PVector df = getDeadFragments(); + PVector rf = getReplacedFragments(); ! boolean fragmentsChanged = ch.size() > 0; ! if (fragmentsChanged) { ! ArchivalReference[] undoIDs = new ArchivalReference[ch.size()]; for (int i = 0; i < undoIDs.length; i++) ! undoIDs[i] = ((Checkpoint)(ch.elementAt(i))).getArchivalReference(); CommandCheckpoints ckp = new CommandCheckpoints(State.getObjectDatabase()); ckp.undoIDs = undoIDs; ckp.cmd = cmd; ! String[] dnames = new String[df.size()]; ! for (int i = 0; i<df.size(); i++) dnames[i] = ((Fragment) ! (df.elementAt(i))).toString(Fragment.NAME); ckp.deletedNames = dnames; ! String[] rnames = new String[rf.size()]; ! for (int i = 0; i<rf.size(); i++) ! rnames[i] = ((Fragment)(rf.elementAt(i))).toString(Fragment.NAME); ckp.replacedNames = rnames; ckp.getArchivalReference().objectModified(); ! PVector commandHistory = getCommandHistory(); ! if (commandHistory.size() >= Profile.globalUndoHistorySize) ! commandHistory.removeElementAt(0); ! commandHistory.addElement(ckp); } ! rf.setSize(0); ! ch.setSize(0); ! boolean fragmentsDied = df.size() > 0; ! if (fragmentsDied) { ! Fragment[] dead = new Fragment[df.size()]; for (int i = 0; i < dead.length; i++) ! dead[i] = (Fragment)(df.elementAt(i)); ! df.setSize(0); // If nothing in the changeHistory, no sheets modified, so can't undo. Last ref // must have been transient. Treat like lethal. ! if (lethalIntent || fragmentsChanged) { ! StringBuffer sb = new StringBuffer("Deleted " + dead[0].toString(Fragment.SHORT_NAME)); for (int i = 1; i < dead.length; i++) { sb.append(", "); *************** *** 37278,37282 **** } ! if (Profile.autoSync && somethingHappened) try { State.getObjectDatabase().sync(); } catch (IOException e) { } --- 37288,37292 ---- } ! if (Profile.autoSync && (fragmentsChanged || fragmentsDied)) try { State.getObjectDatabase().sync(); } catch (IOException e) { } *************** *** 37418,37422 **** + " died when not in a change command?"); else if (!HistoryManager.changeCommandStack.peek().equals("Undo Dialog")) ! HistoryManager.deadFragments.addElement(event.fragment); } } --- 37428,37432 ---- + " died when not in a change command?"); else if (!HistoryManager.changeCommandStack.peek().equals("Undo Dialog")) ! HistoryManager.getDeadFragments().addElement(event.fragment); } } *************** *** 38609,38615 **** if (changeCommandStack.empty()) { UndoDialog.maybeFinishUndo(); ! if (deadFragments.size() != 0 || changeHistory.size() != 0 ! || replacedFragments.size() != 0) Console.internalError("History not empty at beginChangeCommand?"); } changeCommandStack.push(cmd); --- 38619,38628 ---- if (changeCommandStack.empty()) { UndoDialog.maybeFinishUndo(); ! if (getDeadFragments().size() != 0) ! Console.internalError("Dead fragments not empty at beginChangeCommand?"); ! if (getChangeHistory().size() != 0) Console.internalError("History not empty at beginChangeCommand?"); + if (getReplacedFragments().size() != 0) + Console.internalError("Replaced fragments not empty at beginChangeCommand?"); } changeCommandStack.push(cmd); *************** *** 46037,46041 **** the actual error message. This is a magic variable: you can set it multiple times, and the result is cumulative. Values are automatically installed for ! Sun's javac and for Microsoft's jvc. object ram:2797 type=doc-para --- 46050,46054 ---- the actual error message. This is a magic variable: you can set it multiple times, and the result is cumulative. Values are automatically installed for ! Sun's javac and for IBM's jikes. object ram:2797 type=doc-para *************** *** 46884,46889 **** // later gets a replacement event indicating replacement with 1 or // more others. ! static Vector /* of Fragment */ HistoryManager.deadFragments ! = new Vector(); object ram2:49 pkg=org.browsecode.sheets --- 46897,46901 ---- // later gets a replacement event indicating replacement with 1 or // more others. ! private static PVector /* of Fragment */ HistoryManager.deadFragments; object ram2:49 pkg=org.browsecode.sheets *************** *** 46891,46896 **** section text ram2:49 // Fragments that were replaced with 1 or more other fragments. ! static Vector /* of Fragment */ HistoryManager.replacedFragments ! = new Vector(); object ram2:50 pkg=org.browsecode.sheets --- 46903,46907 ---- section text ram2:49 // Fragments that were replaced with 1 or more other fragments. ! private static PVector /* of Fragment */ HistoryManager.replacedFragments; object ram2:50 pkg=org.browsecode.sheets *************** *** 82432,82435 **** --- 82443,82504 ---- section text schin:1272 private boolean Splash.Progress.firstPaintComplete; + object schin:1273 + pkg=org.browsecode.sheets + type=java + section text schin:1273 + static PVector HistoryManager.getChangeHistory () + { + if (changeHistory == null) { + changeHistory = (PVector)State.getGlobalStateVar("HistoryManager.changeHistory"); + if (changeHistory == null) { + changeHistory = new PVector(State.getObjectDatabase(), 20); + State.setGlobalStateVar("HistoryManager.changeHistory", changeHistory); + } + } + return changeHistory; + } + object schin:1274 + pkg=org.browsecode.sheets + type=java + section text schin:1274 + static PVector HistoryManager.getDeadFragments () + { + if (deadFragments == null) { + deadFragments = (PVector)State.getGlobalStateVar("HistoryManager.deadFragments"); + if (deadFragments == null) { + deadFragments = new PVector(State.getObjectDatabase(), 20); + State.setGlobalStateVar("HistoryManager.deadFragments", deadFragments); + } + } + return deadFragments; + } + object schin:1275 + pkg=org.browsecode.sheets + type=java + section text schin:1275 + static PVector HistoryManager.getReplacedFragments () + { + if (replacedFragments == null) { + replacedFragments = (PVector)State.getGlobalStateVar("HistoryManager.replacedFragments"); + if (replacedFragments == null) { + replacedFragments = new PVector(State.getObjectDatabase(), 20); + State.setGlobalStateVar("HistoryManager.replacedFragments", replacedFragments); + } + } + return replacedFragments; + } + object schin:1276 + pkg=org.browsecode.sheets + type=java + section text schin:1276 + // Line terminator used for exporting files + public static String Profile.lineTerminator; + object schin:1279 + type=doc-para + section text schin:1279 + The character or set of characters used to terminate each line in exported + files. By default, this will get set to appropriate line terminator for + the machine you are running on. Use this variable to override the default + line terminator. object sjc:1 pkg=org.browsecode.sheets.dicer *************** *** 95742,95745 **** --- 95811,95815 ---- ram:1501 ram:1707 + schin:1276 nkramer:15095 nkramer:8556 *************** *** 100836,100842 **** --- 100906,100915 ---- ram:29 ram:43 + schin:1273 ram:453 ram2:48 + schin:1274 ram2:49 + schin:1275 ram:31 ram:760 *************** *** 102675,102678 **** --- 102748,102752 ---- ram:2785 ram:2793 + schin:1278 object ram:2785 title=compile-command : String = "javac %java%"\nrecompile-command : String = "javac %JAVA%" *************** *** 106300,106303 **** --- 106374,106384 ---- schin:1226 schin:1227 + object schin:1278 + title=line-terminator : String = (platform-specific) + type=doc-definition + section text schin:1278 + line-terminator : String = (platform-specific) + section components schin:1278 + schin:1279 object sjc:6 title=ClickableLabel Index: todo.txt =================================================================== RCS file: /cvsroot/sheets/sheets/todo.txt,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** todo.txt 11 Jun 2003 10:31:16 -0000 1.27 --- todo.txt 12 Jun 2003 05:13:18 -0000 1.28 *************** *** 2,5 **** --- 2,8 ---- - + todo: + improve performance of file import by turning off the history manager during the batch. + more annoying bugs: java.lang.NullPointerException |