Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Viewing a single document partition
Viewing a single document partition [message #111698] Mon, 18 August 2003 05:33 Go to next message
Eclipse UserFriend
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 #111750 is a reply to message #111698] Mon, 18 August 2003 10:29 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tom.eicher.gmx.ch.nodomain

Currently, the "Show source of selected element" feature of the Java
Editor which lets you display a method at a time is implemented using
the ITextViewer.setVisibleRegion(int, int) method. See how it is
implemented for a start.

You can also have a look at org.eclipse.jface.text.ProjectionDocument
and its usage. There are "projection" source folders in the
org.eclipse.jface.text and org.eclipse.text projects that support the
notion of folded or projected documents.

-tom

Ian Brown wrote:
> 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 #111843 is a reply to message #111750] Mon, 18 August 2003 13:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: paull.NOSPAMcodetelligence.com

Is using the ITextViewer.setVisibleRegion(int, int) method preferable to
using the TextEditor .showHighlightRangeOnly(true)
..setHighlightRange(offset,length,true)?

Paul
"Tom Eicher" <tom.eicher@gmx.ch.nodomain> wrote in message
news:bhqnst$va0$1@eclipse.org...
> Currently, the "Show source of selected element" feature of the Java
> Editor which lets you display a method at a time is implemented using
> the ITextViewer.setVisibleRegion(int, int) method. See how it is
> implemented for a start.
>
> You can also have a look at org.eclipse.jface.text.ProjectionDocument
> and its usage. There are "projection" source folders in the
> org.eclipse.jface.text and org.eclipse.text projects that support the
> notion of folded or projected documents.
>
> -tom
>
> Ian Brown wrote:
> > 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 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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)?
> >
>
>
Previous Topic:disappearing "build project" option
Next Topic:How to add external builders permanently and programmatically
Goto Forum:
  


Current Time: Tue Jul 22 00:51:45 EDT 2025

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

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

Back to the top