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 221860 - Action registration by the annotation doesn't work (PHP "comment" button stopped working in 7.3 beta 2)
Summary: Action registration by the annotation doesn't work (PHP "comment" button stop...
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Actions/Menu/Toolbar (show other bugs)
Version: 7.3
Hardware: All All
: P3 normal (vote)
Assignee: Miloslav Metelka
URL:
Keywords: REGRESSION
: 222509 222694 222926 223240 224307 225797 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-11-09 20:47 UTC by rkaiser0324
Modified: 2013-02-10 07:58 UTC (History)
9 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
IDE log (46.25 KB, text/plain)
2012-11-09 20:47 UTC, rkaiser0324
Details

Note You need to log in before you can comment on or make changes to this bug.
Description rkaiser0324 2012-11-09 20:47:52 UTC
Product Version = NetBeans IDE Dev (Build nbms-and-javadoc-9541-on-20121108)
Operating System = Windows 7 version 6.1 running on amd64
Java; VM; Vendor = 1.7.0_01
Runtime = Java HotSpot(TM) 64-Bit Server VM 21.1-b02

Open a PHP document, highlight a line, and press the "Comment" toolbar button at the top.

-> You hear an error beep, but nothing happens.

This was working fine in the previous 7.3 version I was on (I think it was Beta 1, but am not sure).
Comment 1 rkaiser0324 2012-11-09 20:47:57 UTC
Created attachment 127511 [details]
IDE log
Comment 2 Marian Mirilovic 2012-11-10 07:25:22 UTC
reproducible in 
Product Version: NetBeans IDE Dev (Build 201211080001)
Java: 1.7.0_10-ea; Java HotSpot(TM) 64-Bit Server VM 23.6-b04
Runtime: Java(TM) SE Runtime Environment 1.7.0_10-ea-b13
Comment 3 Ondrej Brejla 2012-11-10 10:01:36 UTC
Really strange...seems that a click on that button doesn't create PHP custom ToggleCommentAction, but pressing ctrl+shift+c works properly. Really don't know who made what change, that this stopped to work.
Comment 4 Ondrej Brejla 2012-11-10 10:13:01 UTC
Milo, can you help me? Svata told me, that you made some changes in Actions in last few weeks...
Comment 5 Ondrej Brejla 2012-11-10 10:46:45 UTC
Milo, just a note. We register our custom ToggleCommentAction using the annotation:

@EditorActionRegistration(name = ExtKit.toggleCommentAction, mimeType = PHP_MIME_TYPE) 

and default CSL Toggle action registration is suppressed by:

if (!mimeType.equals("text/x-php5")) {
    actions.add(new ToggleBlockCommentAction());
}

in CSLEditorKit.createActions(). Maybe it can help you to understand the problem.

Thanks in advance!
Comment 6 Ondrej Brejla 2012-11-10 14:28:40 UTC
Just another note, if I register it directly through the layer:

<file name="org-netbeans-modules-php-editor-actions-ToggleBlockCommentAction.instance"/>

Everything works as expected. So maybe something is wrong with annotation processing?
Comment 7 Ondrej Brejla 2012-11-13 09:08:01 UTC
I don't know what else can I do on my side. Milo, can you evaluate it please? Thanks in advance.
Comment 8 Miloslav Metelka 2012-11-13 15:09:50 UTC
Fixed. It was an error of the old EditorActionRegistrationProcessor that it honored action's constructor with (Map<String, ?> attrs) parameter though it could not call it since xml layer does not support such construction (only static method with such parameter is supported) so in fact it called default constructor anyway but it generated a direct construction instead of wrapper construction. I've modified the processor to no longer generate direct construction which mostly would not affect anything but in this particular case there's a code in ExtKit that checks for BaseAction which fails with wrapper action.

http://hg.netbeans.org/jet-main/rev/2b4073efa613
Comment 9 Marian Mirilovic 2012-11-21 13:43:45 UTC
*** Bug 222509 has been marked as a duplicate of this bug. ***
Comment 10 Marian Mirilovic 2012-11-25 23:06:22 UTC
*** Bug 222694 has been marked as a duplicate of this bug. ***
Comment 11 Marian Mirilovic 2012-11-29 09:18:39 UTC
*** Bug 222926 has been marked as a duplicate of this bug. ***
Comment 12 Ondrej Brejla 2012-12-04 12:09:19 UTC
*** Bug 223240 has been marked as a duplicate of this bug. ***
Comment 13 charrison1988 2012-12-04 12:12:22 UTC
So it's fixed, but how do we fix it now? Any patch?
Comment 14 Miloslav Metelka 2012-12-04 14:41:09 UTC
If your client code uses EditorActionRegistration and has a similar problem then please create a static method and annotate that one instead (like it's done in the fix):

@EditorActionRegistration(name = ExtKit.toggleCommentAction, mimeType = PHP_MIME_TYPE)
public static ToggleBlockCommentAction create(Map<String, ?> attrs) {
    return new ToggleBlockCommentAction(attrs);
}

That will fix the problem (action will be directly instantiated without a wrapper).
Comment 15 Marian Mirilovic 2013-01-03 11:53:17 UTC
*** Bug 224307 has been marked as a duplicate of this bug. ***
Comment 16 Marian Mirilovic 2013-02-10 07:58:52 UTC
*** Bug 225797 has been marked as a duplicate of this bug. ***