Lines 13-19
Link Here
|
13 |
* "Portions Copyrighted [year] [name of copyright owner]" |
13 |
* "Portions Copyrighted [year] [name of copyright owner]" |
14 |
* |
14 |
* |
15 |
* The Original Software is NetBeans. The Initial Developer of the Original |
15 |
* The Original Software is NetBeans. The Initial Developer of the Original |
16 |
* Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun |
16 |
* Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun |
17 |
* Microsystems, Inc. All Rights Reserved. |
17 |
* Microsystems, Inc. All Rights Reserved. |
18 |
*/ |
18 |
*/ |
19 |
|
19 |
|
Lines 38-43
Link Here
|
38 |
import com.sun.jdi.request.EventRequestManager; |
38 |
import com.sun.jdi.request.EventRequestManager; |
39 |
import com.sun.jdi.request.InvalidRequestStateException; |
39 |
import com.sun.jdi.request.InvalidRequestStateException; |
40 |
|
40 |
|
|
|
41 |
import java.beans.PropertyChangeEvent; |
41 |
import java.beans.PropertyChangeListener; |
42 |
import java.beans.PropertyChangeListener; |
42 |
import java.beans.PropertyChangeSupport; |
43 |
import java.beans.PropertyChangeSupport; |
43 |
import java.util.ArrayList; |
44 |
import java.util.ArrayList; |
Lines 471-476
Link Here
|
471 |
updateCurrentCallStackFrame (thread); |
472 |
updateCurrentCallStackFrame (thread); |
472 |
} |
473 |
} |
473 |
|
474 |
|
|
|
475 |
/** |
476 |
* Set the current thread and call stack, but do not fire changes. |
477 |
* @return The PropertyChangeEvent associated with this change, it can have |
478 |
* attached other PropertyChangeEvents as a propagation ID. |
479 |
*/ |
480 |
private PropertyChangeEvent setCurrentThreadNoFire(JPDAThread thread) { |
481 |
Object oldT = currentThread; |
482 |
currentThread = (JPDAThreadImpl) thread; |
483 |
PropertyChangeEvent evt = null; |
484 |
if (thread != oldT) |
485 |
evt = new PropertyChangeEvent(this, PROP_CURRENT_THREAD, oldT, currentThread); |
486 |
PropertyChangeEvent evt2 = updateCurrentCallStackFrameNoFire(thread); |
487 |
if (evt == null) evt = evt2; |
488 |
else if (evt2 != null) evt.setPropagationId(evt2); |
489 |
return evt; |
490 |
} |
491 |
|
474 |
public void setCurrentCallStackFrame (CallStackFrame callStackFrame) { |
492 |
public void setCurrentCallStackFrame (CallStackFrame callStackFrame) { |
475 |
CallStackFrame old = setCurrentCallStackFrameNoFire(callStackFrame); |
493 |
CallStackFrame old = setCurrentCallStackFrameNoFire(callStackFrame); |
476 |
if (old == callStackFrame) return ; |
494 |
if (old == callStackFrame) return ; |
Lines 797-809
Link Here
|
797 |
* Performs stop action. |
815 |
* Performs stop action. |
798 |
*/ |
816 |
*/ |
799 |
public void setStoppedState (ThreadReference thread) { |
817 |
public void setStoppedState (ThreadReference thread) { |
|
|
818 |
PropertyChangeEvent evt; |
800 |
synchronized (LOCK) { |
819 |
synchronized (LOCK) { |
801 |
// this method can be called in stopped state to switch |
820 |
// this method can be called in stopped state to switch |
802 |
// the current thread only |
821 |
// the current thread only |
803 |
JPDAThread t = getThread (thread); |
822 |
JPDAThread t = getThread (thread); |
804 |
checkJSR45Languages (t); |
823 |
checkJSR45Languages (t); |
805 |
setCurrentThread (t); |
824 |
evt = setCurrentThreadNoFire(t); |
806 |
setState (STATE_STOPPED); |
825 |
PropertyChangeEvent evt2 = setStateNoFire(STATE_STOPPED); |
|
|
826 |
|
827 |
if (evt == null) evt = evt2; |
828 |
else if (evt2 != null) { |
829 |
PropertyChangeEvent evt3 = evt; |
830 |
while(evt3.getPropagationId() != null) evt3 = (PropertyChangeEvent) evt3.getPropagationId(); |
831 |
evt3.setPropagationId(evt2); |
832 |
} |
833 |
} |
834 |
if (evt != null) { |
835 |
do { |
836 |
firePropertyChange(evt); |
837 |
evt = (PropertyChangeEvent) evt.getPropagationId(); |
838 |
} while (evt != null); |
807 |
} |
839 |
} |
808 |
} |
840 |
} |
809 |
|
841 |
|
Lines 963-988
Link Here
|
963 |
} |
995 |
} |
964 |
} |
996 |
} |
965 |
|
997 |
|
966 |
private void setState (int state) { |
998 |
private PropertyChangeEvent setStateNoFire (int state) { |
967 |
if (state == this.state) return; |
999 |
if (state == this.state) return null; |
968 |
int o = this.state; |
1000 |
int o = this.state; |
969 |
this.state = state; |
1001 |
this.state = state; |
970 |
firePropertyChange (PROP_STATE, new Integer (o), new Integer (state)); |
|
|
971 |
|
972 |
//PENDING HACK see issue 46287 |
1002 |
//PENDING HACK see issue 46287 |
973 |
System.setProperty( |
1003 |
System.setProperty( |
974 |
"org.openide.awt.SwingBrowserImpl.do-not-block-awt", |
1004 |
"org.openide.awt.SwingBrowserImpl.do-not-block-awt", |
975 |
String.valueOf (state != STATE_DISCONNECTED) |
1005 |
String.valueOf (state != STATE_DISCONNECTED) |
976 |
); |
1006 |
); |
|
|
1007 |
return new PropertyChangeEvent(this, PROP_STATE, new Integer (o), new Integer (state)); |
1008 |
} |
1009 |
|
1010 |
private void setState (int state) { |
1011 |
PropertyChangeEvent evt = setStateNoFire(state); |
1012 |
if (evt != null) { |
1013 |
firePropertyChange(evt); |
1014 |
} |
977 |
} |
1015 |
} |
978 |
|
1016 |
|
979 |
/** |
1017 |
/** |
980 |
* Fires property change. |
1018 |
* Fires property change. |
981 |
*/ |
1019 |
*/ |
982 |
private void firePropertyChange (String name, Object o, Object n) { |
1020 |
private void firePropertyChange (String name, Object o, Object n) { |
983 |
pcs.firePropertyChange (name, o, n); |
1021 |
pcs.firePropertyChange (name, o, n); |
984 |
} |
1022 |
} |
985 |
|
1023 |
|
|
|
1024 |
/** |
1025 |
* Fires property change. |
1026 |
*/ |
1027 |
private void firePropertyChange (PropertyChangeEvent evt) { |
1028 |
pcs.firePropertyChange (evt); |
1029 |
} |
1030 |
|
986 |
private SourcePath engineContext; |
1031 |
private SourcePath engineContext; |
987 |
public synchronized SourcePath getEngineContext () { |
1032 |
public synchronized SourcePath getEngineContext () { |
988 |
if (engineContext == null) |
1033 |
if (engineContext == null) |
Lines 1027-1032
Link Here
|
1027 |
} catch (AbsentInformationException e) { |
1072 |
} catch (AbsentInformationException e) { |
1028 |
setCurrentCallStackFrame (null); |
1073 |
setCurrentCallStackFrame (null); |
1029 |
} |
1074 |
} |
|
|
1075 |
} |
1076 |
|
1077 |
/** |
1078 |
* @param thread The thread to take the top frame from |
1079 |
* @return A PropertyChangeEvent or <code>null</code>. |
1080 |
*/ |
1081 |
private PropertyChangeEvent updateCurrentCallStackFrameNoFire(JPDAThread thread) { |
1082 |
CallStackFrame old; |
1083 |
CallStackFrame callStackFrame; |
1084 |
if ( (thread == null) || |
1085 |
(thread.getStackDepth () < 1)) |
1086 |
old = setCurrentCallStackFrameNoFire(callStackFrame = null); |
1087 |
else |
1088 |
try { |
1089 |
old = setCurrentCallStackFrameNoFire(callStackFrame = thread.getCallStack (0, 1) [0]); |
1090 |
} catch (AbsentInformationException e) { |
1091 |
old = setCurrentCallStackFrameNoFire(callStackFrame = null); |
1092 |
} |
1093 |
if (old == callStackFrame) return null; |
1094 |
else return new PropertyChangeEvent(this, PROP_CURRENT_CALL_STACK_FRAME, |
1095 |
old, callStackFrame); |
1030 |
} |
1096 |
} |
1031 |
|
1097 |
|
1032 |
private List disableAllBreakpoints () { |
1098 |
private List disableAllBreakpoints () { |