Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Plug-in startup triggered by project nature detection
Plug-in startup triggered by project nature detection [message #214928] Fri, 16 September 2005 11:15 Go to next message
Eclipse UserFriend
Originally posted by: paolo_cst.yahoo.it

Hi all,
I wish to know if there is a way to force the automatic startup of a
plug-in when the user open a project with a given nature associated. I
have to extend a plug-in that creates a project with a custom nature,
and I wish the plug-in to start when the user try to open similar
project (with the same custom nature) in the workspace.
Sorry for my English, any help (even about the previous unanswered
questions) will be greatly appreciated.
Thanks, Paolo
Re: Plug-in startup triggered by project nature detection [message #214936 is a reply to message #214928] Fri, 16 September 2005 11:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

Short answer is no. Natures are just tags on the project. Unless someone
requests something about that nature, then the nature class will not be
instantiated. That is the way all of Eclipse works. Plugins aren't
activated until someone asks for something from that plugin. That
prevents having all plugins always activated.


--
Thanks,
Rich Kulp
Re: Plug-in startup triggered by project nature detection [message #214955 is a reply to message #214936] Fri, 16 September 2005 16:25 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: paolo_cst.yahoo.it

First of all, thank you Rich for your answer! :-)
I think that a workaround should be possible: what if my plug-in
register itself at the org.eclipse.ui.startup extension point, and in
the earlyStartup() method it verificates the nature of every project
opened in the workspace? It is possible? Obviously, if no-one project is
matching the expected nature, the plug-in should turn-off itself by a
call to the org.eclipse.ui.plugin.AbstractUIPlugin.stop() method.

Is it a valid approach? Thanks very much for your help.

Paolo

Rich Kulp wrote:
> Short answer is no. Natures are just tags on the project. Unless someone
> requests something about that nature, then the nature class will not be
> instantiated. That is the way all of Eclipse works. Plugins aren't
> activated until someone asks for something from that plugin. That
> prevents having all plugins always activated.
>
>
Re: Plug-in startup triggered by project nature detection [message #214957 is a reply to message #214955] Fri, 16 September 2005 17:07 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

That will work, BUT!!! you shouldn't use early startup for that. That is
a very expensive thing to do. EarlyStartup should almost never be used.
It causes a plugin to be activated even if it is not needed.

So the question really should be why do you need your plugin activated
when the project with your nature is opened?

--
Thanks,
Rich Kulp
Re: Plug-in startup triggered by project nature detection [message #214959 is a reply to message #214957] Fri, 16 September 2005 17:25 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: paolo_cst.yahoo.it

Rich Kulp wrote:
> That will work, BUT!!! you shouldn't use early startup for that. That is
> a very expensive thing to do. EarlyStartup should almost never be used.
> It causes a plugin to be activated even if it is not needed.

Yes, I know... this is the point because i wish to stop it if it is not
needed. I'm trying this way, but I have some problem calling the
org.eclipse.ui.plugin.AbstractUIPlugin.stop(BundleContext) method. How
can I obtain the BundleContext argument?

> So the question really should be why do you need your plugin activated
> when the project with your nature is opened?

I need to have control over source modifications made by users on the
java files located in projects with my custom nature. Specifically, I
need to warn the users if they try to rename/delete some methods
automatically generated by my plug-in by means of a wizard.
Hence, I think to need to add a call to
JavaCore.addElementChangedListener(Listener) at the workspace startup.

Are my thoughts correct? I'm a newbie in Plug-in developing...

Thanks for all!
Paolo
Re: Plug-in startup triggered by project nature detection [message #215042 is a reply to message #214959] Sat, 17 September 2005 10:31 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

There is no way to stop them from deleting or renaming them. the
notifications come after the rename/delete has already occurred. however
you can put warning markers on the classes after the fact. You can do
this by using a builder in the project instead. Project builders and
natures go together.

See:

http://eclipse.org/articles/Article-Builders/builders.html

The article talks about natures and builders and markers.

>
> I need to have control over source modifications made by users on the
> java files located in projects with my custom nature. Specifically, I
> need to warn the users if they try to rename/delete some methods
> automatically generated by my plug-in by means of a wizard.
> Hence, I think to need to add a call to
> JavaCore.addElementChangedListener(Listener) at the workspace startup.
>
> Are my thoughts correct? I'm a newbie in Plug-in developing...
>
> Thanks for all!
> Paolo
>
>

--
Thanks,
Rich Kulp
Re: Plug-in startup triggered by project nature detection [message #215049 is a reply to message #215042] Sun, 18 September 2005 08:57 Go to previous message
Eclipse UserFriend
Originally posted by: paolo_cst.yahoo.it

Thank you very much for the suggestion :-)), now i go to read the article.


Rich Kulp wrote:
> There is no way to stop them from deleting or renaming them. the
> notifications come after the rename/delete has already occurred. however
> you can put warning markers on the classes after the fact. You can do
> this by using a builder in the project instead. Project builders and
> natures go together.
>
> See:
>
> http://eclipse.org/articles/Article-Builders/builders.html
>
> The article talks about natures and builders and markers.
>
Previous Topic:Where is the JDTCompilerAdapter for use with ANT.
Next Topic:Adding a method
Goto Forum:
  


Current Time: Fri Jul 18 08:55:12 EDT 2025

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

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

Back to the top