StructuredTextEditor hide some contents [message #326164] |
Mon, 10 March 2008 07:56 |
Eclipse User |
|
|
|
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 #326169 is a reply to message #326168] |
Mon, 10 March 2008 10:43 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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());
> }
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05881 seconds