|
From: <ox-...@us...> - 2003-05-23 09:55:40
|
Update of /cvsroot/sheets/sheets
In directory sc8-pr-cvs1:/tmp/cvs-serv18983
Modified Files:
Sheets.sheets build.xml todo.txt
Log Message:
1. automatically append .bat to command on failure (to emulate windows command prompt behavior)
2. fixed extend class wizard to work for bytecode objects
3. extend class wizard now prints out starting brace on same line as header
4. extend class wizard now removes comments, removes abstract keyword, and adds public keyword for interfaces
5. Goto documentation now works properly for throws clauses and class extends/implements
6. Fixed memo list bug (caused those annoying dialogs on exit)
7. Increased efficiency of prototype.sdb file copy
8. Updated code to use new database API
9. Fixed exit so that it will not close the main window if you abort
10. Turned off caching of ByteCodeObjects in order to prevent database corruption
11. Updated to new version of OX -- Database recreate required!
Index: Sheets.sheets
===================================================================
RCS file: /cvsroot/sheets/sheets/Sheets.sheets,v
retrieving revision 1.48
retrieving revision 1.49
diff -C2 -d -r1.48 -r1.49
*** Sheets.sheets 8 May 2003 22:21:11 -0000 1.48
--- Sheets.sheets 23 May 2003 09:55:00 -0000 1.49
***************
*** 8984,8992 ****
try {
proc = Runtime.getRuntime().exec(newcmd);
! }
! catch (IOException e) {
! Console.log("Execution of " + newcmd + " failed to start: " + e);
! Console.status("Execution of " + newcmd + " failed to start: " + e);
! return;
}
--- 8984,9002 ----
try {
proc = Runtime.getRuntime().exec(newcmd);
! } catch (IOException e) {
! try {
! // try executing command with a ".bat" extension like the command prompt in windows
! int firstSpace = newcmd.indexOf(" ");
! String withBat;
! if (firstSpace == -1)
! withBat = newcmd + ".bat";
! else
! withBat = newcmd.substring(0, firstSpace) + ".bat" + newcmd.substring(firstSpace);
! proc = Runtime.getRuntime().exec(withBat);
! } catch (IOException e2) {
! Console.log("Execution of " + newcmd + " failed to start: " + e);
! Console.status("Execution of " + newcmd + " failed to start: " + e);
! return;
! }
}
***************
*** 26715,26732 ****
if (protoFile.exists()) {
try {
! byte[] buffer = new byte[2048];
! InputStream proto = new FileInputStream(protoFile);
! OutputStream db = new FileOutputStream(state.dbFile);
! int bytes = proto.read(buffer);
! while (bytes != -1) {
! db.write(buffer, 0, bytes);
! bytes = proto.read(buffer);
}
db.close();
proto.close();
} catch (FileNotFoundException e) {
! ;
} catch (IOException e) {
! ;
}
}
--- 26725,26743 ----
if (protoFile.exists()) {
try {
! FileChannel proto = new FileInputStream(protoFile).getChannel();
! FileChannel db = new FileOutputStream(state.dbFile).getChannel();
! long remaining = proto.size();
! long position = 0;
! while (remaining > 0) {
! long transfered = proto.transferTo(position, remaining, db);
! position += transfered;
! remaining -= transfered;
}
db.close();
proto.close();
} catch (FileNotFoundException e) {
! // ignore because we already check file existence
} catch (IOException e) {
! Console.internalError(e);
}
}
***************
*** 26735,26742 ****
ObjectDatabase database = new ObjectDatabase(state.dbFile);
State.setObjectDatabase(database);
- if (state.dbFile.exists())
- database.open();
- else
- database.create();
State.loadGlobalState();
} catch (DatabaseLockedException e) {
--- 26746,26749 ----
***************
*** 26748,26755 ****
}
System.exit(1);
- } catch (ArchivalException e) {
- Console.error("ArchivalException opening " + state.dbFile + ": " + e);
- e.printStackTrace();
- System.exit(1);
} catch (ArchivalRuntimeException e) {
Console.error("ArchivalRuntimeException opening " + state.dbFile + ": " + e);
--- 26755,26758 ----
***************
*** 37303,37307 ****
if (ch.size() >= Profile.globalUndoHistorySize)
ch.removeElementAt(0);
!
ch.addElement(ckp);
}
--- 37306,37310 ----
if (ch.size() >= Profile.globalUndoHistorySize)
ch.removeElementAt(0);
!
ch.addElement(ckp);
}
***************
*** 37904,37907 ****
--- 37907,37914 ----
public static void Sheets.exit (String command)
{
+ if (HistoryManager.changeCommandStack.size() > 1) {
+ Console.internalError("Command change stack not empty upon exit. " + HistoryManager.changeCommandStack);
+ }
+
if (CommitEditsDialog.checkForEdits())
return;
***************
*** 37935,37939 ****
FragmentList.cleanMemoLists();
HistoryManager.endChangeCommand(command, true);
! State.getObjectDatabase().finalize();
Timer.reportAll();
System.exit(0);
--- 37942,37950 ----
FragmentList.cleanMemoLists();
HistoryManager.endChangeCommand(command, true);
! try {
! State.getObjectDatabase().finalize();
! } catch (IOException e) {
! Console.internalError(e);
! }
Timer.reportAll();
System.exit(0);
***************
*** 43293,43306 ****
return "unknown";
}
- object ram:2174
- pkg=org.browsecode.sheets
- type=java
- section text ram:2174
- // When we close the context window, that means exit.
- public void ContextSheetFrame.close (boolean stopObserving, boolean forReal) {
- super.close(true);
- if (!Sheets.tryingToExit)
- Sheets.exit("close-window");
- }
object ram:2175
pkg=org.browsecode.sheets
--- 43304,43307 ----
***************
*** 49408,49412 ****
// Like the above, this is the "header" view, except we use raw names instead
// of class qualified names.
! protected String JavaFragment.classlessHeader () {
String raw = beforeName + simpleName() + afterName.substring(0, headerEnd);
return StringSplitter.join(adjustLines(raw, startingColumn), '\\n');
--- 49409,49413 ----
// Like the above, this is the "header" view, except we use raw names instead
// of class qualified names.
! public String JavaFragment.classlessHeader () {
String raw = beforeName + simpleName() + afterName.substring(0, headerEnd);
return StringSplitter.join(adjustLines(raw, startingColumn), '\\n');
***************
*** 50276,50281 ****
return dialog.editsActive;
}
! else
! return false;
}
object rgs:6091
--- 50277,50281 ----
return dialog.editsActive;
}
! return false;
}
object rgs:6091
***************
*** 58103,58112 ****
for (int i=0; i<indices.length; i++) {
buf.append("\\n\\n");
! JavaFunctionFragment meth = (JavaFunctionFragment) possibleMethods.elementAt(indices[i]);
! if (meth instanceof JavaFragment)
! buf.append(meth.classlessHeader());
! else
! System.out.println("ExtendJavaClassDialog.generateNewFragments for ByteCodeObjects not yet implemented");
! buf.append("\\n{\\n}");
}
result = buf.toString();
--- 58103,58164 ----
for (int i=0; i<indices.length; i++) {
buf.append("\\n\\n");
! JavaInterface meth = (JavaInterface)possibleMethods.elementAt(indices[i]);
! String header = meth.classlessHeader();
!
! // strip comments
! StringBuffer newHeader = new StringBuffer(header.length());
! char lastlastc = ' ';
! char lastc = '\\n';
! boolean inSingleLineComment = false;
! boolean inMultiLineComment = false;
! boolean commentStartsWithReturn = false;
! boolean skipChar = false;
! for (int j=0; j<header.length(); j++) {
! char c = header.charAt(j);
! if (!inMultiLineComment && !inSingleLineComment) {
! if (c == '/' && lastc == '/') { // single line comment start
! inSingleLineComment = true;
! newHeader.setLength(newHeader.length() - 1);
! commentStartsWithReturn = lastlastc == '\\n';
! } else if (c == '*' && lastc == '/') { // multi line comment start
! inMultiLineComment = true;
! newHeader.setLength(newHeader.length() - 1);
! commentStartsWithReturn = lastlastc == '\\n';
! }
! }
!
! if (!skipChar && !inSingleLineComment && !inMultiLineComment)
! newHeader.append(c);
! skipChar = false;
!
! if (inSingleLineComment && c == '\\n') { // single line comment end
! inSingleLineComment = false;
! if (commentStartsWithReturn)
! newHeader.setLength(newHeader.length() - 1);
! commentStartsWithReturn = false;
! } else if (inMultiLineComment && c == '/' && lastc == '*') { // multi line comment end
! inMultiLineComment = false;
! boolean commentEndsWithReturn = header.length() > j + 1 && header.charAt(j + 1) == '\\n';
! if (commentStartsWithReturn && commentEndsWithReturn)
! skipChar = true;
! commentStartsWithReturn = false;
! }
!
! lastlastc = lastc;
! lastc = c;
! }
! header = newHeader.toString();
!
! // remove abstract from header
! header = StringSplitter.substringReplace(header, " abstract ", " ");
! if (header.startsWith("abstract ")) // catch the case where header begins with keyword
! header = header.substring(9);
!
! // add public keyword for interfaces
! if (meth instanceof JavaMemberInterface && ((JavaMemberInterface)meth).enclosingClass().isInterface() && !header.startsWith("public "))
! header = "public " + header;
!
! buf.append(header);
! buf.append(" {\\n}");
}
result = buf.toString();
***************
*** 58664,58668 ****
rgs:10972
rgs:10974
- ram:2174
object rgs:10972
pkg=org.browsecode.sheets
--- 58716,58719 ----
***************
*** 64398,64401 ****
--- 64449,64453 ----
schin:626
schin:627
+ schin:1255
object rgs:13224
pkg=org.browsecode.javaStuff
***************
*** 67766,67770 ****
schin:1012
schin:1013
! schin:1014
schin:1015
schin:1016
--- 67818,67822 ----
schin:1012
schin:1013
! schin:1254
schin:1015
schin:1016
***************
*** 74468,74472 ****
schin:701
schin:961
! schin:1014
schin:1015
schin:1016
--- 74520,74524 ----
schin:701
schin:961
! schin:1254
schin:1015
schin:1016
***************
*** 75692,75696 ****
result[i + fields.length] = ByteCodeFunction.createMethodOrConstructor(methods[i], this);
}
! memberCache = new SoftReference(result);
return result;
}
--- 75744,75749 ----
result[i + fields.length] = ByteCodeFunction.createMethodOrConstructor(methods[i], this);
}
! // disable cache temporarily (was causing problems with ObjectDatabase marking)
! // memberCache = new SoftReference(result);
return result;
}
***************
*** 75810,75813 ****
--- 75863,75867 ----
schin:766
schin:767
+ schin:1253
schin:768
schin:769
***************
*** 78169,78173 ****
if (info instanceof UVector && ((UVector)info).size() > 0)
results = (UVector)info;
! else if (info instanceof JavaFragment) {
results = new UVector();
results.addElement(info);
--- 78223,78227 ----
if (info instanceof UVector && ((UVector)info).size() > 0)
results = (UVector)info;
! else if (info instanceof JavaInterface) {
results = new UVector();
results.addElement(info);
***************
*** 79801,79805 ****
section text schin:996
public String ByteCodeObject.toString(int view) {
- styleList.clear();
switch (view) {
case SHORT_NAME: return simpleName();
--- 79855,79858 ----
***************
*** 79808,79812 ****
case HEADER:
case FULL:
! return styledText();
default:
Console.internalError("Bad view in ByteCodeObject.toString");
--- 79861,79868 ----
case HEADER:
case FULL:
! styleList.clear();
! StringBuffer sb = new StringBuffer();
! styledText(sb, styleList, true);
! return sb.toString();
default:
Console.internalError("Bad view in ByteCodeObject.toString");
***************
*** 79932,79947 ****
this.color = color;
}
- object schin:1014
- pkg=org.browsecode.javaStuff
- type=java
- section text schin:1014
- ArrayList ByteCodeObject.styleList = new ArrayList();
object schin:1015
pkg=org.browsecode.javaStuff
type=java
section text schin:1015
! String ByteCodeObject.styledText() {
StringBuffer sb = new StringBuffer();
! styledText(sb, styleList);
return sb.toString();
}
--- 79988,79998 ----
this.color = color;
}
object schin:1015
pkg=org.browsecode.javaStuff
type=java
section text schin:1015
! public String ByteCodeObject.classlessHeader() {
StringBuffer sb = new StringBuffer();
! styledText(sb, new ArrayList(), false);
return sb.toString();
}
***************
*** 79950,79954 ****
type=java
section text schin:1016
! void ByteCodeObject.styledText(StringBuffer sb, ArrayList styleList) {
String attributes = Utility.accessToString(flags.getModifiers());
styleList.add(new ByteCodeViewer.StyleMarker(0, sb.length(), sb.length() + attributes.length(), Profile.reservedWordColor));
--- 80001,80005 ----
type=java
section text schin:1016
! void ByteCodeObject.styledText(StringBuffer sb, ArrayList styleList, boolean prependClass) {
String attributes = Utility.accessToString(flags.getModifiers());
styleList.add(new ByteCodeViewer.StyleMarker(0, sb.length(), sb.length() + attributes.length(), Profile.reservedWordColor));
***************
*** 79959,79964 ****
type=java
section text schin:1017
! void ByteCodeClass.styledText(StringBuffer sb, ArrayList styleList) {
! super.styledText(sb, styleList);
if (sb.length() > 0)
sb.append(" ");
--- 80010,80015 ----
type=java
section text schin:1017
! void ByteCodeClass.styledText(StringBuffer sb, ArrayList styleList, boolean prependClass) {
! super.styledText(sb, styleList, prependClass);
if (sb.length() > 0)
sb.append(" ");
***************
*** 80009,80014 ****
type=java
section text schin:1020
! void ByteCodeField.styledText(StringBuffer sb, ArrayList styleList) {
! super.styledText(sb, styleList);
if (sb.length() > 0)
sb.append(" ");
--- 80060,80065 ----
type=java
section text schin:1020
! void ByteCodeField.styledText(StringBuffer sb, ArrayList styleList, boolean prependClass) {
! super.styledText(sb, styleList, prependClass);
if (sb.length() > 0)
sb.append(" ");
***************
*** 80020,80026 ****
styleList.add(new ByteCodeViewer.StyleMarker(0, sb.length() - type.length(), sb.length(), Profile.reservedWordColor));
! // print out Class.fieldName
sb.append(" ");
! sb.append(trueNameString());
}
object schin:1021
--- 80071,80077 ----
styleList.add(new ByteCodeViewer.StyleMarker(0, sb.length() - type.length(), sb.length(), Profile.reservedWordColor));
! // print out field name
sb.append(" ");
! sb.append(prependClass ? trueNameString() : simpleName());
}
object schin:1021
***************
*** 80028,80033 ****
type=java
section text schin:1021
! void ByteCodeMethod.styledText(StringBuffer sb, ArrayList styleList) {
! super.styledText(sb, styleList);
if (sb.length() > 0)
sb.append(" ");
--- 80079,80084 ----
type=java
section text schin:1021
! void ByteCodeMethod.styledText(StringBuffer sb, ArrayList styleList, boolean prependClass) {
! super.styledText(sb, styleList, prependClass);
if (sb.length() > 0)
sb.append(" ");
***************
*** 80039,80045 ****
styleList.add(new ByteCodeViewer.StyleMarker(0, sb.length() - type.length(), sb.length(), Profile.reservedWordColor));
! // print out Class.fieldName
sb.append(" ");
! sb.append(trueNameString());
printSignature(sb, styleList);
--- 80090,80096 ----
styleList.add(new ByteCodeViewer.StyleMarker(0, sb.length() - type.length(), sb.length(), Profile.reservedWordColor));
! // print out method name
sb.append(" ");
! sb.append(prependClass ? trueNameString() : simpleName());
printSignature(sb, styleList);
***************
*** 80049,80054 ****
type=java
section text schin:1022
! void ByteCodeConstructor.styledText(StringBuffer sb, ArrayList styleList) {
! super.styledText(sb, styleList);
if (sb.length() > 0)
sb.append(" ");
--- 80100,80105 ----
type=java
section text schin:1022
! void ByteCodeConstructor.styledText(StringBuffer sb, ArrayList styleList, boolean prependClass) {
! super.styledText(sb, styleList, prependClass);
if (sb.length() > 0)
sb.append(" ");
***************
*** 80342,80348 ****
return null;
ByteCodeClass bcc = new ByteCodeClass(this, clazz);
! if (cachedClasses == null)
! cachedClasses = new HashMap();
! cachedClasses.put(fullName, new SoftReference(bcc));
return bcc;
}
--- 80393,80400 ----
return null;
ByteCodeClass bcc = new ByteCodeClass(this, clazz);
! // disable cache temporarily (was causing problems with ObjectDatabase marking)
! // if (cachedClasses == null)
! // cachedClasses = new HashMap();
! // cachedClasses.put(fullName, new SoftReference(bcc));
return bcc;
}
***************
*** 82259,82262 ****
--- 82311,82332 ----
}
}
+ object schin:1253
+ pkg=org.browsecode.javaStuff
+ type=java
+ section text schin:1253
+ public String JavaInterface.classlessHeader ();
+ object schin:1254
+ pkg=org.browsecode.javaStuff
+ type=java
+ section text schin:1254
+ ArrayList ByteCodeObject.styleList = new ArrayList();
+ object schin:1255
+ pkg=org.browsecode.javaStuff
+ type=java
+ section text schin:1255
+ public String InnerClass.classlessHeader () {
+ // maybe come up with a syntax for this?
+ return null;
+ }
object sjc:1
pkg=org.browsecode.sheets.dicer
***************
*** 85011,85015 ****
sjc:567
wlott:121
- wlott:830
wlott:377
wlott:378
--- 85081,85084 ----
***************
*** 85974,85978 ****
comp.removeContainer(this);
! if (interesting)
makeInteresting();
if (numFragments() == 0 && !interesting) {
--- 86043,86047 ----
comp.removeContainer(this);
! if (!interesting)
makeInteresting();
if (numFragments() == 0 && !interesting) {
***************
*** 86213,86218 ****
public static Object State.getGlobalStateVar (String name)
{
- if (state == null)
- loadGlobalState();
return state.get(name);
}
--- 86282,86285 ----
***************
*** 86223,86228 ****
public static void State.setGlobalStateVar (String name, Object value)
{
- if (state == null)
- loadGlobalState();
state.put(name, value);
}
--- 86290,86293 ----
***************
*** 87166,87170 ****
type=java
section text wlott:633
! public static void ConsistencyCheck.main (String args[])
{
if (args.length != 1) {
--- 87231,87235 ----
type=java
section text wlott:633
! public static void ConsistencyCheck.main (String args[]) throws IOException
{
if (args.length != 1) {
***************
*** 87174,87188 ****
File sdbFile = new File(args[0]);
!
! try {
! State.setObjectDatabase(ObjectDatabase.open(sdbFile));
! } catch (FileDoesNotExistException e) {
System.err.println("Can't find " + sdbFile);
System.exit(1);
} catch (DatabaseLockedException e) {
Console.error(sdbFile + " appears to be in use. If not, delete "
+ sdbFile + ".lock and try again.");
System.exit(1);
! } catch (Exception e) {
System.err.println(e + " while opening " + sdbFile);
System.exit(1);
--- 87239,87254 ----
File sdbFile = new File(args[0]);
! if (!sdbFile.exists()) {
System.err.println("Can't find " + sdbFile);
System.exit(1);
+ }
+
+ try {
+ State.setObjectDatabase(new ObjectDatabase(sdbFile));
} catch (DatabaseLockedException e) {
Console.error(sdbFile + " appears to be in use. If not, delete "
+ sdbFile + ".lock and try again.");
System.exit(1);
! } catch (IOException e) {
System.err.println(e + " while opening " + sdbFile);
System.exit(1);
***************
*** 87677,87688 ****
dialog.dispose();
}
- object wlott:830
- pkg=org.browsecode.sheets
- type=java
- section text wlott:830
- public static void State.clearGlobalState ()
- {
- state = null;
- }
object wlott:833
pkg=org.browsecode.sheets
--- 87743,87746 ----
***************
*** 89329,89333 ****
type=java
section text wlott:2067
! public static void PTableTest.main (String args[])
{
File dbFile = new File("ptabletest.db");
--- 89387,89391 ----
type=java
section text wlott:2067
! public static void PTableTest.main (String args[]) throws IOException
{
File dbFile = new File("ptabletest.db");
***************
*** 89337,89344 ****
ObjectDatabase database;
try {
! database = ObjectDatabase.open(dbFile);
} catch (DatabaseLockedException e) {
throw new Error("Got a DBLockedExcpetion, but we deleted the lock file?");
! } catch (Exception e) {
throw new Error(e.toString());
}
--- 89395,89402 ----
ObjectDatabase database;
try {
! database = new ObjectDatabase(dbFile);
} catch (DatabaseLockedException e) {
throw new Error("Got a DBLockedExcpetion, but we deleted the lock file?");
! } catch (IOException e) {
throw new Error(e.toString());
}
***************
*** 94990,94994 ****
rgs:10972
rgs:10974
- ram:2174
object nkramer:630
title=SheetViewer
--- 95048,95051 ----
***************
*** 103318,103321 ****
--- 103375,103379 ----
schin:766
schin:767
+ schin:1253
schin:768
schin:769
***************
*** 103376,103379 ****
--- 103434,103438 ----
schin:610
schin:612
+ schin:1255
schin:614
schin:615
***************
*** 105885,105889 ****
schin:1000
schin:999
! schin:1014
schin:1015
schin:1016
--- 105944,105948 ----
schin:1000
schin:999
! schin:1254
schin:1015
schin:1016
***************
*** 106694,106698 ****
wlott:120
wlott:121
- wlott:830
wlott:377
wlott:378
--- 106753,106756 ----
Index: build.xml
===================================================================
RCS file: /cvsroot/sheets/sheets/build.xml,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** build.xml 16 Apr 2003 18:00:53 -0000 1.17
--- build.xml 23 May 2003 09:55:05 -0000 1.18
***************
*** 90,94 ****
<mkdir dir="${test}"/>
<echo>Launching test...</echo>
! <java classname="org.browsecode.sheets.Sheets" maxmemory="192m" dir="${test}" fork="true">
<!-- Fix for Solaris pref spaming -->
<jvmarg value="-Djava.util.prefs.syncInterval=2000000"/>
--- 90,94 ----
<mkdir dir="${test}"/>
<echo>Launching test...</echo>
! <java classname="org.browsecode.sheets.Sheets" maxmemory="768m" dir="${test}" fork="true">
<!-- Fix for Solaris pref spaming -->
<jvmarg value="-Djava.util.prefs.syncInterval=2000000"/>
Index: todo.txt
===================================================================
RCS file: /cvsroot/sheets/sheets/todo.txt,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** todo.txt 6 May 2003 10:03:40 -0000 1.17
--- todo.txt 23 May 2003 09:55:05 -0000 1.18
***************
*** 2,11 ****
-
annoying bugs that should be fixed:
touch all classes in the package on package-header modification
Attempt to get a released object when closing editor with a temporary sheet (such as the compile sheet) open
! * Stuff for Unix:
! The default monocode font is awful. See if there is a better one for unix.
* Better File Management:
--- 2,19 ----
-
+ Important:
+ need to fix sync on open so it is iterative
+
annoying bugs that should be fixed:
+ empty compile command causes exceptions
+ dragging in TOC only works on left side of items
+ no line numbers on inner classes
+ methods of inner classes show up in completion, but "go" doesn't work
touch all classes in the package on package-header modification
Attempt to get a released object when closing editor with a temporary sheet (such as the compile sheet) open
+ Attributes (like file header of and exports) should not keep fragments alive.
! * Database Testing:
! Database (or rather Sheets using the Database) seems to react badly to low memory conditions (perhaps just expediting the inevitable corruption)
* Better File Management:
***************
*** 18,21 ****
--- 26,30 ----
Stuff I Want to do:
+ Make the compile/recompile commands general purpose exec commands that can be listed and bound in the .sheetsrc file
Add a Profile keybinding for search-box completion
Fix the language expert so that it can lookup the right xml expert by public identifier.
***************
*** 100,104 ****
Fix a few odd cases ("System.out.println")
Need to have repository traverse jars with embedded classpaths
- Middle-click doesn't always work for things which complete successfully
Restrict completion to entities in classpath across projects (JavaSentinel.getClass)
--- 109,112 ----
|