This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 99410 - [DEBUGGER] Unable to set breakpoint in java if ruby debugger session is running
Summary: [DEBUGGER] Unable to set breakpoint in java if ruby debugger session is running
Status: VERIFIED FIXED
Alias: None
Product: ruby
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Martin Krauskopf
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-03-29 16:48 UTC by Tomas Danek
Modified: 2007-09-14 14:47 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tomas Danek 2007-03-29 16:51:51 UTC
NetBeans IDE Dev (Build 070327)
1.6.0-rc; Java HotSpot(TM) Client VM 1.6.0-rc-b99
Windows XP version 5.1 running on x86
en_US (nb); Cp1252
+ fresh ruby1 cluster
---------------------------------------------------
- have 2 projects; ruby and java
- start some ruby debugging session
- try to add breakpoint in java file from java project- it does not work.
- vice versa it works
Comment 1 Martin Krauskopf 2007-04-16 17:57:31 UTC
Might be that Java debugger is checking whether the active session is Java
debugger session. When you switch back to the Java session you can set
breakpoints in Java files. Actually I'm not sure what behavior is better. But
it's probably by design in Java debugger? Ruby debugger allow you to set
breakpoints only in Ruby source. Reassigning for evaluation. Probably to be
closed? Feel free to reassign back if you think it is oddity in the Ruby
debugger. Thanks.
Comment 2 Martin Entlicher 2007-05-11 15:23:26 UTC
This is not by design, it should work.
E.g. you can add Java breakpoints while ANT debugger session is running and
vice-versa.
I'll check what can be wrong...
Comment 3 Martin Entlicher 2007-05-16 12:25:46 UTC
It's a bug of the ruby debugger.
Specifically
org.netbeans.modules.ruby.debugger.breakpoints.RubyBreakpointActionProvider
returns isEnabed() true even when a Java file is selected. Therefore we call
doAction() on it. But it does nothing. This is why the breakpoint is not added
in Java files.
It should return isEnabled() false when it can not submit the breakpoint.
Comment 4 Martin Krauskopf 2007-05-16 12:28:45 UTC
Thanks for the help Martine.
Comment 5 Martin Krauskopf 2007-05-16 13:30:26 UTC
Martine, what is the right way to fix this. Obviously I would override
ActionsProviderSupport.isEnabled(Object action). But I've took a look into
AntBreakpointActionProvider for an inspiration and it uses quite unintuitive
approach. Listening on TopComponents:

  TopComponent.getRegistry().addPropertyChangeListener(
    WeakListeners.propertyChange(this, TopComponent.getRegistry()));

and then doing enable/disable work in propertyChange(). Strange "Debugger API".
I know, probably you just inherited it ;)

But anyway, what is the right way. I would go rather overriding the isEnabled()
But there might be some reason why I should not (performance?)?
Comment 6 Martin Entlicher 2007-05-16 15:14:24 UTC
I know that this looks strange. This approach is necessary if the action is e.g.
in a toolbar or in some other visible place and should actively enable/disable
it's state. The query for isEnabled() is fast then.
But if you do not need the enable/disable events, you can just overrid
isEnabled(). In this case it should be sufficient.

I would like to review the JPDA and ANT debugger actions at some point and
adjust the behavior so that it would not clutter the IDE with too many listeners.
Comment 7 Martin Krauskopf 2007-05-16 17:24:44 UTC
Went with the Ant debugger way.

RubyBreakpointActionProvider.java;
new revision: 1.6; previous revision: 1.5
Comment 8 Jiri Kovalsky 2007-07-03 14:14:15 UTC
Reassigning this issue to newly created 'ruby' component.
Comment 9 Jiri Kovalsky 2007-07-03 14:44:48 UTC
Changing target milestone of all resolved Ruby issues from TBD to 6.0 Beta 1 build.
Comment 10 Tomas Danek 2007-09-14 14:47:19 UTC
verified in 20070914