Bug 262714 - Evaluate why certain Actions are not logged
Evaluate why certain Actions are not logged
Status: RESOLVED FIXED
Product: editor
Classification: Unclassified
Component: Actions/Menu/Toolbar
8.1
PC Windows 7
: P2 (vote)
: 8.2
Assigned To: Miloslav Metelka
issues@editor
cndreq
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2016-07-07 09:17 UTC by Geertjan Wielenga
Modified: 2016-09-07 01:57 UTC (History)
7 users (show)

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Geertjan Wielenga 2016-07-07 09:17:55 UTC
For demonstrations and other presentations, it is very useful to be able to display (to the audience, to students, etc) the currently used action, in the NetBeans status bar. The NetBeans Key Promoter plugin makes this possible:

https://github.com/GeertjanWielenga/NetBeansKeyPromoter

The plugin above reads the 'var/uigestures' file, detects actions logged there, and displays them.

However, there are two blockers, in these files, which excludes certain actions from being logged, e.g., 'rectangular-block-selection':

Module: org.netbeans.modules.editor.lib2
Class: org\netbeans\spi\editor\AbstractEditorAction.java
Code:

private static boolean isLogged(String actionName) {
    return actionName != null &&
            !"default-typed".equals(actionName) && //NOI18N
            -1 == actionName.indexOf("caret") && //NOI18N
            -1 == actionName.indexOf("delete") && //NOI18N
            -1 == actionName.indexOf("selection") && //NOI18N
            -1 == actionName.indexOf("build-tool-tip") &&//NOI18N
            -1 == actionName.indexOf("build-popup-menu") &&//NOI18N
            -1 == actionName.indexOf("page-up") &&//NOI18N
            -1 == actionName.indexOf("page-down") &&//NOI18N
            -1 == actionName.indexOf("-kit-install"); //NOI18N
}

Module: org.netbeans.modules.editor.lib
Class: org\netbeans\editor\BaseAction.java
Code:

if (UILOG.isLoggable(Level.FINE)) {
    String actionName = getValue(NAME) != null ? getValue(NAME).toString().toLowerCase() : null;
    if (actionName != null &&
        !"default-typed".equals(actionName) && //NOI18N
        -1 == actionName.indexOf("caret") && //NOI18N
        -1 == actionName.indexOf("delete") && //NOI18N
        -1 == actionName.indexOf("undo") &&//NOI18N
        -1 == actionName.indexOf("redo") &&//NOI18N
        -1 == actionName.indexOf("selection") && //NOI18N
        -1 == actionName.indexOf("build-tool-tip") &&//NOI18N
        -1 == actionName.indexOf("build-popup-menu") &&//NOI18N
        -1 == actionName.indexOf("page-up") &&//NOI18N
        -1 == actionName.indexOf("page-down") &&//NOI18N
        -1 == actionName.indexOf("-kit-install") //NOI18N
    ) {
        LogRecord r = new LogRecord(Level.FINE, "UI_ACTION_EDITOR"); // NOI18N
        r.setResourceBundle(NbBundle.getBundle(BaseAction.class));
        if (evt != null) {
            r.setParameters(new Object[] { evt, evt.toString(), this, toString(), getValue(NAME) });
        } else {
            r.setParameters(new Object[] { "no-ActionEvent", "no-ActionEvent", this, toString(), getValue(NAME) }); //NOI18N
        }
        r.setLoggerName(UILOG.getName());
        UILOG.log(r);
    }
}

What is the reason for the above exclusions and can they be removed or configured? This blocks a very useful feature to promote NetBeans in YouTube clips, conferences, etc.
Comment 1 Miloslav Metelka 2016-08-24 08:53:28 UTC
Certain actions are used internally e.g. for tooltip building and also kit-install actions could be performed at the editor kit installation into editor component so I should retain their exclusion. On the other hand if you think that all the caret movements and selections should be logged I can comment out the exclusions. Not sure about about logging all the typed characters by the "default-typed" action I'll leave it excluded for now. Let's try and we will and we will see if it will be ok or not.
http://hg.netbeans.org/jet-main/rev/8bf4d31f56e0
Comment 2 Quality Engineering 2016-08-27 02:19:40 UTC
Integrated into 'main-silver', will be available in build *201608270002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/8bf4d31f56e0
User: Miloslav Metelka <mmetelka@netbeans.org>
Log: #262714 - Evaluate why certain Actions are not logged.
Comment 3 Geertjan Wielenga 2016-08-29 03:00:16 UTC
Thanks very much, much better. Only multi-caret mode doesn't seem to be captured, can that be included too?
Comment 4 Vladimir Voskresensky 2016-08-30 17:56:46 UTC
Geertjan, Mila,

I think we previously filtered these actions, because otherwise during usual typing activity we had two problems:
- huge uigestures file with actions which are not analysed anyway
- big I/O activity in parallel to editing file which is a problem at least when userdir at network home (again without real reason)
Comment 5 Vladimir Voskresensky 2016-08-30 17:58:27 UTC
If you really need it for your plug-in it's worth to introduce some flag (System.getProperty in editor setProperty in your plug-in?). But please, do not slowdown the general IDE editor with I/O
Comment 6 Geertjan Wielenga 2016-08-30 18:02:19 UTC
Sure, that property makes perfect sense.
Comment 7 Ralph Ruijs 2016-08-31 06:45:02 UTC
(In reply to Vladimir Voskresensky from comment #5)
> If you really need it for your plug-in it's worth to introduce some flag
> (System.getProperty in editor setProperty in your plug-in?). But please, do
> not slowdown the general IDE editor with I/O

Adding a property to intentionally break the ide doesn't sound good. Is it possible for the uigestures-file-writer, to filter what it writes? Or can we introduce a second logging channel for actions not to be included in the uigestures file?
Comment 8 Miloslav Metelka 2016-08-31 13:01:32 UTC
For now I would create a system property that, when turned on, would include the logging of the extra actions added by the last patch. We can add a more elaborate solution later.
Can it be like this?

org.netbeans.editor.ui.actions.logging.detailed=true
Comment 9 Geertjan Wielenga 2016-08-31 13:06:43 UTC
Perfect.
Comment 10 Miloslav Metelka 2016-09-06 07:51:51 UTC
Property added in http://hg.netbeans.org/jet-main/rev/8f112f9b30fb
Comment 11 Quality Engineering 2016-09-07 01:57:03 UTC
Integrated into 'main-silver', will be available in build *201609070002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/8f112f9b30fb
User: Miloslav Metelka <mmetelka@netbeans.org>
Log: #262714 - Evaluate why certain Actions are not logged - added org.netbeans.editor.ui.actions.logging.detailed system property.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo