Setting Up Eclipse For Flex 2
Posted By : todd sharp Posted At : March 26, 2007 7:20 AM Posted In: Flex
36
Back in 2005 Darron Schall posted Setting Up Eclipse For Flex. A great article, but with the release of Flex 2 it has become a little outdated. I took some time this weekend to set up Eclipse for Flex 2 and thought I'd revise Darron's post a bit to bring it up to speed for those of us who don't generate the revenue to justify Flex Builder but still like to play with it (aka are too cheap to buy it). So here are the steps to get Eclipse up and running. Don't forget that the Flex 2 SDK is completely free so you now have no excuse for not getting into Flex anymore :)
The following steps assume that you're already running the latest version of Eclipse.
Step 1
Download and install the Eclipse Web Tools Platform. As of this post the current version is 1.5.3 so that's where the download link above will take you. Go here if you want to check for a newer version. You really just need the Web Standards portion to set Eclipse up to edit .mxml files - so don't worry about the J2EE project (unless you really want that).
Here's a complete list of files to download.
- emf-sdo-xsd-SDK-2.2.2.zip
- GEF-SDK-3.2.2.zip
- JEM-SDK-1.2.3_jem.zip
- wtp-wst-R-1.5.3.zip (or the complete Web Standards Tools download)
Step 2
Unzip and copy the contents of each package into Eclipse's Features and Plugins directories respectively. The Web Standards Tools are now installed (well, assuming you've restarted Eclipse if you had it running).
I'm going to borrow some of Darron's original post from here and modify as appropriate:
Now that the appropriate plugins are installed, we need to configure Eclipse to recognize .mxml.Start Eclipse
From the menu, select Window -> Preferences. Select General -> Content Types. On the right, expand Text and highlight XML. Click the "Add" button and enter "*.mxml" as the file type. Click OK.
Still in the Window -> Preferences menu, expand "Web and XML" and select "XML Catalog". Click "User Specified Entries" and click "Add" and use the following values.
* URI: browse for the path to the mxml.xsd file (something like: C:\Program Files\Macromedia\Flex\extras\schema\mxml.xsd) Updated from original post: The mxml xsd does *not* ship with the Flex 2 SDK. Tom Chiverton has updated the 1.5 xsd for Flex 2 (available here) but it is not 100% updated. I exchanged emails with Tom yesterday and he did say that he had a new version that he will post online soon. Hey Adobe...we really love your product...can you please give us the xsd??? :)
* Key: Edited from original post http://www.adobe.com/2006/mxml
Click OK to close the preferences window.
That's it! Eclipse should now recognize any tags using the mx: namespace (well, all those that are in the xsd that is) and will give you the appropriate mxml code hints as you code. One catch - thanks Tom for pointing this out - is that when you're within a tag (IE <mx:Button>) you'll need to hit CTRL+Space to bring up the attribute hints.
So I hear you saying "That's great! I can now code Flex applications without Flex Builder a little easier. But how can I compile them easily?" Well there are several ways to do that, but that's another post :) I am also working on a tool to help manage small Flex projects that will help you compile and generate HTML wrappers (without messing with ANT).



