Skip to main content


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 14:00 Go to next message
Hamed Mohammadi is currently offline Hamed MohammadiFriend
Messages: 50
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 15:05 Go to previous messageGo to next message
David Wegener is currently offline David WegenerFriend
Messages: 1445
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 15:46 Go to previous message
Hamed Mohammadi is currently offline Hamed MohammadiFriend
Messages: 50
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:jetty adapter
Goto Forum:
  


Current Time: Thu Mar 28 17:33:50 GMT 2024

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

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

Back to the top