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 116563 - Adding extension to Ruby source causes havoc
Summary: Adding extension to Ruby source causes havoc
Status: RESOLVED FIXED
Alias: None
Product: ruby
Classification: Unclassified
Component: Editing (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Erno Mononen
URL:
Keywords:
: 118426 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-09-24 19:05 UTC by neilgalarneau
Modified: 2009-04-23 13:17 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
NPE.txt (3.10 KB, text/plain)
2007-09-25 14:28 UTC, Martin Krauskopf
Details

Note You need to log in before you can comment on or make changes to this bug.
Description neilgalarneau 2007-09-24 19:05:03 UTC
I have a Ruby project with .rb files, jars, and a file "first.cs". "first.cs" is a ruby file with a different extension
and I want NB to let me edit it as ruby.

I added cs as an extension to the "Source files for Ruby" Object Type, but that caused "first.cs" to disappear from the
project list.

I tried restarting NB, but that just made the project list disappear entirely.

I assume that exceptions are being thrown somewhere, but I can't find where.
Comment 1 Martin Krauskopf 2007-09-25 14:16:33 UTC
First of all I get the attached NPE from GsfDataNode (after I add the extension). Also when I tried to open a .cs file
directly (File -> Open File). I think this exception was already reported somewhere but could not find it now.
Comment 2 Martin Krauskopf 2007-09-25 14:28:36 UTC
Created attachment 49463 [details]
NPE.txt
Comment 3 Torbjorn Norbye 2007-10-05 17:36:45 UTC
Sorry, I can't fix this for 6.0. I've looked into several possibilities, but there's no easy way to fix it.

The root problem is that there's no GUI editor allowing you to customize the mime type resolvers (which map files to
mime tpes). There -is- a way to edit the extension list for an object type, but I can't use that because the object type
implementation is a shared object type used for several completely different file types internally (Ruby, RHTML, JavaFX,
...) so by just adding a file extension there I still don't know if it's for example Ruby or RHTML. I can't even just
pick one because a lot of the code downstream depends on looking at a file and asking what language it is
(ruby/rhtml/etc.) and if it's not a recognized file, ignoring it. If I simply were to pick a random one, the code
indexer for example would start trying to parse unrelated files.


Downgrading to P3 since we're trying to fix all P2s for 6.0.

Perhaps we can add an extra module on the update center where the module adds extra ruby file extensions through some
kind of user interaction in the options panel? Ideally this would be an IDE-wide feature, not something hacked together
for Ruby.
Comment 4 Torbjorn Norbye 2007-10-10 19:05:51 UTC
*** Issue 118426 has been marked as a duplicate of this issue. ***
Comment 5 Martin Krauskopf 2008-04-01 08:17:27 UTC
Tor are you planning to fix this one now, after code-freeze, in trunk. I think this might become real problem - it is
problem for other file-types (whose modules are based on top of GSF) as well, right?
Comment 6 Torbjorn Norbye 2008-04-01 19:20:08 UTC
No, I cannot fix it -- the FileObject.getMIMEType() must be right, which doesn't happen just because you recognize a
file by a DataLoader. (GSF and lots of editing services and layer file registrations are based on mime types).

Right now, adding an extension is very hidden anyway, it's in the old options property sheet.

What we need is a user-configurable mime type resolver. It lets users associate additional file extensions for various
mime types.  If we had that, users could add whatever file extension they want to associate it with the Ruby mimetype,
and everything should work correctly.

The key thing about this user-configurable mime type resolver is obviously having an options panel which lets you select
a filetype (=mimetype, but use the existing mime resolver's display name which by convention would be something like
"Ruby files" or "Java"), and then in the right hand panel add additional mimetypes. 

This sounds like a good idea for an update center module to begin with, and should be easy to write. There's just too
many things to do!
Comment 7 Erno Mononen 2009-04-23 13:17:04 UTC
This is possible now, Options -> Misc -> Files