(not part of client build) added short description to each source file

This commit is contained in:
jband%netscape.com 1998-09-18 19:56:45 +00:00
Родитель 6d20aa0438
Коммит dcca610736
59 изменённых файлов: 807 добавлений и 582 удалений

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* Hacked ListView to workaround old Java bug on Unix
*/
// when who what
// 06/27/97 jband added this class to implement Unix hack
//
@ -41,7 +45,7 @@ class BackgroundHackListView extends ListView
super(x,y,dx,dy);
}
public void drawViewBackground(Graphics g, int x, int y, int width,int height)
public void drawViewBackground(Graphics g, int x, int y, int width,int height)
{
if(!isTransparent())
{
@ -50,8 +54,8 @@ class BackgroundHackListView extends ListView
{
g.setColor(bc);
// XXX: hackage to deal with Unix problem
// (see bugsplat bug #78027)
// XXX: hackage to deal with Unix problem
// (see bugsplat bug #78027)
java.awt.Graphics awtg = AWTCompatibility.awtGraphicsForGraphics(g);
awtg.setColor(java.awt.Color.white);
awtg.setColor(AWTCompatibility.awtColorForColor(bc));
@ -60,4 +64,4 @@ class BackgroundHackListView extends ListView
}
}
}
}
}

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* Breakpoint with support for break on condition
*/
// when who what
// 06/27/97 jband added this header to my code
//
@ -27,7 +31,7 @@ import netscape.application.*;
import netscape.util.*;
import com.netscape.jsdebugging.api.*;
public class Breakpoint
public class Breakpoint
implements Comparable, Codable
{
@ -61,7 +65,7 @@ public class Breakpoint
public Location getLocation() {return _loc;}
public String getURL() {return _loc.getURL(); }
public int getLine() {return _loc.getLine();}
public String getBreakCondition() {return _breakCondition;}
public void setBreakCondition(String bc) {_breakCondition=bc;}

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* Dialog UI for editing single breakpoint and its condition
*/
// when who what
// 10/14/97 jband created class
//
@ -40,22 +44,22 @@ class BreakpointEditorDialog
private static final int _spacerDX = 5;
private static final int _spacerDY = 5;
public BreakpointEditorDialog(String title,
int line,
String url,
String condition,
public BreakpointEditorDialog(String title,
int line,
String url,
String condition,
Font font,
boolean isNew )
{
super();
setTitle(title);
setCloseable( false );
setResizable( false );
int contentDX = _labelDX + _editDX + _spacerDX * 3;
int contentDY = _editDY * 3 + _spacerDY * 5 + _buttonDY;
int buttonY = _editDY * 3 + _spacerDY * 4;
int buttonY = _editDY * 3 + _spacerDY * 4;
int buttonX2 = contentDX - _spacerDX - _buttonDX;
int buttonX1 = buttonX2 - _spacerDX - _buttonDX;
int labelX = _spacerDX;
@ -64,7 +68,7 @@ class BreakpointEditorDialog
int Y1 = _spacerDY;
int Y2 = Y1 + _editDY + _spacerDY;
int Y3 = Y2 + _editDY + _spacerDY;
Size size = windowSizeForContentSize(contentDX, contentDY);
setBounds(0,0,size.width,size.height);
@ -86,22 +90,22 @@ class BreakpointEditorDialog
_textFieldCondition.setStringValue(new String(condition));
_textFieldCondition.setFont(font);
addSubview(_textFieldCondition);
Button button;
button = new Button(buttonX1,buttonY,_buttonDX,_buttonDY);
button.setTitle("OK");
button.setTarget(this);
button.setCommand(OK_CMD);
addSubview(button);
button = new Button(buttonX2,buttonY,_buttonDX,_buttonDY);
button.setTitle("Cancel");
button.setTarget(this);
button.setCommand(CANCEL_CMD);
addSubview(button);
if( isNew )
if( isNew )
setFocusedView( _textFieldLine );
else
setFocusedView( _textFieldCondition );
@ -119,7 +123,7 @@ class BreakpointEditorDialog
label.setBorder(null);
return label;
}
// implement target interface
public void performCommand(String cmd, Object data)
{
@ -131,13 +135,13 @@ class BreakpointEditorDialog
if( null == _URL || 0 == _URL.trim().length() )
{
Alert.runAlertInternally( Alert.notificationImage(),
"invalid entry",
"invalid entry",
"you must enter a valid url",
"OK", null,null );
"OK", null,null );
setFocusedView( _textFieldURL );
return;
}
_condition = _textFieldCondition.stringValue();
if( null == _condition || 0 == _condition.trim().length() )
{
@ -158,9 +162,9 @@ class BreakpointEditorDialog
if( _line <= 0 )
{
Alert.runAlertInternally( Alert.notificationImage(),
"invalid entry",
"invalid entry",
"line number must be >= 1",
"OK", null,null );
"OK", null,null );
setFocusedView( _textFieldLine );
return;
}
@ -172,14 +176,14 @@ class BreakpointEditorDialog
{
hide();
}
}
}
public boolean okPressed() {return _ok;}
public String getURL() {return _URL;}
public String getCondition() {return _condition;}
public int getLine() {return _line;}
private TextField _textFieldLine;
private TextField _textFieldURL;
private TextField _textFieldCondition;
@ -189,6 +193,6 @@ class BreakpointEditorDialog
private boolean _ok = false;
private static final String OK_CMD = "OK_CMD";
private static final String CANCEL_CMD = "CANCEL_CMD";
}
}

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* Hook (with conditional support) for breakpoints
*/
// when who what
// 06/27/97 jband added this header to my code
//
@ -25,7 +29,7 @@ package com.netscape.jsdebugging.ifcui;
import netscape.security.PrivilegeManager;
import com.netscape.jsdebugging.api.*;
class BreakpointHook
class BreakpointHook
extends InstructionHook
implements ChainableHook, JSErrorReporter
{
@ -35,7 +39,7 @@ class BreakpointHook
_emperor = emperor;
setTyrant(tyrant);
setBreakpoint(bp);
}
}
public void aboutToExecute(ThreadStateBase debug)
{
@ -61,37 +65,37 @@ class BreakpointHook
public void setTyrant(Object tyrant) {_ctrlTyrant = (ControlTyrant) tyrant;}
public void setNextHook(Hook nextHook) {_nextHook = (InstructionHook) nextHook;}
public InstructionHook getNextHook() {return _nextHook;}
private boolean _shouldStop(JSThreadState threadState)
{
// System.out.println( "1) in _shouldStop" );
if( null == _ctrlTyrant || null == _bp )
return false;
// System.out.println( "2) in _shouldStop" );
// currently don't stopping when already stopped
if( ControlTyrant.STOPPED == _ctrlTyrant.getState() )
return false;
String breakCondition = _bp.getBreakCondition();
if( null == breakCondition )
return true;
// System.out.println( "3) in _shouldStop" );
JSErrorReporter oldER = null;
try
{
PrivilegeManager.enablePrivilege("Debugger");
DebugController dc = _emperor.getDebugController();
String filename;
if( _ctrlTyrant.getEmperor().isPre40b6() ||
if( _ctrlTyrant.getEmperor().isPre40b6() ||
Emperor.REMOTE_SERVER == _ctrlTyrant.getEmperor().getHostMode() )
filename = "HiddenBreakpointEval";
else
filename = _bp.getURL();
JSStackFrameInfo frame = (JSStackFrameInfo) threadState.getCurrentFrame();
_errorString = null;
@ -101,8 +105,8 @@ class BreakpointHook
}
// System.out.println( "4) in _shouldStop, condition = " + breakCondition);
ExecResult fullresult =
ExecResult fullresult =
dc.executeScriptInStackFrame(frame,breakCondition,filename,1);
String result = fullresult.getResult();
@ -112,11 +116,11 @@ class BreakpointHook
_ctrlTyrant.setErrorReporter(oldER);
oldER = null;
}
// System.out.println( "5) in _shouldStop");
if( null != _errorString )
return false;
// System.out.println( "6) in _shouldStop, result = " + result );
if( null == result || ! result.equals("true") )
return false;
@ -133,7 +137,7 @@ class BreakpointHook
// System.out.println( "9) in _shouldStop");
return true;
}
// implement JSErrorReporter interface
public synchronized int reportError( String msg,
String filename,
@ -143,7 +147,7 @@ class BreakpointHook
{
_errorString = msg;
return JSErrorReporter.RETURN;
}
}
private Emperor _emperor;
private ControlTyrant _ctrlTyrant;

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* Persistence support for breakpoints
*/
// when who what
// 07/31/97 jband created this file
//

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* 'Model' that manages breakpoints
*/
// when who what
// 06/27/97 jband added this header to my code
//
@ -33,7 +37,7 @@ import netscape.security.PrivilegeManager;
// scripts stored in a Vector with newest scripts at the high end
public class BreakpointTyrant
extends Observable
extends Observable
implements Observer, PrefsSupport
{
public BreakpointTyrant(Emperor emperor)
@ -170,7 +174,7 @@ public class BreakpointTyrant
// we reverse the list so that newest scripts are first
for( int i = count-1; i >= 0; i-- )
a[count-(i+1)] = _scripts.elementAt(i);
a[count-(i+1)] = _scripts.elementAt(i);
return a;
}
@ -183,7 +187,7 @@ public class BreakpointTyrant
int count = _scripts.count();
for( int i = count-1; i >= 0; i-- )
{
Script script = (Script) _scripts.elementAt(i);
Script script = (Script) _scripts.elementAt(i);
if( url.equals(script.getURL()) )
vret.addElement(script);
}
@ -194,12 +198,12 @@ public class BreakpointTyrant
{
return getScriptsVectorForURL(url).elementArray();
}
public void modifiedBreakpoint( Breakpoint bp )
{
_notifyObservers(BreakpointTyrantUpdate.MODIFIED_ONE, bp);
}
/*******************************/
private boolean _isNonShadowedLocationInScript(Location loc, Script script)
@ -259,7 +263,7 @@ public class BreakpointTyrant
int count = _scripts.count();
for( int i = count-1; i >= 0; i-- )
{
Script script = (Script) _scripts.elementAt(i);
Script script = (Script) _scripts.elementAt(i);
if( _isLocationInScript(loc, script) )
{
if( null != script.getFunction() )
@ -305,7 +309,7 @@ public class BreakpointTyrant
int count = _scripts.count();
for( int i = 0; i < count; i++ )
{
Script script = (Script) _scripts.elementAt(i);
Script script = (Script) _scripts.elementAt(i);
if( ! _isNonShadowedLocationInScript(loc, script) )
continue;
@ -416,7 +420,7 @@ public class BreakpointTyrant
// this is called on native thread, can not do notify!!!
// _notifyObservers(BreakpointTyrantUpdate.DEACTIVATED_ONE, bp);
}
}
}
// implement observer interface
@ -482,15 +486,15 @@ public class BreakpointTyrant
"com.netscape.jsdebugging.ifcui.BreakpointSaver" );
if( -1 != id )
{
BreakpointSaver bs = (BreakpointSaver)
BreakpointSaver bs = (BreakpointSaver)
unarchiver.unarchiveIdentifier(id);
bs.sendToTyrant(this);
}
}
// data...
// data...
private Emperor _emperor;
private ControlTyrant _controlTyrant;
private DebugController _dc;
@ -501,10 +505,10 @@ public class BreakpointTyrant
private BPTyrantScriptHook _scriptHook;
private boolean _enabled = false;
private Thread _uiThreadForAssertCheck = null;
}
}
// used here only...
class BPTyrantScriptHook
class BPTyrantScriptHook
extends ScriptHook
implements ChainableHook
{

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* Information to describe a breakpoint update event
*/
// when who what
// 06/27/97 jband added this header to my code
//
@ -43,5 +47,5 @@ class BreakpointTyrantUpdate
public int type;
public Breakpoint bp;
}
}

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* 'View' to manage all breakpoints
*/
// when who what
// 06/27/97 jband added this header to my code
//
@ -29,7 +33,7 @@ import netscape.util.*;
import com.netscape.jsdebugging.ifcui.palomar.util.*;
import com.netscape.jsdebugging.ifcui.palomar.widget.layout.*;
public class BreakpointView
public class BreakpointView
extends InternalWindow
implements Observer, Target
{
@ -37,10 +41,10 @@ public class BreakpointView
private static final int _buttonHeight = 24;
private static final int _buttonYSpace = 5;
private static final int _buttonXSpace = 5;
private int _nextButtonX;
private int _nextButtonY;
public BreakpointView( Emperor emperor, Rect rect )
{
super(rect);
@ -59,16 +63,16 @@ public class BreakpointView
Size size = contentSize();
int listwidth = size.width - (_buttonWidth + (_buttonXSpace * 2));
Rect rectSG = new Rect(0, 0, listwidth, size.height);
_nextButtonX = listwidth + _buttonXSpace;
_nextButtonY = _buttonYSpace;
_nextButtonY = _buttonYSpace;
_addButton( "New", NEW_CMD );
_addButton( "Edit", EDIT_CMD);
_addButton( "Delete", DEL_CMD );
_nextButtonY += _buttonYSpace * 2;
_addButton( "Done", DONE_CMD);
ScrollGroup sg = new ScrollGroup(rectSG);
sg.setHorizScrollBarDisplay( ScrollGroup.AS_NEEDED_DISPLAY );
sg.setVertScrollBarDisplay( ScrollGroup.AS_NEEDED_DISPLAY );
@ -76,8 +80,8 @@ public class BreakpointView
sg.setAutoResizeSubviews(true);
sg.contentView().setLayoutManager( new MarginLayout() );
sg.setBackgroundColor(_emperor.getBackgroundColor());
setCloseable( false );
setCloseable( false );
setResizable( false );
setTitle( "Breakpoints" );
addSubview(sg);
@ -96,10 +100,10 @@ public class BreakpointView
refresh();
layoutView(1,1);
layoutView(-1,-1);
layoutView(1,1);
layoutView(-1,-1);
}
private Button _addButton( String title, String cmd )
{
Button button = new Button(_nextButtonX,_nextButtonY,
@ -129,7 +133,7 @@ public class BreakpointView
if( cmd.equals(NEW_CMD ) )
{
newBreakpoint();
}
}
else if( cmd.equals(EDIT_CMD) )
{
int index = _listview.selectedIndex();
@ -141,7 +145,7 @@ public class BreakpointView
return;
editBreakpoint(bp);
}
}
else if( cmd.equals(DEL_CMD ) )
{
int index = _listview.selectedIndex();
@ -152,7 +156,7 @@ public class BreakpointView
_breakpointTyrant.removeBreakpoint(bp);
// will be refreshed upon notification from _breakpointTyrant
}
}
else if( cmd.equals(DONE_CMD) )
{
Application.application().performCommandLater(
@ -172,7 +176,7 @@ public class BreakpointView
selBP = (Breakpoint) selItem.data();
_listview.removeAllItems();
Font linefont = _emperor.getFixedFont();
int maxlinelen = 0;
@ -192,7 +196,7 @@ public class BreakpointView
// find the max lengths for later formating of each item
int maxLineno = 0;
int maxFilenameChars = 0;
int maxFilenameChars = 0;
for( i = 0; i < itemCount; i++ )
{
@ -208,11 +212,11 @@ public class BreakpointView
for( i = 0; i < itemCount; i++ )
{
Breakpoint bp = (Breakpoint) breakpoints.elementAt(i);
// format text...
buf.setLength(0);
// padded line number
int lineno = bp.getLine();
buf.append(lineno);
@ -246,10 +250,10 @@ public class BreakpointView
item.setFont( linefont );
item.setSelectedColor(_emperor.getSelectionColor());
_listview.addItem( item );
if( 0 == i )
_listview.selectItemAt(i); // make sure SOMETHING selected
if( null != selBP && selBP == bp )
{
_listview.selectItemAt(i);
@ -261,7 +265,7 @@ public class BreakpointView
_listview.setBounds( 0, 0, (maxlinelen+1) * fm.charWidth('X'),0 );
_listview.sizeToMinSize();
layoutView(0,0);
layoutView(0,0);
_listview.draw();
}
@ -269,9 +273,9 @@ public class BreakpointView
public boolean newBreakpoint()
{
BreakpointEditorDialog bed =
BreakpointEditorDialog bed =
new BreakpointEditorDialog( "New Breakpoint",
1, "", "true",
1, "", "true",
_emperor.getFixedFont(),
true );
bed.showModally();
@ -293,7 +297,7 @@ public class BreakpointView
bp.setBreakCondition(condition);
_breakpointTyrant.modifiedBreakpoint(bp);
_breakpointTyrant.modifiedBreakpoint(bp);
// select the new item
int i = _indexOfListItemWithBP(bp);
@ -302,7 +306,7 @@ public class BreakpointView
return true;
}
return false;
}
public boolean editBreakpoint( Breakpoint bp )
@ -313,7 +317,7 @@ public class BreakpointView
if( null == condition )
condition = "true";
BreakpointEditorDialog bed =
BreakpointEditorDialog bed =
new BreakpointEditorDialog( "Edit Breakpoint",
bp.getLine(),
bp.getURL(),
@ -335,13 +339,13 @@ public class BreakpointView
bed.getLine() != bp.getLine() )
{
// we need to construct a new breakpoint!
_breakpointTyrant.removeBreakpoint(bp);
_breakpointTyrant.removeBreakpoint(bp);
Location loc = new Location( bed.getURL(), bed.getLine() );
bp = _breakpointTyrant.addBreakpoint(loc);
}
bp.setBreakCondition(condition);
_breakpointTyrant.modifiedBreakpoint(bp);
_breakpointTyrant.modifiedBreakpoint(bp);
// select the new item
int i = _indexOfListItemWithBP(bp);
@ -360,7 +364,7 @@ public class BreakpointView
return i;
}
// failed to find it...
return -1;
return -1;
}
@ -373,6 +377,6 @@ public class BreakpointView
private static final String EDIT_CMD = "EDIT_CMD";
private static final String DEL_CMD = "DEL_CMD";
private static final String DONE_CMD = "DONE_CMD";
}
}

