How can i get SourceViewer in the TextEditor? [message #334414] |
Sat, 07 February 2009 08:56  |
Eclipse User |
|
|
|
Hello,
My Editor extends Class TextEditor. I want to insert an function
which NonEditable Modus is for my Editor. If my Editor work in this Modus,
some keywordTexts in the Editor will be set to noneditable. For Example,
for the Text from this java File: public class MyClass{}: public and class
is the keywords. User cannt edit them.
The TextEditor use a SourceViewer to manage the display of the Text
in Editor. And the SourceViewer use the StyledText to controll the
displayed Text. Therefore, I want to insert a VertifyListener into the
StyledText of the SourceViewer in my Editor. But first i must get the
StyledText of the SourceViewer of my TextEditor.
I have written the following Code to get the StyledText.
public class ASEditor extends TextEditor {
StyledText displayController;
public ASEditor()
{
super();
displayController = this.getSourceViewer().getTextWidget();
}
}
But its maybe impossible.Because i cant get the SourceViewer instanz with
getSourceViewer().
Can some body help me about how can i SourceViewer Instanz in TextEditor?
Sorry for my bad English.If you cant understand my Quetion, you can post
me in this Topic.
Thanks in Advance.
Mu Jia
|
|
|
Re: How can i get SourceViewer in the TextEditor? [message #334440 is a reply to message #334414] |
Mon, 09 February 2009 04:20  |
Eclipse User |
|
|
|
MuJia wrote:
> Hello,
> My Editor extends Class TextEditor. I want to insert an function
> which NonEditable Modus is for my Editor. If my Editor work in this
> Modus, some keywordTexts in the Editor will be set to noneditable. For
> Example, for the Text from this java File: public class MyClass{}:
> public and class is the keywords. User cannt edit them.
> The TextEditor use a SourceViewer to manage the display of the
> Text in Editor. And the SourceViewer use the StyledText to controll
> the displayed Text. Therefore, I want to insert a VertifyListener into
> the StyledText of the SourceViewer in my Editor. But first i must get
> the StyledText of the SourceViewer of my TextEditor. I have
> written the following Code to get the StyledText.
>
> public class ASEditor extends TextEditor {
>
> StyledText displayController;
>
> public ASEditor()
> {
> super();
> displayController = this.getSourceViewer().getTextWidget();
>
> }
> }
> But its maybe impossible.Because i cant get the SourceViewer
> instanz with getSourceViewer().
Of course it will return 'null' when you ask for it before it has been
created but later getSourceViewer() will give you the viewer.
Dani
>
> Can some body help me about how can i SourceViewer Instanz in TextEditor?
>
> Sorry for my bad English.If you cant understand my Quetion, you can
> post me in this Topic.
> Thanks in Advance.
>
> Mu Jia
>
|
|
|
Powered by
FUDForum. Page generated in 0.04052 seconds