Home » Eclipse Projects » Eclipse Platform » How to call or Not to createPartControl()
|
Re: How to call or Not to createPartControl() [message #8871 is a reply to message #7567] |
Thu, 24 April 2003 00:53 |
Eclipse User |
|
|
|
Originally posted by: bob.objfac.com
There is nothing that is going to get you a sourceviewer reference before it
is created, so there's not much use in asking for 'the above functionality'.
Please see my reply in your previous thread on the same subject.
Bob
"Syed Rizvi" <sma_r@hotmail.com> wrote in message
news:b869sv$978$1@rogue.oti.com...
> Hi all,
>
> I am trying to get the following line to work but I get a null value for
> the viewer.
>
> ISourceViewer viewer = this.getSourceViewer();
>
> From the newsgroup someone sys that I am suppose use createPartControl()
> and someone else says that I can't use it as it is called from the
> framework.I read about it in the documentation where it says "Clients
> should not call this method (the workbench calls this method when it needs
> to, which may be never). "
>
> Is there any other way I can get the above functionality.
> I would realy apprecaite any help.
>
> Syed
>
|
|
| |
Re: How to call or Not to createPartControl() [message #9231 is a reply to message #8997] |
Thu, 24 April 2003 13:30 |
Eclipse User |
|
|
|
Originally posted by: mccull1.does.not.like.spam.us.ibm.com
The ISourceViewer is _probably_ created when the editor is created, but that
is really up to the editor. If the editor is a subclass of
AbstractTextEditor, you can get it back out using a hack, but there is no
API for it. See this bug:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=22452
and note that the same hack works if the left hand side says ISourceViewer
instead of ITextViewer.
-Andrew
"Syed Rizvi" <sma_r@hotmail.com> wrote in message
news:b87sdv$969$1@rogue.oti.com...
> I am not clear about one thing and that is when I open up an editor is the
> sourceViewer created or not.As I call the underlined method after the
> creation of the editor,as I have stated in the previous thread on the same
> subject.
>
> Syed
>
> Bob Foster wrote:
>
> > There is nothing that is going to get you a sourceviewer reference
before it
> > is created, so there's not much use in asking for 'the above
functionality'.
> > Please see my reply in your previous thread on the same subject.
>
> > Bob
>
> > "Syed Rizvi" <sma_r@hotmail.com> wrote in message
> > news:b869sv$978$1@rogue.oti.com...
> > > Hi all,
> > >
> > > I am trying to get the following line to work but I get a null value
for
> > > the viewer.
> > >
> > > ISourceViewer viewer = this.getSourceViewer();
> > >
> > > From the newsgroup someone sys that I am suppose use
createPartControl()
> > > and someone else says that I can't use it as it is called from the
> > > framework.I read about it in the documentation where it says "Clients
> > > should not call this method (the workbench calls this method when it
needs
> > > to, which may be never). "
> > >
> > > Is there any other way I can get the above functionality.
> > > I would realy apprecaite any help.
> > >
> > > Syed
> > >
>
>
>
>
>
|
|
|
Re: How to call or Not to createPartControl() [message #10257 is a reply to message #9231] |
Thu, 24 April 2003 13:58 |
Eclipse User |
|
|
|
Originally posted by: bob.objfac.com
That reply is puzzling the heck out of me. I'm looking at the code in
AbstractTextEditor createPartControl() which unconditionally calls
createSourceViewer() which unconditionally does a new SourceViewer, in both
AbstractTextEditor and in the TextEditor override.
So how is the SourceViewer instance available before this call?
Bob
"Andrew McCullough" <mccull1@does.not.like.spam.us.ibm.com> wrote in message
news:b88opu$j0$1@rogue.oti.com...
>
>
> The ISourceViewer is _probably_ created when the editor is created, but
that
> is really up to the editor. If the editor is a subclass of
> AbstractTextEditor, you can get it back out using a hack, but there is no
> API for it. See this bug:
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=22452
>
> and note that the same hack works if the left hand side says ISourceViewer
> instead of ITextViewer.
>
> -Andrew
>
>
> "Syed Rizvi" <sma_r@hotmail.com> wrote in message
> news:b87sdv$969$1@rogue.oti.com...
> > I am not clear about one thing and that is when I open up an editor is
the
> > sourceViewer created or not.As I call the underlined method after the
> > creation of the editor,as I have stated in the previous thread on the
same
> > subject.
> >
> > Syed
> >
> > Bob Foster wrote:
> >
> > > There is nothing that is going to get you a sourceviewer reference
> before it
> > > is created, so there's not much use in asking for 'the above
> functionality'.
> > > Please see my reply in your previous thread on the same subject.
> >
> > > Bob
> >
> > > "Syed Rizvi" <sma_r@hotmail.com> wrote in message
> > > news:b869sv$978$1@rogue.oti.com...
> > > > Hi all,
> > > >
> > > > I am trying to get the following line to work but I get a null value
> for
> > > > the viewer.
> > > >
> > > > ISourceViewer viewer = this.getSourceViewer();
> > > >
> > > > From the newsgroup someone sys that I am suppose use
> createPartControl()
> > > > and someone else says that I can't use it as it is called from the
> > > > framework.I read about it in the documentation where it says
"Clients
> > > > should not call this method (the workbench calls this method when it
> needs
> > > > to, which may be never). "
> > > >
> > > > Is there any other way I can get the above functionality.
> > > > I would realy apprecaite any help.
> > > >
> > > > Syed
> > > >
> >
> >
> >
> >
> >
>
>
|
|
|
Re: How to call or Not to createPartControl() [message #10389 is a reply to message #10257] |
Thu, 24 April 2003 14:04 |
Eclipse User |
|
|
|
Originally posted by: mccull1.does.not.like.spam.us.ibm.com
Sorry, I should have been more explicit:
The SourceViewer is obviously not available before the call to
createPartControl, but Syed said the editor was already created ("As I call
the underlined method after the
creation of the editor"), and that he was re-calling createPartControl(),
which is obviously inappropriate.
As long as we're talking about AbstractTextEditor & Subclasses, the
SourceViewer is created when the editor is created, and it can be retrieved
via the hack described in the bug report. Any other editor, of course,
might work differently.
-Andrew
"Bob Foster" <bob@objfac.com> wrote in message
news:b88pqf$1o4$1@rogue.oti.com...
> That reply is puzzling the heck out of me. I'm looking at the code in
> AbstractTextEditor createPartControl() which unconditionally calls
> createSourceViewer() which unconditionally does a new SourceViewer, in
both
> AbstractTextEditor and in the TextEditor override.
>
> So how is the SourceViewer instance available before this call?
>
> Bob
>
> "Andrew McCullough" <mccull1@does.not.like.spam.us.ibm.com> wrote in
message
> news:b88opu$j0$1@rogue.oti.com...
> >
> >
> > The ISourceViewer is _probably_ created when the editor is created, but
> that
> > is really up to the editor. If the editor is a subclass of
> > AbstractTextEditor, you can get it back out using a hack, but there is
no
> > API for it. See this bug:
> >
> > https://bugs.eclipse.org/bugs/show_bug.cgi?id=22452
> >
> > and note that the same hack works if the left hand side says
ISourceViewer
> > instead of ITextViewer.
> >
> > -Andrew
> >
> >
> > "Syed Rizvi" <sma_r@hotmail.com> wrote in message
> > news:b87sdv$969$1@rogue.oti.com...
> > > I am not clear about one thing and that is when I open up an editor is
> the
> > > sourceViewer created or not.As I call the underlined method after the
> > > creation of the editor,as I have stated in the previous thread on the
> same
> > > subject.
> > >
> > > Syed
> > >
> > > Bob Foster wrote:
> > >
> > > > There is nothing that is going to get you a sourceviewer reference
> > before it
> > > > is created, so there's not much use in asking for 'the above
> > functionality'.
> > > > Please see my reply in your previous thread on the same subject.
> > >
> > > > Bob
> > >
> > > > "Syed Rizvi" <sma_r@hotmail.com> wrote in message
> > > > news:b869sv$978$1@rogue.oti.com...
> > > > > Hi all,
> > > > >
> > > > > I am trying to get the following line to work but I get a null
value
> > for
> > > > > the viewer.
> > > > >
> > > > > ISourceViewer viewer = this.getSourceViewer();
> > > > >
> > > > > From the newsgroup someone sys that I am suppose use
> > createPartControl()
> > > > > and someone else says that I can't use it as it is called from the
> > > > > framework.I read about it in the documentation where it says
> "Clients
> > > > > should not call this method (the workbench calls this method when
it
> > needs
> > > > > to, which may be never). "
> > > > >
> > > > > Is there any other way I can get the above functionality.
> > > > > I would realy apprecaite any help.
> > > > >
> > > > > Syed
> > > > >
> > >
> > >
> > >
> > >
> > >
> >
> >
>
>
|
|
|
Re: How to call or Not to createPartControl() [message #10585 is a reply to message #10389] |
Thu, 24 April 2003 14:31 |
Eclipse User |
|
|
|
Originally posted by: bob.objfac.com
Got it. If it's one's own editor, of course, you don't need the hack. You
can always wrap the protected getSourceViewer() method.
You make an interesting point. From Syed's earlier posts, I assumed his
problem was that he was trying to get the SourceViewer too early in the
cycle. For example, it's an easy mistake to try to get it in the editor
constructor or initialization method (at least, I've made it ;). Maybe
there's some other kind of bug.
Hey, Syed, if my last reply in the other thread didn't help you, how about
posting some source code?
Bob
"Andrew McCullough" <mccull1@does.not.like.spam.us.ibm.com> wrote in message
news:b88qpr$2mt$1@rogue.oti.com...
>
> Sorry, I should have been more explicit:
>
> The SourceViewer is obviously not available before the call to
> createPartControl, but Syed said the editor was already created ("As I
call
> the underlined method after the
> creation of the editor"), and that he was re-calling createPartControl(),
> which is obviously inappropriate.
>
> As long as we're talking about AbstractTextEditor & Subclasses, the
> SourceViewer is created when the editor is created, and it can be
retrieved
> via the hack described in the bug report. Any other editor, of course,
> might work differently.
>
> -Andrew
>
> "Bob Foster" <bob@objfac.com> wrote in message
> news:b88pqf$1o4$1@rogue.oti.com...
> > That reply is puzzling the heck out of me. I'm looking at the code in
> > AbstractTextEditor createPartControl() which unconditionally calls
> > createSourceViewer() which unconditionally does a new SourceViewer, in
> both
> > AbstractTextEditor and in the TextEditor override.
> >
> > So how is the SourceViewer instance available before this call?
> >
> > Bob
> >
> > "Andrew McCullough" <mccull1@does.not.like.spam.us.ibm.com> wrote in
> message
> > news:b88opu$j0$1@rogue.oti.com...
> > >
> > >
> > > The ISourceViewer is _probably_ created when the editor is created,
but
> > that
> > > is really up to the editor. If the editor is a subclass of
> > > AbstractTextEditor, you can get it back out using a hack, but there is
> no
> > > API for it. See this bug:
> > >
> > > https://bugs.eclipse.org/bugs/show_bug.cgi?id=22452
> > >
> > > and note that the same hack works if the left hand side says
> ISourceViewer
> > > instead of ITextViewer.
> > >
> > > -Andrew
> > >
> > >
> > > "Syed Rizvi" <sma_r@hotmail.com> wrote in message
> > > news:b87sdv$969$1@rogue.oti.com...
> > > > I am not clear about one thing and that is when I open up an editor
is
> > the
> > > > sourceViewer created or not.As I call the underlined method after
the
> > > > creation of the editor,as I have stated in the previous thread on
the
> > same
> > > > subject.
> > > >
> > > > Syed
> > > >
> > > > Bob Foster wrote:
> > > >
> > > > > There is nothing that is going to get you a sourceviewer reference
> > > before it
> > > > > is created, so there's not much use in asking for 'the above
> > > functionality'.
> > > > > Please see my reply in your previous thread on the same subject.
> > > >
> > > > > Bob
> > > >
> > > > > "Syed Rizvi" <sma_r@hotmail.com> wrote in message
> > > > > news:b869sv$978$1@rogue.oti.com...
> > > > > > Hi all,
> > > > > >
> > > > > > I am trying to get the following line to work but I get a null
> value
> > > for
> > > > > > the viewer.
> > > > > >
> > > > > > ISourceViewer viewer = this.getSourceViewer();
> > > > > >
> > > > > > From the newsgroup someone sys that I am suppose use
> > > createPartControl()
> > > > > > and someone else says that I can't use it as it is called from
the
> > > > > > framework.I read about it in the documentation where it says
> > "Clients
> > > > > > should not call this method (the workbench calls this method
when
> it
> > > needs
> > > > > > to, which may be never). "
> > > > > >
> > > > > > Is there any other way I can get the above functionality.
> > > > > > I would realy apprecaite any help.
> > > > > >
> > > > > > Syed
> > > > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
|
|
|
Re: How to call or Not to createPartControl() [message #14296 is a reply to message #10585] |
Fri, 25 April 2003 05:14 |
Syed Rizvi Messages: 145 Registered: July 2009 |
Senior Member |
|
|
Thanks both of you for the info.What I am actually doing is using the
JavaEditor example of Eclipse.With that I can open up an editor for a
java file(So the editor is open).This editor extends TextEditor so
createPartControl must be called somewhere BUT it is not called in my
JavaEditor code.
I am using the ButtonPressed method in MessageDialog.Whenever a button is
pressed it checks its ID an and simply calls the setEditable method in the
main class(class with the JavaEditor Constructor).
So to my understanding when the editor has been created then I should be
able to get hold of the viewer.
I have tried both of your solutions,
Bob
With your hack the createPartControl is not called(even being in the
Construtor class for the JavaEditor).Secondly the setEditable method
didn't got me the "viewer".Can you let me know which code you want.
Andrew for you hack,I couldn't get rid of the error that I am getting on
"editor".Any idea how to clear this.
Again thanks both of you for the info.
Syed
Bob Foster wrote:
> Got it. If it's one's own editor, of course, you don't need the hack. You
> can always wrap the protected getSourceViewer() method.
> You make an interesting point. From Syed's earlier posts, I assumed his
> problem was that he was trying to get the SourceViewer too early in the
> cycle. For example, it's an easy mistake to try to get it in the editor
> constructor or initialization method (at least, I've made it ;). Maybe
> there's some other kind of bug.
> Hey, Syed, if my last reply in the other thread didn't help you, how about
> posting some source code?
> Bob
> "Andrew McCullough" <mccull1@does.not.like.spam.us.ibm.com> wrote in message
> news:b88qpr$2mt$1@rogue.oti.com...
> >
> > Sorry, I should have been more explicit:
> >
> > The SourceViewer is obviously not available before the call to
> > createPartControl, but Syed said the editor was already created ("As I
> call
> > the underlined method after the
> > creation of the editor"), and that he was re-calling createPartControl(),
> > which is obviously inappropriate.
> >
> > As long as we're talking about AbstractTextEditor & Subclasses, the
> > SourceViewer is created when the editor is created, and it can be
> retrieved
> > via the hack described in the bug report. Any other editor, of course,
> > might work differently.
> >
> > -Andrew
> >
> > "Bob Foster" <bob@objfac.com> wrote in message
> > news:b88pqf$1o4$1@rogue.oti.com...
> > > That reply is puzzling the heck out of me. I'm looking at the code in
> > > AbstractTextEditor createPartControl() which unconditionally calls
> > > createSourceViewer() which unconditionally does a new SourceViewer, in
> > both
> > > AbstractTextEditor and in the TextEditor override.
> > >
> > > So how is the SourceViewer instance available before this call?
> > >
> > > Bob
> > >
> > > "Andrew McCullough" <mccull1@does.not.like.spam.us.ibm.com> wrote in
> > message
> > > news:b88opu$j0$1@rogue.oti.com...
> > > >
> > > >
> > > > The ISourceViewer is _probably_ created when the editor is created,
> but
> > > that
> > > > is really up to the editor. If the editor is a subclass of
> > > > AbstractTextEditor, you can get it back out using a hack, but there is
> > no
> > > > API for it. See this bug:
> > > >
> > > > https://bugs.eclipse.org/bugs/show_bug.cgi?id=22452
> > > >
> > > > and note that the same hack works if the left hand side says
> > ISourceViewer
> > > > instead of ITextViewer.
> > > >
> > > > -Andrew
> > > >
> > > >
> > > > "Syed Rizvi" <sma_r@hotmail.com> wrote in message
> > > > news:b87sdv$969$1@rogue.oti.com...
> > > > > I am not clear about one thing and that is when I open up an editor
> is
> > > the
> > > > > sourceViewer created or not.As I call the underlined method after
> the
> > > > > creation of the editor,as I have stated in the previous thread on
> the
> > > same
> > > > > subject.
> > > > >
> > > > > Syed
> > > > >
> > > > > Bob Foster wrote:
> > > > >
> > > > > > There is nothing that is going to get you a sourceviewer reference
> > > > before it
> > > > > > is created, so there's not much use in asking for 'the above
> > > > functionality'.
> > > > > > Please see my reply in your previous thread on the same subject.
> > > > >
> > > > > > Bob
> > > > >
> > > > > > "Syed Rizvi" <sma_r@hotmail.com> wrote in message
> > > > > > news:b869sv$978$1@rogue.oti.com...
> > > > > > > Hi all,
> > > > > > >
> > > > > > > I am trying to get the following line to work but I get a null
> > value
> > > > for
> > > > > > > the viewer.
> > > > > > >
> > > > > > > ISourceViewer viewer = this.getSourceViewer();
> > > > > > >
> > > > > > > From the newsgroup someone sys that I am suppose use
> > > > createPartControl()
> > > > > > > and someone else says that I can't use it as it is called from
> the
> > > > > > > framework.I read about it in the documentation where it says
> > > "Clients
> > > > > > > should not call this method (the workbench calls this method
> when
> > it
> > > > needs
> > > > > > > to, which may be never). "
> > > > > > >
> > > > > > > Is there any other way I can get the above functionality.
> > > > > > > I would realy apprecaite any help.
> > > > > > >
> > > > > > > Syed
> > > > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
|
|
|
Re: How to call or Not to createPartControl() [message #14311 is a reply to message #14296] |
Fri, 25 April 2003 05:44 |
Eclipse User |
|
|
|
Originally posted by: bob.objfac.com
You put a breakpoint in createPartControl() and it is never called? That is
very strange. How is this editor being created?
To back all the way out of this confusion, put a breakpoint in the
createPartControl() method of the unmodified JavaEditor example, edit a .jav
file and see what happens. If you put breakpoints in the initialize method,
etc. you will be able to see the order in which these things should happen.
Bob
"Syed Rizvi" <sma_r@hotmail.com> wrote in message
news:b8ag7d$a1c$1@rogue.oti.com...
> Thanks both of you for the info.What I am actually doing is using the
> JavaEditor example of Eclipse.With that I can open up an editor for a
> java file(So the editor is open).This editor extends TextEditor so
> createPartControl must be called somewhere BUT it is not called in my
> JavaEditor code.
> I am using the ButtonPressed method in MessageDialog.Whenever a button is
> pressed it checks its ID an and simply calls the setEditable method in the
> main class(class with the JavaEditor Constructor).
> So to my understanding when the editor has been created then I should be
> able to get hold of the viewer.
>
> I have tried both of your solutions,
> Bob
> With your hack the createPartControl is not called(even being in the
> Construtor class for the JavaEditor).Secondly the setEditable method
> didn't got me the "viewer".Can you let me know which code you want.
>
>
> Andrew for you hack,I couldn't get rid of the error that I am getting on
> "editor".Any idea how to clear this.
>
> Again thanks both of you for the info.
>
> Syed
>
>
>
> Bob Foster wrote:
>
> > Got it. If it's one's own editor, of course, you don't need the hack.
You
> > can always wrap the protected getSourceViewer() method.
>
> > You make an interesting point. From Syed's earlier posts, I assumed his
> > problem was that he was trying to get the SourceViewer too early in the
> > cycle. For example, it's an easy mistake to try to get it in the editor
> > constructor or initialization method (at least, I've made it ;). Maybe
> > there's some other kind of bug.
>
> > Hey, Syed, if my last reply in the other thread didn't help you, how
about
> > posting some source code?
>
> > Bob
>
> > "Andrew McCullough" <mccull1@does.not.like.spam.us.ibm.com> wrote in
message
> > news:b88qpr$2mt$1@rogue.oti.com...
> > >
> > > Sorry, I should have been more explicit:
> > >
> > > The SourceViewer is obviously not available before the call to
> > > createPartControl, but Syed said the editor was already created ("As I
> > call
> > > the underlined method after the
> > > creation of the editor"), and that he was re-calling
createPartControl(),
> > > which is obviously inappropriate.
> > >
> > > As long as we're talking about AbstractTextEditor & Subclasses, the
> > > SourceViewer is created when the editor is created, and it can be
> > retrieved
> > > via the hack described in the bug report. Any other editor, of
course,
> > > might work differently.
> > >
> > > -Andrew
> > >
> > > "Bob Foster" <bob@objfac.com> wrote in message
> > > news:b88pqf$1o4$1@rogue.oti.com...
> > > > That reply is puzzling the heck out of me. I'm looking at the code
in
> > > > AbstractTextEditor createPartControl() which unconditionally calls
> > > > createSourceViewer() which unconditionally does a new SourceViewer,
in
> > > both
> > > > AbstractTextEditor and in the TextEditor override.
> > > >
> > > > So how is the SourceViewer instance available before this call?
> > > >
> > > > Bob
> > > >
> > > > "Andrew McCullough" <mccull1@does.not.like.spam.us.ibm.com> wrote in
> > > message
> > > > news:b88opu$j0$1@rogue.oti.com...
> > > > >
> > > > >
> > > > > The ISourceViewer is _probably_ created when the editor is
created,
> > but
> > > > that
> > > > > is really up to the editor. If the editor is a subclass of
> > > > > AbstractTextEditor, you can get it back out using a hack, but
there is
> > > no
> > > > > API for it. See this bug:
> > > > >
> > > > > https://bugs.eclipse.org/bugs/show_bug.cgi?id=22452
> > > > >
> > > > > and note that the same hack works if the left hand side says
> > > ISourceViewer
> > > > > instead of ITextViewer.
> > > > >
> > > > > -Andrew
> > > > >
> > > > >
> > > > > "Syed Rizvi" <sma_r@hotmail.com> wrote in message
> > > > > news:b87sdv$969$1@rogue.oti.com...
> > > > > > I am not clear about one thing and that is when I open up an
editor
> > is
> > > > the
> > > > > > sourceViewer created or not.As I call the underlined method
after
> > the
> > > > > > creation of the editor,as I have stated in the previous thread
on
> > the
> > > > same
> > > > > > subject.
> > > > > >
> > > > > > Syed
> > > > > >
> > > > > > Bob Foster wrote:
> > > > > >
> > > > > > > There is nothing that is going to get you a sourceviewer
reference
> > > > > before it
> > > > > > > is created, so there's not much use in asking for 'the above
> > > > > functionality'.
> > > > > > > Please see my reply in your previous thread on the same
subject.
> > > > > >
> > > > > > > Bob
> > > > > >
> > > > > > > "Syed Rizvi" <sma_r@hotmail.com> wrote in message
> > > > > > > news:b869sv$978$1@rogue.oti.com...
> > > > > > > > Hi all,
> > > > > > > >
> > > > > > > > I am trying to get the following line to work but I get a
null
> > > value
> > > > > for
> > > > > > > > the viewer.
> > > > > > > >
> > > > > > > > ISourceViewer viewer = this.getSourceViewer();
> > > > > > > >
> > > > > > > > From the newsgroup someone sys that I am suppose use
> > > > > createPartControl()
> > > > > > > > and someone else says that I can't use it as it is called
from
> > the
> > > > > > > > framework.I read about it in the documentation where it says
> > > > "Clients
> > > > > > > > should not call this method (the workbench calls this method
> > when
> > > it
> > > > > needs
> > > > > > > > to, which may be never). "
> > > > > > > >
> > > > > > > > Is there any other way I can get the above functionality.
> > > > > > > > I would realy apprecaite any help.
> > > > > > > >
> > > > > > > > Syed
> > > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
>
>
>
>
>
|
|
|
Re: How to call or Not to createPartControl() [message #14340 is a reply to message #14311] |
Fri, 25 April 2003 05:58 |
Syed Rizvi Messages: 145 Registered: July 2009 |
Senior Member |
|
|
Bob
There is no createPartControl method in the unmodified javaeditor example.
it is simply calling with "super" the TextEditor as the javaeditor extends
TextEditor,and I think that is what is calling createPartControl.
Syed
Foster wrote:
> You put a breakpoint in createPartControl() and it is never called? That is
> very strange. How is this editor being created?
> To back all the way out of this confusion, put a breakpoint in the
> createPartControl() method of the unmodified JavaEditor example, edit a .jav
> file and see what happens. If you put breakpoints in the initialize method,
> etc. you will be able to see the order in which these things should happen.
> Bob
> "Syed Rizvi" <sma_r@hotmail.com> wrote in message
> news:b8ag7d$a1c$1@rogue.oti.com...
> > Thanks both of you for the info.What I am actually doing is using the
> > JavaEditor example of Eclipse.With that I can open up an editor for a
> > java file(So the editor is open).This editor extends TextEditor so
> > createPartControl must be called somewhere BUT it is not called in my
> > JavaEditor code.
> > I am using the ButtonPressed method in MessageDialog.Whenever a button is
> > pressed it checks its ID an and simply calls the setEditable method in the
> > main class(class with the JavaEditor Constructor).
> > So to my understanding when the editor has been created then I should be
> > able to get hold of the viewer.
> >
> > I have tried both of your solutions,
> > Bob
> > With your hack the createPartControl is not called(even being in the
> > Construtor class for the JavaEditor).Secondly the setEditable method
> > didn't got me the "viewer".Can you let me know which code you want.
> >
> >
> > Andrew for you hack,I couldn't get rid of the error that I am getting on
> > "editor".Any idea how to clear this.
> >
> > Again thanks both of you for the info.
> >
> > Syed
> >
> >
> >
> > Bob Foster wrote:
> >
> > > Got it. If it's one's own editor, of course, you don't need the hack.
> You
> > > can always wrap the protected getSourceViewer() method.
> >
> > > You make an interesting point. From Syed's earlier posts, I assumed his
> > > problem was that he was trying to get the SourceViewer too early in the
> > > cycle. For example, it's an easy mistake to try to get it in the editor
> > > constructor or initialization method (at least, I've made it ;). Maybe
> > > there's some other kind of bug.
> >
> > > Hey, Syed, if my last reply in the other thread didn't help you, how
> about
> > > posting some source code?
> >
> > > Bob
> >
> > > "Andrew McCullough" <mccull1@does.not.like.spam.us.ibm.com> wrote in
> message
> > > news:b88qpr$2mt$1@rogue.oti.com...
> > > >
> > > > Sorry, I should have been more explicit:
> > > >
> > > > The SourceViewer is obviously not available before the call to
> > > > createPartControl, but Syed said the editor was already created ("As I
> > > call
> > > > the underlined method after the
> > > > creation of the editor"), and that he was re-calling
> createPartControl(),
> > > > which is obviously inappropriate.
> > > >
> > > > As long as we're talking about AbstractTextEditor & Subclasses, the
> > > > SourceViewer is created when the editor is created, and it can be
> > > retrieved
> > > > via the hack described in the bug report. Any other editor, of
> course,
> > > > might work differently.
> > > >
> > > > -Andrew
> > > >
> > > > "Bob Foster" <bob@objfac.com> wrote in message
> > > > news:b88pqf$1o4$1@rogue.oti.com...
> > > > > That reply is puzzling the heck out of me. I'm looking at the code
> in
> > > > > AbstractTextEditor createPartControl() which unconditionally calls
> > > > > createSourceViewer() which unconditionally does a new SourceViewer,
> in
> > > > both
> > > > > AbstractTextEditor and in the TextEditor override.
> > > > >
> > > > > So how is the SourceViewer instance available before this call?
> > > > >
> > > > > Bob
> > > > >
> > > > > "Andrew McCullough" <mccull1@does.not.like.spam.us.ibm.com> wrote in
> > > > message
> > > > > news:b88opu$j0$1@rogue.oti.com...
> > > > > >
> > > > > >
> > > > > > The ISourceViewer is _probably_ created when the editor is
> created,
> > > but
> > > > > that
> > > > > > is really up to the editor. If the editor is a subclass of
> > > > > > AbstractTextEditor, you can get it back out using a hack, but
> there is
> > > > no
> > > > > > API for it. See this bug:
> > > > > >
> > > > > > https://bugs.eclipse.org/bugs/show_bug.cgi?id=22452
> > > > > >
> > > > > > and note that the same hack works if the left hand side says
> > > > ISourceViewer
> > > > > > instead of ITextViewer.
> > > > > >
> > > > > > -Andrew
> > > > > >
> > > > > >
> > > > > > "Syed Rizvi" <sma_r@hotmail.com> wrote in message
> > > > > > news:b87sdv$969$1@rogue.oti.com...
> > > > > > > I am not clear about one thing and that is when I open up an
> editor
> > > is
> > > > > the
> > > > > > > sourceViewer created or not.As I call the underlined method
> after
> > > the
> > > > > > > creation of the editor,as I have stated in the previous thread
> on
> > > the
> > > > > same
> > > > > > > subject.
> > > > > > >
> > > > > > > Syed
> > > > > > >
> > > > > > > Bob Foster wrote:
> > > > > > >
> > > > > > > > There is nothing that is going to get you a sourceviewer
> reference
> > > > > > before it
> > > > > > > > is created, so there's not much use in asking for 'the above
> > > > > > functionality'.
> > > > > > > > Please see my reply in your previous thread on the same
> subject.
> > > > > > >
> > > > > > > > Bob
> > > > > > >
> > > > > > > > "Syed Rizvi" <sma_r@hotmail.com> wrote in message
> > > > > > > > news:b869sv$978$1@rogue.oti.com...
> > > > > > > > > Hi all,
> > > > > > > > >
> > > > > > > > > I am trying to get the following line to work but I get a
> null
> > > > value
> > > > > > for
> > > > > > > > > the viewer.
> > > > > > > > >
> > > > > > > > > ISourceViewer viewer = this.getSourceViewer();
> > > > > > > > >
> > > > > > > > > From the newsgroup someone sys that I am suppose use
> > > > > > createPartControl()
> > > > > > > > > and someone else says that I can't use it as it is called
> from
> > > the
> > > > > > > > > framework.I read about it in the documentation where it says
> > > > > "Clients
> > > > > > > > > should not call this method (the workbench calls this method
> > > when
> > > > it
> > > > > > needs
> > > > > > > > > to, which may be never). "
> > > > > > > > >
> > > > > > > > > Is there any other way I can get the above functionality.
> > > > > > > > > I would realy apprecaite any help.
> > > > > > > > >
> > > > > > > > > Syed
> > > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> >
> >
> >
> >
> >
|
|
|
Re(2): How to call or Not to createPartControl() [message #15449 is a reply to message #14340] |
Fri, 25 April 2003 15:05 |
Syed Rizvi Messages: 145 Registered: July 2009 |
Senior Member |
|
|
The JavaEditor is using createPartControl of TextEditor,so I think that is
what is being used by the editor.
Syed
Syed Rizvi wrote:
> Bob
> There is no createPartControl method in the unmodified javaeditor example.
> it is simply calling with "super" the TextEditor as the javaeditor extends
> TextEditor,and I think that is what is calling createPartControl.
> Syed
> Foster wrote:
> > You put a breakpoint in createPartControl() and it is never called? That is
> > very strange. How is this editor being created?
> > To back all the way out of this confusion, put a breakpoint in the
> > createPartControl() method of the unmodified JavaEditor example, edit a
jav
> > file and see what happens. If you put breakpoints in the initialize method,
> > etc. you will be able to see the order in which these things should happen.
> > Bob
> > "Syed Rizvi" <sma_r@hotmail.com> wrote in message
> > news:b8ag7d$a1c$1@rogue.oti.com...
> > > Thanks both of you for the info.What I am actually doing is using the
> > > JavaEditor example of Eclipse.With that I can open up an editor for a
> > > java file(So the editor is open).This editor extends TextEditor so
> > > createPartControl must be called somewhere BUT it is not called in my
> > > JavaEditor code.
> > > I am using the ButtonPressed method in MessageDialog.Whenever a button is
> > > pressed it checks its ID an and simply calls the setEditable method in
the
> > > main class(class with the JavaEditor Constructor).
> > > So to my understanding when the editor has been created then I should be
> > > able to get hold of the viewer.
> > >
> > > I have tried both of your solutions,
> > > Bob
> > > With your hack the createPartControl is not called(even being in the
> > > Construtor class for the JavaEditor).Secondly the setEditable method
> > > didn't got me the "viewer".Can you let me know which code you want.
> > >
> > >
> > > Andrew for you hack,I couldn't get rid of the error that I am getting on
> > > "editor".Any idea how to clear this.
> > >
> > > Again thanks both of you for the info.
> > >
> > > Syed
> > >
> > >
> > >
> > > Bob Foster wrote:
> > >
> > > > Got it. If it's one's own editor, of course, you don't need the hack.
> > You
> > > > can always wrap the protected getSourceViewer() method.
> > >
> > > > You make an interesting point. From Syed's earlier posts, I assumed his
> > > > problem was that he was trying to get the SourceViewer too early in the
> > > > cycle. For example, it's an easy mistake to try to get it in the editor
> > > > constructor or initialization method (at least, I've made it ;). Maybe
> > > > there's some other kind of bug.
> > >
> > > > Hey, Syed, if my last reply in the other thread didn't help you, how
> > about
> > > > posting some source code?
> > >
> > > > Bob
> > >
> > > > "Andrew McCullough" <mccull1@does.not.like.spam.us.ibm.com> wrote in
> > message
> > > > news:b88qpr$2mt$1@rogue.oti.com...
> > > > >
> > > > > Sorry, I should have been more explicit:
> > > > >
> > > > > The SourceViewer is obviously not available before the call to
> > > > > createPartControl, but Syed said the editor was already created ("As
I
> > > > call
> > > > > the underlined method after the
> > > > > creation of the editor"), and that he was re-calling
> > createPartControl(),
> > > > > which is obviously inappropriate.
> > > > >
> > > > > As long as we're talking about AbstractTextEditor & Subclasses, the
> > > > > SourceViewer is created when the editor is created, and it can be
> > > > retrieved
> > > > > via the hack described in the bug report. Any other editor, of
> > course,
> > > > > might work differently.
> > > > >
> > > > > -Andrew
> > > > >
> > > > > "Bob Foster" <bob@objfac.com> wrote in message
> > > > > news:b88pqf$1o4$1@rogue.oti.com...
> > > > > > That reply is puzzling the heck out of me. I'm looking at the code
> > in
> > > > > > AbstractTextEditor createPartControl() which unconditionally calls
> > > > > > createSourceViewer() which unconditionally does a new SourceViewer,
> > in
> > > > > both
> > > > > > AbstractTextEditor and in the TextEditor override.
> > > > > >
> > > > > > So how is the SourceViewer instance available before this call?
> > > > > >
> > > > > > Bob
> > > > > >
> > > > > > "Andrew McCullough" <mccull1@does.not.like.spam.us.ibm.com> wrote
in
> > > > > message
> > > > > > news:b88opu$j0$1@rogue.oti.com...
> > > > > > >
> > > > > > >
> > > > > > > The ISourceViewer is _probably_ created when the editor is
> > created,
> > > > but
> > > > > > that
> > > > > > > is really up to the editor. If the editor is a subclass of
> > > > > > > AbstractTextEditor, you can get it back out using a hack, but
> > there is
> > > > > no
> > > > > > > API for it. See this bug:
> > > > > > >
> > > > > > > https://bugs.eclipse.org/bugs/show_bug.cgi?id=22452
> > > > > > >
> > > > > > > and note that the same hack works if the left hand side says
> > > > > ISourceViewer
> > > > > > > instead of ITextViewer.
> > > > > > >
> > > > > > > -Andrew
> > > > > > >
> > > > > > >
> > > > > > > "Syed Rizvi" <sma_r@hotmail.com> wrote in message
> > > > > > > news:b87sdv$969$1@rogue.oti.com...
> > > > > > > > I am not clear about one thing and that is when I open up an
> > editor
> > > > is
> > > > > > the
> > > > > > > > sourceViewer created or not.As I call the underlined method
> > after
> > > > the
> > > > > > > > creation of the editor,as I have stated in the previous thread
> > on
> > > > the
> > > > > > same
> > > > > > > > subject.
> > > > > > > >
> > > > > > > > Syed
> > > > > > > >
> > > > > > > > Bob Foster wrote:
> > > > > > > >
> > > > > > > > > There is nothing that is going to get you a sourceviewer
> > reference
> > > > > > > before it
> > > > > > > > > is created, so there's not much use in asking for 'the above
> > > > > > > functionality'.
> > > > > > > > > Please see my reply in your previous thread on the same
> > subject.
> > > > > > > >
> > > > > > > > > Bob
> > > > > > > >
> > > > > > > > > "Syed Rizvi" <sma_r@hotmail.com> wrote in message
> > > > > > > > > news:b869sv$978$1@rogue.oti.com...
> > > > > > > > > > Hi all,
> > > > > > > > > >
> > > > > > > > > > I am trying to get the following line to work but I get a
> > null
> > > > > value
> > > > > > > for
> > > > > > > > > > the viewer.
> > > > > > > > > >
> > > > > > > > > > ISourceViewer viewer = this.getSourceViewer();
> > > > > > > > > >
> > > > > > > > > > From the newsgroup someone sys that I am suppose use
> > > > > > > createPartControl()
> > > > > > > > > > and someone else says that I can't use it as it is called
> > from
> > > > the
> > > > > > > > > > framework.I read about it in the documentation where it
says
> > > > > > "Clients
> > > > > > > > > > should not call this method (the workbench calls this
method
> > > > when
> > > > > it
> > > > > > > needs
> > > > > > > > > > to, which may be never). "
> > > > > > > > > >
> > > > > > > > > > Is there any other way I can get the above functionality.
> > > > > > > > > > I would realy apprecaite any help.
> > > > > > > > > >
> > > > > > > > > > Syed
> > > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > >
> > >
> > >
> > >
> > >
|
|
|
Goto Forum:
Current Time: Wed Feb 05 11:54:39 GMT 2025
Powered by FUDForum. Page generated in 0.04378 seconds
|