Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » How to batch multiple changes to a document so that it can be undone with a single undo ?
How to batch multiple changes to a document so that it can be undone with a single undo ? [message #319876] Wed, 05 September 2007 02:02 Go to next message
Eclipse UserFriend
This is a multi-part message in MIME format.

------=_NextPart_000_006D_01C7EF93.1CBFA0A0
Content-Type: multipart/alternative;
boundary="----=_NextPart_001_006E_01C7EF93.1CBFA0A0"


------=_NextPart_001_006E_01C7EF93.1CBFA0A0
Content-Type: text/plain;
charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

BlankHi,

In my plug-in I have to edit the same IDocument (in an editor), on =
several places.
My problem is that I can't find a way to do my changes to the document, =
so that the user could undo them with a single undo command.

Is there any way to do this?
If there is, where can I find an examples?

Right now I create a ReplaceEdit for each change, add them to a =
MultiTextEdit object and finally call the apply method of this object to =
do the actual change to the document.
The apply method does take a "style" parameter, but no matter how I set =
it, the result is the same.

Thanks in advance

Kristof

------=_NextPart_001_006E_01C7EF93.1CBFA0A0
Content-Type: text/html;
charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE id=3DridTitle>Blank</TITLE>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dwindows-1252"><BASE=20
href=3D"file://C:\Program Files\Common Files\Microsoft =
Shared\Stationery\">
<STYLE>BODY {
MARGIN-TOP: 25px; FONT-SIZE: 10pt; MARGIN-LEFT: 25px; COLOR: #000000; =
FONT-FAMILY: Arial, Helvetica
}
P.msoNormal {
MARGIN-TOP: 0px; FONT-SIZE: 10pt; MARGIN-LEFT: 0px; COLOR: #ffffcc; =
FONT-FAMILY: Helvetica, "Times New Roman"
}
LI.msoNormal {
MARGIN-TOP: 0px; FONT-SIZE: 10pt; MARGIN-LEFT: 0px; COLOR: #ffffcc; =
FONT-FAMILY: Helvetica, "Times New Roman"
}
</STYLE>

<META content=3D"MSHTML 6.00.2800.1597" name=3DGENERATOR></HEAD>
<BODY id=3DridBody bgColor=3D#ffffff=20
background=3Dcid:006801c7ef82$59354a00$e3c66b9f@eemea.ericsson.se>
<DIV>Hi,</DIV>
<DIV>&nbsp;</DIV>
<DIV>In my plug-in I have to edit the same IDocument (in an editor), on =
several=20
places.</DIV>
<DIV>My problem is that I can't find a way to do my changes to the =
document, so=20
that the user could undo them with a single undo command.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Is there any way to do this?</DIV>
<DIV>If there is, where can I find&nbsp;an examples?</DIV>
<DIV>&nbsp;</DIV>
<DIV>Right now I create a ReplaceEdit for each change, add them to a=20
MultiTextEdit object and finally call the apply method of this object to =
do the=20
actual change to the document.</DIV>
<DIV>The apply method does take a "style" parameter, but no matter how I =
set it,=20
the result is the same.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Thanks in advance</DIV>
<DIV>&nbsp;</DIV>
<DIV>Kristof</DIV>
<DIV>&nbsp;</DIV></BODY></HTML>

------=_NextPart_001_006E_01C7EF93.1CBFA0A0--

------=_NextPart_000_006D_01C7EF93.1CBFA0A0
Content-Type: image/gif;
name="Blank Bkgrd.gif"
Content-Transfer-Encoding: base64
Content-ID: <006801c7ef82$59354a00$e3c66b9f@eemea.ericsson.se>

R0lGODlhLQAtAID/AP////f39ywAAAAALQAtAEACcAxup8vtvxKQsFon6d02 898pGkgiYoCm6sq2
7iqWcmzOsmeXeA7uPJd5CYdD2g9oPF58ygqz+XhCG9JpJGmlYrPXGlfr/Yo/ VW45e7amp2tou/lW
xo/zX513z+Vt+1n/tiX2pxP4NUhy2FM4xtjIUQAAOw==

------=_NextPart_000_006D_01C7EF93.1CBFA0A0--
Re: How to batch multiple changes to a document so that it can be undone with a single undo ? [message #319885 is a reply to message #319876] Wed, 05 September 2007 07:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: automatic.javalobby.org

What happens when you do this? Does each change get given its own undo?

Alex.
Re: How to batch multiple changes to a document so that it can be undone with a single undo ? [message #319886 is a reply to message #319885] Wed, 05 September 2007 07:25 Go to previous messageGo to next message
Eclipse UserFriend
Exactly.

Each change receives its own undo.

Kristof

"Alex Blewitt" <automatic@javalobby.org> wrote in message
news:805524705.6351188990750262.JavaMail.root@cp9.dzone.com...
> What happens when you do this? Does each change get given its own undo?
>
> Alex.
Re: How to batch multiple changes to a document so that it can be undone with a single undo ? [message #319909 is a reply to message #319876] Wed, 05 September 2007 12:14 Go to previous messageGo to next message
Eclipse UserFriend
Kristof Szabados wrote:

> Hi,
>
> In my plug-in I have to edit the same IDocument (in an editor), on
> several places.
> My problem is that I can't find a way to do my changes to the
> document, so that the user could undo them with a single undo command.
>
> Is there any way to do this?
> If there is, where can I find an examples?
>
> Right now I create a ReplaceEdit for each change, add them to a
> MultiTextEdit object and finally call the apply method of this object
> to do the actual change to the document.
> The apply method does take a "style" parameter, but no matter how I
> set it, the result is the same.

This should work. If it doesn't please file a bug report against
Platform Text with steps / test case to reproduce. You could also try
the RewriteSessionEditProcessor.

Dani

>
> Thanks in advance
>
> Kristof
>
Re: How to batch multiple changes to a document so that it can be undone with a single undo ? [message #319939 is a reply to message #319909] Thu, 06 September 2007 05:24 Go to previous message
Eclipse UserFriend
Thanky this fully solved my problem.

Kristof

"Daniel Megert" <daniel_megert@ch.ibm.com> wrote in message
news:fbmkmt$hqo$1@build.eclipse.org...
> Kristof Szabados wrote:
>
> > Hi,
> >
> > In my plug-in I have to edit the same IDocument (in an editor), on
> > several places.
> > My problem is that I can't find a way to do my changes to the
> > document, so that the user could undo them with a single undo command.
> >
> > Is there any way to do this?
> > If there is, where can I find an examples?
> >
> > Right now I create a ReplaceEdit for each change, add them to a
> > MultiTextEdit object and finally call the apply method of this object
> > to do the actual change to the document.
> > The apply method does take a "style" parameter, but no matter how I
> > set it, the result is the same.
>
> This should work. If it doesn't please file a bug report against
> Platform Text with steps / test case to reproduce. You could also try
> the RewriteSessionEditProcessor.
>
> Dani
>
> >
> > Thanks in advance
> >
> > Kristof
> >
Previous Topic:problems when using embedded jars
Next Topic:Using Sub Projects
Goto Forum:
  


Current Time: Sat Jul 19 09:21:33 EDT 2025

Powered by FUDForum. Page generated in 0.03686 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top