Eclipse without ZK Studio
- Visit Eclipse download page and download Eclipse IDE for Java EE Developers
- Uncompress it to a proper directory
- Then, eclipse is ready to start.
- For example, you could double-click eclipse.exe to start Eclipse under Windows.
Setting up Eclipse without ZK Studio
Here is the description of using ZK with Eclipse without ZK Studio. However, it is recommended to use ZK Studio for Eclipse, which is much more powerful and easier to use.
How to setup the zul.xsd schema into Eclipse
- You should have setup Eclipse to work with ZK. The details is in the above smalltalk.
- Execute the Eclipse SDK.
- Select Window/Preferences... from the menu and the Preferences dialog popup.
- Select Web and XML/XML Catalog from the left sidebar tree menu and the right side is the XML Catalog panel.
- Select User Specified Entries in the XML Catalog Entries field and press the Add... button.
- The Add XML Catalog Entry dialog now popup:
- Now you should see a new entry http://www.zkoss.org/2005/zul/zul.xsd under the User Specified Entires.
How to generate ZUL files from the ZUL schema using Eclipse
- You should have setup the zul.xsd schema into Eclipse.
- Select File/New/Other... from the Eclipse SDK menu and the New dialog popup.
- In Select a wizard page, select XML/XML from the tree menu and press Next > button.
- In Create XML File page, select Create XML file from an XML schema file and then press Next > button.
- In XML File Name page, type or select a proper parent folder for your project. It is generally under the WebContext folder of your project. Then type in the ZUL file name you want to create(e.g. helloworld.zul) and press Next > button.
- In Select XML Schema File page, select Select XML catalog entry option. You should see the http://www.zkoss.org/2005/zul/zul.xsd in the XML Catalog list. Now select the entry and press Next > button.
- In Select Root Element page:
- In Root Element field, pick a proper root element. In most ZK applications, it is generally a window or an zk element.
- In Content options field, you can leave as it is.
- In Namespace Information field, you can select the entry and press edit... button to take out the prefix or change the prefix.
- Press Finish button.
- The ZUL file is created and opened on an XML editor window.
- Now you can start editing your ZUL file. Press Alt-/ to open the Content Assist popup window to help you fill up proper ZUL elements and attributes.
Add Schema to ZUL Manually
Instead of using Eclipse's XML wizard, you could specify the schema directly in your ZUL document, such that the validation and Content Assist will be enabled automatically. Here is an example.
<zk xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.zkoss.org/2005/zul/zul.xsd"> ... </zk>
Notice that you have to specify the schema location in the root element, and the root element could be any valid ZUL component, such as window.
How to setup Eclipse to work with zhtml
- Select Window/Preferences... from the Eclipse SDK menu and the Preferences dialog will popup.
- Select General and Content Types Catalog from the left sidebar tree menu and the right side is the Content Types panel.
- Select Text and XML in the Content types and press the Add... button .
- Add *.zhtml or such as *.zul, *.jsp, *.html etc.
- Finally, you can press the RightClick on your file and choose the XML editor in the Open With menu.
How to setup the Rational Application Developer RAD version of Eclipse to work with zhtml
- Select Window/Preferences... from the SDK menu and the Preferences dialog will popup.
- Select Workbench/File Assocations then click on the top Add to add a file type *.zhtml
- Click on the lower Add and select HTML Source Page Editor and set it to be default