How to view the SWT examples (Eclipse) source code?
I just downloaded the SWT examples from the Eclipse site but I have开发者_JAVA百科 a problem: I cannot view the source code. I can launch the Control Example application (which I need) but if I create a project with those .jar-s included I just see empty packages in them. What do I do wrong? Is there a way to see those .java files?
I'm developing an RCP application for Eclipse and those examples can help me out.
Download the archive with examples from eclipse download site (e.g. org.eclipse.sdk.examples-3.7.zip).
Locate the plugins\org.eclipse.swt.examples.source_3.7.0.v3735b.jar
(or other appropriate jar version) file in the archive and extract the content (jar are just renamed zip files) to some existing Eclipse project or create new one (e.g. SWTExamples). In the src
folder you can find all example's sources. To run control example, run project with main class org.eclipse.swt.examples.controlexample.ControlExample
.
In the package org.eclipse.swt.examples.controlexample
you can find sources for which are you looking for.
IMHO the control examples have quite complicated source code, but there could be found what you need.
As listed on the SWT examples page:
If you have downloaded them and run them inside Eclipse, the sources can be found in eclipse/plugins/org.eclipse.swt.examples.[exampleName].source_[version].jar
If you downloaded the .jar's directly, you have instructions on the examples page (http://www.eclipse.org/swt/examples.php) on how to install them in eclipse, which should download the source .jar's.
Ok, I zipped out the .jar-s on my filesystem and now I see the sources. :)
So if someone runs into this problem, then you just have to unzip the .jar-s located in the plugins directory.
精彩评论