History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: IDEABKL-3647
Type: New Feature New Feature
Status: Open Open
Priority: Major Major
Assignee: Maxim Shafirov
Reporter: Keith Lea
Votes: 1
Watchers: 1
Available Workflow Actions

Mark as Stalled
Operations

If you were logged in you would be able to see more operations.
IDEA: Backlog

Add @InReadAction, @OnEventQueue(NOW|LATER), @InWriteAction(NOW|LATER) method annotations and custom classloader or compiler

Created: 13 Jun 06 04:25   Updated: 13 Jun 06 12:29
Component/s: Plugin Support. API
Affects Version/s: None
Fix Version/s: None

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown

Build: 4,247
Severity: Medium


 Description  « Hide
I am tired of runWriteAction and so on. IDEA should provide these annotations, which have the following effects:

@InReadAction adds ApplicationManager.getApplication().runReadAction(new Runnable() { public void run() { to the beginning of the method, and } })); to the end.

@OnEventQueue(when=NOW|LATER) adds Application app = ApplicationManager.getApplication(); Runnable me = new Runnable() { public void run() { to the beginning of the method, and {{ }}; if (app.isDispatchThread()) { me.run(); } else { app.invoke${which}(me); } }} to the end, where {{${which} }} is Later or AndWait depending on the value of when argument to the annotation.

@InWriteAction(when=NOW|LATER) is very similar to @OnEventQueue except it runs the runnable wrapped in app.runWriteAction() as well.

I currently use runReadAction 14 times in my plugins. I use runWriteAction 33 times. I use invokeLater and invokeAndWait 10 times. Hopefully with these annotations I could eliminate all of those calls and all of that boilerplate.

By the way, maybe you could take the fact that this bug report is pretty hard to read, as a sign that the currently required boilerplate makes code similarly unreadable.



 All   Comments   Work Log   Change History      Sort Order:
There are no comments yet on this issue.