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 74317

Summary: Get rid of references to Java file extensions
Product: debugger Reporter: Martin Entlicher <mentlicher>
Component: JavaAssignee: Martin Entlicher <mentlicher>
Status: NEW ---    
Severity: blocker CC: chihinko, herbertc, ivan, tor
Priority: P1    
Version: 5.x   
Hardware: All   
OS: All   
Issue Type: TASK Exception Reporter:
Attachments: Possible implementation to resolve the issue with ToggleBreakpoint action

Description Martin Entlicher 2006-04-03 15:49:31 UTC
There are checks for .java file extensions at several places in debuggerjpda
module. This is causing problems when other languages that compile to class
files are to be debugged. Therefore we should not reference .java extensions
explicitely.

Usages of ".java":
debuggerjpda/ant/antsrc/org/netbeans/modules/debugger/jpda/ant/JPDAReload.java
(-this might be O.K.)
debuggerjpda/ant/src/org/netbeans/modules/debugger/projects/RunToCursorActionProvider.java
debuggerjpda/src/org/netbeans/modules/debugger/jpda/EditorContextBridge.java
debuggerjpda/src/org/netbeans/modules/debugger/jpda/SourcePath.java
debuggerjpda/ui/src/org/netbeans/modules/debugger/jpda/ui/actions/RunIntoMethodActionProvider.java
debuggerjpda/ui/src/org/netbeans/modules/debugger/jpda/ui/actions/RunToCursorActionProvider.java
debuggerjpda/ui/src/org/netbeans/modules/debugger/jpda/ui/actions/ToggleBreakpointActionProvider.java
debuggerjpda/ui/src/org/netbeans/modules/debugger/jpda/ui/EditorContextBridge.java
debuggerjpda/ui/src/org/netbeans/modules/debugger/jpda/ui/SourcePath.java
Comment 1 Torbjorn Norbye 2006-06-16 02:23:51 UTC
The behavior in ToggleBreakPointProvider is blocking our non-Java (but Java
VM-language) debugger from being usable.
Comment 2 Torbjorn Norbye 2006-08-18 18:48:53 UTC
I thought I would make a patch for this to hopefully speed up the resolution of
this issue.

When I looked at it, I discovered that it's difficult from within the
ActionProvider to get a handle on the Document corresponding to the current
editor, since the context API doesn't provide it.

Furthermore, I realized that it's not ideal to assume that whoever owns the
DataObject will know whether or not the data type is debuggable.

It seems much better if a module can independently register knowledge about
whether a particular file type is debuggable (or more specifically,
breakpointable) or not.

Thus, one way to fix this is for the ToggleBreakpointAction to be changed from
looking at the particular MIME type, and hardcode checking it against
text/x-java, to look up in the layer filesystem and check whether the given MIME
type is known to be debuggable.

The attached patch will do that.

The debuggerjpda module will first register in Debugging/Breakpoints/text/x-java
that the text/x-java MIME type is known to be debuggable.  Then, the Toggle
action will instead of doing an equals comparison on text/x-java, simply look in
the SystemFileSystem and check whether the current MIME type is in the
Breakpoints folder.  Obviously, rather than just check the existence of a folder
you could use more fancy lookup here, or actually look up a specific instance
which could be queried (if more dynamic determination of debuggability needs to
be made).

But this simple change at least removes this barrier to non-Java VM languages.
With this change I can register my own MIME type and everything seems to be
working smoothly (well, once I implemented the org.openide.src API too.... is
that going to be replaced soon?)
Comment 3 Torbjorn Norbye 2006-08-18 18:50:41 UTC
Created attachment 33076 [details]
Possible implementation to resolve the issue with ToggleBreakpoint action
Comment 4 Torbjorn Norbye 2006-08-18 18:51:41 UTC
I'll look at the other actions with hardcoded java references (such as
RunToCursorActionProvider) pending your thoughts on this idea.
Comment 5 Peter Pis 2008-04-10 22:53:14 UTC
Changing TM for open issues.