Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-text-dev] Unable to get hold of ISourceViewer

Hi all,

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();

Actually I am using the JavaEditor example,there I am calling the following method through a messageDialog.What happens is that I frist open up a .java based file and call the following method after pressing one of the button on the Dialog.If the ButtonID is the correct one then this method is called.I have used the above code in the XMLEditor by calling createPartControl but in the case of javaEditor this method doesn't get called for some reason.I would really apprecaite if some one can help me on this.

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

Thanks

Syed Rizvi



_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE* http://join.msn.com/?page=features/junkmail



Back to the top