Skip to main content
Jump to: navigation, search

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

< E4
(New page: The SWT port for Flex consists of the Adobe Flex environment (the ActionScript compiler), the Flex tools plugins (which provides the tools needed to compile and launch Java code in a Flas...)
 
Line 1: Line 1:
 +
<h2>SWT for Flex</h2>
  
 
The SWT port for Flex consists of the Adobe Flex environment (the ActionScript compiler), the Flex tools plugins (which provides the tools needed to compile and launch 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!
 
The SWT port for Flex consists of the Adobe Flex environment (the ActionScript compiler), the Flex tools plugins (which provides the tools needed to compile and launch 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!
Line 11: Line 12:
 
   ''Error: could not find JRE''
 
   ''Error: could not find JRE''
 
   ''Error: could not find Java 2 Runtime Environment.''
 
   ''Error: could not find Java 2 Runtime Environment.''
 +
 +
'''Setup the Flex tools:'''
 +
 +
# Download a new build of Eclipse 3.5 (latest milestone build is fine).
 +
# 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.
 +
# 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.
 +
# Download the Flex tools by going to the e4 build site (http://download.eclipse.org/e4/downloads/), clicking on the latest build, and copying the link location of the Update link.
 +
# Back in your Eclipse workspace, select Help>Install New Software...
 +
# Click on the Add Site... button and paste in the Update link you copied from the build page. Click OK.  (Or drag the Update link from the build site into the first page of Help>Install New Software...)
 +
# Under the Uncategorized section, select the ActionScript Developer Tools plugin and click Next (twice), accept the license and click Install.
 +
# When prompted to restart, click on Yes.
 +
# 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'''
 +
 +
# Turn off auto build ('Project' -> 'Build Automatically')
 +
# 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.
 +
# Select the "e4.swt.as.demo.psf", right click and select Import Project Set... (If prompted for username:password, you should use anonymous:anonymous).
 +
# Add a new ActionScript VM. ('Window' -> 'Preferences' -> 'Java>Installed JREs').
 +
## Click Add...
 +
## Select ActionScript VM, click next.
 +
## Click Directory... and browse to either your Firefox or IE install directory.
 +
## Click OK.
 +
## Click Finish
 +
# 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).
 +
## org.eclipse.swt
 +
## org.eclipse.swt.e4.jcl
 +
## org.eclipse.swt.examples
 +
# Refresh the org.eclipse.swt project to pick up the linked resources.
 +
# Turn on Build Automatically (You can watch the build progress in the ActionScript Build Console, available from the Console view)
 +
#  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.
 +
 +
# Create a Java Project.
 +
# Add the ActionScript nature to the project "Select Project>Popup Menu>Action Script Tools>Toogle Nature".
 +
# Add the org.eclipse.swt project to the Java Build Path projects tab.
 +
# Change the execution environment of the project JRE container to J2AS-1.5
 +
# Add this class, save and Run as ActionScript Application
 +
<source lang="java">
 +
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();
 +
}
 +
}
 +
</source>

Revision as of 15:52, 6 February 2009

SWT for Flex

The SWT port for Flex consists of the Adobe Flex environment (the ActionScript compiler), the Flex tools plugins (which provides the tools needed to compile and launch 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!

The Eclipse target environment provides support for compiling, launching and debugging java applications in flash player.

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. Download a new build of Eclipse 3.5 (latest milestone build is fine).
  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. Download the Flex tools by going to the e4 build site (http://download.eclipse.org/e4/downloads/), clicking on the latest build, and copying the link location of the Update link.
  6. Back in your Eclipse workspace, select Help>Install New Software...
  7. Click on the Add Site... button and paste in the Update link you copied from the build page. Click OK. (Or drag the Update link from the build site into the first page of Help>Install New Software...)
  8. Under the Uncategorized section, select the ActionScript Developer Tools plugin and click Next (twice), accept the license and click Install.
  9. When prompted to restart, click on Yes.
  10. 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