http://cfsilence.com/blog/client/index.cfm/2007/4/...
First, I have Eclipse 3.2.2. I downloaded 'EMF' (http://www.eclipse.org/modeling/emf/downloads/?pro...).
Get version 2.2.3! (Not 2.3.0!).
Then I could install 'WST' using the Help-> Software Updates .. -> .. Callisto and then the last entry. Click the button that checks requirements.
Once this is all finished I have the 'Web and XML' entry.
One Question:
I'm looking for a actionscript plugin (syntax, hints, etc.) for eclipse that works in combination with your flex plugin.
If I use this one:
http://sourceforge.net/projects/aseclipseplugin/
there is no syntax hightlighting of as - code in *.mxml files.
Do you know a solution?
Thanks a lot for your work so far.
Hope this helps
Thanks!
Even though I browse to the .xsd file, if I shut the preferences window and re-open it, I get a message in red saying that the .xsd file can't be found. This is because Eclipse changes the path to the .xsd file to something that actually can't be found. No matter where I put it, it can't find it.
So after all this effort, eclipse is about as useful in this context as Notepad.
Thanks for the tutorial. I tried it, but it seems as if something went wrong. I get no syntax highlighting and no code completion when opening/editing an mxml file.
I installes the WTF through the plugin manager directly in eclipse.
Do you know what could be the problem?
java.lang.NullPointerException
at org.eclipse.wst.sse.ui.StructuredTextEditor.update(StructuredTextEditor.java:3047)
at org.eclipse.wst.xml.ui.internal.tabletree.XMLMultiPageEditorPart.addSourcePage(XMLMultiPageEditorPart.java:338)
at org.eclipse.wst.xml.ui.internal.tabletree.XMLMultiPageEditorPart.createPages(XMLMultiPageEditorPart.java:505)
at org.eclipse.ui.part.MultiPageEditorPart.createPartControl(MultiPageEditorPart.java:276)
at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:596)
at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:372)
at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:566)
at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:290)
at org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:140)
at org.eclipse.ui.internal.presentations.util.PresentablePartFolder.select(PresentablePartFolder.java:268)
at org.eclipse.ui.internal.presentations.util.LeftToRightTabOrder.select(LeftToRightTabOrder.java:65)
at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.selectPart(TabbedStackPresentation.java:394)
at org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:1144)
at org.eclipse.ui.internal.PartStack.setSelection(PartStack.java:1097)
at org.eclipse.ui.internal.PartStack.showPart(PartStack.java:1311)
at org.eclipse.ui.internal.PartStack.add(PartStack.java:455)
at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:102)
at org.eclipse.ui.internal.PartStack.add(PartStack.java:441)
at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:111)
at org.eclipse.ui.internal.EditorSashContainer.addEditor(EditorSashContainer.java:60)
at org.eclipse.ui.internal.EditorAreaHelper.addToLayout(EditorAreaHelper.java:217)
at org.eclipse.ui.internal.EditorAreaHelper.addEditor(EditorAreaHelper.java:207)
at org.eclipse.ui.internal.EditorManager.createEditorTab(EditorManager.java:822)
at org.eclipse.ui.internal.EditorManager.openEditorFromDescriptor(EditorManager.java:721)
at org.eclipse.ui.internal.EditorManager.openEditor(EditorManager.java:682)
at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2593)
at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2528)
at org.eclipse.ui.internal.WorkbenchPage.access$10(WorkbenchPage.java:2520)
at org.eclipse.ui.internal.WorkbenchPage$9.run(WorkbenchPage.java:2505)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2500)
at org.eclipse.ui.actions.OpenWithMenu.openEditor(OpenWithMenu.java:288)
at org.eclipse.ui.actions.OpenWithMenu.access$0(OpenWithMenu.java:280)
at org.eclipse.ui.actions.OpenWithMenu$2.handleEvent(OpenWithMenu.java:184)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3348)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2968)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1930)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1894)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:422)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:95)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
at org.eclipse.core.launcher.Main.run(Main.java:977)
at org.eclipse.core.launcher.Main.main(Main.java:952)
Try specifying the core classes location (under Windows-Preferences, ActionScript2, Core path). If you have flex2 sdk specify the lib directory.
Then change to ActionScript2 perspective and create a project then move your AS sources there and try to open from your project.
The other exception you would see if you used the ASDT 085 release is a ClassCastException under the same circumstances. If you set the core path and open the files under a project then all is well. At least with Eclipse 3.3
And that's it. The "Web and XML" should appear.
I have Eclipse 3.2.2 and i am trying to intergarte plugin of Flex 3. So can u giide me which plugin required and also where the mxml.xsd file is present?
Please reply this......
I am tryig to run my project using Ant build (apache-ant-1.7.1-bin.zip) with flex 2 sdk and eclipse 3.2.2. But it throwing one error like below
:
:[exec] Loading configuration file C:\Program Files\flex_sdk_2_194515\frameworks\flex-config.xml
[exec] Error: unable to open 'Workspace\Flex\test.mxml'
[exec] Use 'mxmlc -help' for information about using the command line.
BUILD FAILED
D:\Flex Workspace\Flex\build.xml:5: exec returned: 1
Ant build is running as i have tested from command prompt.
Please suggest me why this error is coming?????
I am having a difficulty in figuring out the latest / exact versions of the four plugins (emf,gef,jem,wtp as mentioned in this post) to be installed.It would be great if I could get help regarding this....
Please reply
above but i still dont get the Flex perspective. Please help