I am new to eclipse plugin development. I want to develop a plugin which will generate XML files from the classes present in the workspace. It will have 2-3 UI forms which will take information from user while generating XMLs.
From what I have read till now, I think there are two ways by which we can develop plugins
SWT
RPC
I want to know which will be appropriate way to go for me ?
Both, they aren't mutually exclusive. SWT is the widget toolkit used in Eclipse, and RCP ("Rich Client Platform") is an application platform based on SWT that is also the foundation of the Eclipse IDE.
I'd suggest that you start with a project template. Get the latest "Eclipse for RCP and RAP developers" package from the Eclipse download site. Create a new plug-in project (File > New > Plug-in Project), check "This plug-in will make contributions to the UI" on the second page of the wizard, and on the last page, select one of the templates.
You should also have a look at the answers to How to write a plugin for Eclipse? to get started.
Please note that, while this approach still works with Eclipse 4, there are newer APIs to use if you target Eclipse 4 IDEs only. For documentation of this approach, see Eclipse 4 RCP (aka E4) documentation.
I'm trying to build eclipse from scratch. I could download eclipse e4 from CVS, which has 426 projects. After the automatic build, I got tens of broken project build. I tried to fix some of them, but most of them are still broken including swt and jface.
Googling about eclipse architecture, I found that Wikipedia points out that
With the exception of a small run-time kernel, everything in Eclipse is a plug-in.
What projects in CVS are the run-time kernel? How many projects do I need to build successfully to get vanilla eclipse that is not a plugin but core eclipse? I mean what is the project that after the build I can execute eclipse.exe even though it has no plugin?
Any hints for building them would also be great.
I asked the same question to eclipse forum to get some answers.
In short, this is the idea.
You need a launcher which is platform dependent:
http://eclipse.org/equinox/framework/
http://wiki.eclipse.org/FAQ_How_do_I_run_Eclipse%3F
Then, you need OSGi/Equinox to be compiled
http://www.eclipse.org/equinox/documents/quickstart-framework.php
Once you have the launcher and OSGi, everything is a module on top of it.
I want to create an Eclipse RCP from our collection of already existing Eclipse plugins.
We have the pecularity that in our RCP we want the user to be able to open ("import") Eclipse projects (we distribute some of our features in bundles which come in the form of Eclipse projects. These should be registered in the workspace because a model server scans for the opened projects and loads them). Also, when I open files via File->open an exception is thrown from our internal editors: File opening intentionally only is possible if you load an imported resource.
For the moment, I have gotten the RCP to work by depending on org.eclipse.core.resources and org.eclipse.ui.navigator.resources. Thereby, I can import complete Eclipse projects. However, I am unsure[1] this is the correct/"intented" way of doing it (e.g. the navigator view is lacking icons per default) should I rather use the CNF?
The main thing is, we have to support loading/importing Eclipse projects in our RCP. Your answer is even helpful if you know other RCPs which allow to import Eclipse projects.
Regards
SuperUser
[1] http://wiki.eclipse.org/RCP_FAQ#Is_the_resources_plug-in_.28org.eclipse.core.resources.29_considered_part_of_the_Rich_Client_Platform.3F
If you are using org.eclipse.ui.navigator.resources then you are using the CNF (it's org.eclipse.ui.navigator).
The link you have is pretty outdated information, using the Eclipse Resources support in an RCP application will work fine (our product does it). And then if you want to package the application to work either as RCP or in an IDE environment you are one step closer. Also, despite what the link you provided says, don't be afraid to use stuff in org.eclipse.ui.ide if you need them. All you really need to be concerned about is to make sure you are only using classes that are actual Eclipse API, if you do that, then everything will work on future Eclipse versions. Anything that's public is Eclipse API unless it's marked in the Javadoc that it's not intended to be used by clients.
You should not be using the Resource Navigator as that has been deprecated and is not as general as the CNF.
As far as importing and exporting Eclipse projects with RCP, our product does that as well and it works fine.
I would say you are on the right track.
Earlier I was using Netbeans,and it had all framework in it like struts ,spring,hibernate.As Eclipse is used mostly in industry,so i downloaded Eclipse Indigo java ee ,but i am not able to find option to create application using framework like sturts or hibernate or spring. I am gonna use them in future. as i am in learning phase,also if it does not support these framework,please give me link which eclipse to download as eclipse website contain number of eclipse version which to download i don't have idea.
It depends upon which type of application you want to create and i am taking an example of web-application
to create a web-application all you need is to create a dynamic web-project in eclipse by
Right click on the project explorer/ file->new.
Crete a web-application by following the wizard.
and you are all set to start your development>regarding suport for Spring/Hibernate,they provide there plugin for eclipse all you need to do either
Go to market place by Help->marketplace
Go to respective website say spring source and Hibernate
search for the plugin and install them in your eclipse and you are all set to go
Hibernate Tool
Spring IDE
Will suggest you to install using marketplace i.e help->marketplace
Eclipse is plugin based. WTP is the generic webapp plugin. Hibernate tools for hibernate and maybe Akrogen for struts. (Search for 'xxx eclipse plugin' with your favorite search engine, in the future)
You can look into Maven if you want, Maven has a whole range of archetypes for almost every combination of projects.
My organization has made an upper level decision to move to maven as the standard build tool for Java projects. I have been tasked with helping our local teams migrate projects over to maven.
One of the core tools that is in play is the MyEclipse IDE. MyEclipse seems to have had a "fun" history with the maven team as evidenced in various places, especially when dealing with war projects. I haven't encountered problems with simple jar projects...yet.
After fighting with MyEclipse and failing to make it recognize a war project easily, the question becomes, is MyEclipse worth it for developing maven war apps?
If so, is there a way to get MyEclipse to play nicely with a war project that I've not found? Or, am I simply better off suggesting its time to use Eclipse Java EE edition with m2eclipse?
No. MyEclipse does not support projects that were created outside of it. It is by design only working with projects created using its wizards.
From the Using Maven in MyEclipse Overview
NOTE: Maven is only supported for new projects. Migration of existing
projects to Maven-enabled projects is not supported at this time, but
may be considered for a later release. Right now the MyEclipse team is
focused on providing as fluid a new-Maven-project experience as
possible
I am working as a tech lead, and we recently started moving to maven. I had a couple of issues getting maven to work with myeclipse. First, even when I "Enabled all m2eclipse features" checkbox, I still couldn't check out a project as a maven project, from subversion. That option (that you get from m2eclipse) just wasn't available.
Also, some of the preferences you get with m2eclipse are not available with maven4myeclipse.
Finally, I couldn't just uninstall the maven4eclipse plugin and install m2eclipse. That would have been an acceptable workaround.
I think Genutec tried to make Maven more accesible to newbies, but there are some problems in the impementation, and I don't see them being fixed soon. For us, that will likely delegate MyEclipse to being just a fancy jsp editor.
Mike,
Sorry to hear you are fighting MyEclipse and Maven, in the past the most common problem I've seen causing people pain in this area is when they don't have the Web Root, Java source dirs or resource dirs set correctly.
Using this webpage as reference for a standard Maven2 web project layout, you can easily create a Maven-enabled MyEclipse Web Project. The steps you would want to take are as follows:
File > New > Web Project
Give your project a name, use the Java source dir of "src/main/java" and a Web Root of "src/main/webapp", check the Java EE spec level you want, check "Add Maven support" checkbox and hit Finish (unless you want to setup the artifact/group IDs).
Now, if this is the first time using Maven4MyEclipse, a lot of initialization will take place preparing your local repository and grabbing all the Java EE resources to build your project, but after that's done you should be all set.
You can execute the Maven targets off the Right-click Run As or Debug As menu and even manage custom goal execution using the "Maven build..." shortcut -- this is all similar to m2eclipse.
If you decide you want to use m2eclipse complete, you can navigate to Window > Preferences > MyEclipse > Maven4MyEclipse and check the "Enable all m2eclipse features" checkbox.
Out of the box we only hide the bits that can make Maven confusing for first-time folks, if you enable all the m2 bits, you can do whatever you want with Maven and MyEclipse. If you keep having trouble stop by our forums and let us know and we'll help out as best we can.
Mike,
think the issue is that the project has already been created outside of MyEclipse and >worked thru maven using the command line. Importing it is not successful.
I saw this post when looking for other Maven resources so I'll chime in.
Why not import your existing project using File > Import and turn on all the m2eclipse features and continue to develop it as you did before using maven commandline tools? I've done this and it works well for legacy projects, once m2eclipse features are enabled as mentioned in Riyad's #5.
Personally, I've always thought the maven war format was a bust, but we still have some old projects that use it around. Maven's format is just a default (and a poor one), not some sort of standard. However, we currently leave those old projects "as is" (using the above technique) just because it's easy. But for new work we use the MyEclipse web projects then just enable Maven support on them. The benefit is that you get all the Maven support and it's super easy to use and manage but no more commandline (although that still works too) and all the MyEclipse tools work perfectly on them as well. It's a "best of both" approach, well, at least for us. YMMV.
Hope that helps,
Dave
Mike,
Interesting, what happens when you have developers who are not using MyEclipse?
Not an issue here; I work for a very large company that has been standardized on it for quite some time (happily, I might add as we used to be a WSAD shop -- shudder.)
Anyway, if you have some that use MyEclipse and some that don't I see two options. First, if you create MyEclipse web projects and then "Add Maven capabilities" (or whatever it's called) to them, they'll work in MyEclipse and from the Maven commandline as well. So even if you're not using MyEclipse you can still use the commandline Maven tools. Also, since the MyEclipse structure is the more standard "exploded war" layout, it should work with whatever else you use as well.
Other thing to consider is that Maven's web layout is simply a default and Maven can easily support any project structure, including the one MyEclipse uses, so you should be able to use the MyEclipse project with Maven in any tool with just a little additional config. That's likely why the Maven commandline tools still work on the MyEclipse Web projects -- the MyEclipse guys just automatically configure Maven to recognize the format.
You also could just import the externally created Maven web projects as I said in my last post. We don't like to do that because that structure is unique to Maven and just doesn't work with any tools except Maven. As a result, it basically defeats the the tool support you get automatically in MyEclipse, Eclipse Java EE, or pretty much any other tool. It's just a poor default. Exploded WAR format, that's used by MyEclipse, Eclipse Java EE, WSAD, RAD, and everyone else is simply a better solution. Especially when it still works with Maven just fine as well.
Maven was made to be flexible to project structure. We've just found by using that flexibility a little you can get Maven support and great tool support too.
Dave