本文整理汇总了Java中org.netbeans.api.debugger.DebuggerManager.getDebuggerManager方法的典型用法代码示例。如果您正苦于以下问题:Java DebuggerManager.getDebuggerManager方法的具体用法?Java DebuggerManager.getDebuggerManager怎么用?Java DebuggerManager.getDebuggerManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.netbeans.api.debugger.DebuggerManager
的用法示例。
在下文中一共展示了DebuggerManager.getDebuggerManager方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isEnabled
import org.netbeans.api.debugger.DebuggerManager; //导入方法依赖的package包/类
@Override
public boolean isEnabled (Object node) {
BreakpointGroup bg = (BreakpointGroup) node;
if (bg.getGroup() == BreakpointGroup.Group.CUSTOM) {
String groupName = ((BreakpointGroup)node).getName();
DebuggerManager dm = DebuggerManager.getDebuggerManager ();
Breakpoint[] bs = dm.getBreakpoints ();
int i, k = bs.length;
for (i = 0; i < k; i++) {
if (bs [i].getGroupName ().equals (groupName)) {
if (!bs[i].isEnabled()) {
return true;
}
}
}
} else {
List<Breakpoint> breakpoints = bg.getBreakpoints();
for (Breakpoint b : breakpoints) {
if (!b.isEnabled()) {
return true;
}
}
}
return false;
}
示例2: getShowingBreakpoints
import org.netbeans.api.debugger.DebuggerManager; //导入方法依赖的package包/类
/**
* @return all breakpoints that are not hidden.
*/
private static Breakpoint[] getShowingBreakpoints() {
DebuggerManager dm = DebuggerManager.getDebuggerManager ();
Breakpoint[] bs = dm.getBreakpoints ();
boolean[] visible = new boolean[bs.length];
int n = 0;
for (int i = 0; i < bs.length; i++) {
Breakpoint b = bs[i];
boolean v = isVisible(b);
visible[i] = v;
if (v) {
n++;
}
}
Breakpoint[] visibleBs = new Breakpoint[n];
int vi = 0;
for (int i = 0; i < bs.length; i++) {
if (visible[i]) {
visibleBs[vi++] = bs[i];
}
}
return visibleBs;
}
示例3: actionPerformed
import org.netbeans.api.debugger.DebuggerManager; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
EditorUI eui = Utilities.getEditorUI(editorPane);
Point location = et.getLocation();
location = eui.getStickyWindowSupport().convertPoint(location);
eui.getToolTipSupport().setToolTipVisible(false);
DebuggerManager dbMgr = DebuggerManager.getDebuggerManager();
BaseDocument document = Utilities.getDocument(editorPane);
DataObject dobj = (DataObject) document.getProperty(Document.StreamDescriptionProperty);
FileObject fo = dobj.getPrimaryFile();
Watch.Pin pin = new EditorPin(fo, pinnable.line, location);
final Watch w = dbMgr.createPinnedWatch(pinnable.expression, pin);
SwingUtilities.invokeLater(() -> {
try {
PinWatchUISupport.getDefault().pin(w, pinnable.valueProviderId);
} catch (IllegalArgumentException ex) {
Exceptions.printStackTrace(ex);
}
});
}
示例4: doAction
import org.netbeans.api.debugger.DebuggerManager; //导入方法依赖的package包/类
@Override
public void doAction(Object action) {
Line line = JSUtils.getCurrentLine();
if (line == null) {
return ;
}
DebuggerManager d = DebuggerManager.getDebuggerManager();
boolean add = true;
for (Breakpoint breakpoint : d.getBreakpoints()) {
if (breakpoint instanceof JSLineBreakpoint &&
JSUtils.getLine((JSLineBreakpoint) breakpoint).equals(line)) {
d.removeBreakpoint(breakpoint);
add = false;
break;
}
}
if (add) {
d.addBreakpoint(JSUtils.createLineBreakpoint(line));
}
}
示例5: purge
import org.netbeans.api.debugger.DebuggerManager; //导入方法依赖的package包/类
/**
* Remove all breakpoints that have properties specified by this manager.
*
* @return number of breakpoints that were removed
*/
public synchronized int purge() {
DebuggerManager debuggerManager = DebuggerManager.getDebuggerManager();
int removedBreakpoints = 0;
for (Breakpoint bp : debuggerManager.getBreakpoints()) {
if (bp instanceof MethodBreakpoint) {
MethodBreakpoint testedBreakpoint = (MethodBreakpoint) bp;
if (isQualified(testedBreakpoint)) {
debuggerManager.removeBreakpoint(testedBreakpoint);
++removedBreakpoints;
}
}
}
// the breakpoint has been deleted in the loop
methodBreakpoint = null;
return removedBreakpoints;
}
示例6: changeSession
import org.netbeans.api.debugger.DebuggerManager; //导入方法依赖的package包/类
private void changeSession(SessionItem si) {
if (si != null) {
Session ses = si.getSession();
DebuggerManager dm = DebuggerManager.getDebuggerManager();
if (ses != null && ses != dm.getCurrentSession()) {
dm.setCurrentSession(ses);
}
}
}
示例7: actionPerformed
import org.netbeans.api.debugger.DebuggerManager; //导入方法依赖的package包/类
@Override
public void actionPerformed (ActionEvent e) {
DebuggerManager dm = DebuggerManager.getDebuggerManager ();
Breakpoint[] bs = getShowingBreakpoints();
int i, k = bs.length;
for (i = 0; i < k; i++) {
dm.removeBreakpoint (bs [i]);
}
}
示例8: actionPerformed
import org.netbeans.api.debugger.DebuggerManager; //导入方法依赖的package包/类
public void actionPerformed (ActionEvent e) {
DebuggerManager dm = DebuggerManager.getDebuggerManager ();
if (dm.lookup (null, BreakpointType.class).size () == 0)
return; // no breakpoint events...
// create Add Breakpoint Dialog for it
AddBreakpointDialogManager abdm = abdmRef != null ? abdmRef.get() : null;
if (abdm == null) {
abdm = new AddBreakpointDialogManager ();
abdmRef = new WeakReference<AddBreakpointDialogManager>(abdm);
}
abdm.getDialog ().setVisible (true);
}
示例9: refreshValueProviders
import org.netbeans.api.debugger.DebuggerManager; //导入方法依赖的package包/类
private void refreshValueProviders() {
DebuggerManager dm = DebuggerManager.getDebuggerManager ();
DebuggerEngine e = dm.getCurrentEngine ();
List<? extends ValueProvider> providers;
if (e == null) {
providers = dm.lookup (null, ValueProvider.class);
} else {
providers = DebuggerManager.join(e, dm).lookup (null, ValueProvider.class);
}
if (!providers.isEmpty()) {
synchronized (valueProvidersLock) {
if (valueProviders == null) {
valueProviders = new HashMap<>();
}
Set<String> existingProviderIds = new HashSet<>();
for (ValueProvider provider : providers) {
String id = provider.getId();
existingProviderIds.add(id);
DelegatingValueProvider dvp = valueProviders.get(id);
if (dvp == null) {
dvp = new DelegatingValueProvider(id);
valueProviders.put(id, dvp);
}
dvp.setDelegate(provider);
}
Set<String> staleProviderIds = new HashSet<>(valueProviders.keySet());
staleProviderIds.removeAll(existingProviderIds);
for (String staleId : staleProviderIds) {
valueProviders.get(staleId).setDelegate(null);
}
}
}
}
示例10: findUnique
import org.netbeans.api.debugger.DebuggerManager; //导入方法依赖的package包/类
static String findUnique (String sessionName) {
DebuggerManager cd = DebuggerManager.getDebuggerManager ();
Session[] ds = cd.getSessions ();
// 1) finds all already used indexes and puts them to HashSet
int i, k = ds.length;
HashSet<Integer> m = new HashSet<Integer>();
for (i = 0; i < k; i++) {
String pn = ds [i].getName ();
if (!pn.startsWith (sessionName)) continue;
if (pn.equals (sessionName)) {
m.add (Integer.valueOf(0));
continue;
}
try {
int t = Integer.parseInt (pn.substring (sessionName.length ()));
m.add (Integer.valueOf(t));
} catch (Exception e) {
}
}
// 2) finds first unused index in m
k = m.size ();
for (i = 0; i < k; i++)
if (!m.contains (Integer.valueOf(i)))
break;
if (i > 0) sessionName = sessionName + i;
return sessionName;
}
示例11: doMakeCurrent
import org.netbeans.api.debugger.DebuggerManager; //导入方法依赖的package包/类
private void doMakeCurrent() {
debugger.setCurrentThread (this);
Session session = debugger.getSession();
DebuggerManager manager = DebuggerManager.getDebuggerManager();
if (session != manager.getCurrentSession()) {
manager.setCurrentSession(session);
}
}
示例12: testBreakpointUnambiguity2
import org.netbeans.api.debugger.DebuggerManager; //导入方法依赖的package包/类
/**
* Tests debugger's ability to make difference between different projects
* with the same classes while getting the locations during class-loaded event.
*
* 1. The user creates 2 classes: ${test.dir.src}/.../LineBreakpointApp.java
* and ${test.dir.src_2}/.../LineBreakpointApp.java
* 2. Then set a breakpoint in ${test.dir.src_2}/.../LineBreakpointApp.java.
*
* Debugger should stop _only_ in the second project. If debugger stopped in
* the first one, then assertion violation would arise because of source path
* equality test.
*/
public void testBreakpointUnambiguity2 () throws Exception {
try {
Utils.BreakPositions bp = Utils.getBreakPositions(System.getProperty ("test.dir.src") +
"org/netbeans/api/debugger/jpda/testapps/LineBreakpointApp.java");
LineBreakpoint lb1 = LineBreakpoint.create(
Utils.getURL(System.getProperty ("user.home") + // intentionally bad path
java.io.File.separator +
"org/netbeans/api/debugger/jpda/testapps/LineBreakpointApp.java"), bp.getStopLine("condition1"));
//lb1.setSourceRoot(System.getProperty ("test.dir.src") + "_2");
DebuggerManager dm = DebuggerManager.getDebuggerManager ();
dm.addBreakpoint (lb1);
TestBreakpointListener tb1 = new TestBreakpointListener (lb1);
lb1.addJPDABreakpointListener (tb1);
support = JPDASupport.attach (
"org.netbeans.api.debugger.jpda.testapps.LineBreakpointApp"
);
JPDADebugger debugger = support.getDebugger();
support.waitState (JPDADebugger.STATE_STOPPED); // Stopped or disconnected
assertEquals(
"Debugger should not stop on BP with faked source root",
debugger.getState(),
JPDADebugger.STATE_DISCONNECTED
);
tb1.checkNotNotified();
dm.removeBreakpoint (lb1);
} finally {
if (support != null) support.doFinish ();
}
}
示例13: testBreakpointUnambiguity
import org.netbeans.api.debugger.DebuggerManager; //导入方法依赖的package包/类
/**
* Tests debugger's ability to make difference between different JSP pages
* with the same name while getting the locations during class-loaded event.
*
* 1. The user creates JSP (index.jsp, include.jsp, d/include.jsp) and
* 2. statically includes d/include.jsp (as 1st) and include.jsp (as 2nd) into index.jsp.
* 3. Then bp is set in include.jsp (line 2).
*
* Debugger should stop _only_ in the include.jsp. If debugger stopped in the first JSP
* (d/include.jsp), then assertion violation would arise because of source path
* equality test.
*/
public void testBreakpointUnambiguity () throws Exception {
try {
//install SDE extension to class file
runSDEInstaller(testAppCLAZ, testAppSMAP);
//String URL = getClass().getResource("testapps/resources/included.jsp").toString();
String URL = "file:"+SRC_ROOT+"/org/netbeans/api/debugger/jpda/testapps/resources/included.jsp";
LineBreakpoint lb = LineBreakpoint.create(URL, LINE_NUMBER);
lb.setStratum(STRATUM); // NOI18N
lb.setSourceName(SOURCE_NAME);
lb.setSourcePath(SOURCE_PATH_SECOND);
lb.setPreferredClassName(CLASS_NAME);
DebuggerManager dm = DebuggerManager.getDebuggerManager ();
dm.addBreakpoint (lb);
support = JPDASupport.attach (
"org.netbeans.api.debugger.jpda.testapps.JspLineBreakpointApp"
);
JPDADebugger debugger = support.getDebugger();
support.waitState (JPDADebugger.STATE_STOPPED); // breakpoint hit
assertNotNull(debugger.getCurrentCallStackFrame());
assertEquals(
"Debugger stopped at wrong file",
lb.getSourcePath(),
debugger.getCurrentCallStackFrame().getSourcePath(STRATUM)
);
dm.removeBreakpoint (lb);
} finally {
if (support != null) support.doFinish ();
}
}
示例14: testBreakpointRepeatability
import org.netbeans.api.debugger.DebuggerManager; //导入方法依赖的package包/类
/**
* Tests debugger's ability to stop in one JSP as many times as this JSP
* is included in another page.
*
* 1. The user creates JSP (index.jsp, include.jsp) and
* 2. statically includes include.jsp twice into index.jsp.
* 3. Then bp is set in include.jsp (line 2).
*
* Debugger should stop twice in the include.jsp. If debugger didn't stopped
* in the include.jsp for the second time, then assertion violation would arise
* because of testing debugger's state for STOP state.
*/
public void testBreakpointRepeatability () throws Exception {
try {
//install SDE extension to class file
runSDEInstaller(testAppCLAZ, testAppSMAP);
//String URL = getClass().getResource("testapps/resources/included.jsp").toString();
String URL = "file:"+SRC_ROOT+"/org/netbeans/api/debugger/jpda/testapps/resources/included.jsp";
LineBreakpoint lb = LineBreakpoint.create(URL, LINE_NUMBER);
lb.setStratum(STRATUM); // NOI18N
lb.setSourceName(SOURCE_NAME);
lb.setSourcePath(SOURCE_PATH_SECOND);
lb.setPreferredClassName(CLASS_NAME);
DebuggerManager dm = DebuggerManager.getDebuggerManager ();
dm.addBreakpoint (lb);
support = JPDASupport.attach (
"org.netbeans.api.debugger.jpda.testapps.JspLineBreakpointApp"
);
JPDADebugger debugger = support.getDebugger();
support.waitState (JPDADebugger.STATE_STOPPED); // first breakpoint hit
support.doContinue ();
support.waitState (JPDADebugger.STATE_STOPPED); // second breakpoint hit
assertTrue(
"Debugger did not stop at breakpoint for the second time.",
debugger.getState() == JPDADebugger.STATE_STOPPED
);
dm.removeBreakpoint (lb);
} finally {
if (support != null) support.doFinish ();
}
}
示例15: propertyChange
import org.netbeans.api.debugger.DebuggerManager; //导入方法依赖的package包/类
@Override
public void propertyChange(PropertyChangeEvent evt) {
String propertyName = evt.getPropertyName ();
if (propertyName == null) {
return;
}
if (DebuggerManager.PROP_CURRENT_ENGINE.equals(propertyName)) {
setCurrentDebugger(DebuggerManager.getDebuggerManager().getCurrentEngine());
}
if (JPDADebugger.PROP_BREAKPOINTS_ACTIVE.equals(propertyName)) {
JPDADebugger debugger = currentDebugger;
if (debugger != null) {
getAnnotationProvider().setBreakpointsActive(debugger.getBreakpointsActive());
}
}
if ( (!JPDABreakpoint.PROP_ENABLED.equals (propertyName)) &&
(!JPDABreakpoint.PROP_VALIDITY.equals (propertyName)) &&
(!LineBreakpoint.PROP_CONDITION.equals (propertyName)) &&
(!LineBreakpoint.PROP_URL.equals (propertyName)) &&
(!LineBreakpoint.PROP_LINE_NUMBER.equals (propertyName)) &&
(!FieldBreakpoint.PROP_CLASS_NAME.equals (propertyName)) &&
(!FieldBreakpoint.PROP_FIELD_NAME.equals (propertyName)) &&
(!MethodBreakpoint.PROP_CLASS_FILTERS.equals (propertyName)) &&
(!MethodBreakpoint.PROP_CLASS_EXCLUSION_FILTERS.equals (propertyName)) &&
(!MethodBreakpoint.PROP_METHOD_NAME.equals (propertyName)) &&
(!MethodBreakpoint.PROP_METHOD_SIGNATURE.equals (propertyName))
) {
return;
}
JPDABreakpoint b = (JPDABreakpoint) evt.getSource ();
DebuggerManager manager = DebuggerManager.getDebuggerManager();
Breakpoint[] bkpts = manager.getBreakpoints();
boolean found = false;
for (int x = 0; x < bkpts.length; x++) {
if (b == bkpts[x]) {
found = true;
break;
}
}
if (!found) {
// breakpoint has been removed
return;
}
getAnnotationProvider().postAnnotationRefresh(b, true, true);
}