write actions

Hello guys,

Am I right that if my action extends EditorAction and on its creation I
provide my ActionHandler which extends EditorWriteActionHandler then
in EditorWriteActionHandler.executeWriteAction(..) I don't need to wrap my
code, which modifies a file, into the following construction:

CommandProcessor.getInstance().executeCommand(new Runnable() {
public void run() {
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
.. code which writes to an editor
}
}
}
}

The reason I am asking that it seems that this is a recommended way to make changes
to an editor, but when I looked at EditorWriteActionHandler.execute() method I found
that this is already done there

public final void execute(Editor editor, DataContext datacontext) {
...........
ApplicationManager.getApplication().runWriteAction(new _cls1(editor, datacontext));
...........
}

--
Dmitry Skavish
-


Boston, MA, USA
tel. +1 781 910-3810
http://www.jzox.com
http://www.flashgap.com

1 comment
Comment actions Permalink

Yes, Dmitry

you're perfectly right. EditorWriteActionHandler runs command and write
action for you.

--

Best regards,
Maxim Shafirov
JetBrains, Inc / IntelliJ Software
http://www.intellij.com
"Develop with pleasure!"


"Dmitry Skavish" <skavish@usa.net> wrote in message
news:att9ut$5r5$1@is.intellij.net...

Hello guys,

>

Am I right that if my action extends EditorAction and on its creation I
provide my ActionHandler which extends EditorWriteActionHandler then
in EditorWriteActionHandler.executeWriteAction(..) I don't need to wrap my
code, which modifies a file, into the following construction:

>

CommandProcessor.getInstance().executeCommand(new Runnable() {
public void run() {
ApplicationManager.getApplication().runWriteAction(new Runnable()

{

public void run() {
.. code which writes to an editor
}
}
}
}

>

The reason I am asking that it seems that this is a recommended way to

make changes

to an editor, but when I looked at EditorWriteActionHandler.execute()

method I found

that this is already done there

>

public final void execute(Editor editor, DataContext datacontext) {
...........
ApplicationManager.getApplication().runWriteAction(new

_cls1(editor, datacontext));

...........
}

>

--
Dmitry Skavish
-----------------------
Boston, MA, USA
tel. +1 781 910-3810
http://www.jzox.com
http://www.flashgap.com

>


0

Please sign in to leave a comment.