Cannot import eclipse source code - eclipse

I've followed this tutorial (Step 2) to a tee on how to import the eclipse source code so that I can explore the various packages in order to assimilate some certain aspects of the code. I can import the plugin, but I can't see any source files, only binary class files. Does anyone know how I can download and view the eclipse source code? It does not seem straightforward at all.

Open Eclipse
Open menu 'Help' -> 'Install new software'
Select 'The Eclipse Project Updates'
Select 'Eclipse SDK' and install/restart
Open menu 'Window' -> 'Show View' -> 'Plug-ins'
You will find a list of all the plug-ins. Right-click on one, select 'Import as source project' and the source files will appear in a new project.
Note this works on Helios, it may be slightly different on other versions

The source code was not packaged with the version of eclipse that you were using, And Garrett Hall's suggestion was to download "Eclipse SDK Feature" from the "Eclipse Project Updates" site. "Eclipse SDK Feature" is nothing but source code with minimal eclipse. So the source would get downloaded and get installed and after a restart and an import of the plugin project, the plugin source code can be seen.
This is not universal- as in ,just downloading the Eclipse SDK feature would not be sufficient to see source code of any plugin(which did not include the sources).

If you want to understand the source code better, then I would suggest that you fetch it from SCM into your workspace. You can easily do that from the "Plugins" view: find the plugin you're interested in right and try right-click, "Import As" > "Project from Repository...". It should automatically clone the repository, checkout the right tag and import the source of the plugin.

Related

How to open the workspace folder from within Eclipse

My Eclipse has a project open which is inside a workspace folder.
Can I open the folder somehow from within Eclipse like you can in Visual Studio where you simply right click a project and press the "Open Containing Folder"?
There is a plugin that offers the functionality that you're seeing (and a little bit more) called, StartExplorer Eclipse Plug-in.
It's available here:
http://basti1302.github.io/startexplorer/
StartExplorer's github repo is here: https://github.com/basti1302/startexplorer
You install it by going to Help -> Install new software -> (add the update site url and install)

How to use SVN to build a library

I am trying to follow a tutorial, and I am told to:
1- Get the source code for the Java EMV Reader library from http://code.google.com/p/javaemvreader/ and build it.
2- Drop the resulting jar file in lib/.
3- Import the project in Eclipse and build it.
I right click the java files, and choose run as but don't get an option to run as Java Application. I also can not export the files as a JAR file. I have enclosed an image of what I have
After the first comment, I right clicked on my project, and under Maven, chose the option "configure as Maven" project. ( Thank you so much; this must be one of the fastest resolutions in the world )And I can now run the project. I get the window in my pic2, which I have attached. I don't however know what step 2 of the above instructions means. I don't see a lib/ folder. And the project he is refering to in step 3 is on git. Any ideas on what he means? ![pic2]!1
Eclipse projects have a "type" and that controls what tools are available. You probably created a "Basic Project" which means there are no compilers or other Java tools associated with it. You would want to create a Java Project in Eclipse.
That project does not seem to have Eclipse .project and .classpath files checked into the repository. It does look to be a Maven project however. So you would either want the m2eclipse plugins installed, and check this out as a Maven project, which would handle configuring everything else, or you want to use the Checkout As ... option and use the wizard to create a new Java project to checkout.
These are more Eclipse IDE questions than SVN or Subclipse questions.

Running Eclipse JDT from sources

I want to run Eclipse Java Development Tools form source code, but I'm stuck after checking out codes from eclipse repositories.
I've checked out all plugins from org.eclipse.jdt and imported them into my workspace, but after this I'm stuck.
There is lot of errors so obviously there are dependencides missing, but I don't know what else is needed to import/install in order to make this work.
I've read tutorial by Lars Vogella about working with Eclipse source codes, but it only covers examination of codes.
http://www.vogella.de/articles/EclipseCodeAccess/article.html
The Eclipse Classic Edition has the source-code of JDT and PDE integrated. After downloading and starting Eclipse Classic you can open the View "Plug-ins", select the JDT Plugins and select "Import as..." -> "Source Project" via Context-Menu
Following up our discussion, you should make sure that the versions of the plug-ins you check out from the source repository are consistent with those installed on your Eclipse. You can check out the source code of your installed plug-ins by going to the plug-ins view, right-click on the JDT plug-ins and choose Import As -> Project from a Repository... and select Import specific versions below.
A simple way is to
- File > Import
- Plug-ins and fragments
- On the next screen under 'Import as' select 'Projects from repository'
- On next screen, use filter as 'org.eclipse.jdt' and import all the matching plugins.

