Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » How can i get SourceViewer in the TextEditor?
How can i get SourceViewer in the TextEditor? [message #334414] Sat, 07 February 2009 08:56 Go to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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
>
Previous Topic:Using command Framework to add items to pagebooks
Next Topic:Eclipse build problem
Goto Forum:
  


Current Time: Thu Mar 13 13:15:26 EDT 2025

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

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

Back to the top