Просмотреть файл

@ -5,9 +5,9 @@ package com.netscape.jsdebugging.ifcui;
class BuildDate
{
// Wednesday, September 16, 1998 at 11:58 AM
// Friday, September 18, 1998 at 12:54 PM
public static final long buildDate = 905972322000L;
public static final long buildDate = 906148451000L;
public static final java.util.Date date()
{

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* Store and compare call chains (for stepping)
*/
// when who what
// 06/27/97 jband added this header to my code
//
@ -83,4 +87,4 @@ class CallChain
}
private Script[] _chain;
}
}

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* Base class for hooks to support chaining
*/
// when who what
// 06/27/97 jband added this header to my code
//
@ -28,5 +32,5 @@ interface ChainableHook
{
public void setTyrant( Object tyrant);
public void setNextHook(Hook nextHook);
}
}

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* Maintain state for a command (used to update menus and toolbars)
*/
// when who what
// 06/27/97 jband added this header to my code
//
@ -38,5 +42,5 @@ class CmdState
public String name;
public boolean enabled;
public boolean checked;
}
}

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* Manages validating and routing user commands
*/
// when who what
// 06/27/97 jband added this header to my code
//
@ -32,12 +36,12 @@ import com.netscape.jsdebugging.ifcui.palomar.widget.PopupButton;
import com.netscape.jsdebugging.api.*;
public class CommandTyrant
extends Observable
extends Observable
implements Observer, Target
{
// this list of ids must start with 0 and be contiguous and have count set
// ............................................
public static final int RUN = 0;
public static final int RUN = 0;
public static final int ABORT = 1;
public static final int STEP_OVER = 2;
public static final int STEP_INTO = 3;
@ -66,7 +70,7 @@ public class CommandTyrant
public static final int COPY_STRING = 26;
public static final int CUT = 27;
public static final int TEST = 28;
// XXX add the rest...
// XXX add the rest...
public static final int CMD_COUNT = 29; // just a count of the above
// ............................................
@ -77,19 +81,19 @@ public class CommandTyrant
_cmdStatesArray = new CmdState[CMD_COUNT];
for( i = 0; i < CMD_COUNT; i++ )
_cmdStatesArray[i] = new CmdState(i,null,true,false);
// add the names
// add the names
// these must match the full list above
// ............................................
_cmdStatesArray[RUN ].name = "RUN";
_cmdStatesArray[ABORT ].name = "ABORT";
_cmdStatesArray[STEP_OVER ].name = "STEP_OVER";
_cmdStatesArray[STEP_INTO ].name = "STEP_INTO";
_cmdStatesArray[STEP_OUT ].name = "STEP_OUT";
_cmdStatesArray[INTERRUPT ].name = "INTERRUPT";
_cmdStatesArray[PAGELIST_CLICK ].name = "PAGELIST_CLICK";
_cmdStatesArray[PAGELIST_DBLCLICK ].name = "PAGELIST_DBLCLICK";
_cmdStatesArray[PAGELIST_SHOW_HIDE ].name = "PAGELIST_SHOW_HIDE";
_cmdStatesArray[RUN ].name = "RUN";
_cmdStatesArray[ABORT ].name = "ABORT";
_cmdStatesArray[STEP_OVER ].name = "STEP_OVER";
_cmdStatesArray[STEP_INTO ].name = "STEP_INTO";
_cmdStatesArray[STEP_OUT ].name = "STEP_OUT";
_cmdStatesArray[INTERRUPT ].name = "INTERRUPT";
_cmdStatesArray[PAGELIST_CLICK ].name = "PAGELIST_CLICK";
_cmdStatesArray[PAGELIST_DBLCLICK ].name = "PAGELIST_DBLCLICK";
_cmdStatesArray[PAGELIST_SHOW_HIDE ].name = "PAGELIST_SHOW_HIDE";
_cmdStatesArray[REFRESH_ALL ].name = "REFRESH_ALL";
_cmdStatesArray[STACKVIEW_CLICK ].name = "STACKVIEW_CLICK";
_cmdStatesArray[STACKVIEW_DBLCLICK ].name = "STACKVIEW_DBLCLICK";
@ -110,8 +114,8 @@ public class CommandTyrant
_cmdStatesArray[COPY_STRING ].name = "COPY_STRING";
_cmdStatesArray[CUT ].name = "CUT";
_cmdStatesArray[TEST ].name = "TEST";
// _cmdStatesArray[].name = "";
// _cmdStatesArray[].name = "";
// XXX add the rest...
// ............................................
@ -184,7 +188,7 @@ public class CommandTyrant
_cmdStatesArray[PAGELIST_SHOW_HIDE ].checked = false;
else
_cmdStatesArray[PAGELIST_SHOW_HIDE ].checked = true;
if( null == _watchView || ! _watchView.isVisible() )
_cmdStatesArray[WATCHES_SHOW_HIDE ].checked = false;
else
@ -194,12 +198,12 @@ public class CommandTyrant
_cmdStatesArray[BREAKPOINTS_SHOW_HIDE ].checked = false;
else
_cmdStatesArray[BREAKPOINTS_SHOW_HIDE ].checked = true;
if( null == _inspectorView || ! _inspectorView.isVisible() )
_cmdStatesArray[INSPECTOR_SHOW_HIDE ].checked = false;
else
_cmdStatesArray[INSPECTOR_SHOW_HIDE ].checked = true;
if( null == _sourceViewManager || ! _sourceViewManager.getShowLineNumbers() )
_cmdStatesArray[SHOW_LINE_NUMBERS ].checked = false;
else
@ -235,7 +239,7 @@ public class CommandTyrant
}
}
if( null == _consoleView ||
if( null == _consoleView ||
null == _inspectorView ||
null == _sourceTyrant )
{
@ -246,7 +250,7 @@ public class CommandTyrant
}
else
{
if( null != _sourceTyrant.getSelectedText() ||
if( null != _sourceTyrant.getSelectedText() ||
_inspectorView.canCopy() ||
_consoleView.canCopy() )
{
@ -290,7 +294,7 @@ public class CommandTyrant
Class.forName("java.awt.datatransfer.Clipboard");
Class.forName("netscape.application.jdk11compatibility.JDKClipboard");
// if(AS.DEBUG)System.out.println( "using native clipboard");
}
}
catch(Exception e)
{
_usingLocalClipboard = true;
@ -353,22 +357,22 @@ public class CommandTyrant
}
switch(cmdState.id)
{
case RUN:
case RUN:
_controlTyrant.runit();
break;
case ABORT:
case ABORT:
_controlTyrant.abort();
break;
case STEP_OVER:
case STEP_OVER:
_controlTyrant.stepOver();
break;
case STEP_INTO:
case STEP_INTO:
_controlTyrant.stepInto();
break;
case STEP_OUT :
case STEP_OUT :
_controlTyrant.stepOut();
break;
case INTERRUPT:
case INTERRUPT:
if( null != _controlTyrant )
_controlTyrant.interrupt(! _controlTyrant.getInterrupt());
refreshCmdStatesAndNotifyObservers();
@ -376,7 +380,7 @@ public class CommandTyrant
case PAGELIST_CLICK:
_updateSelectedPageListItem( (ListView)data );
break;
case PAGELIST_DBLCLICK:
case PAGELIST_DBLCLICK:
_updateSelectedPageListItem( (ListView)data );
SourceTextItem sti = _sourceTyrant.getSelectedSourceItem();
if( null != sti && null != _sourceViewManager )
@ -483,7 +487,7 @@ public class CommandTyrant
_watchView.show();
}
refreshCmdStatesAndNotifyObservers();
break;
break;
case COPY_TO_WATCH:
String str = _getCopyText();
if( null != str )
@ -493,7 +497,7 @@ public class CommandTyrant
if( null != _watchView )
_watchView.refresh();
refreshCmdStatesAndNotifyObservers();
}
break;
@ -515,7 +519,7 @@ public class CommandTyrant
if( null != bp )
_breakpointView.editBreakpoint(bp);
// redraw done on notification from BreakpointTyrant...
break;
break;
case BREAKPOINTS_SHOW_HIDE:
if( null == _breakpointView )
break;
@ -527,7 +531,7 @@ public class CommandTyrant
_breakpointView.show();
}
refreshCmdStatesAndNotifyObservers();
break;
break;
case INSPECTOR_SHOW_HIDE:
if( null == _inspectorView )
break;
@ -539,7 +543,7 @@ public class CommandTyrant
_inspectorView.show();
}
refreshCmdStatesAndNotifyObservers();
break;
break;
case INSPECT_SEL_STRING:
if( null != _sourceTyrant && null != _sourceTyrant.getSelectedText())
{
@ -565,7 +569,7 @@ public class CommandTyrant
if( null != _watchView )
_watchView.refresh();
refreshCmdStatesAndNotifyObservers();
}
break;
@ -593,7 +597,7 @@ public class CommandTyrant
break;
default:
if(AS.S)ER.T( false, "cmdState id not handled: " + cmdState.id, this);
break;
break;
}
}
@ -633,11 +637,11 @@ public class CommandTyrant
}
return _localClipboard;
}
private String _getCopyText()
{
String s = null;
if( null != _sourceTyrant )
s = _sourceTyrant.getSelectedText();
if( null == s )
@ -649,11 +653,11 @@ public class CommandTyrant
}
return s;
}
private String _getCutText()
{
String s = null;
if( null != _inspectorView && _inspectorView.canCopy() )
s = _inspectorView.cut();
else if( null != _consoleView && _consoleView.canCopy() )
@ -695,7 +699,7 @@ public class CommandTyrant
if( null == _inspectorView )
_inspectorView = _emperor.getInspectorView();
_haveAllViews =
_haveAllViews =
null != _pageListView &&
null != _sourceViewManager &&
null != _commandView &&
@ -705,10 +709,10 @@ public class CommandTyrant
null != _breakpointView &&
null != _inspectorView ;
}
// data...
private Application _app;
// data...
private Application _app;
private Emperor _emperor;
private ControlTyrant _controlTyrant ;
private BreakpointTyrant _breakpointTyrant;
@ -735,7 +739,7 @@ public class CommandTyrant
private CmdState[] _cmdStatesArray;
private Hashtable _cmdStatesHashtable;
}
}

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* Manages menus and toolbar
*/
// when who what
// 06/27/97 jband added this header to my code
//
@ -47,12 +51,12 @@ class CmdViewItem
public boolean checked;
public String checkedText;
public String uncheckedText;
}
}
public class CommandView
implements Observer
{
public CommandView( Emperor emperor,
public CommandView( Emperor emperor,
Menu mainMenu,
MenuItem fileMenu,
int originY )
@ -126,7 +130,7 @@ public class CommandView
RootView rv = _emperor.getRootView();
minSize = _toolBarWindow.windowSizeForContentSize(rv.width(), minSize.height);
_toolBarWindow.sizeTo(minSize.width, minSize.height);
_emperor.setToolbarHeight(minSize.height);
_emperor.setToolBarWindow(_toolBarWindow);
@ -228,21 +232,21 @@ public class CommandView
private Bitmap _loadBitmap(String name, boolean fromJar)
{
java.awt.Image image = null;
java.awt.Image image = null;
Bitmap bitmap = null;
if(!fromJar)
return Bitmap.bitmapNamed(name);
try
{
{
java.io.InputStream in = null;
String fullname = "images/"+name;
ClassLoader loader = getClass().getClassLoader();
if(null != loader)
{
// if(AS.DEBUG)System.out.println("using loader.getResourceAsStream()");
in = loader.getResourceAsStream(fullname);
in = loader.getResourceAsStream(fullname);
}
else
{
@ -252,26 +256,26 @@ public class CommandView
if(null != in)
{
// System.err.println("good stream");
byte[] buf = new byte[in.available()];
in.read(buf);
image = java.awt.Toolkit.getDefaultToolkit().createImage(buf);
// System.err.println("good stream");
byte[] buf = new byte[in.available()];
in.read(buf);
image = java.awt.Toolkit.getDefaultToolkit().createImage(buf);
}
// else
// System.err.println("bad stream");
}
// System.err.println("bad stream");
}
catch (java.io.IOException e)
{
// System.err.println("Unable to read image.");
// e.printStackTrace();
}
{
// System.err.println("Unable to read image.");
// e.printStackTrace();
}
if(null != image)
{
int width;
int height;
// XXX pretty iffy!
while(-1 == (width = image.getWidth(null)) ||
while(-1 == (width = image.getWidth(null)) ||
-1 == (height = image.getHeight(null)))
Thread.currentThread().yield();
@ -280,8 +284,8 @@ public class CommandView
int[] pix = new int[width*height];
java.awt.image.PixelGrabber grabber =
new java.awt.image.PixelGrabber(image, 0, 0, width, height,
java.awt.image.PixelGrabber grabber =
new java.awt.image.PixelGrabber(image, 0, 0, width, height,
pix, 0, width);
try
@ -291,8 +295,8 @@ public class CommandView
}
catch(InterruptedException ie)
{
// System.err.println("grabber interrupted");
// ie.printStackTrace();
// System.err.println("grabber interrupted");
// ie.printStackTrace();
}
}
if(null == bitmap)
@ -300,7 +304,7 @@ public class CommandView
if(AS.DEBUG)System.err.println("loading bitmap from jar failed, trying Bitmap.bitmapNamed()");
bitmap = Bitmap.bitmapNamed(name);
}
return bitmap;
}
@ -312,7 +316,7 @@ public class CommandView
if( null != item.button )
{
if( force ||
if( force ||
item.enabled != state.enabled ||
item.checked != state.checked )
{
@ -328,9 +332,9 @@ public class CommandView
if( force || item.checked != state.checked )
{
if( state.checked && null != item.checkedText )
item.menuItem.setTitle( item.checkedText );
item.menuItem.setTitle( item.checkedText );
else if( ! state.checked && null != item.uncheckedText )
item.menuItem.setTitle( item.uncheckedText );
item.menuItem.setTitle( item.uncheckedText );
}
}
item.enabled = state.enabled;

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* Interface to support sending strings to consloe
*/
// when who what
// 06/27/97 jband added this header to my code
//
@ -25,5 +29,5 @@ package com.netscape.jsdebugging.ifcui;
interface ConsolePrinter
{
public void print(String stringToPrint, boolean isOutput);
}
}

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* 'Model' for Console
*/
// when who what
// 06/27/97 jband added this header to my code
//
@ -32,7 +36,7 @@ import netscape.security.ForbiddenTargetException;
import com.netscape.jsdebugging.api.*;
public class ConsoleTyrant
extends Observable
extends Observable
implements Observer, Target, JSErrorReporter // , SimulatorPrinter // XXX Sim Hack
{
public ConsoleTyrant(Emperor emperor)
@ -51,17 +55,17 @@ public class ConsoleTyrant
}
public void setPrinter(ConsolePrinter printer)
public void setPrinter(ConsolePrinter printer)
{
_printer = printer;
// XXX need to plant this hook (or our own pass through) into JSD
}
/*
* NOTE: this ErrorReporter may be called on a thread other than
* the IFC UI thread
* NOTE: this ErrorReporter may be called on a thread other than
* the IFC UI thread
*/
// implement JSErrorReporter interface
public int reportError( String msg,
String filename,
@ -71,7 +75,7 @@ public class ConsoleTyrant
{
_errorString = msg;
return JSErrorReporter.RETURN;
}
}
public void eval(String input)
{
@ -83,7 +87,7 @@ public class ConsoleTyrant
/*
* In order to allow the user to enter functions on multiple lines,
* this hack accumulates line which go to the console printer, but
* this hack accumulates line which go to the console printer, but
* are not sent to JSD until the end is reached.
* The rule is that when not accumulating if a line ends with '{'
* then it is assumed to be the end of a function definition line and
@ -140,7 +144,7 @@ public class ConsoleTyrant
_emperor.setWaitCursor(true);
PrivilegeManager.enablePrivilege("Debugger");
String result = "";
_errorString = null;
@ -152,7 +156,7 @@ public class ConsoleTyrant
DebugController dc = _emperor.getDebugController();
if( null != dc && null != frame )
{
ExecResult fullresult =
ExecResult fullresult =
dc.executeScriptInStackFrame(frame,eval,filename,evalLine);
result = fullresult.getResult();
@ -192,7 +196,7 @@ public class ConsoleTyrant
{
}
/*
/*
// implement SimulatorPrinter interface
public void print(String stringToPrint)
{
@ -227,9 +231,9 @@ public class ConsoleTyrant
private Emperor _emperor;
private ControlTyrant _controlTyrant;
private StackTyrant _stackTyrant;
private int _lineno;
private int _lineno;
private String _accumulator = null;
private int _accumulatorLine;
private ConsolePrinter _printer;
private String _errorString;
}
}

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* 'View' for console
*/
// when who what
// 06/27/97 jband added this header to my code
//
@ -125,7 +129,7 @@ public class ConsoleView
if ( o == _controlTyrant )
_setTextFieldEnabledState();
}
private void _setTextFieldEnabledState()
{
if( ControlTyrant.STOPPED == _controlTyrant.getState() )
@ -139,7 +143,7 @@ public class ConsoleView
_textfield.setEditable(false);
}
}
// implement ConsolePrinter interface
public synchronized void print(String stringToPrint, boolean isOutput)

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* 'Model' that manages most interaction with debug API
*/
// when who what
// 06/27/97 jband added this header to my code
//
@ -31,8 +35,8 @@ import netscape.security.PrivilegeManager;
import netscape.security.ForbiddenTargetException;
import com.netscape.jsdebugging.api.*;
public class ControlTyrant
extends Observable
public class ControlTyrant
extends Observable
implements Observer, Target, JSErrorReporter
{
public static final int RUNNING = 0;
@ -79,7 +83,7 @@ public class ControlTyrant
}
// accessors
public int getState() {return _state;}
public boolean getInterrupt() {return _interrupt;}
public boolean getEnabled() {return _enabled;}
@ -110,7 +114,7 @@ public class ControlTyrant
}
// command handlers
public synchronized void interrupt(boolean b)
{
PrivilegeManager.enablePrivilege("Debugger");
@ -321,7 +325,7 @@ public class ControlTyrant
_semaphore.release();
return;
}
// save arguments
_threadState = debug;
@ -329,7 +333,7 @@ public class ControlTyrant
if(AS.DEBUG)Log.trace("ControlTyrant.aboutToExecute", "6) about to call _pc.getSourceLocation()");
_sourceLocation = (JSSourceLocation) _pc.getSourceLocation();
if(AS.DEBUG)Log.trace("ControlTyrant.aboutToExecute", "7) _pc.getSourceLocation() returned");
if(false)
{
String leadin = "interrupted at:";
@ -430,13 +434,13 @@ public class ControlTyrant
Sound.soundNamed("droplet.au").play();
// AWTCompatibility.awtToolkit().beep();
ErrorReporterDialog erd =
ErrorReporterDialog erd =
new ErrorReporterDialog(_emperor, (ErrorReport) data);
_emperor.enableAppClose(false);
erd.showModally();
erd.showModally();
_emperor.enableAppClose(true);
_debugBreakResponse = erd.getAnswer();
notify();
}
@ -450,19 +454,19 @@ public class ControlTyrant
// implement observer interface
public void update(Observable o, Object arg)
{
}
/*
* NOTE: this ErrorReporter may be called on a thread other than
* the IFC UI thread
* NOTE: this ErrorReporter may be called on a thread other than
* the IFC UI thread
*/
public synchronized JSErrorReporter setErrorReporter(JSErrorReporter er)
{
JSErrorReporter old = _errorReporter;
_errorReporter = er;
_errorReporter = er;
return old;
}
public JSErrorReporter getErrorReporter()
{
@ -478,7 +482,7 @@ public class ControlTyrant
{
if( ! _enabled )
return JSErrorReporter.PASS_ALONG;
if( null != _errorReporter && this != _errorReporter )
return _errorReporter.reportError(msg,filename,lineno,linebuf,tokenOffset);
@ -492,7 +496,7 @@ public class ControlTyrant
while( -1 == _debugBreakResponse && _enabled )
{
try
try
{
wait();
}
@ -524,8 +528,8 @@ public class ControlTyrant
}
// data...
private Application _app;
// data...
private Application _app;
private int _state;
private boolean _interrupt;
private Emperor _emperor;
@ -553,11 +557,11 @@ public class ControlTyrant
private final String HIT_EXEC_HOOK = "HIT_EXEC_HOOK";
private final String HIT_ERROR_REPORTER = "HIT_ERROR_REPORTER";
}
/***************************************************************************/
// used internally only...
// used internally only...
class CtrlSemaphore
{
public boolean available() {return _available;}
@ -569,12 +573,12 @@ class CtrlSemaphore
_available = false;
return true;
}
private boolean _available = true;
}
// used internally only...
class CtrlInterruptHook
// used internally only...
class CtrlInterruptHook
extends InterruptHook
implements ChainableHook
{
@ -606,11 +610,11 @@ class CtrlInterruptHook
private ControlTyrant _ctrlTyrant;
private InterruptHook _nextHook;
}
// used internally only...
class CtrlDebugBreakHook
}
// used internally only...
class CtrlDebugBreakHook
extends DebugBreakHook
implements ChainableHook
{
@ -640,5 +644,5 @@ class CtrlDebugBreakHook
private ControlTyrant _ctrlTyrant;
private DebugBreakHook _nextHook;
}
}

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* Information sent with update events from CommandTyrant
*/
// when who what
// 06/27/97 jband added this header to my code
//
@ -34,5 +38,5 @@ class ControlTyrantUpdate
}
public int type;
public int state;
}
}

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* Windows style Cut/Copy/Paste hotkey support
*/
// when who what
// 11/19/97 jband added this class
//
@ -25,7 +29,7 @@ package com.netscape.jsdebugging.ifcui;
import netscape.application.*;
import netscape.util.*;
public class EditKeyTextFilter
public class EditKeyTextFilter
implements TextFilter
{
public EditKeyTextFilter(CommandTyrant commandTyrant)
@ -42,27 +46,27 @@ public class EditKeyTextFilter
{
case 'c':
Application.application().performCommandLater(
_commandTyrant,
_commandTyrant.cmdString(CommandTyrant.COPY),
_commandTyrant,
_commandTyrant.cmdString(CommandTyrant.COPY),
null);
return false;
case 'v':
Application.application().performCommandLater(
_commandTyrant,
_commandTyrant.cmdString(CommandTyrant.PASTE),
_commandTyrant,
_commandTyrant.cmdString(CommandTyrant.PASTE),
null);
return false;
case 'x':
Application.application().performCommandLater(
_commandTyrant,
_commandTyrant.cmdString(CommandTyrant.CUT),
_commandTyrant,
_commandTyrant.cmdString(CommandTyrant.CUT),
null);
return false;
default:
break;
}
}
return true;
return true;
}
private CommandTyrant _commandTyrant;

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* Central 'Model' that creates and coordinates all models and views
*/
// when who what
// 06/27/97 jband added this header to my code
//
@ -44,7 +48,7 @@ public class Emperor
Menu mainMenu,
MenuItem fileMenu,
MenuView menuView,
int hostMode,
int hostMode,
String host,
StatusWindow statusWindow )
@ -62,7 +66,7 @@ public class Emperor
_mainWindow.setHidesWhenPaused(false);
_fixedFont = new Font( "Courier", Font.PLAIN, 13 );
_debuggerIsActive = true;
if(AS.DEBUG)
@ -96,11 +100,11 @@ public class Emperor
public static final int REMOTE_SERVER = 1;
public static final int RHINO = 2;
public static final String LOCAL_LOADER_NAME =
public static final String LOCAL_LOADER_NAME =
"com.netscape.jsdebugging.api.local.AdapterLoaderLocal";
public static final String SERVER_LOADER_NAME =
public static final String SERVER_LOADER_NAME =
"com.netscape.jsdebugging.api.corba.AdapterLoaderCorba";
public static final String RHINO_LOADER_NAME =
public static final String RHINO_LOADER_NAME =
"com.netscape.jsdebugging.api.rhino.AdapterLoaderRhino";
public static boolean isDebuggingSupported(int which, String host)
@ -118,7 +122,7 @@ public class Emperor
loaderName = RHINO_LOADER_NAME;
break;
default:
return false;
return false;
}
try
@ -151,7 +155,7 @@ public class Emperor
loaderName = RHINO_LOADER_NAME;
break;
default:
return false;
return false;
}
try
@ -192,8 +196,8 @@ public class Emperor
{
if( null != _menuView )
_menuViewHeight = _menuView.itemHeight();
_commandView = new CommandView( this, _mainMenu, fileMenu, _menuViewHeight );
_commandView = new CommandView( this, _mainMenu, fileMenu, _menuViewHeight );
Rect rectCanvas = getClientRect();
// hack for space for native menu
@ -211,11 +215,11 @@ public class Emperor
Rect rectWatchView = new Rect(rectCanvas.x+20,rectCanvas.y+20,popupDX,popupDY);
Rect rectBreakpointView = new Rect(rectCanvas.x+40,rectCanvas.y+40,popupDX,popupDY);
Rect rectInspectorView = new Rect(rectCanvas.x+60,rectCanvas.y+60,popupDX,popupDY);
Rect rectStackView = new Rect( 0, lowerWindowY,
stackViewWidth,
Rect rectStackView = new Rect( 0, lowerWindowY,
stackViewWidth,
_lowerWindowDY );
Rect rectConsole = new Rect( stackViewWidth, lowerWindowY,
rectCanvas.width-stackViewWidth,
rectCanvas.width-stackViewWidth,
_lowerWindowDY);
// hack for "unsigned window" subwindow
@ -226,7 +230,7 @@ public class Emperor
_pageListView = new PageListView( this, rectPageList );
_sourceViewManager = new SourceViewManager(this);
_sourceViewManager.setPreferedNewViewRect( rectSrc );
_stackView = new StackView( this, rectStackView );
_stackView = new StackView( this, rectStackView );
_consoleView = new ConsoleView(this, rectConsole );
_watchView = new WatchView(this, rectWatchView);
_breakpointView = new BreakpointView(this, rectBreakpointView);
@ -282,10 +286,10 @@ public class Emperor
if( null != _sourceViewManager )
_sourceViewManager.prefsRead( unarchiver );
if( null != _watchTyrant )
_watchTyrant.prefsRead( unarchiver );
// add the rest...
@ -298,7 +302,7 @@ public class Emperor
// print and eat
System.out.println(e);
}
}
@ -338,7 +342,7 @@ public class Emperor
System.out.println(e);
}
}
private void _debuggerIsClosing()
@ -373,7 +377,7 @@ public class Emperor
return false;
return true;
}
public void windowDidHide(Window aWindow)
public void windowDidHide(Window aWindow)
{
if( null == _mainWindow || _mainWindow != aWindow || _ignoreHide )
return;
@ -441,7 +445,7 @@ public class Emperor
{
String linetext;
while( null != (linetext = s.readLine()) )
{
{
String url;
String condition;
int sep1;
@ -532,7 +536,7 @@ public class Emperor
return new Rect(0,_toolbarHeight+_menuViewHeight,
s.width,s.height-_toolbarHeight-_menuViewHeight);
}
private Rect getPreferedNewSourceViewRect()
{
Rect rect = getClientRect();
@ -621,7 +625,7 @@ public class Emperor
private int _toolbarHeight;
private RootView _rootView;
private boolean _appCanClose = true;
private ControlTyrant _controlTyrant ;
private BreakpointTyrant _breakpointTyrant;
private SourceTyrant _sourceTyrant ;
@ -645,10 +649,10 @@ public class Emperor
private int _lowerWindowDY;
private static final Color _backgroundColor = Color.white;
private static final Color _disabledBackgroundColor = Color.lightGray;
private static final Color _backgroundColor = Color.white;
private static final Color _disabledBackgroundColor = Color.lightGray;
private static final Color _selectionColor = Color.lightGray;
// private static final Color _backgroundColor = Color.lightGray;
// private static final Color _backgroundColor = Color.lightGray;
// private static final Color _selectionColor = Color.white;
private static final String _prefsFilenameClient = "jsdcpref.txt";

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* Interface to help decouple Emperor from debugger embedding windows
*/
// when who what
// 11/10/97 jband added file
//
@ -25,4 +29,4 @@ package com.netscape.jsdebugging.ifcui;
public interface EmperorOwner
{
public void setWaitCursor(boolean set);
}
}

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* Platform specific support for detecting platform and locating prefs files
*/
// when who what
// 12/06/97 jband added this file
//
@ -77,7 +81,7 @@ public class Env
_coursePlatformType = ENV_MAC;
else
_coursePlatformType = ENV_UNIX;
}
}
catch(Exception e)
{
System.out.println(e);
@ -103,7 +107,7 @@ public class Env
if(null != loadDir)
_codebaseDir = loadDir.replace('/', File.separatorChar);
// unescape the path
// unescape the path
StringBuffer sb = new StringBuffer();
int len = _codebaseDir.length();
for(int i = 0; i < len; i++ )
@ -120,7 +124,7 @@ public class Env
i += 2;
}
}
sb.append(c);
sb.append(c);
}
_codebaseDir = sb.toString();
@ -136,9 +140,9 @@ public class Env
}
// hack to lose the leading slash in Mac filenames
//
//
// REMOVED! Mac Java in Nav wants leading slash!
//
//
// if( ENV_MAC == _coursePlatformType &&
// _codebaseDir.length() >= 2 &&
// _codebaseDir.charAt(0) == File.separatorChar )
@ -157,7 +161,7 @@ public class Env
}
// hack to get a 'normal' filename on Windows
if( ENV_WIN == _coursePlatformType && _codebaseDir.charAt(1) == '|' )
if( ENV_WIN == _coursePlatformType && _codebaseDir.charAt(1) == '|' )
_codebaseDir = _codebaseDir.charAt(0)+":"+ _codebaseDir.substring(2);
}
@ -188,17 +192,17 @@ public class Env
int sep = _codebaseDir.indexOf(File.separatorChar,1);
if(-1 != sep)
{
_prefsDir = _codebaseDir.substring(0,sep+1) +
_prefsDir = _codebaseDir.substring(0,sep+1) +
"System Folder" +
File.separatorChar +
"Preferences" +
File.separatorChar;
}
}
}
}
private static int _coursePlatformType = 0;
private static String _codebaseDir = null;
private static String _prefsDir = null;
}
}

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* Holds error state information
*/
// when who what
// 06/30/97 jband added this simple dumb data class
//

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* Dialog to display error info and get user's response
*/
// when who what
// 06/30/97 jband added this class
//
@ -54,16 +58,16 @@ class ErrorReporterDialog
Size sz = icon.minSize();
icon.sizeTo(sz.width,sz.height);
addSubview(icon);
int boxTop = _spacerDY + sz.height + _spacerDY;
int contentDX = _boxDX + _spacerDX * 2;
int contentDY = boxTop + _boxDY + _spacerDY * 3 + _buttonDY;
int buttonY = boxTop + _boxDY + _spacerDY * 2;
int buttonY = boxTop + _boxDY + _spacerDY * 2;
int buttonX3 = _boxDX + _spacerDX - _buttonDX;
int buttonX2 = buttonX3 - _spacerDX - _buttonDX;
int buttonX1 = buttonX2 - _spacerDX - _buttonDX;
Size size = windowSizeForContentSize(contentDX, contentDY);
setBounds(0,0,size.width,size.height);
@ -77,35 +81,35 @@ class ErrorReporterDialog
title.setBackgroundColor(Color.lightGray);
title.setEditable(false);
addSubview(title);
ERDListView lv = new ERDListView( emperor.getFixedFont() );
lv.setAllowsEmptySelection(true);
lv.setAllowsMultipleSelection(false);
lv.setBackgroundColor(Color.lightGray);
if( null != er.filename )
{
lv.addLine( "IN "+ er.filename );
lv.addLine( "LINE "+ er.lineno );
lv.addLine( "" );
}
lv.addLine( er.msg );
if( null != er.linebuf )
{
StringBuffer sb = new StringBuffer(er.tokenOffset+2);
for(int i = 0; i < er.tokenOffset; i++ )
sb.append('.');
sb.append('^');
lv.addLine( "" );
lv.addLine( er.linebuf );
lv.addLine( sb.toString() );
}
lv.sizeToContent();
ScrollGroup sg1 = new ScrollGroup(_spacerDX,boxTop,_boxDX,_boxDY);
sg1.setHorizScrollBarDisplay( ScrollGroup.AS_NEEDED_DISPLAY );
sg1.setVertScrollBarDisplay( ScrollGroup.AS_NEEDED_DISPLAY );
@ -114,15 +118,15 @@ class ErrorReporterDialog
sg1.contentView().setLayoutManager( new MarginLayout() );
sg1.setBackgroundColor(Color.lightGray);
addSubview(sg1);
Button button;
button = new Button(buttonX1,buttonY,_buttonDX,_buttonDY);
button.setTitle("OK");
button.setTarget(this);
button.setCommand(OK_CMD);
addSubview(button);
button = new Button(buttonX2,buttonY,_buttonDX,_buttonDY);
button.setTitle("Debug");
button.setTarget(this);
@ -130,16 +134,16 @@ class ErrorReporterDialog
if( "syntax error".equals(er.msg) )
button.setEnabled(false);
addSubview(button);
button = new Button(buttonX3,buttonY,_buttonDX,_buttonDY);
button.setTitle("Pass On");
button.setTarget(this);
button.setCommand(PASS_ON_CMD);
addSubview(button);
center();
}
// implement target interface
public void performCommand(String cmd, Object data)
{
@ -152,25 +156,25 @@ class ErrorReporterDialog
else
return;
hide();
}
}
public int getAnswer() {return _answer;}
private int _answer = JSErrorReporter.RETURN;
private static final String OK_CMD = "OK_CMD";
private static final String DEBUG_CMD = "DEBUG_CMD";
private static final String PASS_ON_CMD = "PASS_ON_CMD";
}
}
class ERDListView extends BackgroundHackListView
{
public ERDListView( Font font )
{
super();
super();
_linefont = font;
}
public void addLine( String text )
{
ListItem item = new ListItem();
@ -180,19 +184,19 @@ class ERDListView extends BackgroundHackListView
_maxlinelen = Math.max( _maxlinelen, text.length() );
}
public void sizeToContent()
{
FontMetrics fm = _linefont.fontMetrics();
setBounds( 0, 0, (_maxlinelen+1) * fm.charWidth('X'),0 );
sizeToMinSize();
}
// don't allow selection...
public boolean mouseDown(MouseEvent me) {return false;}
public void mouseDragged(MouseEvent me) {}
public void mouseUp(MouseEvent me) {}
private Font _linefont = null;
private int _maxlinelen = 0;
}

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* Dialog used in remote debugging to choose server
*/
// when who what
// 11/10/97 jband added this file
//
@ -42,16 +46,16 @@ class HostNameDialog
public HostNameDialog(String title, String label, String hostname)
{
super();
setTitle(title);
setCloseable( false );
setResizable( false );
int contentDX = _editDX + _spacerDX * 2;
int contentDY = _labelDY + _editDY + _buttonDY + _spacerDY * 4;
int labelY = _spacerDY;
int editY = _labelDY + _spacerDY * 2;
int buttonY = _labelDY + _editDY + _spacerDY * 3;
int buttonY = _labelDY + _editDY + _spacerDY * 3;
int labelX = _spacerDX;
int editX = _spacerDX;
@ -59,7 +63,7 @@ class HostNameDialog
int buttonX3 = contentDX - _spacerDX - _buttonDX;
int buttonX2 = buttonX3 - _spacerDX - _buttonDX;
int buttonX1 = buttonX2 - _spacerDX - _buttonDX;
Size size = windowSizeForContentSize(contentDX, contentDY);
setBounds(0,0,size.width,size.height);
@ -73,13 +77,13 @@ class HostNameDialog
addSubview(_textField);
Button button;
button = new Button(buttonX1,buttonY,_buttonDX,_buttonDY);
button.setTitle("OK");
button.setTarget(this);
button.setCommand(OK_CMD);
addSubview(button);
button = new Button(buttonX2,buttonY,_buttonDX,_buttonDY);
button.setTitle("Localhost");
button.setTarget(this);
@ -106,7 +110,7 @@ class HostNameDialog
label.setBorder(null);
return label;
}
// implement target interface
public void performCommand(String cmd, Object data)
{
@ -120,11 +124,11 @@ class HostNameDialog
if( null == _hostName || 0 == _hostName.length() )
{
_hostName = _hostName.trim();
Alert.runAlertInternally(
Alert.runAlertInternally(
Alert.notificationImage(),
"invalid entry",
"invalid entry",
"you must enter a valid hostname or ip address",
"OK", null,null );
"OK", null,null );
setFocusedView( _textField );
return;
}
@ -142,7 +146,7 @@ class HostNameDialog
_keyPressed = CANCEL;
hide();
}
}
}
// implement TextFilter interface
public boolean acceptsEvent(Object o, KeyEvent ke , Vector vec)
@ -152,7 +156,7 @@ class HostNameDialog
Application.application().performCommandLater(this, OK_CMD, null);
return false;
}
return true;
return true;
}
public void showModally()
@ -176,7 +180,7 @@ class HostNameDialog
public String getHostName() {return _hostName;}
public int getKeyPressed() {return _keyPressed;}
private TextField _textField;
private int _keyPressed;
private String _hostName;
@ -184,6 +188,6 @@ class HostNameDialog
private static final String CANCEL_CMD = "CANCEL_CMD";
private static final String LOCALHOST_CMD = "LOCALHOST_CMD";
private static final String OK_CMD = "OK_CMD";
}
}

