How can one use the Web Page Editor in custom RCP application? - eclipse

I want to use the "Web Tools Editor" that is part of the Web Tools Plattform in my own RCP-Application. I think i have got some understanding on the RCP plattform by now, but I still have no clue how to access the functionality of the pagedesigner (org.eclipse.jst.pagedesigner) after adding it as a dependency to my project. Has anyone some experience in adding components of the web tools plattform into an RCP-Application and can give me a hint or something?

There's a difficulty with these sorts of requests (I am, myself, trying to include this or that feature that I saw in the Eclipse IDE, every so often).
The trick is to try and identify the component you want to bring in, and then try and pull it into your project, without bringing in too many dependencies.
The first step used to be quite hard, but since 3.4 it is a matter of using the Plug-In Spy - hold down Alt-Shift-F1 on whilst your desired component is in focus should give you a tooltip showing you the class, the bundle, etc etc.
The second step is altogether more tricky and is where I usuaully fail to get any results:
if you are lucky then you can just include the bundle in the launch configuration/.product of your app. Once you hit Add Required Bundles, you are not left with 3000 bundles (i.e. your RCP is now Eclipse).
usually, this is not the case, because the Eclipse team haven't refactored the bit of code you're interested in out into an RCP safe bundle. If so, then you're going to have to do that yourself.
Again, if you are lucky then that will mean moving some classes out of the eclipse bundle into your own, including internal classes, and that will be the end of it - i.e. the dependencies of your desired functionality are all within the bundle.
If you're unlucky, then you need to isolate/reimplement the bit of functionality that is required, and change your version of the copied code.
It is hard laborious, and pretty difficult to upgrade. I realise that none of this is what you want to hear.

Related

What is a good workflow for java with EJB, JSP, Servlet, and shared project, jQuery in eclipse/glassfish?

I am attempting to learn java EE by developing an app from scratch. What I have now is JSPs, EJBs, Servlets, jQuery script. I feel my progress is very slow right now.
I am afraid to consider JRebel-like tools at the moment.
Is there a step by step cycle I can follow to be more efficient?
When should I trigger the .reload file?
When should I delete/restart glassfish, when I modify: java, jsp, jsp fragment, dependent project?
Do I need to restart every time I modify a java file or only on major changes like add/remove class, add/remove method?
Do I need to run in debug mode every time so I can immediately see my changes on the fly?
Since your last comment, I think maybe I understand a little better what you're after.
I know you're looking for a glassfish solution, which I don't know very well, but if you're willing to work with other application servers, there are some good solutions for fast turnaround.
The JBoss IDE is free and integrates tightly with the JBoss Application Server. If you use the default directory layouts created by the Eclipse project wizards, turnaround for most changes is completely transparent and nearly simultaneous. I think you can find other IDEs with similar characteristics. (BTW - I don't use JRebel myself but hear very good reports from those I know who do.)

How to debug a plugin in Eclipse - i.e. a Java project without a Main method

I am currently trying to modify the behavior of an existing open-source plug-in for Eclipse.
I'm trying to understand how the plugin works. To do so, I opened it in "Debug" mode as an Eclipse application and I am testing it out after having inserted many breakpoints.
However, sine Eclipse plugins do not have a Main method, it's still really difficult for me to keep track of everything that is going on. The calls seem to jump arbitrarily (which I quickly realized was happening through all the interfaces and superclasses the plugin is inheriting) and I can't see exactly what's doing what.
What is the proper (read: BEST) way to debug a program with no Main method? How can I test, tweak, and explore and program - in this case a plugin - whose modus operandi I'm uncertain of?
You need to run your plugin in a runtime workbench. This (simplistically) starts a new instance of Eclipse with all existing plugins installed, plus the plugin you want to debug. Make sure that you have the PDE tools installed in your Eclipse instance and then in the debug configurations area, double-click on Eclipse Application to generate a default runtime workbench launch config.
I'd also recommend that you read up on PDE (plugin development environment), and you can get an overview here: http://wiki.eclipse.org/PDE/FAQ. And you can read up on plugins in general here: http://eclipsepluginsite.com/. There are many tutorials and lots of information all over the web. So, google is your friend.
Along with using breakpoints in Debug method you can even try printing stack trace using Thread.currentThread().getStackTrace() method to know the starting point of a Thread.

Which Eclipse package for total noob to download, and can I change it later?

Many different Eclipse packages are listed on http://www.eclipse.org/downloads/ and the comparison chart on http://www.eclipse.org/downloads/compare.php helps with knowing some of the differences. What I don't know as a total Eclipse (and Java) noob is how important it is to download the "right one" and how easy it is to fix things afterward if I discover I need some feature/capability/addon/whatever later.
For example, I need to get up to speed on RCP (whatever that is) quickly, but suspect I might want to also know about "EMF" and "GEF" and other things which aren't in the RCP version of Eclipse, or not listed at all such as SWT. I'm further confused by the top line of the comparison table, "RCP/Platform" with checkmarks under all columns - does this mean any package will do for learning the basics of RCP? This is not noob-friendly!
As an Eclipse know-nothing, what should I do?
I'd say download Eclipse Classic, then you can add whatever you need as plugins when you discover you need them in the future.

Lift and Eclipse RCP Integration

I work on a fairly simple but large two-tier application that consists approximately 40 Eclipse RCP plugins. We have a new use case that is taking us to the web for a very small portion of this functionality. I'd like to prototype this using Lift. Clearly, I'm facing a few challenges.
Lift + OSGi. Can Lift get at OSGi bundles? Can it be packaged as an OSGi bundle itself and integrated into a web container?
Build System. We use the archaic Eclipse PDE build (read: Eclipse has no build system) with Cruise Control. Lift uses Maven.
Development Environment. This one I'm not sure anyone can help me with. I've tried to use the Scala plugin with Eclipse and it's still not ready. There are just too many impediments to make it useful. Saying that, I don't see this as a major issue because I can keep all the Lift code in one module, only referencing the Java code a very specific areas.
I'm wondering if anyone has tried anything similar to this and has any advice. Note that I won't be using any of the ORM stuff in Lift because all persistence is managed in the existing plugins behind an API. So, am I barking up the wrong tree? Is there something else I need to be aware of?
I could revert to simply using these instructions but I'd really like to take Lift for a spin because Java is... well... it's Java. :-(
There's thread in google groups about using lift as an OSGi bundle.
For the build system as far as I remember PDE sit's on top of ant, so you can use maven for building lift related stuff first and then call PDE's build.xml

Time to develop an option in Eclipse to modify a Java file source

I'm evaluating the possibility of developing an Eclipse plugin to modify the source code of some Java files.
The Eclipse plugin should:
add one menu option or context menu option to launch the modification process.
add a key binding
only alter the UI in that way when an editor has been open on a Java file.
the modification process would not open a dialog, or maybe, a very simple one.
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.
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)
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.
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).