Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » viewer = null when calling ISourceViewer viewer = getSourceViewer
viewer = null when calling ISourceViewer viewer = getSourceViewer [message #161455] Tue, 25 November 2003 03:29 Go to next message
Eclipse UserFriend
Originally posted by: sma_r.hotmial.com

Hi all,
I have asked this question couple of times before but the slution doesn't
get me my result.
I am getting a NULL value from the following line of code when the method
is called after the creation of the editor

public void setMyBoolean(boolean editable)
{
ISourceViewer viewer = getSourceViewer();
viewer.setEditable(editable); //there is no outcome from this line of
code
}

Then I found out a hack for this from Andrew that does get me the object
but still doesn't get seteditable(false) to work instead if i call
viewer.gettextWidget.setEnabled(false); then the editor area is made
readonly but I can't get anything copied from there or entered in the
editor through other programs.

if (part instanceof CompilationUnitEditor) {
CompilationUnitEditor editor = (CompilationUnitEditor)part;
ITextViewer viewer =
(ITextViewer)editor.getAdapter(ITextOperationTarget.class);
}
I ahve found nothing substantial about this getSourceViewer() in the
archives but there are too many question asked there,that shows other
users had some difficulty in getting hold of it.
i would really appreciate if I can know of any toehr way of getting hold
of the sourceViewer of the active editor.

I would really apprecaite any pointers.

Syed
Any idea how to solve this problem [message #161973 is a reply to message #161455] Tue, 25 November 2003 23:42 Go to previous message
Eclipse UserFriend
Syed wrote:

> Hi all,
> I have asked this question couple of times before but the slution doesn't
> get me my result.
> I am getting a NULL value from the following line of code when the method
> is called after the creation of the editor

> public void setMyBoolean(boolean editable)
> {
> ISourceViewer viewer = getSourceViewer();
> viewer.setEditable(editable); //there is no outcome from this line of
> code
> }

> Then I found out a hack for this from Andrew that does get me the object
> but still doesn't get seteditable(false) to work instead if i call
> viewer.gettextWidget.setEnabled(false); then the editor area is made
> readonly but I can't get anything copied from there or entered in the
> editor through other programs.

> if (part instanceof CompilationUnitEditor) {
> CompilationUnitEditor editor = (CompilationUnitEditor)part;
> ITextViewer viewer =
> (ITextViewer)editor.getAdapter(ITextOperationTarget.class);
> }
> I ahve found nothing substantial about this getSourceViewer() in the
> archives but there are too many question asked there,that shows other
> users had some difficulty in getting hold of it.
> i would really appreciate if I can know of any toehr way of getting hold
> of the sourceViewer of the active editor.

> I would really apprecaite any pointers.

> Syed
Previous Topic:Editable Partitions
Next Topic:Locking/Unlocking the editor
Goto Forum:
  


Current Time: Sun Apr 27 00:08:45 EDT 2025

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

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

Back to the top