Просмотреть файл

@ -16,10 +16,14 @@
* Reserved.
*/
/*
* 'Model' to manage inspector info about a singe value
*/
// when who what
// 10/30/97 jband added this file
//
package com.netscape.jsdebugging.ifcui;
import netscape.application.*;
@ -28,9 +32,9 @@ import com.netscape.jsdebugging.ifcui.palomar.util.*;
public class InspectorNodeModel
{
public InspectorNodeModel( String name,
public InspectorNodeModel( String name,
int depth,
InspectorNodeModel parent,
InspectorNodeModel parent,
InspectorTyrant tyrant )
{
_name = name.trim();
@ -82,7 +86,7 @@ public class InspectorNodeModel
prev = cur;
}
}
return childCount;
return childCount;
}
public synchronized void clearLinks()
@ -149,4 +153,4 @@ public class InspectorNodeModel
private boolean _hasProperties;
private String _type;
private boolean _isValid;
}
}

Просмотреть файл

@ -16,10 +16,14 @@
* Reserved.
*/
/*
* 'Model' to do tree of data inspection
*/
// when who what
// 10/30/97 jband added this file
//
package com.netscape.jsdebugging.ifcui;
import java.util.Observable;
@ -32,7 +36,7 @@ import netscape.security.ForbiddenTargetException;
import com.netscape.jsdebugging.api.*;
public class InspectorTyrant
extends Observable
extends Observable
implements Observer, Target, JSErrorReporter // , SimulatorPrinter // XXX Sim Hack
{
public InspectorTyrant(Emperor emperor)
@ -71,11 +75,11 @@ public class InspectorTyrant
// It is important that our function name not conflict with anything
// in the user's namespace. I think this should be safe :)
private static final String _propEnumeratorFunctionName =
private static final String _propEnumeratorFunctionName =
"__John_Bandhauer_Says_This_Is_A_Unique_Identifier__";
// Rhino currently does not like this form
// private static final String _propEnumeratorFunction =
// private static final String _propEnumeratorFunction =
// "function "+_propEnumeratorFunctionName+"(ob)\n"+
// "{\n"+
// " var retval = \"\";\n"+
@ -85,7 +89,7 @@ public class InspectorTyrant
// " return retval;\n"+
// "}\n";
private static final String _propEnumeratorFunction =
private static final String _propEnumeratorFunction =
_propEnumeratorFunctionName+" = new Function(\"ob\",\""+
" var retval = new String();"+
" var prop;"+
@ -123,7 +127,7 @@ public class InspectorTyrant
// we build both a string and a number vector so that we can
// seperately sort them before concating them. NOTE that numVec
// actually holds strings representing numbers, rather than the
// actually holds strings representing numbers, rather than the
// numbers themselves - we don't want rounding & conversions errors
Vector stringVec = new Vector();
Vector numVec = new Vector();
@ -164,9 +168,9 @@ public class InspectorTyrant
}
else
{
// the below deals with cases where the property
// name is not a number, but is not a valid
// identifier either.
// the below deals with cases where the property
// name is not a number, but is not a valid
// identifier either.
// e.g. window["foo/bar"]
// the navigator.mimeTypes array has such properties
String nameToAdd = null;
@ -185,7 +189,7 @@ public class InspectorTyrant
stringVec.addElement(nameToAdd);
}
}
start = i+1;
start = i+1;
}
}
@ -207,7 +211,7 @@ public class InspectorTyrant
}
}
return retval;
return retval;
}
public String eval(String input)
@ -230,14 +234,14 @@ public class InspectorTyrant
return null;
String filename;
if( _emperor.isPre40b6() ||
if( _emperor.isPre40b6() ||
Emperor.REMOTE_SERVER == _emperor.getHostMode() )
filename = "inspector";
else
filename = loc.getURL();
PrivilegeManager.enablePrivilege("Debugger");
String result = "";
_errorString = null;
@ -249,7 +253,7 @@ public class InspectorTyrant
DebugController dc = _emperor.getDebugController();
if( null != dc && null != frame )
{
ExecResult fullresult =
ExecResult fullresult =
dc.executeScriptInStackFrame(frame,eval,filename,1);
result = fullresult.getResult();
@ -273,10 +277,10 @@ public class InspectorTyrant
}
/*
* NOTE: this ErrorReporter may be called on a thread other than
* the IFC UI thread
* NOTE: this ErrorReporter may be called on a thread other than
* the IFC UI thread
*/
// implement JSErrorReporter interface
public int reportError( String msg,
String filename,
@ -286,7 +290,7 @@ public class InspectorTyrant
{
_errorString = msg;
return JSErrorReporter.RETURN;
}
}
// implement observer interface
public void update(Observable o, Object arg)
@ -320,4 +324,4 @@ public class InspectorTyrant
private StackTyrant _stackTyrant;
private String _errorString;
private InspectorNodeModel _rootNode;
}
}

