Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "E4/SWT/Running the demos"

< E4
m
Line 13: Line 13:
 
'''Setup the Flex tools:'''
 
'''Setup the Flex tools:'''
  
# Shut down the Eclipse build which has the SWT ActionScript tools installed. If you do not have an Eclipse build with the SWT ActionScript tools already installed, follow these [[E4/Install | directions]] before continuing.
+
# Shut down the Eclipse build which has the SWT ActionScript tools installed. If you do not have an Eclipse build with the SWT ActionScript tools already installed, follow [[E4/Install | these directions]] before continuing.
 
# Update your eclipse.ini file and add another line at the end, -Dflex.sdk=&lt;your path to the installed sdk&gt; '''Note: Make sure you don't edit the command line (for example in a launch shortcut) as it overrides the .ini file and loses the Flex settings.'''
 
# Update your eclipse.ini file and add another line at the end, -Dflex.sdk=&lt;your path to the installed sdk&gt; '''Note: Make sure you don't edit the command line (for example in a launch shortcut) as it overrides the .ini file and loses the Flex settings.'''
 
# Make sure that you are using at least a 1.5 JRE to run Eclipse as the ActionScript tools plugin requires it.
 
# Make sure that you are using at least a 1.5 JRE to run Eclipse as the ActionScript tools plugin requires it.

Revision as of 18:37, 6 February 2009

These instructions assume that you have already downloaded and installed the SWT ActionScript development tools. If you have not, please follow these directions before continuing.

The SWT port for Flex consists of the Adobe Flex environment (the ActionScript compiler), the SWT ActionScript development tools plugins (which provides the tools needed to build, launch and debug Java code in a Flash player) and the Eclipse target environment (the running plugins, the SWT port itself and example code). NOTE: That the both the tools and the port are in the pre-alpha stage. You are living on the bleeding edge. Good luck!

Setup Flex environment:

  1. Download and install the Adobe Open Source Flex SDK (available from http://opensource.adobe.com). NOTE: The path where you install the Flex SDK must contain no spaces. This is due to a bug in FCSH.
  2. Verify that your Flex install works by opening a command prompt, changing to the Flex SDK bin directory, typing "mxmlc" and hitting Enter. If you get a message like the following, you will need to add a JAVA_HOME environment variable that points to the home dir or edit the bin/jvm.config file in the Flex SDK.
  Error: could not find JRE
  Error: could not find Java 2 Runtime Environment.

Setup the Flex tools:

  1. Shut down the Eclipse build which has the SWT ActionScript tools installed. If you do not have an Eclipse build with the SWT ActionScript tools already installed, follow these directions before continuing.
  2. Update your eclipse.ini file and add another line at the end, -Dflex.sdk=<your path to the installed sdk> Note: Make sure you don't edit the command line (for example in a launch shortcut) as it overrides the .ini file and loses the Flex settings.
  3. Make sure that you are using at least a 1.5 JRE to run Eclipse as the ActionScript tools plugin requires it.
  4. Create a new Eclipse Workspace. NOTE: The path were you create the workspace must contain no spaces. This is due to a bug in FCSH.
  5. Create a workspace variable in Linked Resources preference page ('Preferences' -> 'Workspace' -> 'Linked Resources'). The variable should be called WORKSPACE and point to the root of your Eclipse workspace.

Setup the Eclipse target environment

  1. Turn off auto build ('Project' -> 'Build Automatically')
  2. Connect to dev.eclipse.org:/cvsroot/eclipse and browse to the e4 project. Check out the org.eclipse.e4.swt.releng project into your workspace.
  3. Select the "e4.swt.as.demo.psf", right click and select Import Project Set... (If prompted for username:password, you should use anonymous:anonymous).
  4. Add a new ActionScript VM. ('Window' -> 'Preferences' -> 'Java>Installed JREs').
    1. Click Add...
    2. Select ActionScript VM, click next.
    3. Click Directory... and browse to either your Firefox or IE install directory.
    4. Click OK.
    5. Click Finish
  5. Change the .classpath_flex to .classpath for the following projects. (Note that in order to see the classpath files, you have to either do this in the Navigator view or turn off the resources filter in the Packages Explorer by clicking on the drop down arrow menu in the top right hand corner of the package explorer, selecting Filters and unchecking *.resources).
    1. org.eclipse.swt
    2. org.eclipse.swt.e4.jcl
    3. org.eclipse.swt.examples
  6. Refresh the org.eclipse.swt project to pick up the linked resources.
  7. Turn on Build Automatically (You can watch the build progress in the ActionScript Build Console, available from the Console view)
  8. You can run any of the demos from org.eclipse.swt.e4.examples by clicking on them and Selecting "Run As>ActionScript Application". Note that for the Flickr example, you must select static linking in the launch configuration dialog.

Setup a sample SWT ActionScript project from scratch

 Note that this assumes you have gone through the steps above.
  1. Create a Java Project.
  2. Add the ActionScript nature to the project "Select Project>Popup Menu>Action Script Tools>Toogle Nature".
  3. Add the org.eclipse.swt project to the Java Build Path projects tab.
  4. Change the execution environment of the project JRE container to J2AS-1.5
  5. Add this class, save and Run as ActionScript Application
public class Main {
	public static void main(String[] args) {
		Display display = new Display();
		Shell shell = new Shell(display);
		shell.setLayout(new GridLayout(1, false));
 
		Button b = new Button(shell, SWT.PUSH);
		b.setText("Push");
 
		shell.pack();
		shell.open();
	}
}

Back to the top