Viewing a single document partition [message #111698] |
Mon, 18 August 2003 05:33  |
Eclipse User |
|
|
|
Originally posted by: ian.brown.printsoft.de
Hi,
I have a document which is partitioned into 2 partitions (header and
body).
I have a multi-page editor in which I want to edit the body partition in a
TextEditor in page 1 and I want to edit the header partition via a SWT form
in page 2.
My question is how can I make page 1 (the TextEditor) only display the body
partition. Currently I have the header displayed in a separate colour, but I
cannot see how to make the text editor ignore it completely. Any help or
ideas would be much appreciated.
Thanks,
Ian
|
|
|
|
|
Re: Viewing a single document partition [message #112852 is a reply to message #111843] |
Wed, 20 August 2003 05:09   |
Eclipse User |
|
|
|
Originally posted by: ian.brown.printsoft.de
If you use setHighlightRange() then this means the user cannot highlight
stuff in the view because you are already using the highlight.
I found a solution to my problem that seems to work. I make a new document
class ... Basically just copied the Document implementation. I then overrode
the set(String text) function to only pass the data following the header to
the textstore and the header. I seems to work at the moment ... I need to do
some clever stuff on saving, but I would need to do that anyhow.
Basically, I added the code below...
public void set(String text) {
int length= getStore().getLength();
DocumentEvent e= new DocumentEvent(this, 0, length, text);
fireDocumentAboutToBeChanged(e);
String str_body = text;
if (text.length() > 5){
// This splits the input on the CRC line (which is the end of the text
header).
String[] split_results = text.split("[\r\n]CRC=[0-9A-F]*[\n\r]+", 2);
str_body = split_results[1];
}
getStore().set(str_body);
getTracker().set(str_body);
fireDocumentChanged(e);
}
"Paul L" <paull@NOSPAMcodetelligence.com> wrote in message
news:bhr2vg$bhs$1@eclipse.org...
> Is using the ITextViewer.setVisibleRegion(int, int) method preferable to
> using the TextEditor .showHighlightRangeOnly(true)
> .setHighlightRange(offset,length,true)?
>
|
|
|
Re: Viewing a single document partition [message #113327 is a reply to message #112852] |
Wed, 20 August 2003 17:40  |
Eclipse User |
|
|
|
Originally posted by: paull.NOSPAMcodetelligence.com
Maybe I'm missinterpreting what you are saying, but when you use
showHighlightRangeOnly/setHighlightRange() the editor will only display the
text within the range and the user can still highlight what they want within
this text. At least thats how it is working in my editor.
Pul
"Ian Brown" <ian.brown@printsoft.de> wrote in message
news:bhvdoh$6a2$1@eclipse.org...
> If you use setHighlightRange() then this means the user cannot highlight
> stuff in the view because you are already using the highlight.
>
> I found a solution to my problem that seems to work. I make a new document
> class ... Basically just copied the Document implementation. I then
overrode
> the set(String text) function to only pass the data following the header
to
> the textstore and the header. I seems to work at the moment ... I need to
do
> some clever stuff on saving, but I would need to do that anyhow.
>
> Basically, I added the code below...
>
> public void set(String text) {
>
> int length= getStore().getLength();
>
> DocumentEvent e= new DocumentEvent(this, 0, length, text);
>
> fireDocumentAboutToBeChanged(e);
>
>
> String str_body = text;
>
> if (text.length() > 5){
>
> // This splits the input on the CRC line (which is the end of the text
> header).
>
> String[] split_results = text.split("[\r\n]CRC=[0-9A-F]*[\n\r]+", 2);
>
> str_body = split_results[1];
>
> }
>
> getStore().set(str_body);
>
> getTracker().set(str_body);
>
>
> fireDocumentChanged(e);
>
> }
>
>
> "Paul L" <paull@NOSPAMcodetelligence.com> wrote in message
> news:bhr2vg$bhs$1@eclipse.org...
> > Is using the ITextViewer.setVisibleRegion(int, int) method preferable to
> > using the TextEditor .showHighlightRangeOnly(true)
> > .setHighlightRange(offset,length,true)?
> >
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.06851 seconds