5

I'm evaluating the possibility of developing an Eclipse plugin to modify the source code of some Java files.

The Eclipse plugin should:

  1. add one menu option or context menu option to launch the modification process.
  2. add a key binding
  3. only alter the UI in that way when an editor has been open on a Java file.
  4. the modification process would not open a dialog, or maybe, a very simple one.
  5. the modification process would traverse the AST of the Java file and would modify it.

Considering that we have no experience with Eclipse plugins and we need spend time in reading docs, how much time do you estimate in developing that plugin?

Thanks in advance.

Seb
  • 24,920
  • 5
  • 67
  • 85
Daniel Fanjul
  • 3,493
  • 3
  • 26
  • 29
  • I voted down because I do not think that this is the way to do estimates. Correct me if I'm wrong – Bertvan Apr 17 '09 at 12:13
  • 2
    He's asking for estimate because they don't have XP in coding Eclipse plugins... I believe this is a good question indeed. – Seb Apr 17 '09 at 12:15
  • 2
    I voted up, because I have been asked for estimates where I knew absoutely nothing about the problem domain. In that case your estimate ranges from 1 day to infinity. The asker is sensible and asking "Knowing the technology, how long would it take you?" and "How long would it take a complete beginner to do it". They need a number to bring back to management, answers from SO will lend some "estimate" to their "guess" makeing it an "Educated Guess" – Binary Worrier Apr 17 '09 at 12:18
  • Also, depending on the ratio of "time to build" and "learning curve" it may be better to buy in some expertise for a short time, rather than have a steep and painful learning curve for the team. All information that can be found here on SO (hopefully). Unfortunately I know nothing of this "Eclipse" of which you speak :) – Binary Worrier Apr 17 '09 at 12:21
  • I think you are assuming that this is an "estimate" for "management", maybe it's just a personal project? – matt b Apr 17 '09 at 15:04
  • Right, we need to estimate the effort of every alternative we are considering. Since we know nothing about Eclipse API -this is a risk we assume-, I asked here for some guidance to correcty evaluate the time. Of course, we have already started a prototype to experiment. It is not a personal project question this time, :). Thanks for your answers! – Daniel Fanjul Apr 20 '09 at 13:55
  • @DanielFanjul In the name of learning and curiosity, and if you still remember, would you care to share your experiences about this project for other wannabe plugin developers? – ZeroOne Feb 12 '13 at 07:28
  • @ZeroOne We didn't started the project. Too much work, not enough profit. – Daniel Fanjul Apr 27 '13 at 14:03

3 Answers3

4

It's really not that difficult at all... I had students in my design patterns class doing it for an assignment (adding/removing javabean getters and setters)

See http://help.eclipse.org/ganymede/topic/org.eclipse.jdt.doc.isv/guide/jdt_api_manip.htm

[EDIT: added the following article reference]

And a great article on it at http://www.eclipse.org/articles/article.php?file=Article-JavaCodeManipulation_AST/index.html (from 2006 -- there may be a few API changes since)

Yes, writing plugins takes a little getting used to, but so does any API.

And you can modify the AST -- see the page I reference above.

(I should note that the above link is from the eclipse help, which can also be accessed via Help->Help Contents inside Eclipse -- there's a lot of good info in there, but it's just a starting point)

Scott Stanchfield
  • 29,742
  • 9
  • 47
  • 65
1

You'll probably spend quite some time cursing the complexity of the eclipse plugin system. There are some example plugin development projects that can be very helpful if they cover the area you're working in.

I'd say you're looking at 2-4 days of work, spent mainly getting familiar with the platform - someone with a lot of experience writing eclipse plugins would probably take no more than an hour.

However, your step 5 could be tricky. I don't know how easy it is to access and change the Java AST; my experience is based on developing an editor plugin for an exotic file format rather than Java code.

Michael Borgwardt
  • 342,105
  • 78
  • 482
  • 720
0

Well, the four first points are easy to achieve, even by monkey coders that look at the eclipse PDE documentation shipped with Eclipse. These can be achieve in 1 day of work, maybe 2.

The hardest point is really the fifth one and the kind of modification you expect to do. Acting directly on the editor content is simple, accessing the editor internal AST and modifying it is really a bigger challenge and I doubt that it could be achieve in less than a week by unexperimented people (it can take longer, depending of what kind of modification you want to apply).

gizmo
  • 11,819
  • 6
  • 44
  • 61
  • I disagree with your assertion that the first points are easy to achieve, considering the PDE documentation shipped with Eclipse contains deprecated structures! It may be easy to do, but certainly not easy to do *properly*. – StockB Feb 14 '13 at 12:11