简体   繁体   中英

How to view the SWT examples (Eclipse) source code?

I just downloaded the SWT examples from the Eclipse site but I have 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 (eg 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 (eg 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM