Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Repost: I can't get the SourceViewer to invoke SetEditable
Repost: I can't get the SourceViewer to invoke SetEditable [message #61828] Wed, 04 June 2003 03:59
Syed Rizvi is currently offline Syed RizviFriend
Messages: 145
Registered: July 2009
Senior Member
Hi all,

I have asked this question couple of weeks ago but as couldn't solve the
problem as my editor was not working properly.

Actually I want to make the editor readonly by using SetEditable method
and for that I am trying to get hold of the viewer through ISourceViewer
by using the following code but can't get it to work and always get a null
value for
view.

ISourceViewer viewer = getSourceViwer();

I am calling the following method with a click of a button from
messageDialog but don't get it to work as I get a null vlaue for the
viewer.

public void setEditable(boolean editable) {
ISourceViewer viewer = getSourceViewer();
if (viewer != null) {
viewer.setEditable(editable);
}
}

My earlier quest of the solution was a hack by Andrew McCullough given
below that was getting me the viewer of the editor but I can't get the
setEditable(boolean) to work with it,and I don't know how to debug it.
Following is the method that I am using in my JavaEditor example.

if (part instanceof TextEditor) {
TextEditor editor = (TextEditor)part;
ITextViewer viewer =
(ITextViewer)editor.getAdapter(ITextOperationTarget.class);

if (viewer != null) {
viewer.setEditable(false);
}

}

I have set breakpoints before and after this viewer.setEditable,all of
them are called but the editor remains the same.
I would realy apprecaite any help.

Thanks

Syed
Previous Topic:Application Branding Example
Next Topic:Skinnable Eclipse?
Goto Forum:
  


Current Time: Mon Nov 04 19:21:02 GMT 2024

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

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

Back to the top