Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-text-dev] EditorInput method

Hi there,

I know I am not suppose to be writing to this group as it is for development issues,but I have asked my question to the Eclipse Newsgroup and couldn't get an appropraite answer.I will appreciate your pointers.

I am trying to make a plugin in which two programmers can work on the same file from remote location.For that I have to make the editor of my peer readonly through a messageDialog button.
I am using javaeditor from the SWTExample for testing on my own system.

I have already used all the following methods:

protected void doSetInput(IEditorInput input) throws CoreException {
   super.doSetInput(input);
   ((IFileEditorInput)input).getFile().setReadOnly(true);
}

Can't use the above method as it can't be called from another class for
some reason.But it does the job only when I change the boolean manually .

////////////////////////

public ISourceViewer getSourceViewer()  {
  return super.getSourceViewer();
}
public void method  {
 viewer.setEditable(false);
}

SourceViewer viewer;
it is in a try catch block so I get a NullpointerException on it.As viewer shows up NULL.

/////////

The third method was this one that is also giving  me a
NullPointerException

IFileEditorInput input =
(IFileEditorInput)getActiveEditorPart().getEditorInput();
((IFileEditorInput)input).getFile().setReadOnly(true);


i am not sure what method to call after getEditorInput so as to get hold
of the input.As I can't debug this method.

////////////////

The Last method that is also giving me a NullPointerException is the
following:

ISourceViewer viewer = this.getMySourceViewer();
System,.out.println("viewer" + viewer); // i get NULL here
abstractTextEditor.getSourceViewer();
textviewer.setEditable(false);

all these methods are in the are one class and they are called from
another class when the user presses a button that invokes the method.

To my understanding the location of these methods do play an important role as most of the time these methods are either invoked before they should be or don't work by pressing the button.


Secondly I though I should deactivate the editor as we do by clicking on the view in the workbench but I couldn't find that method.

Or may be I can look for that method that takes the input to Eclipse on a lower level then IEditorInput,IFileEditorInput,IstorageInput and change that input to something that would stop it from appearing on the editor.

I wuould appreciate your help.

Syed







_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail



Back to the top