Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 638
Adam Arold Avatar asked Jul 26 '11 13:07

Adam Arold


People also ask

How do I download SWT for Eclipse?

3.1.Download the SWT library from the Eclipse download page. Navigate to the download page of the latest stable Eclipse release. Scroll down to the SWT binaries and download the correct version for your Java and OS version. Copy the swt.

What is SWT in programming?

SWT is an open source widget toolkit for Java designed to provide efficient, portable access to the user-interface facilities of the operating systems on which it is implemented.

What is SWT composite?

Composite is an ancestor of every SWT class to which you can add widgets, including Shell . For that reason, you can think of a Composite as being simply the working area of a Shell , without the styles associated with the aspects of Shell that make windows—the titlebar, control menu, etc.

What is Shell in SWT?

public Shell(Display display) Constructs a new instance of this class given only the display to create it on. It is created with style SWT.


2 Answers

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.

like image 83
Sorceror Avatar answered Oct 06 '22 23:10

Sorceror


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.

like image 38
Johan Sannemo Avatar answered Oct 07 '22 01:10

Johan Sannemo