Home » Eclipse Projects » Eclipse Platform » How do I find a view programmatically in Eclipse 3.x.x?
| | |
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   |
Eclipse User |
|
|
|
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   |
Eclipse User |
|
|
|
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   |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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...
> > >>>>
> > >>>
> > >>
> > >>
> > >
> >
>
>
|
|
|
Goto Forum:
Current Time: Sat Jul 19 14:49:32 EDT 2025
Powered by FUDForum. Page generated in 0.33862 seconds
|