|
Re: How JavaEditor example can extend CompilationUnitEditor [message #11021 is a reply to message #9236] |
Thu, 01 May 2003 17:24 |
Eclipse User |
|
|
|
Originally posted by: bob.objfac.com
It can't. This is telling you that the active editor in the page is the
standard Java editor, not your editor.
Bob
"Syed Rizvi" <sma_r@hotmail.com> wrote in message
news:b8olih$2g4$1@rogue.oti.com...
> Hi all,
>
> I am using the javaeditor example to test my plugin work.I am trying to
> get hold of ISourceViewer through the following methodby pressing a button
> on the messageDialog after teh editor has been created.
>
> public void setEditable(boolean editable) {
> ISourceViewer viewer = getSourceViewer();
> if (viewer != null) {
> viewer.setEditable(editable);
> }
> }
>
> But I am having some difficulty as I always get a null value for
> "viewer".I read a hack for this problem that is:
>
> if (part instanceof CompilationUnitEditor) {
> CompilationUnitEditor editor = (CompilationUnitEditor)part;
> ITextViewer viewer =
> (ITextViewer)editor.getAdapter(ITextOperationTarget.class);
> }
>
> I get "part" from this code
> IEditorPart part = page.getActiveEditor();
> System.out.println("part");
>
> The "part" value I get here says
> org.eclipse.internal.jdt.ui.javaeditor.compilationuniteditor .
>
> But my editor extends TextEditor not CompilatioUunitEditor,because of
> which the code doesn't run.If I change it to "part instanceof TextEditor"
> it won't work as the part value is different.
> On the other hand if I try to extends the javaeditor from
> CompilationUnitEditor I can't do that as I get an error "can't resolve
it".
>
> Any help would be appreciated.
>
> Syed
>
|
|
|
|
Re: How JavaEditor example can extend CompilationUnitEditor [message #12342 is a reply to message #11639] |
Fri, 02 May 2003 15:16 |
Eclipse User |
|
|
|
Originally posted by: bob.objfac.com
You can always set a breakpoint in your editor. If the debugger stops there,
your editor is running. (But I thought part of your problem was that
breakpoints are mysteriously not being hit?)
Bob
"Syed Rizvi" <sma_r@hotmail.com> wrote in message
news:b8splr$1gv$1@rogue.oti.com...
> :-( That is weird sort of,I have been working with that editor for such a
> long time knowing that it is my editor.Is there any way I can cjheck if my
> editor is really working as it is suppose to.
>
> Syed
>
>
> Bob Foster wrote:
>
> > It can't. This is telling you that the active editor in the page is the
> > standard Java editor, not your editor.
>
> > Bob
>
> > "Syed Rizvi" <sma_r@hotmail.com> wrote in message
> > news:b8olih$2g4$1@rogue.oti.com...
> > > Hi all,
> > >
> > > I am using the javaeditor example to test my plugin work.I am trying
to
> > > get hold of ISourceViewer through the following methodby pressing a
button
> > > on the messageDialog after teh editor has been created.
> > >
> > > public void setEditable(boolean editable) {
> > > ISourceViewer viewer = getSourceViewer();
> > > if (viewer != null) {
> > > viewer.setEditable(editable);
> > > }
> > > }
> > >
> > > But I am having some difficulty as I always get a null value for
> > > "viewer".I read a hack for this problem that is:
> > >
> > > if (part instanceof CompilationUnitEditor) {
> > > CompilationUnitEditor editor = (CompilationUnitEditor)part;
> > > ITextViewer viewer =
> > > (ITextViewer)editor.getAdapter(ITextOperationTarget.class);
> > > }
> > >
> > > I get "part" from this code
> > > IEditorPart part = page.getActiveEditor();
> > > System.out.println("part");
> > >
> > > The "part" value I get here says
> > > org.eclipse.internal.jdt.ui.javaeditor.compilationuniteditor .
> > >
> > > But my editor extends TextEditor not CompilatioUunitEditor,because of
> > > which the code doesn't run.If I change it to "part instanceof
TextEditor"
> > > it won't work as the part value is different.
> > > On the other hand if I try to extends the javaeditor from
> > > CompilationUnitEditor I can't do that as I get an error "can't resolve
> > it".
> > >
> > > Any help would be appreciated.
> > >
> > > Syed
> > >
>
>
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03304 seconds