The Project Wizard is a scaffolding wizard. This means it generates files and folders for you. This powerful wizard is by far the greatest of them all. Below is a list of features.
Name
The project name
Source Folder
The source folder for your classes. This must be where your classes are located and doesn't include external libraries.
Package
The base package of your project. So this will be everything up to the point of framework specific package definitions.
So if the "view" package is specific to the framework it shouldn't be included. For PureMVC for example, com.company.project.client is a
sufficient basepath as the wizard will append the framework specific packages like "controller" or "model". These leaf packages are
defined within the template for each type of project. Essentially the wizard makes use of string tokenizers and will replace a token
within the template class files with the concatenated value specified here.
Template
The project template to follow for creating this project. To see how to customise or create a new template please see the Template section.
Template Location
The default location will be where the plug-in was installed to which should be in your Eclipse install location under
"plugins" and then com.wezside.fwk.../templates. When creating custom templates just change this value to where the new templates are
stored. Should the list of different types of templates not appear in the combo box then there was an error in parsing the custom
templates.
It's easy to create new templates although a firm understanding of the template features and structure does help. It is advisable to make a copy of the default templates and start by changing the location to the new location in the preference settings as mentioned above. Below is a short tutorial on creating a custom template with the template descriptor file explained.
The structure
A single config XML file lists all the templates with their relative location included as shown below:
<?xml version="1.0" encoding="UTF-8"?> <config> <project_type> <item src="pureas.xml"><![CDATA[AS3]]></item> <item src="airbasic.xml"><![CDATA[AIR]]></item> <item src="away3d.xml"><![CDATA[Away3D]]></item>--> <item src="cairngorm.xml"><![CDATA[Cairngorm]]></item> <item src="pureas.xml"><![CDATA[CS]]></item> <item src="flex.xml"><![CDATA[Flex]]></item> <item src="gigya.xml"><![CDATA[Gigya Widget]]></item> <item src="mate.xml"><![CDATA[Mate]]></item>--> <item src="modulo.xml"><![CDATA[Modulo]]></item> <item src="parsley.xml"><![CDATA[Parsley]]></item> <item src="pv3d.xml"><![CDATA[Pv3D]]></item>--> <item src="puremvc.xml"><![CDATA[PureMVC]]></item> <item src="robotlegs.xml"><![CDATA[RobotLegs]]></item> </project_type> </config>
Browse to the installed location of the plug-in {eclipse-installation}/plugins/com.wezside.fwk.WizardCollection_{version}. Copy the templates/ folder to a location that won't change. If you want to you can change these templates from the install directory although it's not recomended cause if anything goes wrong you will have to re-install the plug-in.
Open the config.xml and duplicate one of the item nodes. Update the src attribute and the CDATA label. The src is relative to the XML so if you want you can include it in a sub-folder but then be sure to update this location in the src attribute. The default is to leave it in the same folder and create subfolders for the actual template files.
<?xml version="1.0" encoding="UTF-8"?> <config> <project_type> ... <item src="custom.xml"><![CDATA[My Custom Template]]></item> ... </project_type> </config>
Create a new file with the same name and location as specified in the src attribute in the config.xml file. The purpose of this file is to define the collections of files and folders that will be included in this template.
<?xml version="1.0" encoding="UTF-8"?> <template> <meta> <content id="author" value="Wesley.Swanepoel" /> </meta> <template_files> <!-- Class files --> <file src="puremvc/App.mxml" type="class" outputPath="" forceRoot="true" /> ... <!-- Other template files --> <file src="puremvc/data.xml" type="bin" outputPath="bin/xml" /> <file src="puremvc/index.html" type="bin" outputPath="bin" /> <file src="puremvc/swfobject.js" type="bin" outputPath="bin/js/swfobject" /> ... </template_files> <template_folders> <folder type="src"><![CDATA[controller]]></folder> <folder type="src"><![CDATA[model]]></folder> <folder type="src"><![CDATA[view/components]]></folder> <folder type="bin"><![CDATA[bin/xml]]></folder> <folder type="bin"><![CDATA[bin/js/swfobject]]></folder> <folder type="bin"><![CDATA[lib]]></folder> </template_folders> </template>
The following replacement string tokens are available for use within template files:
The last step is to create the files and folders defined in the path specified within the template. String token replacement will only happen on text files. Below is an example of a class file using the {package} and {author} tokens.
package {package}.view.component
{
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.text.TextFormat;
import gs.TweenLite;
/**
* @author {author}
* @version 0.8.3.200911261311.200911261311.200911261311.200911261311.200911261311.200911261311.200911261311.200911261311
*/
public class ProgressView extends Sprite
{
public static const NAME:String = "ProgressView";
public static const SHOW:String = NAME + "Show";
public static const HIDE:String = NAME + "Hide";
public static const UPDATE:String = NAME + "Update";
private var textField:TextField;
public function ProgressView()
{
init();
}
private function init():void
{
var textFormat:TextFormat = new TextFormat();
textFormat.color = 0xFFFFFF;
textFormat.font = 'Arial';
textField = new TextField();
textField.autoSize = TextFieldAutoSize.CENTER;
textField.defaultTextFormat = textFormat;
textField.embedFonts = true;
textField.text = 'Please wait...';
textField.x = 300 - ( textField.width / 2 );
textField.y = 200 - ( textField.height / 2 );
addChild( textField );
}
public function show():void
{
textField.text = "Please wait...";
TweenLite.to( this, .5, { autoAlpha: 1 } );
}
public function hide():void
{
TweenLite.to( this, .5, { autoAlpha: 0 } );
}
public function update(percent:Number):void
{
textField.text = "Loaded " + percent + "%";
}
}
}
You can install this plug-in through the Eclipse Update Manager:
http://fwk.wezside.co.za/update