Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » IDocument.replace(...) don't work with lpex
IDocument.replace(...) don't work with lpex [message #22404] Wed, 20 March 2002 15:25 Go to next message
Eclipse UserFriend
Originally posted by: c.tucholski.avkseg.com

>Repost this on the eclipse.tools.cdt newsgroup. The LPEX editor is
>part of the CDT and the lpex developer most likely watches that one
>more closely. It sounds like an lpex problem.
>
>Peter

Christian Tucholski wrote:


Hi,

I'm using the IDocument.replace(...) function to manipulate files. With
the java editor the function works correct. But it has no effect with
the lpex editor.

Is this a bug or a feature of eclipse? Or have I done something wrong?

Thanks

\\|//
(. .)
-oOOo-(w)-oOOo-
Christian
Re: IDocument.replace(...) don't work with lpex [message #22448 is a reply to message #22404] Wed, 20 March 2002 19:37 Go to previous messageGo to next message
adrian is currently offline adrianFriend
Messages: 26
Registered: July 2009
Junior Member
Christian,

In general, in LPEX you should try to use its own functions, rather than
Eclipse's. LPEX's versions of TextViewer, SourceViewer, etc. are *partial*
implementations of Eclipse's. What are you trying to do?

I'm currently adding the handling of documentChanged(DocumentEvent) in
LpexTextViewer, in order to handle correctly the replacing of an open file
with a copy from the local history. This fix will probably fix your
problem too.

Which version of LPEX are you using (which Eclipse driver)? I can send you
a patched driver when I'm finished.

Christian Tucholski wrote:

> >Repost this on the eclipse.tools.cdt newsgroup. The LPEX editor is
> >part of the CDT and the lpex developer most likely watches that one
> >more closely. It sounds like an lpex problem.
> >
> >Peter
>
> Christian Tucholski wrote:
>
> Hi,
>
> I'm using the IDocument.replace(...) function to manipulate files. With
> the java editor the function works correct. But it has no effect with
> the lpex editor.
>
> Is this a bug or a feature of eclipse? Or have I done something wrong?
>
> Thanks
>
> \\|//
> (. .)
> -oOOo-(w)-oOOo-
> Christian
Re: IDocument.replace(...) don't work with lpex [message #22537 is a reply to message #22448] Thu, 21 March 2002 13:28 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: c.tucholski.avkseg.com

Hi Adrian,

the goal is to insert some text components into the active editor to the
cursor position. If I use special editor functions the program will be
editor dependent. For this case the replace() function is very pleasant
to use.
I'm working with the eclipse Build 20020125 and the CDT-Version R2-20020208,

regards,

\\|//
(. .)
-oOOo-(w)-oOOo-
Christian



adrian wrote:

> Christian,
>
> In general, in LPEX you should try to use its own functions, rather than
> Eclipse's. LPEX's versions of TextViewer, SourceViewer, etc. are *partial*
> implementations of Eclipse's. What are you trying to do?
>
> I'm currently adding the handling of documentChanged(DocumentEvent) in
> LpexTextViewer, in order to handle correctly the replacing of an open file
> with a copy from the local history. This fix will probably fix your
> problem too.
>
> Which version of LPEX are you using (which Eclipse driver)? I can send you
> a patched driver when I'm finished.
>
> Christian Tucholski wrote:
>
>
>> >Repost this on the eclipse.tools.cdt newsgroup. The LPEX editor is
>> >part of the CDT and the lpex developer most likely watches that one
>> >more closely. It sounds like an lpex problem.
>> >
>> >Peter
>>
>>Christian Tucholski wrote:
>>
>>Hi,
>>
>>I'm using the IDocument.replace(...) function to manipulate files. With
>>the java editor the function works correct. But it has no effect with
>>the lpex editor.
>>
>>Is this a bug or a feature of eclipse? Or have I done something wrong?
>>
>>Thanks
>>
>> \\|//
>> (. .)
>>-oOOo-(w)-oOOo-
>> Christian
>>
>
Re: IDocument.replace(...) don't work with lpex [message #22664 is a reply to message #22537] Mon, 25 March 2002 15:50 Go to previous messageGo to next message
adrian is currently offline adrianFriend
Messages: 26
Registered: July 2009
Junior Member
This was successfully handled offline.

LPEX doesn't keep stream-oriented IDocument up-to-date between saves, so querying
/ setting text should be done in LPEX directly:

