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 68684 - Rule file not editable
Summary: Rule file not editable
Status: RESOLVED FIXED
Alias: None
Product: contrib
Classification: Unclassified
Component: Jackpot (show other bugs)
Version: 5.x
Hardware: All All
: P3 blocker (vote)
Assignee: _ tball
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-14 19:54 UTC by Jesse Glick
Modified: 2005-11-22 00:28 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 Jesse Glick 2005-11-14 19:54:24 UTC
Using in 051111 on Mustang b60:

	org.netbeans.jackpot [1.1.7 051112]
	org.netbeans.modules.jackpot/1 [1.1.7 051112 @BUILD_NUMBER_SUBST@]
	org.netbeans.modules.jackpot.rules [1.1.4 051112]

[Note unsubstituted token in second module! Delete OIDE-M-I-V from your
manifest.mf...]

1. Jackpot | Command Manager
2. Select Transformers | Remove Unnecessary Casts
3. Open in Editor
4. Try to type anything

-> error in status bar:

"org/netbeans/modules/jackpot/resources/RemoveUnneededCasts.rules cannot be
locked because it is read-only"

Is this intentionally r/o? Seems like it should be editable, at least if you
offer the option to open it in the editor... or if not, should be copiable thru
Command Manager to something that is editable.
Comment 1 _ tball 2005-11-14 20:09:43 UTC
Right, Tim Boudreau wanted to be able to view the built-in rule files, which are
jar resources and thus read-only.  Should I instead copy the rule file resources
during module installation, so they are editable?  

Copying sounds like a nice option -- is a right-click menu action sufficient, or
do you think a button is necessary?
Comment 2 Jesse Glick 2005-11-14 22:22:06 UTC
The customary way to do this kind of thing (used e.g. for templates) is to
declare the standard rules as files in some part of your XML layer, and always
access them via Repository.default.defaultFileSystem (for both reading and
writing). Any edits will be stored in the corresponding location in your user
directory. If you wipe out part or all of your user directory, the corresponding
edits will be reverted as a result. Upgrades to the Jackpot module will change
effectively change only those rule files which have not been edited.
Comment 3 _ tball 2005-11-15 20:23:31 UTC
Okay, I'll add them to the Repository.  Currently I have "JackpotCommand"
instances in a services folder, which are simple beans with command name and the
name of the command (rule or class file) to execute.  Do you think I should
still keep these beans, or replace them with the actual command files?  
Comment 4 Jesse Glick 2005-11-15 21:24:24 UTC
Well it's up to you, but I might suggest just having something like

<folder name="Jackpot">
  <folder n="Transformers">
    <!-- editable, .rules file present in JAR next to layer -->
    <file n="RemoveUnneededCasts.rules" url="RemoveUnneededCasts.rules"/>
    <!-- not editable, impl in code -->
    <file n="o-n-m-jackpot-SpecialTransformer.instance"/>
  </>
</>
Comment 5 _ tball 2005-11-22 00:28:29 UTC
Built-in rule files are now stored as recommended, and so are editable.