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 205798 - API to retrieve a specific action by ID
Summary: API to retrieve a specific action by ID
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Actions (show other bugs)
Version: 7.0
Hardware: All All
: P3 normal (vote)
Assignee: Jesse Glick
URL:
Keywords: API, API_REVIEW_FAST
Depends on: 169338 207003
Blocks: 183794
  Show dependency tree
 
Reported: 2011-12-01 17:58 UTC by Jesse Glick
Modified: 2012-01-07 16:21 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Proposed patch (18.83 KB, patch)
2011-12-28 23:36 UTC, Jesse Glick
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2011-12-01 17:58:44 UTC
Given a known

@ActionID(category=Constants.CATEGORY, id=Constants.ID) ...

it is often useful to load that Action for some sort of programmatic presentation. Currently you need to do

FileUtil.getConfigObject("Actions/" + Constants.CATEGORY + "/" + Constants.ID.replace('.', '-') + ".instance", Action.class)

which is awkward. This should rather be a utility method in Actions.
Comment 1 Jesse Glick 2011-12-28 23:36:40 UTC
Created attachment 114514 [details]
Proposed patch
Comment 2 Jesse Glick 2011-12-28 23:37:25 UTC
Please review.
Comment 3 Jesse Glick 2012-01-06 16:18:31 UTC
Employed the new method in a bunch more places. Also changed it to throw IAE when the corresponding @ActionID would have been rejected during compilation, to defend against likely mistakes such as using '-' as a package separator. core-main #f5e9614e5a7d
Comment 4 Quality Engineering 2012-01-07 16:21:45 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/f5e9614e5a7d
User: Jesse Glick <jglick@netbeans.org>
Log: #205798: API to retrieve a specific action by ID.