// <import plugin="com.ibm.lpex"/> in plugin.xml
import com.ibm.lpex.core.LpexView;
import com.ibm.lpex.alef.LpexTextEditor;
.. . .
IEditorPart editor = IWorkbenchPage.getActiveEditor();

// (a) Using LPEX
if (editor instanceof LpexTextEditor) {
LpexTextEditor lpexEditor = (LpexTextEditor)editor;
LpexView lpexView = lpexEditor.getLpexView();
if (lpexView != null) {
// insert my_string at the cursor;
// if the text passed to the insertText command contains new line
// characters ('\n'), new lines will be inserted into the document
lpexView.doDefaultCommand("insertText " + my_string);
// refresh the display
LpexView.doGlobalCommand("screenShow");
}
}

// (b) Using an Eclipse editor
else {
. . .
}
Re: IDocument.replace(...) don't work with lpex [message #22707 is a reply to message #22664] Tue, 26 March 2002 15:55 Go to previous messageGo to next message
Brian Thomson is currently offline Brian ThomsonFriend
Messages: 18
Registered: July 2009
Junior Member
Christian, please open a Bugzilla enhancement request against the Lpex component if you have any issues with
this answer. I think your desire to avoid editor-specific code in your plugin when you are invoking
generic function is very reasonable.

Brian

adrian wrote:

> This was successfully handled offline.
>
> LPEX doesn't keep stream-oriented IDocument up-to-date between saves, so querying
> / setting text should be done in LPEX directly:
>
> // <import plugin="com.ibm.lpex"/> in plugin.xml
> import com.ibm.lpex.core.LpexView;
> import com.ibm.lpex.alef.LpexTextEditor;
> . . .
> IEditorPart editor = IWorkbenchPage.getActiveEditor();
>
> // (a) Using LPEX
> if (editor instanceof LpexTextEditor) {
> LpexTextEditor lpexEditor = (LpexTextEditor)editor;
> LpexView lpexView = lpexEditor.getLpexView();
> if (lpexView != null) {
> // insert my_string at the cursor;
> // if the text passed to the insertText command contains new line
> // characters ('\n'), new lines will be inserted into the document
> lpexView.doDefaultCommand("insertText " + my_string);
> // refresh the display
> LpexView.doGlobalCommand("screenShow");
> }
> }
>
> // (b) Using an Eclipse editor
> else {
> . . .
> }
>
>
Re: IDocument.replace(...) don't work with lpex [message #22751 is a reply to message #22707] Wed, 27 March 2002 08:45 Go to previous message
Eclipse UserFriend
Originally posted by: c.tucholski.avkseg.com

Hi Brian,

I think I can live with this solution. It is nice to have this part
editor independent but it is not necessary. The behavior of lpex and
java are different (e.g. lpex don't like 'cr' (0xd) characters) that I
must anyhow distinguish the editors.

Regards,

\\|//
(. .)
-oOOo-(w)-oOOo-
Christian



Brian Thomson wrote:

> Christian, please open a Bugzilla enhancement request against the Lpex
> component if you have any issues with
> this answer. I think your desire to avoid editor-specific code in your
> plugin when you are invoking
> generic function is very reasonable.
>
> Brian
>
> adrian wrote:
>
>> This was successfully handled offline.
>>
>> LPEX doesn't keep stream-oriented IDocument up-to-date between saves,
>> so querying
>> / setting text should be done in LPEX directly:
>>
>> // <import plugin="com.ibm.lpex"/> in plugin.xml
>> import com.ibm.lpex.core.LpexView;
>> import com.ibm.lpex.alef.LpexTextEditor;
>> . . .
>> IEditorPart editor = IWorkbenchPage.getActiveEditor();
>>
>> // (a) Using LPEX
>> if (editor instanceof LpexTextEditor) {
>> LpexTextEditor lpexEditor = (LpexTextEditor)editor;
>> LpexView lpexView = lpexEditor.getLpexView();
>> if (lpexView != null) {
>> // insert my_string at the cursor;
>> // if the text passed to the insertText command contains new line
>> // characters ('\n'), new lines will be inserted into the document
>> lpexView.doDefaultCommand("insertText " + my_string);
>> // refresh the display
>> LpexView.doGlobalCommand("screenShow");
>> }
>> }
>>
>> // (b) Using an Eclipse editor
>> else {
>> . . .
>> }
>>
>>
>
Previous Topic:An error has occurred when creating this editor
Next Topic:Compiler Error... what does it mean?
Goto Forum:
  


Current Time: Mon Jul 29 20:12:07 GMT 2024

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

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

Back to the top