does deleteString() automatically feed the undo mechanism?

I am working on a plug in that utilizes the Document.deleteString() method. While the deletion is working fine, the undo mechanism is not being updated, such that the deletion can be undone?

Is the deleteString() method supposed to automatically mark the changes for undo?

If not, where can I find more documentation or examples of properly managing the undo mechanism to be able to go back to the pre-delete state?

Thanks,

Eric Bergerson

4 comments

I wonder if you use code like:
CommandProcessor.getInstance().executeCommand(
project,
new Runnable() {
public void run() {
ApplicationManager.getApplication().runWriteAction(
new Runnable() {
public void run() {
// your document updates here
}
}
}
}
},
"action id",
"action description"
);

Eric Bergerson wrote:

I am working on a plug in that utilizes the Document.deleteString() method. While the deletion is working fine, the undo mechanism is not being updated, such that the deletion can be undone?

Is the deleteString() method supposed to automatically mark the changes for undo?

If not, where can I find more documentation or examples of properly managing the undo mechanism to be able to go back to the pre-delete state?

Thanks,

Eric Bergerson



--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0

Yes, in fact the code is in that structure.

It is not my code. It is the code to ideamacs plugin written by elias-m@algoneet.se. I was using a patched version of the code that had some extra functionality. However, it is not working properly under 4.0. So I have been working to update it. The problem was the use of deprecated API, which I fixed, and now the functions are working correctly.

However, undo does not work on any edits performed by actions from this plugin (works fine for everything else).

I have been looking to see if I just need to call some proper localVcs calls to register the edits, but without doc or examples, can't seem to get it to work.

Any suggestions would be helpful.

Thanks.

0

Thanks for your help. I am going to stop trying to integrate in the custom functionality at this time. I think I am using some very old source. I think I will have to contact Elias to get the most recent version.

However, if you could still post a brief paragraph describing how the undo mechanism works during a document edit, and if any steps have to be taken to insure its proper usage, that would be helpful. Tx.

- Eric

0

The guideline is to use command/write action code outlined before. The
Undo support is not working when some external change is encountered
since last action. Switching focus from editor could also cause
different action to be undone. Please, post the exact nonworking code in
order to find the problem.

Eric Bergerson wrote:

Thanks for your help. I am going to stop trying to integrate in the custom functionality at this time. I think I am using some very old source. I think I will have to contact Elias to get the most recent version.

However, if you could still post a brief paragraph describing how the undo mechanism works during a document edit, and if any steps have to be taken to insure its proper usage, that would be helpful. Tx.

- Eric



--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0

Please sign in to leave a comment.