Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Simple problem,how to get 'Shell' object from plugin's views?
Simple problem,how to get 'Shell' object from plugin's views? [message #291520] Sun, 18 September 2005 15:44 Go to next message
Eclipse UserFriend
Originally posted by: guru.lifesting.com

I created a class named 'shutdown' extends 'Viewpart' to
be a view of my eclipse plugin,now I want to add an action
which simply open a file-choose box using MessageDialog
class to this view,but the MessageDialog's constructor me-
thod must need a shell object as primary parameter.
So the problem is how to get the 'Shell' from anywhere?

Thanks!

life.sting
Re: Simple problem,how to get 'Shell' object from plugin's views? [message #291521 is a reply to message #291520] Sun, 18 September 2005 18:18 Go to previous messageGo to next message
Haris Peco is currently offline Haris PecoFriend
Messages: 1072
Registered: July 2009
Senior Member
lifesting wrote:

> I created a class named 'shutdown' extends 'Viewpart' to
> be a view of my eclipse plugin,now I want to add an action
> which simply open a file-choose box using MessageDialog
> class to this view,but the MessageDialog's constructor me-
> thod must need a shell object as primary parameter.
> So the problem is how to get the 'Shell' from anywhere?
>
> Thanks!
>
> life.sting

you can add null too MessageDialog or get shell like this
PlatformUI.getWorkbench().getDisplay().getActiveShell();
Re: Simple problem,how to get 'Shell' object from plugin's views? [message #291538 is a reply to message #291521] Mon, 19 September 2005 10:59 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: guru.lifesting.com

Very very thank you!Follow your direction ,I have solved
this problem.
Re: Simple problem,how to get 'Shell' object from plugin's views? [message #291541 is a reply to message #291520] Mon, 19 September 2005 11:53 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

lifesting wrote:
> I created a class named 'shutdown' extends 'Viewpart' to
> be a view of my eclipse plugin,now I want to add an action
> which simply open a file-choose box using MessageDialog
> class to this view,but the MessageDialog's constructor me-
> thod must need a shell object as primary parameter.
> So the problem is how to get the 'Shell' from anywhere?


If you want to make sure you are using the same shell as your view, you
can go viewpart.getSite().getShell().

Later,
PW


Re: Simple problem,how to get 'Shell' object from plugin's views? [message #291698 is a reply to message #291521] Wed, 21 September 2005 19:21 Go to previous message
Tod Creasey is currently offline Tod CreaseyFriend
Messages: 59
Registered: July 2009
Member
Try to use the shell associated with the view not the active shell - it is
potentially different.

Use IViewPart#getSite()#getShell()


Tod Creasey
Eclipse UI Committer

"snpe" <snpe@snpe.co.yu> wrote in message
news:dgk40j$idl$2@news.eclipse.org...
> lifesting wrote:
>
> > I created a class named 'shutdown' extends 'Viewpart' to
> > be a view of my eclipse plugin,now I want to add an action
> > which simply open a file-choose box using MessageDialog
> > class to this view,but the MessageDialog's constructor me-
> > thod must need a shell object as primary parameter.
> > So the problem is how to get the 'Shell' from anywhere?
> >
> > Thanks!
> >
> > life.sting
>
> you can add null too MessageDialog or get shell like this
> PlatformUI.getWorkbench().getDisplay().getActiveShell();
Previous Topic:FontRegistry
Next Topic:[Fwd: Eclipse and ClearCase woes]
Goto Forum:
  


Current Time: Tue Jul 16 14:34:15 GMT 2024

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

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

Back to the top