Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » StructuredTextEditor hide some contents
StructuredTextEditor hide some contents [message #326164] Mon, 10 March 2008 07:56 Go to next message
Eclipse UserFriend
Originally posted by: alexjaquet.gmail.com

Hi,

I would like to know if it's possible to hide some text who are
displayed inside a StructureTextEditor.

For example I've the following text inside the editor at the beginin

<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE xgui:module PUBLIC \"-TOTO-\" \"unknown.dtd\">

and I don't want to display it

(I want to have the code completion enabled)

Thanks

Alexandre
Re: StructuredTextEditor hide some contents [message #326168 is a reply to message #326164] Mon, 10 March 2008 10:22 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: alexjaquet.gmail.com

Do I need to play with the ProjectionViewer setVisibleRegion ? If yes
how to work with ProjectionViewer and where to call this function ?

Thanks

Alexandre
Re: StructuredTextEditor hide some contents [message #326169 is a reply to message #326168] Mon, 10 March 2008 10:43 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: alexjaquet.gmail.com

I've tryed the following code without success could someone point me
what's wrong

public void activateEditor() {
String str = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE
xgui:module PUBLIC \"-TOTO-\" \"unknown.dtd\"";

boolean readOnly = true;
if (property != null) {
String v = property.getValue();
str = v == null ? "" : v;
readOnly = false;
}

// Update the contents of the InputStreamEditorInput
InputStreamEditorInput input = (InputStreamEditorInput) getEditorInput();
InputStream is = new ByteArrayInputStream(str.getBytes());
input.setContents(is);
input.setReadOnly(readOnly);
getSourceViewer().setVisibleRegion(str.length(),
getSourceViewer().getDocument().getLength());
// Finally update the user-interface
setInput(getEditorInput());
}
Re: StructuredTextEditor hide some contents [message #326171 is a reply to message #326169] Mon, 10 March 2008 12:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Alexandre,

Isn't this a WTP thing that's bested asked on the WTP newsgroup?


Alexandre Jaquet wrote:
> I've tryed the following code without success could someone point me
> what's wrong
>
> public void activateEditor() {
> String str = "<?xml version=\"1.0\"
> encoding=\"UTF-8\"?><!DOCTYPE xgui:module PUBLIC \"-TOTO-\"
> \"unknown.dtd\"";
>
> boolean readOnly = true;
> if (property != null) {
> String v = property.getValue();
> str = v == null ? "" : v;
> readOnly = false;
> }
>
> // Update the contents of the InputStreamEditorInput
> InputStreamEditorInput input = (InputStreamEditorInput)
> getEditorInput();
> InputStream is = new ByteArrayInputStream(str.getBytes());
> input.setContents(is);
> input.setReadOnly(readOnly);
> getSourceViewer().setVisibleRegion(str.length(),
> getSourceViewer().getDocument().getLength());
> // Finally update the user-interface
> setInput(getEditorInput());
> }
Re: StructuredTextEditor hide some contents [message #326173 is a reply to message #326171] Mon, 10 March 2008 12:55 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: alexjaquet.gmail.com

you 're rigth
Re: StructuredTextEditor hide some contents [message #326185 is a reply to message #326168] Mon, 10 March 2008 17:13 Go to previous message
Alex Le is currently offline Alex LeFriend
Messages: 649
Registered: July 2009
Senior Member
Alexandre Jaquet wrote:
> Do I need to play with the ProjectionViewer setVisibleRegion ? If yes
> how to work with ProjectionViewer and where to call this function ?
>
> Thanks
>
> Alexandre

Hi,

Look for an article on code/text folding on Eclipse.org.
Previous Topic:Dynamically open a view and an editor
Next Topic:Menu label problems (seeing % names)
Goto Forum:
  


Current Time: Wed Jul 17 23:15:23 GMT 2024

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

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

Back to the top