public final class DebuggerManager extends Object implements ContextProvider
Session
s,
Breakpoint
s and
Watch
es.
Description | |
Functionality |
Start & finish debugging:
DebuggerManager manages a process of starting a new debugging (
DebuggerManager.startDebugging(org.netbeans.api.debugger.DebuggerInfo) ). It cooperates with all installed
DebuggerEngineProvider s to create a new
Session (or Sessions) and a new
DebuggerEngine (or Engines).
It supports kill all sessions too (DebuggerManager.finishAllSessions() ).
Sessions management: DebuggerManager keeps list of all Session s (DebuggerManager.getSessions() ),
and manages current session (DebuggerManager.getCurrentSession() ,
DebuggerManager.setCurrentSession(org.netbeans.api.debugger.Session) ).
Engine management: DebuggerManager provides current engine ( DebuggerManager.getCurrentEngine() ).
Current engine is derivated from current session. So,
debuggerManager.getCurrentEngine () == debuggerManager.
getCurrentSession.getCurrentEngine ()
should be always true.
Breakpoints management: DebuggerManager keeps list of all shared breakpoints ( DebuggerManager.getBreakpoints() ).
Breakpoint can be added (DebuggerManager.addBreakpoint(org.netbeans.api.debugger.Breakpoint) ) and removed
(DebuggerManager.removeBreakpoint(org.netbeans.api.debugger.Breakpoint) ).
Watches management: DebuggerManager keeps list of all shared watches ( DebuggerManager.getWatches() ).
Watch can be created & added (DebuggerManager.createWatch(java.lang.String) ).
Support for listening: DebuggerManager propagates all changes to two type of listeners - general PropertyChangeListener and specific
DebuggerManagerListener .
|
Clinents / Providers |
DebuggerCore module should be the only one provider of this abstract class.
This class should be called from debugger plug-in modules and from debugger
UI modules.
|
Lifecycle |
The only one instance of DebuggerManager should exist, and it should be
created in DebuggerManager.getDebuggerManager() method.
|
Evolution | No method should be removed from this class, but some functionality can be added. |
Modifier and Type | Field and Description |
---|---|
static String |
PROP_BREAKPOINTS
Name of property for the set of breakpoints in the system.
|
static String |
PROP_BREAKPOINTS_INIT
Name of property for the set of breakpoints in the system.
|
static String |
PROP_CURRENT_ENGINE
Name of property for current debugger engine.
|
static String |
PROP_CURRENT_SESSION
Name of property for current debugger session.
|
static String |
PROP_DEBUGGER_ENGINES
Name of property for set of running debugger engines.
|
static String |
PROP_SESSIONS
Name of property for set of running debugger sessions.
|
static String |
PROP_WATCHES
Name of property for the set of watches in the system.
|
static String |
PROP_WATCHES_INIT
Name of property for the set of watches in the system.
|
Modifier and Type | Method and Description |
---|---|
void |
addBreakpoint(Breakpoint breakpoint)
Adds a new breakpoint.
|
void |
addDebuggerListener(DebuggerManagerListener l)
This listener notificates about changes of breakpoints, watches and threads.
|
void |
addDebuggerListener(String propertyName,
DebuggerManagerListener l)
Add a debuggerManager listener to changes of watches and breakpoints.
|
Watch |
createPinnedWatch(String expr,
Watch.Pin pin)
Create a watch pinned at the specified pin location.
|
Watch |
createWatch(int index,
String expr)
Creates a watch with its expression set to an initial value
and add it at the specific position
|
Watch |
createWatch(String expr)
Creates a watch with its expression set to an initial value.
|
void |
finishAllSessions()
Kills all
Session s and
DebuggerEngine s. |
ActionsManager |
getActionsManager() |
Breakpoint[] |
getBreakpoints()
Gets all registered breakpoints.
|
DebuggerEngine |
getCurrentEngine()
Returns current debugger engine or
null . |
Session |
getCurrentSession()
Returns current debugger session or
null . |
DebuggerEngine[] |
getDebuggerEngines()
Returns set of running debugger engines.
|
static DebuggerManager |
getDebuggerManager()
Returns default instance of DebuggerManager.
|
Session[] |
getSessions()
Returns set of running debugger sessions.
|
Watch[] |
getWatches()
Gets all shared watches in the system.
|
static ContextProvider |
join(ContextProvider cp1,
ContextProvider cp2)
Join two lookups together.
|
<T> List<? extends T> |
lookup(String folder,
Class<T> service)
Returns list of services of given type from given folder.
|
<T> T |
lookupFirst(String folder,
Class<T> service)
Returns one service of given type from given folder.
|
void |
removeAllWatches()
Removes all watches from the system.
|
void |
removeBreakpoint(Breakpoint breakpoint)
Removes breakpoint.
|
void |
removeDebuggerListener(DebuggerManagerListener l)
Removes debugger listener.
|
void |
removeDebuggerListener(String propertyName,
DebuggerManagerListener l)
Remove a debuggerManager listener to changes of watches and breakpoints.
|
void |
reorderWatches(int[] permutation)
Reorders watches with given permutation.
|
void |
setCurrentSession(Session session)
Sets current debugger session.
|
DebuggerEngine[] |
startDebugging(DebuggerInfo info)
Start a new debugging for given
DebuggerInfo . |
public static final String PROP_BREAKPOINTS_INIT
public static final String PROP_BREAKPOINTS
public static final String PROP_CURRENT_ENGINE
public static final String PROP_CURRENT_SESSION
public static final String PROP_SESSIONS
public static final String PROP_DEBUGGER_ENGINES
public static final String PROP_WATCHES
public static final String PROP_WATCHES_INIT
public static DebuggerManager getDebuggerManager()
public ActionsManager getActionsManager()
public <T> List<? extends T> lookup(String folder, Class<T> service)
lookup
in interface ContextProvider
service
- a type of service to look forfolder
- a folder name or nullpublic <T> T lookupFirst(String folder, Class<T> service)
lookupFirst
in interface ContextProvider
service
- a type of service to look forfolder
- a folder name or nullpublic static ContextProvider join(ContextProvider cp1, ContextProvider cp2)
DebuggerManager.lookup
method will additionally implement Customizer
.cp1
- first lookupcp2
- second lookuppublic DebuggerEngine[] startDebugging(DebuggerInfo info)
DebuggerInfo
. DebuggerInfo provides
information needed to start new debugging. DebuggerManager finds
all SessionProvider
s and
DelegatingSessionProvider
s
installed for given DebuggerInfo, and creates a new
Session
(s).
After that it looks for all
DebuggerEngineProvider
s and
DelegatingDebuggerEngineProvider
s
installed for Session, and crates a new
DebuggerEngine
(s).
Cancellable
),
this startup sequence can be canceled via Thread.interrupt() while
startDebugging() method is waiting for the action providers.info
- debugger startup infopublic void finishAllSessions()
Session
s and
DebuggerEngine
s.public Session getCurrentSession()
null
.null
public void setCurrentSession(Session session)
session
- a session to be currentpublic Session[] getSessions()
public DebuggerEngine[] getDebuggerEngines()
public DebuggerEngine getCurrentEngine()
null
.null
public void addBreakpoint(Breakpoint breakpoint)
breakpoint
- a new breakpointpublic void removeBreakpoint(Breakpoint breakpoint)
breakpoint
- a breakpoint to be removedpublic Breakpoint[] getBreakpoints()
public Watch createWatch(String expr)
expr
- expression to watch for (the format is the responsibility
of the debugger plug-in implementation, but it is typically
a variable name).public Watch createWatch(int index, String expr)
index
- the position at which the specified watch is to be insertedexpr
- expression to watch for (the format is the responsibility
of the debugger plug-in implementation, but it is typically
a variable name).ArrayIndexOutOfBoundsException
- if the index is out of range
(index < 0 || index > getWatches().length)
public Watch createPinnedWatch(String expr, Watch.Pin pin)
expr
- expression to watch for (the format is the responsibility
of the debugger plug-in implementation, but it is typically
a variable name).pin
- A pin where the watch should be pinned at.public Watch[] getWatches()
public void removeAllWatches()
public void reorderWatches(int[] permutation) throws IllegalArgumentException
permutation
- The permutation with the length of current watches listIllegalArgumentException
- if the permutation is not valid permutationpublic void addDebuggerListener(DebuggerManagerListener l)
l
- listener object.public void removeDebuggerListener(DebuggerManagerListener l)
l
- listener object.public void addDebuggerListener(String propertyName, DebuggerManagerListener l)
propertyName
- a name of property to listen onl
- the debuggerManager listener to addpublic void removeDebuggerListener(String propertyName, DebuggerManagerListener l)
propertyName
- a name of property to listen onl
- the debuggerManager listener to remove