Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 13:56 Go to next message
MuJia is currently offline MuJiaFriend
Messages: 1
Registered: July 2009
Junior Member
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 09:20 Go to previous message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
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 Dec 26 19:42:13 GMT 2024

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

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

Back to the top