JUnit Eclipse plugin source-code?

I'm looking into writing an Eclipse plugin for FlexUnit and was wondering where I could get the sources for the JUnit Eclipse plugin. I checked the JUnit sources at sourceforge but couldn't spot any code that looked like the plugin code.
Any idea where this code is available?
You can find it on Eclipse's repository:
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.pde.junit/
There are now git mirrors of the CVS repositories:
org.eclipse.jdt.junit: git://dev.eclipse.org/org.eclipse.jdt/org.eclipse.jdt.junit.git
org.eclipse.jdt.junit.core: git://dev.eclipse.org/org.eclipse.jdt/org.eclipse.jdt.junit.core.git
org.eclipse.jdt.junit.runtime: git://dev.eclipse.org/org.eclipse.jdt/org.eclipse.jdt.junit.runtime.git
org.eclipse.jdt.junit4.runtime: git://dev.eclipse.org/org.eclipse.jdt/org.eclipse.jdt.junit4.runtime.git
Since you are in all likelihood using Eclipse, there's a far easier way to import it right into your workspace. The source is bundled with your eclipse distribution.
Just do
File -> Import -> Plug-ins and Fragments
Keep defaults ("Active target platform", "Select from all plug-ins" & "Projects with source folders"
Hit next, and select the JUnit plugin-packages and hit Finish, and they will be imported as Eclipse projects into your workspace.

How do I attach source code locations to plugins in my Eclipse RCP target platform?

I've got a workspace with multiple RCP plugin projects.
We've set the target platform, so we can build against a standard set of plugins, but are not able to see source code and Javadoc for all the platform plugins.
The Windows -> Preferences -> Plug-in Development -> Target Platform -> Source Code Locations page doesn't seem to have any effect when I add the eclipse directory (it only allows you to add directories).
Copying the source jars from the eclipse directory into the target platform has a similar effect.
What am I doing wrong? How do I attach a set of Source jars to my target platform?
I had the same problem today. In my case I wanted to debug into the source of the plugin embedded jetty (org.mortbay.jetty_5.1.14.v200806031611.jar) which comes with Eclipse Equinox (OSGI) which is part of my eclipse target platform.
When debugged and wanted to go into any class inside a jetty package I always got the message that it is a class from Plugin-Dependencies and the source attachment cannot be modified.
I solved it like this:
Switch to the Plugins View in Eclipse ( Window / Show View / Plugins)
locate the bundle org.mortbay.jetty
right click on that bundle and select "Import as" -> "Binary Project with linked content"
Now that Bundle shows up in your Package Explorer as a new Eclipse project, in my case org.mortbay.jetty.
Now right click on that new project in the package explorer and goto 'Properties / Java Build Path / Libraries'. You see the the jetty jar file there and if you expand this entry you can edit the 'Source Attachment' as usual. I pointed it to the downloaded Jetty Source code located in a completely different folder than my target platform which I am using for my project.
If you use Eclipse SDK bundles when building your target platform, you should be immediately provided with "Java Source Attachment" and "Javadoc Location" for each Eclipse plugin.
For example, I used "Eclipse Platform SDK" (eclipse-platform-SDK-3.4.2-win32) as target space and when I display the "Source Code Locations page" that you mentionned, it is filled with "Source locations declared in the target platform". In the Eclise IDE, I can then see Eclipse core plugins source code and javadoc (in JFace packages for example).
Otherway, it is not so easy to add plugins source code locations but you can succeed it in 2 ways :
providing a "source plugin" (the easiest way if the plugin provider also supplies the source plugin) into the target platform, as an ordinary plugin (PDE will recognise it)
providing an additional source location (not the easy way ...)
You can find more information about Target Source Code Locations in you Eclipse Help, in the following topic :
Plug-in Development Environment Guide > Tools > Preferences > Target Platform Preferences > Source Code Locations
All sources are available if you download the 'Eclipse for RCP and RAP Developers' build from the main downloads page. At least, that's what it's called for the Juno build, it used to be called Eclipse for RCP/Plug-in Developers.
It doesn't look like the plugin source code is available via the standard Java/J2ee Eclipse builds any longer. I was assuming the sources would be available via the update mechanism but have been unable to find the correct update site/feature. If anyone knows, please comment.
I can modify the target platform at runtime, using the -install runtime option. Keep the targetPlatform as the eclipse platform.
However, this loses a lot of the benefits of using a target platform in the first place - i.e. compile time safety.