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 224007

Summary: NetBeans should support Mutil MimeResovler.Resigeration annotations in the same class
Product: platform Reporter: hantsy <hantsy>
Component: Data SystemsAssignee: Jaroslav Tulach <jtulach>
Status: RESOLVED WORKSFORME    
Severity: normal    
Priority: P3    
Version: 7.2.1   
Hardware: PC   
OS: Windows 7   
Issue Type: ENHANCEMENT Exception Reporter:
Bug Depends on: 191777    
Bug Blocks:    

Description hantsy 2012-12-19 03:24:47 UTC
I tried to update some old xml layer config to the Annotation config in my plugin(https://github.com/hantsy/click4nb).

for example, 

@NbBundle.Messages({"CLICK_RESOVLVER_NAME=Click Config File"})
@MIMEResolver.Registration(
   displayName = "#CLICK_RESOVLVER_NAME",
resource = "ClickResolver.xml")
public class ClickMimeResolverRegistration {
}

But it did not support mutil @MIMEResolver.Registration in one class, I have two Resolvers in this project.

I have to create another one in the project.

@NbBundle.Messages({
    "CLICKMENU_RESOVLVER_NAME=Click Menu Config"})
@MIMEResolver.Registration(
   displayName = "#CLICKMENU_RESOVLVER_NAME",
resource = "MenuResolver.xml")
public class MemuMimeResolverRegistration {
}


why not supports like this:
@NbBundle.Messages({
    "CLICKMENU_RESOVLVER_NAME=Click Menu Config"})
@MIMEResolver.Registrations({
     @MIMEResolver.Registration(
         displayName = "#CLICKMENU_RESOVLVER_NAME",
         resource = "MenuResolver.xml"),
     @MIMEResolver.Registration(
         displayName = "#CLICK_RESOVLVER_NAME",
         resource = "ClickResolver.xml")
)
public class MimeResolverRegistration {
}

The original layer.xml supports mutil resovlers in the "MIMEResovler" nodes, why one class only support one @MIMEResolver.Registration.


BTW: personally, I am disappeared when I use the newest Annotation to config plugin, obviously this  MimeResolverRegistration is no use at all(I have to create a empty class to register????), and the annotation @MIMEResolver.Registration is only use for translate info into xml at compiling time.

This did not improve any programming experience.

I hope Netbeans can provide rumtime annotations to improve the programming model, such JSR330, it is supported in Eclipse e4.x, the NetBeans team rejected my  issues directly about this.
Comment 1 Jaroslav Tulach 2012-12-19 13:05:19 UTC
When you mix multiple issues into one report, you risk the chance of not being addressed all.

I understand this report as an enhancement request to allow multiple MIMEResolver.Registration annotations in a single class. I've changed the type of the issue accordingly.
Comment 2 Jaroslav Tulach 2012-12-19 13:11:53 UTC
Please note that the target of the annotation does not have to be only class, it can be any element. For example http://hg.netbeans.org/ergonomics/file/default/cnd.source/src/org/netbeans/modules/cnd/source/CCDataObject.java
is using this "feature". 

Thus I have a feeling your use case is relatively well supported. Marking as works for me.

In case you insist on the "plural annotation" I am sure you know the rules: create patch and use the API review process.