Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Accessing an object application-wide
Accessing an object application-wide [message #838057] Fri, 06 April 2012 10:00 Go to next message
Hamed Mohammadi is currently offline Hamed Mohammadi
Messages: 37
Registered: May 2010
Location: Shiraz - Iran
Member

I have a service class that I need it be accessible from several views and editors. It must be created in application startup onece.

Thanks.
Re: Accessing an object application-wide [message #838098 is a reply to message #838057] Fri, 06 April 2012 11:05 Go to previous messageGo to next message
David Wegener is currently offline David Wegener
Messages: 1299
Registered: July 2009
Senior Member
On 04/06/2012 09:00 AM, Hamed Mohammadi wrote:
> I have a service class that I need it be accessible from several views
> and editors. It must be created in application startup onece.
>
> Thanks.
You can use an Activator for creating a singleton. An Activator is an
optional part of a plugin that allows you to hook into the plugins life
cycle. You can use it to setup static variables that other components
need to access.

The super class of your Activator depends on the type of plugin you
have(UI, non-UI). Look at the documentation for
org.eclipse.core.runtime.Plugin and its subclasses to pick the
appropriate base class for your plugin.
Re: Accessing an object application-wide [message #838119 is a reply to message #838098] Fri, 06 April 2012 11:46 Go to previous message
Hamed Mohammadi is currently offline Hamed Mohammadi
Messages: 37
Registered: May 2010
Location: Shiraz - Iran
Member

David Wegener wrote on Fri, 06 April 2012 19:35
On 04/06/2012 09:00 AM, Hamed Mohammadi wrote:
> I have a service class that I need it be accessible from several views
> and editors. It must be created in application startup onece.
>
> Thanks.
You can use an Activator for creating a singleton. An Activator is an
optional part of a plugin that allows you to hook into the plugins life
cycle. You can use it to setup static variables that other components
need to access.

The super class of your Activator depends on the type of plugin you
have(UI, non-UI). Look at the documentation for
org.eclipse.core.runtime.Plugin and its subclasses to pick the
appropriate base class for your plugin.


Thanks for reply. It seems that the wizard created for me a default Activator class and using that my problem is solved.

Thanks again.
Previous Topic:How to Launch / Run / Open HTML Files in Internal Browser
Next Topic:Problems with GWT demo project
Goto Forum:
  


Current Time: Sun Apr 20 12:35:11 EDT 2014

Powered by FUDForum. Page generated in 0.01594 seconds