Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Developing custom refactorings - Is it possible only using Published API?
Developing custom refactorings - Is it possible only using Published API? [message #245697] Fri, 13 July 2007 11:29 Go to next message
Máirtín Keane is currently offline Máirtín KeaneFriend
Messages: 13
Registered: July 2009
Junior Member
I am looking at developing custom refactorings using the Eclipse's API and
I am trying to figure out if is it possible to do so solely through using
Eclipse's published API?

With regards developing custom refactorings I see Tobias Widmer in his
article "Unleashing the Power of Refactoring"

http://www.eclipse.org/articles/article.php?file=Article-Unl eashing-the-Power-of-Refactoring/index.html

uses internal classes (org.eclipse.jdt.internal.corext.dom.NodeFinder) in
order to develop his custom refactoring.

Is this not bad practice at a minimum (see Guidelines for using the
Eclipse API
http://www.eclipse.org/articles/article.php?file=Article-API -Use/index.html
) and unsafe with regards the plugin breaking when running against future
releases of Eclipse due to dependencies on internal API?

I want to develop some custom refactorings - is it just the case that in
order to develop custom refactorings I will more than likely need to use
some internal classes? And the best I can do is to request any internal
API I use to be put into the published API in the future and fix things
down the line, whilst in the meantime dealing with any breakage in the
code between Eclipse releases due to dependencies on internal API?


Any help\advice greatly appreciated,

Máirtín

p.s. I had this issue in another thread titled "Calling Refactorings
Programmatically", but this I think is a seperate issue so I have broken
it of into its own thread.
Re: Developing custom refactorings - Is it possible only using Published API? [message #245768 is a reply to message #245697] Fri, 13 July 2007 14:53 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jacek.pospychala.pl.ibm.com

Máirtín,

you can write similar class to NodeFinder by extending ASTVisitor. It's
internal, because it's helper class for JDT needs, so if JDT needs
change, this class may also change. Personally, I think it should not be
used in the article, but I guess, author wanted to keep the example
simple and minimize the number of classes. Anyway, I'd suggest raising a
bug against this article (Foundation/Articles component), and writing
similar class for your own in your plug-in.

Generally speaking, the minimal API required to write custom
refactorings is available as it's outlined in article. But the deeper
you get into writing refactorings, the more stuff you may need to
process all the relationships and constraints. JDT team has made quite a
lot refactorings possible over years, thus they have a nice library of
useful classes (like NodeFiner), but I doubt if any of these would
become API, because then they'd also become hard to modify, as API has
to be kept backward compatible.


Máirtín wrote:
> I am looking at developing custom refactorings using the Eclipse's API
> and I am trying to figure out if is it possible to do so solely
> through using Eclipse's published API?
>
> With regards developing custom refactorings I see Tobias Widmer in his
> article "Unleashing the Power of Refactoring"
> http://www.eclipse.org/articles/article.php?file=Article-Unl eashing-the-Power-of-Refactoring/index.html
>
>
> uses internal classes (org.eclipse.jdt.internal.corext.dom.NodeFinder)
> in order to develop his custom refactoring.
>
> Is this not bad practice at a minimum (see Guidelines for using the
> Eclipse API
> http://www.eclipse.org/articles/article.php?file=Article-API -Use/index.html
> ) and unsafe with regards the plugin breaking when running against
> future releases of Eclipse due to dependencies on internal API?
> I want to develop some custom refactorings - is it just the case that
> in order to develop custom refactorings I will more than likely need
> to use some internal classes? And the best I can do is to request any
> internal API I use to be put into the published API in the future and
> fix things down the line, whilst in the meantime dealing with any
> breakage in the code between Eclipse releases due to dependencies on
> internal API?
>
>
> Any help\advice greatly appreciated,
>
> Máirtín
>
> p.s. I had this issue in another thread titled "Calling Refactorings
> Programmatically", but this I think is a seperate issue so I have
> broken it of into its own thread.
>
Re: Developing custom refactorings - Is it possible only using Published API? [message #245773 is a reply to message #245768] Fri, 13 July 2007 17:11 Go to previous message
Máirtín Keane is currently offline Máirtín KeaneFriend
Messages: 13
Registered: July 2009
Junior Member
Jacek Pospychala wrote:

> you can write similar class to NodeFinder by extending ASTVisitor. It's
> internal, because it's helper class for JDT needs, so if JDT needs
> change, this class may also change. Personally, I think it should not be
> used in the article, but I guess, author wanted to keep the example
> simple and minimize the number of classes. Anyway, I'd suggest raising a
> bug against this article (Foundation/Articles component), and writing
> similar class for your own in your plug-in.

Thanks for the reply.

So would it be correct to say that there are two "categories" of internal
classes

(1) Helper classes
(2) Non-helper classes

And should one require the use of these classes they should do the
following

(1) Helper classes - replicate the class (or write something similiar)
(2) Non-helper classes - use directly and request that they be put into
the published API?


-- máirtín
Previous Topic:APT for CDT
Next Topic:Heads up: Eclipse on MacOS
Goto Forum:
  


Current Time: Tue Jul 16 13:44:56 GMT 2024

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

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

Back to the top