Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Using refactoring support from commandline
Using refactoring support from commandline [message #1694135] Thu, 30 April 2015 15:39 Go to next message
Eclipse UserFriend
Hi anyone,

we have written a source migration tool with jdt which allows to migrate some code with rules you have to configure before in xml format.
Now we want to use this from commandline (e.g. gradleplugin).

Can you give me a hind, how I can create an IJavaProject from outside eclipse? Please don't answer to use a headless eclipse application because I don't want to have this overhead. It should be created with a plain java application.

Thanks in advance
Markus
Re: Using refactoring support from commandline [message #1694146 is a reply to message #1694135] Thu, 30 April 2015 18:04 Go to previous messageGo to next message
Eclipse UserFriend
If you say "Refactoring" in the JDT sense: refactoring heavily relies on search, search needs an index and the index is managed by the "IndexManager", which in turn is owned by the JavaModelManager.

See this snippet in JavaModelManager:
    if (Platform.isRunning()) {
        this.indexManager = new IndexManager();
    ...


Ergo, if the platform is not running there's not index manager etc. and hence no Refactoring.

Also an IJavaProject needs an IProject which needs an IWorkspace.

I'm not saying it's impossible to mock all this some how, but that'd be a huge project, and I wouldn't bet that at the end of the day you'd save any overhead.

Doing without all this infrastructure is possible when manipulating individual files, but if you need the full power, then you need the appropriate engine.

Now, that I've told you how difficult things are, have a look at org.eclipse.jdt.core.index.JavaIndexerApplication, e.g., and see how simple it is to write your own headless application Smile

Stephan
Re: Using refactoring support from commandline [message #1694147 is a reply to message #1694146] Thu, 30 April 2015 18:14 Go to previous messageGo to next message
Eclipse UserFriend
Hi Stephan,

writing the headless application itself is not that tricky, I know. But I think starting this application from commandline is not that easy, as I experienced.

But perhaps I didn't have the right tutorial ?
Can you recommend me some howtos?

Thank you
Cheers
Markus
Re: Using refactoring support from commandline [message #1701596 is a reply to message #1694147] Tue, 14 July 2015 06:47 Go to previous message
Eclipse UserFriend
Hi again,

for the ones with the same or a similar problem: I have solved it by creating a product with a headless eclipse application and a gradle plugin, which handles downloading and launching this product. Our users don't have any additional effort with this solution.

Regards
Markus
Previous Topic:New maven project in Eclipse Mars
Next Topic:I am having trouble installing Java onto my laptop
Goto Forum:
  


Current Time: Wed May 07 18:39:30 EDT 2025

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

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

Back to the top