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.
As part of the action clean up (http://www.netbeans.org/download/dev/javadoc/OpenAPIs/org/openide/doc-files/upgrade.html#3.6-actions-event-thread) all actions are encouraged to run in AWT thread. Due to compatibility reasons the actions that do not override new asynchronous() method are still executed on background. So we have infrastructure for doing that in place. Moreover there are actions that cannot be executed in AWT as they would occupy it for too long time (PrintAction) and this would result in poor responsiveness. But they cannot use the build-in infrastructure as that results in a warning message to be printed and they are told to use complicated RP calls by themselves. As a result tons of actions spread over a lot of modules are going to be poluted by innerclasses and RequestProcessor calls that will have to be rewritten in future version once more as we will introduce "progress api" and any background action will be adviced to use it to communicate that something is happening. The goal of my proposed change is to: 1. simplify code for those who conciously want asynchronous action behaviour 2. do it in a way that will allow future enhancements like use of progress api without the need to all the client code. Btw. The actual diff is just four lines long.
Created attachment 13263 [details] Diff of the change and test of its behaviour
FWIW I don't really agree with this patch because I *don't* think it will allow actions to transparently switch to the progress API without changes. Specifically I don't think that PrintAction should be written the way it is for promo-D; it should collect the PrintCookie's synch in performAction (because Node's are in EQ GUI layer) and then print from them asynch. If we have a progress API it should also probably communicate between the PrintCookie and that API. Also putting actions into RequestProcessor is a bit too magical for my tastes. Just because they don't want to run in EQ doesn't necessarily mean they *do* want to run in RP. They may want to use the ExecutionEngine, or do something in a particular Mutex, etc. I think having the asynchronous() -> true simply obscures what the code is doing unnecessarily. So -1 from me for now. I consider the automatic replanning of action code to RP to be an undesirable hack needed to retain backward compatibility, not a feature.
Accoding to reactions on nbdev@ http://www.netbeans.org/servlets/ReadMsg?msgId=691387&listName=nbdev http://www.netbeans.org/servlets/BrowseList?listName=nbdev&by=thread&from=22289 and few bugs that seem to rely on a common fix I consider this bug and I am going to work on this.
Created attachment 13428 [details] Simple solution for this issue and bugs 39866, 39213
In order to show running actions in exit dialog, I needed a way to communicate with core from openide. I have reused ActionManager for that. ModuleActions are still synchronous, but they add and remove wait cursor and keep a list of running actions. In order to keep our unit tests functional, I had to introduce forced synchronous mode. The good thing is that the check is not widespread. It is only in CallableSystemAction and PasteAction, because the later has its own presentation and functional logic. I think now everything is functional, I'll wait for some reviews.
Checking in openide/openide-spec-vers.properties; /cvs/openide/openide-spec-vers.properties,v <-- openide-spec-vers.properties new revision: 1.134; previous revision: 1.133 done Processing log script arguments... More commits to come... Checking in openide/api/doc/changes/apichanges.xml; /cvs/openide/api/doc/changes/apichanges.xml,v <-- apichanges.xml new revision: 1.187; previous revision: 1.186 done Processing log script arguments... More commits to come... Checking in openide/arch/arch-openide-actions.xml; /cvs/openide/arch/arch-openide-actions.xml,v <-- arch-openide-actions.xml new revision: 1.23; previous revision: 1.22 done Processing log script arguments... More commits to come... Checking in openide/src/org/openide/actions/DeleteAction.java; /cvs/openide/src/org/openide/actions/DeleteAction.java,v <-- DeleteAction.java new revision: 1.21; previous revision: 1.20 done Checking in openide/src/org/openide/actions/PasteAction.java; /cvs/openide/src/org/openide/actions/PasteAction.java,v <-- PasteAction.java new revision: 1.53; previous revision: 1.52 done Checking in openide/src/org/openide/actions/PrintAction.java; /cvs/openide/src/org/openide/actions/PrintAction.java,v <-- PrintAction.java new revision: 1.21; previous revision: 1.20 done Processing log script arguments... More commits to come... Checking in openide/src/org/openide/explorer/ExplorerActions.java; /cvs/openide/src/org/openide/explorer/ExplorerActions.java,v <-- ExplorerActions.java new revision: 1.64; previous revision: 1.63 done Processing log script arguments... More commits to come... Checking in openide/src/org/openide/util/actions/CallableSystemAction.java; /cvs/openide/src/org/openide/util/actions/CallableSystemAction.java,v <-- CallableSystemAction.java new revision: 1.17; previous revision: 1.16 done Checking in openide/src/org/openide/util/actions/CallbackSystemAction.java; /cvs/openide/src/org/openide/util/actions/CallbackSystemAction.java,v <-- CallbackSystemAction.java new revision: 1.37; previous revision: 1.36 done Removing openide/src/org/openide/util/actions/MouseCursorUtils.java; /cvs/openide/src/org/openide/util/actions/MouseCursorUtils.java,v <-- MouseCursorUtils.java new revision: delete; previous revision: 1.1 done Checking in openide/src/org/openide/util/actions/NodeAction.java; /cvs/openide/src/org/openide/util/actions/NodeAction.java,v <-- NodeAction.java new revision: 1.44; previous revision: 1.43 done Processing log script arguments... More commits to come... Checking in openide/test/unit/src/org/openide/actions/AbstractCallbackActionTestHidden.java; /cvs/openide/test/unit/src/org/openide/actions/AbstractCallbackActionTestHidden.java,v <-- AbstractCallbackActionTestHidden.java new revision: 1.6; previous revision: 1.5 done Checking in openide/test/unit/src/org/openide/actions/PasteActionTest.java; /cvs/openide/test/unit/src/org/openide/actions/PasteActionTest.java,v <-- PasteActionTest.java new revision: 1.5; previous revision: 1.4 done Processing log script arguments... More commits to come... Checking in openide/test/unit/src/org/openide/explorer/ExplorerPanelTest.java; /cvs/openide/test/unit/src/org/openide/explorer/ExplorerPanelTest.java,v <-- ExplorerPanelTest.java new revision: 1.10; previous revision: 1.9 done Processing log script arguments... More commits to come... RCS file: /cvs/openide/test/unit/src/org/openide/util/actions/AsynchronousTest.java,v done Checking in openide/test/unit/src/org/openide/util/actions/AsynchronousTest.java; /cvs/openide/test/unit/src/org/openide/util/actions/AsynchronousTest.java,v <-- AsynchronousTest.java initial revision: 1.1 done Checking in openide/test/unit/src/org/openide/util/actions/CallbackSystemActionTest.java; /cvs/openide/test/unit/src/org/openide/util/actions/CallbackSystemActionTest.java,v <-- CallbackSystemActionTest.java new revision: 1.10; previous revision: 1.9 done Processing log script arguments... More commits to come... Checking in core/execution/src/org/netbeans/core/execution/Install.java; /cvs/core/execution/src/org/netbeans/core/execution/Install.java,v <-- Install.java new revision: 1.13; previous revision: 1.12 done Processing log script arguments... More commits to come... Checking in core/src/org/netbeans/core/ModuleActions.java; /cvs/core/src/org/netbeans/core/ModuleActions.java,v <-- ModuleActions.java new revision: 1.30; previous revision: 1.29 done Processing log script arguments... More commits to come... RCS file: /cvs/core/test/unit/src/org/netbeans/core/ModuleActionsTest.java,v done Checking in core/test/unit/src/org/netbeans/core/ModuleActionsTest.java; /cvs/core/test/unit/src/org/netbeans/core/ModuleActionsTest.java,v <-- ModuleActionsTest.java initial revision: 1.1 done
*** Issue 39866 has been marked as a duplicate of this issue. ***
*** Issue 35759 has been marked as a duplicate of this issue. ***
closed