Просмотреть файл

@ -16,10 +16,14 @@
* Reserved.
*/
/*
* 'View' to interactively do inspection of a tree of data
*/
// when who what
// 10/30/97 jband added this file
//
package com.netscape.jsdebugging.ifcui;
import java.util.Observable;
@ -29,7 +33,7 @@ import netscape.util.*;
import com.netscape.jsdebugging.ifcui.palomar.util.*;
import com.netscape.jsdebugging.ifcui.palomar.widget.layout.*;
public class InspectorView
public class InspectorView
extends InternalWindow
implements Observer, Target, TextFilter
{
@ -38,10 +42,10 @@ public class InspectorView
private static final int _buttonHeight = 24;
private static final int _spacerDY = 5;
private static final int _spacerDX = 5;
private int _nextButtonX;
private int _nextButtonY;
public InspectorView( Emperor emperor, Rect rect )
{
super(rect);
@ -68,10 +72,10 @@ public class InspectorView
Rect rectEdit = new Rect(_spacerDX, _spacerDY, listwidth, _editDY);
Rect rectSG = new Rect(_spacerDX, listtop, listwidth, _listheight);
_nextButtonX = listwidth + (_spacerDX * 2);
_nextButtonY = _spacerDY;
_nextButtonY = _spacerDY;
_inspectButton = _addButton( "Inspect", INSPECT_CMD );
_nextButtonY += _spacerDY * 2;
_evalButton = _addButton( "Eval", EVAL_CMD );
@ -86,7 +90,7 @@ public class InspectorView
_textfield.setFont(_emperor.getFixedFont());
_textfield.setFilter(this); // to catch return key and edit cmds
addSubview(_textfield);
ScrollGroup sg = new ScrollGroup(rectSG);
sg.setHorizScrollBarDisplay( ScrollGroup.AS_NEEDED_DISPLAY );
sg.setVertScrollBarDisplay( ScrollGroup.AS_NEEDED_DISPLAY );
@ -94,8 +98,8 @@ public class InspectorView
sg.setAutoResizeSubviews(true);
sg.contentView().setLayoutManager( new MarginLayout() );
sg.setBackgroundColor(_emperor.getBackgroundColor());
setCloseable( false );
setCloseable( false );
setResizable( false );
setTitle( "Inspector" );
addSubview(sg);
@ -123,10 +127,10 @@ public class InspectorView
refresh();
layoutView(1,1);
layoutView(-1,-1);
layoutView(1,1);
layoutView(-1,-1);
}
private Button _addButton( String title, String cmd )
{
Button button = new Button(_nextButtonX,_nextButtonY,
@ -191,7 +195,7 @@ public class InspectorView
_inspectorTyrant.setNewRootNode(s);
}
// update done on notification...
}
}
else if( cmd.equals(EVAL_CMD) )
{
if( ControlTyrant.STOPPED != _controlTyrant.getState() )
@ -209,7 +213,7 @@ public class InspectorView
s );
}
}
}
}
else if( cmd.equals(ADD_WATCH_CMD) )
{
String s = _textfield.stringValue();
@ -280,7 +284,7 @@ public class InspectorView
_textfield.setFocusedView();
if( _fixupSizes() )
layoutView(0,0);
layoutView(0,0);
_listview.draw();
_emperor.setWaitCursor(false);
@ -333,7 +337,7 @@ public class InspectorView
newitem.setSelectedColor(_emperor.getSelectionColor());
child = child.getNextSib();
}
if( draw && anyChildren )
{
if( _fixupSizes() )
@ -361,11 +365,11 @@ public class InspectorView
break;
_listview.removeItemAt(index+1);
}
if( draw )
{
if( _fixupSizes() )
layoutView(0,0);
layoutView(0,0);
_listview.scrollItemAtToVisible(index);
_listview.draw();
}
@ -455,8 +459,8 @@ public class InspectorView
private static final String COPY_VALUE_CMD = "COPY_VALUE_CMD";
private static final String DONE_CMD = "DONE_CMD";
}
}
/***************************************************************************/
@ -474,7 +478,7 @@ final class InspectorListView extends SmartItemListView
private InspectorView _iv;
private InspectorListItem _mousedItem;
}
/***************************************************************************/
@ -597,8 +601,8 @@ final class InspectorListItem extends SmartListItem
private InspectorItemDrawer _drawer;
private InspectorNodeModel _model;
}
}
/***************************************************************************/
@ -628,8 +632,8 @@ final class InspectorItemDrawer
}
public void draw( Graphics g,
Rect boundsRect,
public void draw( Graphics g,
Rect boundsRect,
InspectorListItem item,
InspectorNodeModel model )
{
@ -726,7 +730,7 @@ final class InspectorItemDrawer
if( r.intersects( g.clipRect() ) )
{
item.setTextColor(_leftTextColor);
item.drawStringInRect(g,name,_font,r,Graphics.LEFT_JUSTIFIED);
item.drawStringInRect(g,name,_font,r,Graphics.LEFT_JUSTIFIED);
}
}
@ -747,7 +751,7 @@ final class InspectorItemDrawer
item.setTextColor(_rightTextFunctionColor);
else
item.setTextColor(_rightTextColor);
item.drawStringInRect(g,value,_font,r,Graphics.LEFT_JUSTIFIED);
item.drawStringInRect(g,value,_font,r,Graphics.LEFT_JUSTIFIED);
}
}
@ -801,4 +805,4 @@ final class InspectorItemDrawer
private static final int _spacerDY = 3;
private static final int _boxDim = 11;
}
}

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* Core Application class for debugger (used both when app or applet)
*/
// when who what
// 06/27/97 jband added this header to my code
//
@ -90,7 +94,7 @@ public class JSDebuggerApp
PrivilegeManager.enablePrivilege("Debugger");
PrivilegeManager.enablePrivilege("UniversalFileRead");
// It doesn't really matter that much if the user says no to
// It doesn't really matter that much if the user says no to
// these (at this point)
try
{
@ -124,7 +128,7 @@ public class JSDebuggerApp
{
int platform = Env.getCoursePlatformType();
System.out.println("JSD platform is " +
System.out.println("JSD platform is " +
(platform == Env.ENV_WIN ?
"Windows" :
platform == Env.ENV_MAC ?
@ -249,8 +253,8 @@ public class JSDebuggerApp
if( Emperor.REMOTE_SERVER == _mode && null == _host )
{
String hostname = _readHostName();
HostNameDialog dlg = new
HostNameDialog("Choose Server",
HostNameDialog dlg = new
HostNameDialog("Choose Server",
"Enter Hostname or ip address of Server",
hostname);
while(true)
@ -270,10 +274,10 @@ public class JSDebuggerApp
break;
setWaitCursor(false);
if( Alert.DEFAULT_OPTION ==
if( Alert.DEFAULT_OPTION ==
Alert.runAlertInternally( Alert.warningImage(),
"Error",
"JavaScript Debugger support was not found in "+ _host+"\n"
"JavaScript Debugger support was not found in "+ _host+"\n"
+ "\n"
+ "Try a different Server?",
"Yes", "No", null ) )
@ -330,7 +334,7 @@ public class JSDebuggerApp
setWaitCursor(false);
Alert.runAlertInternally( Alert.warningImage(),
"Error",
core_msg
core_msg
+ "\n\n"
+ suggestion
+ "Please see the Debugger release notes for troubleshooting information\n"
@ -349,7 +353,7 @@ public class JSDebuggerApp
MenuItem fileMenu = mainMenu.addItemWithSubmenu("File");
MenuItem item;
_emperor = new Emperor( this, _mainWindow, mainMenu, fileMenu,
_emperor = new Emperor( this, _mainWindow, mainMenu, fileMenu,
menuView, _mode, _host, statusWindow );
addSeparator(fileMenu);
@ -429,7 +433,7 @@ public class JSDebuggerApp
String licenseHtmlFilename = baseDir+"license.html";
LicenseViewer v =
LicenseViewer v =
new LicenseViewer("Netscape JavaScript Debugger License", licenseHtmlFilename);
if( ! v.HtmlLoadedSuccesfully() )
@ -478,7 +482,7 @@ public class JSDebuggerApp
{
String title = "About";
String msg;
msg = "Netscape JavaScript Debugger\n";
msg += "Version "+MAJOR_VERSION+"."+MINOR_VERSION;
if( PREVIEW_VERSION != 0 )
@ -663,7 +667,7 @@ public class JSDebuggerApp
if(AS.S)ER.T(_waitCount >= 0,"_waitCount went negative", this );
if(AS.S)ER.T(Thread.currentThread()==_uiThreadForAssertCheck,"setWaitCursor() called on non-UI thread",this);
if( (1 == _waitCount && set) || (0 == _waitCount && !set) )
{
Vector windows = externalWindows();
@ -672,13 +676,13 @@ public class JSDebuggerApp
{
ExternalWindow window = (ExternalWindow)windows.elementAt(i);
FoundationPanel panel = window.panel();
if (set)
panel.setCursor(View.WAIT_CURSOR);
else
panel.setCursor(View.ARROW_CURSOR);
}
}
}
}

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* IFC FoundationApplet startup support class
*/
package com.netscape.jsdebugging.ifcui;
import netscape.application.*;

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* Simple html viewer to show licence and get acceptance
*/
// when who what
// 11/10/97 jband added this file
//
@ -44,17 +48,17 @@ class LicenseViewer
setTitle(title);
setCloseable(true);
setResizable(false);
int contentDX = _editDX + _spacerDX * 2;
int contentDY = _editDY + _buttonDY + _spacerDY * 3;
int labelY = _spacerDY;
int editY = _spacerDY * 1;
int buttonY = _editDY + _spacerDY * 2;
int buttonY = _editDY + _spacerDY * 2;
int editX = _spacerDX;
int buttonX2 = contentDX - _spacerDX - _buttonDX;
int buttonX1 = buttonX2 - _spacerDX - _buttonDX;
Size size = windowSizeForContentSize(contentDX, contentDY);
setBounds(0,0,size.width,size.height);
@ -89,7 +93,7 @@ class LicenseViewer
_HtmlLoadedSuccesfully = true;
Button button;
button = new Button(buttonX1,buttonY,_buttonDX,_buttonDY);
button.setTitle("I Accept");
button.setTarget(this);
@ -117,7 +121,7 @@ class LicenseViewer
{
hide();
}
}
}
public void showModally()
{
@ -127,12 +131,12 @@ class LicenseViewer
public boolean userPressedAccept() {return _userPressedAccept;}
public boolean HtmlLoadedSuccesfully() {return _HtmlLoadedSuccesfully;}
private boolean _userPressedAccept = false;
private boolean _HtmlLoadedSuccesfully = false;
private TextView _textView;
private static final String CANCEL_CMD = "CANCEL_CMD";
private static final String ACCEPT_CMD = "ACCEPT_CMD";
}
}

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* Source location (file,line) with persistence support
*/
// when who what
// 06/27/97 jband added this header to my code
//
@ -32,7 +36,7 @@ import com.netscape.jsdebugging.ifcui.palomar.util.*;
import netscape.util.*;
public class Location
public class Location
implements Comparable, Codable
{
@ -48,9 +52,9 @@ public class Location
if(AS.S)ER.T(null!=url,"null url in Location ctor",this);
if(AS.S)ER.T(line >=0,"negative line in Location ctor",this);
_url = url;
_url = url;
_line = line;
_stringRep = new String( _url + "#" + _line );
_stringRep = new String( _url + "#" + _line );
}
// for Codable
@ -114,10 +118,10 @@ public class Location
}
public void finishDecoding() throws CodingException
{
_stringRep = new String( _url + "#" + _line );
_stringRep = new String( _url + "#" + _line );
}
private String _url;
private String _url;
private int _line;
private String _stringRep;
}

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* Flexible Logging support
*/
// when who what
// 09/30/97 jband created file
//
@ -78,7 +82,7 @@ public final class Log
if( _logToConsole )
System.out.println(buf);
}
public static boolean getEnabled()
{
return _enabled;
@ -98,7 +102,7 @@ public final class Log
{
_typeEnabled[type] = enabled;
}
public static boolean getShowDate()
{
return _showDate;
@ -108,7 +112,7 @@ public final class Log
{
_showDate = b;
}
public static boolean getShowThreadName()
{
return _showThreadName;
@ -189,7 +193,7 @@ public final class Log
return null != _out;
}
private static void _finish()
{
if( null != _out )
@ -236,5 +240,5 @@ public final class Log
private static boolean _useCodebase = false;
private static String _fullFilename = null;
private static String _baseFilename = "jsdlog.log";
}
}

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* Popup (floating) menu support
*/
// By Jennifer Lateiner
@ -45,7 +49,7 @@ import netscape.application.*;
*
* Also note: getTitle on a menu displayed by MouseMenuView
* will have 4 leading spaces.
*
*
* <pre>
* History:
* 07/30/97: Created by Jenni
@ -75,7 +79,7 @@ public class MouseMenuView extends MenuView {
}
/** Constructs a MouseMenuView with bounds (<b>x</b>, <b>y</b>, <b>width</b>,
* </b>height</b>).
* </b>height</b>).
*/
public MouseMenuView(int x, int y, int width, int height) {
this(x, y, width, height, null, null);
@ -109,7 +113,7 @@ public class MouseMenuView extends MenuView {
* we can track it.
*/
protected InternalWindow createMenuWindow() {
_window = new InternalWindow(0, 0, 0, 0);
_window.setType(InternalWindow.BLANK_TYPE);
_window.setLayer(InternalWindow.IGNORE_WINDOW_CLIPVIEW_LAYER+11);
@ -160,7 +164,7 @@ public class MouseMenuView extends MenuView {
}
}
return;
}
}
super.mouseUp(event);
} catch (java.lang.NullPointerException e) {
@ -185,7 +189,7 @@ public class MouseMenuView extends MenuView {
}
/** Displays the menu in its own InternalWindow
/** Displays the menu in its own InternalWindow
*/
public void show(RootView rootView, MouseEvent event) {
boolean canRightFlip=true;
@ -220,12 +224,12 @@ public class MouseMenuView extends MenuView {
}
sizeToMinSize();
sizeToMinSize();
super.show(rootView, event);
/* Move the menu over and to the left a little from the
* mouse event (which is the standard IFC
* mouse event (which is the standard IFC
if(owner() == null) {
_window.setBounds(_window.bounds.x-5, _window.bounds.y-5,
_window.bounds.width,
@ -250,7 +254,7 @@ public class MouseMenuView extends MenuView {
_window.bounds.height);
canRightFlip = false;
}
}
@ -269,7 +273,7 @@ public class MouseMenuView extends MenuView {
_window.bounds.height);
}
}
if(_window.bounds.y + _window.bounds.height >
rootView.bounds.height) {
_window.setBounds(_window.bounds.x,

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* 'View' of list of sources
*/
// when who what
// 06/27/97 jband added this header to my code
//
@ -30,7 +34,7 @@ import com.netscape.jsdebugging.ifcui.palomar.util.*;
import com.netscape.jsdebugging.ifcui.palomar.widget.layout.*;
import com.netscape.jsdebugging.api.*;
public class PageListView
public class PageListView
extends InternalWindow
implements Observer, Target
{
@ -80,8 +84,8 @@ public class PageListView
sg.setAutoResizeSubviews(true);
sg.contentView().setLayoutManager( new MarginLayout() );
sg.setBackgroundColor(_emperor.getBackgroundColor());
setCloseable( false );
setCloseable( false );
setResizable( false );
setTitle( "Open" );
addSubview(sg);
@ -104,8 +108,8 @@ public class PageListView
_refresh();
layoutView(1,1);
layoutView(-1,-1);
layoutView(1,1);
layoutView(-1,-1);
// show();
}
@ -129,7 +133,7 @@ public class PageListView
{
// XXX update list on stop
}
}
// implement target interface
@ -153,7 +157,7 @@ public class PageListView
boolean sort = _emperor.getHostMode() != Emperor.LOCAL;
_listview.removeAllItems();
SourceTextItem[] array = _sourceTyrant.getSourceTextItemArray();
Font linefont = Font.defaultFont();
@ -183,7 +187,7 @@ public class PageListView
{
SourceTextItem src = array[i];
ListItem item = new ListItem();
String text = src.getURL();
maxlinelen = Math.max( maxlinelen, text.length() );
item.setTitle( text );
@ -222,7 +226,7 @@ public class PageListView
_listview.setBounds( 0, 0, (maxlinelen+1) * fm.charWidth('X'),0 );
_listview.sizeToMinSize();
layoutView(0,0);
layoutView(0,0);
_listview.draw();
}
@ -240,7 +244,7 @@ public class PageListView
private static final String CLOSE_CMD = "CLOSE_CMD";
private static final String OPEN_CMD = "OPEN_CMD";
}
}

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* Interface to support persistence
*/
// when who what
// 08/01/97 jband created this file
//
@ -30,4 +34,4 @@ public interface PrefsSupport
{
public void prefsWrite(Archiver archiver) throws CodingException;
public void prefsRead(Unarchiver unarchiver) throws CodingException;
}
}

Просмотреть файл

@ -9,3 +9,5 @@ from:
This code can be used to run in Navigator or with the standalone JS engines.
This can be built on Windows and packaged in various ways using the build system
in js/jsdj/build.

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* ListView that supports letting ListItems handle their own events
*/
// when who what
// 10/31/97 jband added this file
//
@ -72,6 +76,6 @@ public class SmartItemListView extends BackgroundHackListView
{
return (SmartListItem) itemForPoint(me.x, me.y);
}
}
}

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* ListItems that can handle their own events
*/
// when who what
// 10/31/97 jband added this file
//
@ -58,7 +62,7 @@ public class SmartListItem extends ListItem
if(AS.S)ER.T(lv!=null,"ListItem with no parent called myRect()",this);
return lv.rectForItem(this);
}
}
}

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* 'Model' to hold info on one line of text in source viewer
*/
// when who what
// 06/27/97 jband added this header to my code
//
@ -37,5 +41,5 @@ class SourceLineItemModel
public Breakpoint bp;
public boolean executing; // is this line currently executing?
public String adjustmentChar;
}
}

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* 'Model' to manage sources
*/
// when who what
// 06/27/97 jband added this header to my code
//
@ -32,7 +36,7 @@ import netscape.security.ForbiddenTargetException;
import com.netscape.jsdebugging.api.*;
public class SourceTyrant
extends Observable
extends Observable
implements Observer
{
public SourceTyrant(Emperor emperor) throws ForbiddenTargetException
@ -88,13 +92,13 @@ public class SourceTyrant
return sti;
}
public SourceTextItem[] getSourceTextItemArray()
public SourceTextItem[] getSourceTextItemArray()
{
PrivilegeManager.enablePrivilege("Debugger");
return _sourceTextProvider.getItems();
}
public SourceTextItem getSelectedSourceItem() {return _selectedSourceTextItem;}
public void setSelectedSourceItem(SourceTextItem s)
public void setSelectedSourceItem(SourceTextItem s)
{
if( _selectedSourceTextItem == s )
return;
@ -158,7 +162,7 @@ public class SourceTyrant
/* jband - 06/04/97 - new scheme for user souce line adjustment */
public synchronized void clearAllAdjustmentsForItem( SourceTextItem sti )
{
if( null == _adjustments )
return;
@ -326,8 +330,8 @@ public class SourceTyrant
//////////////////////////////////////////////////////////////////
// data...
// data...
private Emperor _emperor;
private ControlTyrant _controlTyrant;
@ -339,7 +343,7 @@ public class SourceTyrant
private String _selectedText = null;
private Hashtable _adjustments = null;
}
}
class AdjustmentItem
{
@ -351,4 +355,4 @@ class AdjustmentItem
public int line;
public int offset;
public int cummulative_offset;
}
}

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* Info sent with SourceTyrant update events
*/
// when who what
// 06/27/97 jband added this header to my code
//
@ -23,7 +27,7 @@
package com.netscape.jsdebugging.ifcui;
import com.netscape.jsdebugging.api.*;
class SourceTyrantUpdate
{
public static final int SELECT_CHANGED = 0;
@ -38,6 +42,6 @@ class SourceTyrantUpdate
}
public int type;
public SourceTextItem item;
}
}

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* 'View' for interactive viewing of source code
*/
// when who what
// 06/27/97 jband added this header to my code
//
@ -59,8 +63,8 @@ public class SourceView extends InternalWindow
if(AS.S)ER.T(null!=_sourceViewManager,"emperor init order problem", this);
if(AS.S)ER.T(null!=_stackTyrant,"emperor init order problem", this);
_sourceLineVectorModel =
new SourceLineVectorModel(this, _controlTyrant, _stackTyrant,
_sourceLineVectorModel =
new SourceLineVectorModel(this, _controlTyrant, _stackTyrant,
_sourceTyrant, item);
_listview = new SourceTextListView(this);
@ -73,7 +77,7 @@ public class SourceView extends InternalWindow
sg.setAutoResizeSubviews(true);
sg.contentView().setLayoutManager( new MarginLayout() );
sg.setBackgroundColor(_emperor.getBackgroundColor());
setCloseable( true );
setResizable( true );
// setTitle( "Source for: " + item.getURL() );
@ -93,8 +97,8 @@ public class SourceView extends InternalWindow
_refresh(true);
layoutView(1,1);
layoutView(-1,-1);
layoutView(1,1);
layoutView(-1,-1);
show();
}
@ -163,7 +167,7 @@ public class SourceView extends InternalWindow
_refresh(false);
updateMarks();
}
}
public void forceRefresh()
@ -202,7 +206,7 @@ public class SourceView extends InternalWindow
{
_emperor.setWaitCursor(true);
// System.out.println(" _refreshing: " + _item.getURL() +
// System.out.println(" _refreshing: " + _item.getURL() +
// " _item.getDirty() returned: " +
// (_item.getDirty() ? "true" : "false") +
// "_item.getAlterCount() returned: " +
@ -221,7 +225,7 @@ public class SourceView extends InternalWindow
boolean showNumbers = _sourceViewManager.getShowLineNumbers();
SourceTextItemDrawer drawer = new SourceTextItemDrawer();
_listview.setItemDrawer(drawer);
int maxwidth = 0;
@ -238,7 +242,7 @@ public class SourceView extends InternalWindow
newlistitem.setSelectedColor(_emperor.getSelectionColor());
_listview.addItem( newlistitem );
if( 0 == i )
{
itemHeight = _listview.rectForItem(newlistitem).height;
@ -246,11 +250,11 @@ public class SourceView extends InternalWindow
}
maxwidth = Math.max( maxwidth, newlistitem.minWidth() );
}
_listview.setBounds(0,0,maxwidth,0);
_listview.sizeToMinSize();
layoutView(0,0);
layoutView(0,0);
_listview.draw();
_item.setDirty(false);
@ -294,8 +298,8 @@ public class SourceView extends InternalWindow
private String _selectedText = null;
private int _selectedLineNumber = 0;
}
}
/***************************************************************************/
@ -308,7 +312,7 @@ final class SourceTextListView extends SmartItemListView
}
public boolean mouseDown(MouseEvent me)
public boolean mouseDown(MouseEvent me)
{
_dragOrigin = -1;
@ -422,8 +426,8 @@ final class SourceTextListView extends SmartItemListView
// calc marks rect for item and call draw()
Rect rItem = rectForItemAt(i);
Rect r = new Rect( rItem.x,
rItem.y,
_drawer.marksRect().width,
rItem.y,
_drawer.marksRect().width,
rItem.height );
// System.out.println( "draw marks rect for single item: " + r );
draw(r);
@ -459,16 +463,16 @@ final class SourceTextListView extends SmartItemListView
private int _dragOrigin = -1;
private int _dragLast;
private int _dragAdjLineOrigin;
}
}
/***************************************************************************/
final class SourceTextItemDrawer
{
public SourceTextItemDrawer() {}
public void init( Font font, boolean showLineNumbers,
public void init( Font font, boolean showLineNumbers,
int lineCount, int itemHeight )
{
_font = font;
@ -479,7 +483,7 @@ final class SourceTextItemDrawer
_height = itemHeight;
_charWidth = font.fontMetrics().charWidth('0');
_rectBP = new Rect( 0, 0,
_rectBP = new Rect( 0, 0,
_height, _height);
Rect rectExec = new Rect( _rectBP.x + _rectBP.width, 0,
_height/2, _height);
@ -514,8 +518,8 @@ final class SourceTextItemDrawer
_ptText = new Point( _width, 0 );
}
public void draw( Graphics g,
Rect boundsRect,
public void draw( Graphics g,
Rect boundsRect,
SourceTextListItem item,
int lineNumber,
boolean hasBreakpoint,
@ -539,7 +543,7 @@ final class SourceTextItemDrawer
boundsRect.height - _ptText.y );
if( r.intersects( g.clipRect() ) )
item.drawStringInRect(g,text,_font,r,Graphics.LEFT_JUSTIFIED);
item.drawStringInRect(g,text,_font,r,Graphics.LEFT_JUSTIFIED);
}
if( hasBreakpoint )
@ -553,7 +557,7 @@ final class SourceTextItemDrawer
{
if( hasConditionalBreakpoint )
g.setColor( Color.orange );
else
else
g.setColor( Color.red );
g.fillOval( r );
}
@ -606,7 +610,7 @@ final class SourceTextItemDrawer
g.setColor( Color.blue );
g.fillPolygon( x,y,count);
}
if( _showLineNumbers )
{
@ -663,8 +667,8 @@ final class SourceTextItemDrawer
private boolean _showLineNumbers;
private int _charWidth;
}
}
final class SourceTextListItem extends SmartListItem
{
@ -675,7 +679,7 @@ final class SourceTextListItem extends SmartListItem
_charCount = charCount;
}
public boolean mouseDown(MouseEvent me)
public boolean mouseDown(MouseEvent me)
{
/*
System.out.println(".......................");
@ -791,7 +795,7 @@ final class SourceTextListItem extends SmartListItem
_dragOrigin = start;
v.setSelRange(start, end);
if( null != oldItem )
v.drawItemAt( v.indexOfItem(oldItem) );
v.draw( rectOfRangeInRect(start, end, rectText) );
@ -928,7 +932,7 @@ final class SourceTextListItem extends SmartListItem
drawBackground(g, boundsRect);
SourceLineItemModel model = (SourceLineItemModel) data();
_drawer.draw( g, boundsRect, this,
_drawer.draw( g, boundsRect, this,
model.lineNumber,
model.bp != null,
model.bp != null?model.bp.getBreakCondition()!=null:false,
@ -980,13 +984,13 @@ final class SourceTextListItem extends SmartListItem
private int _dragOrigin = -1;
private int _charCount;
private SourceTextItemDrawer _drawer;
}
}
/***************************************************************************/
final class SourceLineVectorModel
{
public SourceLineVectorModel( SourceView sourceView,
public SourceLineVectorModel( SourceView sourceView,
ControlTyrant controlTyrant,
StackTyrant stackTyrant,
SourceTyrant sourceTyrant,
@ -1013,16 +1017,16 @@ final class SourceLineVectorModel
String linetext;
int lineNumber = 1;
while( null != (linetext = s.readLine()) )
{
{
SourceLineItemModel item = new SourceLineItemModel();
item.lineNumber = lineNumber;
item.text = Util.expandTabs(linetext,8);
item.type = SourceLineItemModel.NO_SCRIPT;
item.bp = null; // XXX
item.executing = false;
item.adjustmentChar = null;
vec.addElement( item );
lineNumber++ ;
}
@ -1030,11 +1034,11 @@ final class SourceLineVectorModel
}
}
catch( Exception e ) {}
_sourceLineItemVector = vec;
updateLineItemVector();
}
public synchronized void updateLineItemVector()
{
/*
@ -1043,11 +1047,11 @@ final class SourceLineVectorModel
if( null == sp )
return;
*/
int i;
int count;
// clear all line
// clear all line
int maxLineItemIndex = _sourceLineItemVector.size() - 1;
@ -1056,14 +1060,14 @@ final class SourceLineVectorModel
return;
for( i = 0; i < count; i++ )
{
SourceLineItemModel item =
SourceLineItemModel item =
(SourceLineItemModel) _sourceLineItemVector.elementAt(i);
item.type = SourceLineItemModel.NO_SCRIPT;
item.bp = null;
item.executing = false;
item.adjustmentChar = null;
}
// walk through the scripts and mark lines with scripts
String url = _sourceTextItem.getURL();
@ -1085,7 +1089,7 @@ final class SourceLineVectorModel
{
int base = sections[n].getBaseLineNumber();
int extent = sections[n].getLineExtent();
for( int k = base; k < (base+extent); k++ )
{
if( k > maxLineItemIndex+1 )
@ -1093,11 +1097,11 @@ final class SourceLineVectorModel
int j = _sourceTyrant.systemLine2UserLine(_sourceTextItem,k);
if( j > maxLineItemIndex+1 )
continue;
SourceLineItemModel item =
SourceLineItemModel item =
(SourceLineItemModel) _sourceLineItemVector.elementAt(j-1);
// don't overwrite function with top level script
if( fun )
item.type = SourceLineItemModel.FUNCTION_BODY;
else if( item.type != SourceLineItemModel.FUNCTION_BODY )
@ -1119,7 +1123,7 @@ final class SourceLineVectorModel
if( line > maxLineItemIndex+1 )
continue;
SourceLineItemModel item = (SourceLineItemModel)
SourceLineItemModel item = (SourceLineItemModel)
_sourceLineItemVector.elementAt(line-1);
item.bp = bp;
}
@ -1139,7 +1143,7 @@ final class SourceLineVectorModel
if( index < 1 )
index = 1;
SourceLineItemModel item = (SourceLineItemModel)
SourceLineItemModel item = (SourceLineItemModel)
_sourceLineItemVector.elementAt(index-1);
item.executing = true;
}
@ -1161,7 +1165,7 @@ final class SourceLineVectorModel
}
else
adjChar = "+";
SourceLineItemModel item = (SourceLineItemModel)
SourceLineItemModel item = (SourceLineItemModel)
_sourceLineItemVector.elementAt(line-1);
item.adjustmentChar = adjChar;
}
@ -1171,25 +1175,25 @@ final class SourceLineVectorModel
// This is out of date. If anyone wants to reserect it then they
// had better update this to do the right things!
/*
/*
public synchronized void updateSingleLineItem( int lineNumber )
{
BreakpointTyrant bpt = _sourceView.getBreakpointTyrant();
Breakpoint bp = bpt.findBreakpoint(
Breakpoint bp = bpt.findBreakpoint(
new Location(_sourceTextItem.getURL(),lineNumber));
int maxLineItemIndex = _sourceLineItemVector.size() - 1;
if( lineNumber > maxLineItemIndex+1 )
lineNumber = maxLineItemIndex+1;
SourceLineItemModel item = (SourceLineItemModel)
SourceLineItemModel item = (SourceLineItemModel)
_sourceLineItemVector.elementAt(lineNumber-1);
item.bp = bp;
}
*/
*/
public Vector getLineItemVector() {return _sourceLineItemVector;}
public SourceTextItem getSourceTextItem() {return _sourceTextItem;}
public SourceTextItem getSourceTextItem() {return _sourceTextItem;}
private SourceView _sourceView;
private SourceTyrant _sourceTyrant;
@ -1197,7 +1201,7 @@ final class SourceLineVectorModel
private StackTyrant _stackTyrant;
private SourceTextItem _sourceTextItem; // has url, text, and fullness status
private Vector _sourceLineItemVector;
}
}

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* 'Model' to manage all the source views
*/
// when who what
// 06/27/97 jband added this header to my code
//
@ -88,7 +92,7 @@ public class SourceViewManager
if(null == loc )
return;
SourceTextItem sti =
SourceTextItem sti =
_sourceTyrant.findSourceItem( loc.getURL() );
if(AS.S)ER.T(null!=sti,"could not find SourceTextItem for " + loc.getURL(),this);
if(null == sti)
@ -202,7 +206,7 @@ public class SourceViewManager
}
public void selectionInSourceViewChanged( SourceView sv, String s, int lineno)
{
{
if( _mainSourceView != sv )
return;
@ -258,14 +262,14 @@ public class SourceViewManager
"com.netscape.jsdebugging.ifcui.SourceViewSaver" );
if( -1 != id )
{
SourceViewSaver svs = (SourceViewSaver)
SourceViewSaver svs = (SourceViewSaver)
unarchiver.unarchiveIdentifier(id);
svs.sendToManager(this);
}
}
// data...
// data...
private Emperor _emperor;
private ControlTyrant _controlTyrant;
private SourceTyrant _sourceTyrant;
@ -280,7 +284,7 @@ public class SourceViewManager
private String _selectedTextInMainSourceView = null;
private static final String UPDATE_MARKS = "UPDATE_MARKS";
}
}

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* Persistence support for source viewer options
*/
// when who what
// 08/01/97 jband created this file
//

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* 'Model' of stack information of stopped thread
*/
// when who what
// 06/27/97 jband added this header to my code
//
@ -30,7 +34,7 @@ import com.netscape.jsdebugging.ifcui.palomar.util.*;
import com.netscape.jsdebugging.api.*;
public class StackTyrant
extends Observable
extends Observable
implements Observer
{
public StackTyrant(Emperor emperor)
@ -148,15 +152,15 @@ public class StackTyrant
notifyObservers(new StackTyrantUpdate(StackTyrantUpdate.ARRAY_CHANGED,_currentFrameIndex));
}
// data...
// data...
private Emperor _emperor;
private ControlTyrant _controlTyrant;
private int _currentFrameIndex;
private StackFrameInfo[] _frameArray;
}
}
class StackTyrantUpdate
{
@ -170,6 +174,6 @@ class StackTyrantUpdate
}
public int type;
public int sel;
}
}

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* 'View' for interactive viewing of call stack
*/
// when who what
// 06/27/97 jband added this header to my code
//
@ -60,7 +64,7 @@ public class StackView extends InternalWindow
sg.setAutoResizeSubviews(true);
sg.contentView().setLayoutManager( new MarginLayout() );
sg.setBackgroundColor(_emperor.getBackgroundColor());
setCloseable( false );
setResizable( true );
setTitle( "Call Stack" );
@ -82,8 +86,8 @@ public class StackView extends InternalWindow
_refresh();
layoutView(1,1);
layoutView(-1,-1);
layoutView(1,1);
layoutView(-1,-1);
// show();
@ -92,13 +96,13 @@ public class StackView extends InternalWindow
private synchronized void _refresh()
{
// refill all
_listview.removeAllItems();
if( ControlTyrant.STOPPED != _controlTyrant.getState() )
{
_listview.draw();
return;
return;
}
StackFrameInfo[] array = _stackTyrant.getFrameArray();
@ -113,7 +117,7 @@ public class StackView extends InternalWindow
ListItem newlistitem = new StackViewListItem(drawer);
StackFrameInfo frame = array[i];
String text;
if( frame instanceof JSStackFrameInfo )
@ -161,12 +165,12 @@ public class StackView extends InternalWindow
newlistitem.setData( null );
maxwidth = Math.max( maxwidth, newlistitem.minWidth() );
_listview.addItem( newlistitem );
_listview.addItem( newlistitem );
}
_listview.selectItemAt( _stackTyrant.getCurrentFrameIndex() );
_listview.setBounds(0,0,maxwidth,0);
_listview.sizeToMinSize();
layoutView(0,0);
layoutView(0,0);
}
_listview.draw();
}
@ -203,9 +207,9 @@ public class StackView extends InternalWindow
private ListView _listview;
}
class StackViewListItem extends ListItem
{
public StackViewListItem(StackViewItemDrawer drawer)
@ -232,8 +236,8 @@ class StackViewListItem extends ListItem
private StackViewItemDrawer _drawer;
}
}
class StackViewItemDrawer
{
@ -261,8 +265,8 @@ class StackViewItemDrawer
_ptText = new Point( _width, 0 );
}
public void draw( Graphics g,
Rect boundsRect,
public void draw( Graphics g,
Rect boundsRect,
StackViewListItem item,
boolean isExecPoint )
{
@ -280,7 +284,7 @@ class StackViewItemDrawer
boundsRect.width - _ptText.x,
boundsRect.height - _ptText.y );
item.drawStringInRect(g,text,_font,r,Graphics.LEFT_JUSTIFIED);
item.drawStringInRect(g,text,_font,r,Graphics.LEFT_JUSTIFIED);
}
if( isExecPoint )
{
@ -306,4 +310,4 @@ class StackViewItemDrawer
private int _height;
private Polygon _polyExecPoint;
private Point _ptText;
}
}

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* Window used to give startup status to users (lest they think we're dead)
*/
// when who what
// 11/10/97 jband added this file
//
@ -37,16 +41,16 @@ class StatusWindow
public StatusWindow()
{
super();
setBorder(LineBorder.blackLine());
setCloseable( false );
setResizable( false );
int contentDX = _labelDX + _spacerDX * 2;
int contentDY = _labelDY + _spacerDY * 2;
int labelY = _spacerDY;
int labelX = _spacerDX;
Size size = windowSizeForContentSize(contentDX, contentDY);
setBounds(0,0,size.width,size.height);
@ -73,8 +77,8 @@ class StatusWindow
label.setBorder(null);
return label;
}
private TextField _label;
}
}

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* Interface to handle client-side stepping
*/
// when who what
// 06/27/97 jband added this header to my code
//
@ -30,8 +34,8 @@ interface StepHandler
public static final int CONTINUE_SEND_INTERRUPT = 1;
public static final int CONTINUE_DONE = 2;
public int step( JSThreadState threadState,
JSPC pc,
public int step( JSThreadState threadState,
JSPC pc,
JSSourceLocation sourceLocation,
Hook hook );
}
}

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* Handle stepping into funtions
*/
// when who what
// 06/27/97 jband added this header to my code
//
@ -34,8 +38,8 @@ class StepInto implements StepHandler
}
// implement StepHandler
public int step( JSThreadState threadState,
JSPC pc,
public int step( JSThreadState threadState,
JSPC pc,
JSSourceLocation sourceLocation,
Hook hook )
{
@ -44,7 +48,7 @@ class StepInto implements StepHandler
return STOP;
//
// NOTE: This little dance is necessary because line numbers for PCs
// NOTE: This little dance is necessary because line numbers for PCs
// are not always acending. e,g, in:
//
// for(i=0;i<count;i++)
@ -71,4 +75,4 @@ class StepInto implements StepHandler
private JSSourceLocation _startSourceLocation;
private JSPC _startPC;
}
}

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* Handle stepping out of functions
*/
// when who what
// 06/27/97 jband added this header to my code
//
@ -35,8 +39,8 @@ class StepOut implements StepHandler
}
// implement StepHandler
public int step( JSThreadState threadState,
JSPC pc,
public int step( JSThreadState threadState,
JSPC pc,
JSSourceLocation sourceLocation,
Hook hook )
{
@ -58,4 +62,4 @@ class StepOut implements StepHandler
private CallChain _callChain;
private JSPC _startPC;
}
}

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* Handle stepping over function calls
*/
// when who what
// 06/27/97 jband added this header to my code
//
@ -28,7 +32,7 @@ import com.netscape.jsdebugging.api.*;
class StepOver implements StepHandler
{
public StepOver( JSThreadState startThreadState,
JSSourceLocation startSourceLocation,
JSSourceLocation startSourceLocation,
JSPC startPC )
{
_callChain = new CallChain(startThreadState);
@ -37,8 +41,8 @@ class StepOver implements StepHandler
}
// implement StepHandler
public int step( JSThreadState threadState,
JSPC pc,
public int step( JSThreadState threadState,
JSPC pc,
JSSourceLocation sourceLocation,
Hook hook )
{
@ -72,4 +76,4 @@ class StepOver implements StepHandler
private CallChain _callChain;
private JSSourceLocation _startSourceLocation;
private JSPC _startPC;
}
}

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* Dialog to edit one string
*/
// when who what
// 06/27/97 jband added this header to my code
//
@ -41,42 +45,42 @@ class StringEditorDialog
public StringEditorDialog(String title, String s, Font font)
{
super();
setTitle(title);
setCloseable( false );
setResizable( false );
int contentDX = _editDX + _spacerDX * 2;
int contentDY = _editDY + _spacerDY * 3 + _buttonDY;
int buttonY = _editDY + _spacerDY * 2;
int buttonY = _editDY + _spacerDY * 2;
int buttonX2 = (_editDX + _spacerDX) - _buttonDX;
int buttonX1 = buttonX2 - _spacerDX - _buttonDX;
Size size = windowSizeForContentSize(contentDX, contentDY);
setBounds(0,0,size.width,size.height);
_textfield = new TextField(_spacerDX,_spacerDY,_editDX,_editDY);
_textfield.setStringValue(new String(s));
_textfield.setFont(font);
addSubview(_textfield);
Button button;
button = new Button(buttonX1,buttonY,_buttonDX,_buttonDY);
button.setTitle("OK");
button.setTarget(this);
button.setCommand(OK_CMD);
addSubview(button);
button = new Button(buttonX2,buttonY,_buttonDX,_buttonDY);
button.setTitle("Cancel");
button.setTarget(this);
button.setCommand(CANCEL_CMD);
addSubview(button);
setFocusedView( _textfield );
center();
}
// implement target interface
public void performCommand(String cmd, Object data)
{
@ -89,17 +93,17 @@ class StringEditorDialog
{
hide();
}
}
}
public boolean okPressed() {return _ok;}
public String getString()
public String getString()
{
return null != _textfield ? _textfield.stringValue() : null;
}
private TextField _textfield;
private boolean _ok = false;
private static final String OK_CMD = "OK_CMD";
private static final String CANCEL_CMD = "CANCEL_CMD";
}
}

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* Test code (while developing) - currently for new Value/Props stuff
*/
package com.netscape.jsdebugging.ifcui;
import com.netscape.jsdebugging.api.*;

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* Static util functions...
*/
// when who what
// 06/27/97 jband added this header to my code
//
@ -26,11 +30,6 @@ import java.io.*;
import netscape.application.*;
import netscape.util.*;
/**
* Static util functions...
*/
public class Util
{
public static String expandTabs(String aString, int tabstops)

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* Persistence support for data Watches
*/
// when who what
// 09/25/97 jband created this file
//

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* 'Model' that does data watches
*/
// when who what
// 06/27/97 jband added this header to my code
//
@ -29,7 +33,7 @@ import netscape.util.*;
import com.netscape.jsdebugging.ifcui.palomar.util.*;
public class WatchTyrant
extends Observable
extends Observable
implements Observer, PrefsSupport
{
public WatchTyrant(Emperor emperor)
@ -43,15 +47,15 @@ public class WatchTyrant
if(AS.S)ER.T(null!=_controlTyrant,"emperor init order problem", this);
if(AS.S)ER.T(null!=_consoleTyrant,"emperor init order problem", this);
if(AS.S)ER.T(null!=_stackTyrant,"emperor init order problem", this);
_evalStrings = new Vector();
// test....
// test....
// _evalStrings.addElement( new String( "local" ) );
// _evalStrings.addElement( new String( "ob" ) );
// _evalStrings.addElement( new String( "prop" ) );
// _evalStrings.addElement( new String( "ob[prop]" ) );
_stackTyrant.addObserver(this);
}
@ -62,22 +66,22 @@ public class WatchTyrant
evalList();
}
public Vector getWatchList()
public Vector getWatchList()
{
return _evalStrings;
}
public void addWatchString(String s)
}
public void addWatchString(String s)
{
_evalStrings.addElement(s);
}
public void evalList()
{
if( null != _stackTyrant.getCurrentFrame() )
_evalOurList();
}
private void _evalOurList()
{
int count = _evalStrings.count();
@ -88,7 +92,7 @@ public class WatchTyrant
_consoleTyrant.eval(s);
}
}
// implement PrefsSupport interface
public void prefsWrite(Archiver archiver) throws CodingException
{
@ -102,20 +106,20 @@ public class WatchTyrant
"com.netscape.jsdebugging.ifcui.WatchSaver" );
if( -1 != id )
{
WatchSaver ws = (WatchSaver)
WatchSaver ws = (WatchSaver)
unarchiver.unarchiveIdentifier(id);
ws.sendToTyrant(this);
}
}
// data...
// data...
private Emperor _emperor;
private ControlTyrant _controlTyrant;
private ConsoleTyrant _consoleTyrant;
private StackTyrant _stackTyrant;
private Vector _evalStrings;
}
}

Просмотреть файл

@ -16,6 +16,10 @@
* Reserved.
*/
/*
* 'View' to display and edit list of data watches
*/
// when who what
// 06/27/97 jband added this header to my code
//
@ -29,7 +33,7 @@ import netscape.util.*;
import com.netscape.jsdebugging.ifcui.palomar.util.*;
import com.netscape.jsdebugging.ifcui.palomar.widget.layout.*;
public class WatchView
public class WatchView
extends InternalWindow
implements Observer, Target
{
@ -37,10 +41,10 @@ public class WatchView
private static final int _buttonHeight = 24;
private static final int _buttonYSpace = 5;
private static final int _buttonXSpace = 5;
private int _nextButtonX;
private int _nextButtonY;
public WatchView( Emperor emperor, Rect rect )
{
super(rect);
@ -57,10 +61,10 @@ public class WatchView
Size size = contentSize();
int listwidth = size.width - (_buttonWidth + (_buttonXSpace * 2));
Rect rectSG = new Rect(0, 0, listwidth, size.height);
_nextButtonX = listwidth + _buttonXSpace;
_nextButtonY = _buttonYSpace;
_nextButtonY = _buttonYSpace;
_addButton( "New", NEW_CMD );
_addButton( "Edit", EDIT_CMD);
_addButton( "Move Up", UP_CMD );
@ -69,7 +73,7 @@ public class WatchView
_addButton( "Eval", EVAL_CMD);
_nextButtonY += _buttonYSpace * 2;
_addButton( "Done", DONE_CMD);
ScrollGroup sg = new ScrollGroup(rectSG);
sg.setHorizScrollBarDisplay( ScrollGroup.AS_NEEDED_DISPLAY );
sg.setVertScrollBarDisplay( ScrollGroup.AS_NEEDED_DISPLAY );
@ -77,8 +81,8 @@ public class WatchView
sg.setAutoResizeSubviews(true);
sg.contentView().setLayoutManager( new MarginLayout() );
sg.setBackgroundColor(_emperor.getBackgroundColor());
setCloseable( false );
setCloseable( false );
setResizable( false );
setTitle( "Watches" );
addSubview(sg);
@ -97,10 +101,10 @@ public class WatchView
refresh();
layoutView(1,1);
layoutView(-1,-1);
layoutView(1,1);
layoutView(-1,-1);
}
private Button _addButton( String title, String cmd )
{
Button button = new Button(_nextButtonX,_nextButtonY,
@ -131,7 +135,7 @@ public class WatchView
int index = _listview.selectedIndex();
if( -1 == index )
index = 0;
Vector vec = _watchTyrant.getWatchList();
synchronized( vec )
{
@ -141,7 +145,7 @@ public class WatchView
_listview.selectItemAt(index);
_watchTyrant.evalList();
}
}
}
else if( cmd.equals(EDIT_CMD) )
{
int index = _listview.selectedIndex();
@ -151,11 +155,11 @@ public class WatchView
synchronized( vec )
{
String str = (String) vec.elementAt(index);
StringEditorDialog sed = new StringEditorDialog("Edit Watch",
StringEditorDialog sed = new StringEditorDialog("Edit Watch",
str,
_emperor.getFixedFont());
sed.showModally();
if( sed.okPressed() )
{
vec.setElementAt(sed.getString(),index);
@ -164,7 +168,7 @@ public class WatchView
_watchTyrant.evalList();
}
}
}
}
else if( cmd.equals(UP_CMD ) )
{
int index = _listview.selectedIndex();
@ -178,7 +182,7 @@ public class WatchView
}
refresh();
_watchTyrant.evalList();
}
}
else if( cmd.equals(DOWN_CMD) )
{
int index = _listview.selectedIndex();
@ -192,7 +196,7 @@ public class WatchView
}
refresh();
_watchTyrant.evalList();
}
}
else if( cmd.equals(DEL_CMD ) )
{
int index = _listview.selectedIndex();
@ -205,7 +209,7 @@ public class WatchView
}
refresh();
_watchTyrant.evalList();
}
}
else if( cmd.equals(EVAL_CMD) )
{
_watchTyrant.evalList();
@ -225,9 +229,9 @@ public class WatchView
ListItem selItem = _listview.selectedItem();
if( null != selItem )
selText = selItem.title();
_listview.removeAllItems();
Font linefont = _emperor.getFixedFont();
int maxlinelen = 0;
@ -244,10 +248,10 @@ public class WatchView
item.setFont( linefont );
item.setSelectedColor(_emperor.getSelectionColor());
_listview.addItem( item );
if( 0 == i )
_listview.selectItemAt(i); // make sure SOMETHING selected
if( null != selText && selText.equals(text) )
{
_listview.selectItemAt(i);
@ -259,7 +263,7 @@ public class WatchView
_listview.setBounds( 0, 0, (maxlinelen+1) * fm.charWidth('X'),0 );
_listview.sizeToMinSize();
layoutView(0,0);
layoutView(0,0);
_listview.draw();
}
@ -275,6 +279,6 @@ public class WatchView
private static final String DEL_CMD = "DEL_CMD";
private static final String EVAL_CMD = "EVAL_CMD";
private static final String DONE_CMD = "DONE_CMD";
}
}