Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » How do I find a view programmatically in Eclipse 3.x.x?
How do I find a view programmatically in Eclipse 3.x.x? [message #275683] Wed, 10 November 2004 20:53 Go to next message
Eclipse UserFriend
Thanks for any tips...
Re: How do I find a view programmatically in Eclipse 3.x.x? [message #275684 is a reply to message #275683] Wed, 10 November 2004 21:00 Go to previous messageGo to next message
Eclipse UserFriend
I think I found the answer...Would the below work?

I use the IWorkbenchPage.findView(String viewId) to get my view...I know
I can get the view id from my plugin.xml file, but is there a
programmatic way of getting the view id?

I would appreciate any snippet of code, e.g., get the IWorkbenchPage
object, etc.

Thanks

AL wrote:

> Thanks for any tips...
>
Re: How do I find a view programmatically in Eclipse 3.x.x? [message #275730 is a reply to message #275684] Thu, 11 November 2004 12:34 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Chris_Laffra.ca.ibm.com

See Chapter 9 at http://eclipsefaq.org.
In particular, http://www.eclipsefaq.org/chris/faq/html/faq167.html shows
the way to the workbench page...

Chris

"AL" <unbonnevie@yahoo.com> wrote in message
news:cmugtk$v60$1@eclipse.org...
> I think I found the answer...Would the below work?
>
> I use the IWorkbenchPage.findView(String viewId) to get my view...I know
> I can get the view id from my plugin.xml file, but is there a
> programmatic way of getting the view id?
>
> I would appreciate any snippet of code, e.g., get the IWorkbenchPage
> object, etc.
>
> Thanks
>
> AL wrote:
>
> > Thanks for any tips...
> >
>
Re: How do I find a view programmatically in Eclipse 3.x.x? [message #275737 is a reply to message #275730] Thu, 11 November 2004 13:57 Go to previous messageGo to next message
Eclipse UserFriend
Thanks, but the code in the FAQ only shows the view...I am looking to
get the view object itself, based on the given view id. Also, how the
workbench page is gotten? (It's "..." part also that I am looking to
find out.) Thanks very much.

Snippet of code from FAQ:

IWorkbenchPage page = ...;
String id = "org.eclipse.faq.examples.BooksView";
page.showView(id, "1", IWorkbenchPage.VIEW_VISIBLE);
page.showView(id, "2", IWorkbenchPage.VIEW_ACTIVATE);

Chris Laffra wrote:

> See Chapter 9 at http://eclipsefaq.org.
> In particular, http://www.eclipsefaq.org/chris/faq/html/faq167.html shows
> the way to the workbench page...
>
> Chris
>
> "AL" <unbonnevie@yahoo.com> wrote in message
> news:cmugtk$v60$1@eclipse.org...
>
>>I think I found the answer...Would the below work?
>>
>>I use the IWorkbenchPage.findView(String viewId) to get my view...I know
>>I can get the view id from my plugin.xml file, but is there a
>>programmatic way of getting the view id?
>>
>>I would appreciate any snippet of code, e.g., get the IWorkbenchPage
>>object, etc.
>>
>>Thanks
>>
>>AL wrote:
>>
>>
>>>Thanks for any tips...
>>>
>>
>
>
Re: How do I find a view programmatically in Eclipse 3.x.x? [message #275738 is a reply to message #275737] Thu, 11 November 2004 14:32 Go to previous messageGo to next message
Eclipse UserFriend
Oopss...I see what you (Chris) meant now...

Here is what I do...

MyView myView =
(MyView)MyViewPlugin.getInstance().getWorkbench().getActiveW orkbenchWindow().getActivePage().findView( "com.xyz..views.MyView");

By the getActiveWorkbenchWindow() returns null because there is no display.

I call the above from ANOTHER plugin that imports 'MyViewPlugin'.

Thanks.

Alex.
AL wrote:

> Thanks, but the code in the FAQ only shows the view...I am looking to
> get the view object itself, based on the given view id. Also, how the
> workbench page is gotten? (It's "..." part also that I am looking to
> find out.) Thanks very much.
>
> Snippet of code from FAQ:
>
> IWorkbenchPage page = ...;
> String id = "org.eclipse.faq.examples.BooksView";
> page.showView(id, "1", IWorkbenchPage.VIEW_VISIBLE);
> page.showView(id, "2", IWorkbenchPage.VIEW_ACTIVATE);
>
> Chris Laffra wrote:
>
>> See Chapter 9 at http://eclipsefaq.org.
>> In particular, http://www.eclipsefaq.org/chris/faq/html/faq167.html shows
>> the way to the workbench page...
>>
>> Chris
>>
>> "AL" <unbonnevie@yahoo.com> wrote in message
>> news:cmugtk$v60$1@eclipse.org...
>>
>>> I think I found the answer...Would the below work?
>>>
>>> I use the IWorkbenchPage.findView(String viewId) to get my view...I know
>>> I can get the view id from my plugin.xml file, but is there a
>>> programmatic way of getting the view id?
>>>
>>> I would appreciate any snippet of code, e.g., get the IWorkbenchPage
>>> object, etc.
>>>
>>> Thanks
>>>
>>> AL wrote:
>>>
>>>
>>>> Thanks for any tips...
>>>>
>>>
>>
>>
>
Re: How do I find a view programmatically in Eclipse 3.x.x? [message #275744 is a reply to message #275738] Thu, 11 November 2004 16:05 Go to previous messageGo to next message
Eclipse UserFriend
As stated in the javadoc for getActiveWorkbenchWindow will return null when
called from a non-ui thread.
You will likely need to investigate Display.syncExec and Display.asyncExec
to post into the UI thread

HTH
Darins

"AL" <unbonnevie@yahoo.com> wrote in message
news:cn0eib$cu9$1@eclipse.org...
> Oopss...I see what you (Chris) meant now...
>
> Here is what I do...
>
> MyView myView =
>
(MyView)MyViewPlugin.getInstance().getWorkbench().getActiveW orkbenchWindow()
..getActivePage().findView("com.xyz..views.MyView");
>
> By the getActiveWorkbenchWindow() returns null because there is no
display.
>
> I call the above from ANOTHER plugin that imports 'MyViewPlugin'.
>
> Thanks.
>
> Alex.
> AL wrote:
>
> > Thanks, but the code in the FAQ only shows the view...I am looking to
> > get the view object itself, based on the given view id. Also, how the
> > workbench page is gotten? (It's "..." part also that I am looking to
> > find out.) Thanks very much.
> >
> > Snippet of code from FAQ:
> >
> > IWorkbenchPage page = ...;
> > String id = "org.eclipse.faq.examples.BooksView";
> > page.showView(id, "1", IWorkbenchPage.VIEW_VISIBLE);
> > page.showView(id, "2", IWorkbenchPage.VIEW_ACTIVATE);
> >
> > Chris Laffra wrote:
> >
> >> See Chapter 9 at http://eclipsefaq.org.
> >> In particular, http://www.eclipsefaq.org/chris/faq/html/faq167.html
shows
> >> the way to the workbench page...
> >>
> >> Chris
> >>
> >> "AL" <unbonnevie@yahoo.com> wrote in message
> >> news:cmugtk$v60$1@eclipse.org...
> >>
> >>> I think I found the answer...Would the below work?
> >>>
> >>> I use the IWorkbenchPage.findView(String viewId) to get my view...I
know
> >>> I can get the view id from my plugin.xml file, but is there a
> >>> programmatic way of getting the view id?
> >>>
> >>> I would appreciate any snippet of code, e.g., get the IWorkbenchPage
> >>> object, etc.
> >>>
> >>> Thanks
> >>>
> >>> AL wrote:
> >>>
> >>>
> >>>> Thanks for any tips...
> >>>>
> >>>
> >>
> >>
> >
>
Re: How do I find a view programmatically in Eclipse 3.x.x? [message #275794 is a reply to message #275744] Fri, 12 November 2004 10:41 Go to previous message
Eclipse UserFriend
Originally posted by: Chris_Laffra.ca.ibm.com

I did not get that subtle detail :-)

If you are running your code from a Job (as you should), you could consider
using a UIJob:
See http://www.eclipsefaq.org/chris/faq/html/faq187.html

Chris

"Darin Swanson" <Darin_Swanson@us.ibm.com> wrote in message
news:cn0k5k$o2h$1@eclipse.org...
> As stated in the javadoc for getActiveWorkbenchWindow will return null
when
> called from a non-ui thread.
> You will likely need to investigate Display.syncExec and Display.asyncExec
> to post into the UI thread
>
> HTH
> Darins
>
> "AL" <unbonnevie@yahoo.com> wrote in message
> news:cn0eib$cu9$1@eclipse.org...
> > Oopss...I see what you (Chris) meant now...
> >
> > Here is what I do...
> >
> > MyView myView =
> >
>
(MyView)MyViewPlugin.getInstance().getWorkbench().getActiveW orkbenchWindow()
> .getActivePage().findView("com.xyz..views.MyView");
> >
> > By the getActiveWorkbenchWindow() returns null because there is no
> display.
> >
> > I call the above from ANOTHER plugin that imports 'MyViewPlugin'.
> >
> > Thanks.
> >
> > Alex.
> > AL wrote:
> >
> > > Thanks, but the code in the FAQ only shows the view...I am looking to
> > > get the view object itself, based on the given view id. Also, how the
> > > workbench page is gotten? (It's "..." part also that I am looking to
> > > find out.) Thanks very much.
> > >
> > > Snippet of code from FAQ:
> > >
> > > IWorkbenchPage page = ...;
> > > String id = "org.eclipse.faq.examples.BooksView";
> > > page.showView(id, "1", IWorkbenchPage.VIEW_VISIBLE);
> > > page.showView(id, "2", IWorkbenchPage.VIEW_ACTIVATE);
> > >
> > > Chris Laffra wrote:
> > >
> > >> See Chapter 9 at http://eclipsefaq.org.
> > >> In particular, http://www.eclipsefaq.org/chris/faq/html/faq167.html
> shows
> > >> the way to the workbench page...
> > >>
> > >> Chris
> > >>
> > >> "AL" <unbonnevie@yahoo.com> wrote in message
> > >> news:cmugtk$v60$1@eclipse.org...
> > >>
> > >>> I think I found the answer...Would the below work?
> > >>>
> > >>> I use the IWorkbenchPage.findView(String viewId) to get my view...I
> know
> > >>> I can get the view id from my plugin.xml file, but is there a
> > >>> programmatic way of getting the view id?
> > >>>
> > >>> I would appreciate any snippet of code, e.g., get the IWorkbenchPage
> > >>> object, etc.
> > >>>
> > >>> Thanks
> > >>>
> > >>> AL wrote:
> > >>>
> > >>>
> > >>>> Thanks for any tips...
> > >>>>
> > >>>
> > >>
> > >>
> > >
> >
>
>
Previous Topic:Relationship between View
Next Topic:3.1/3.0.1 crash with Suse 9.2 and KDE
Goto Forum:
  


Current Time: Sat Jul 19 14:49:32 EDT 2025

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

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

Back to the top