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 236400 - Replace Cookies by interfaces in all CookieActions
Summary: Replace Cookies by interfaces in all CookieActions
Status: NEW
Alias: None
Product: platform
Classification: Unclassified
Component: Actions (show other bugs)
Version: 7.3.1
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Jan Peska
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-26 06:49 UTC by jmborer
Modified: 2013-09-26 07:02 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jmborer 2013-09-26 06:49:53 UTC

    
Comment 1 jmborer 2013-09-26 07:02:03 UTC
It is recommended to switch from Cookies to interfaces i.e. use Openable instead of OpenCookie. Unfortunately this is not possible yet.

For example when you try to use Openable with org.openide.actions.OpenAction the action will never be enabled. OpenAction defines OpenCookie as the class to lookup for enabling the action. This is also true with many others like  EditAction,
PrintAction, etc.

You can compare OpenAction to SaveAction where Savable is used instead of the old SaveCookie.

Actually the fix is very easy: OpenCookie already implementing Openable, one only needs to return Openable class in method OpenAction.cookieClasses() (at least I suppose it should work like this) instead of OpenCookie.

This would look like:

public class OpenAction extends CookieAction {
    protected Class[] cookieClasses() {
        return new Class[] { Openable.class };
    }
...
}