You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by rz...@apache.org on 2013/01/15 22:44:03 UTC

svn commit: r1433677 [1/3] - in /flex/utilities/trunk/installerLocaleEditor: ./ libs/ src/ src/assets/ src/org/ src/org/apache/ src/org/apache/flex/ src/org/apache/flex/runtimelocale/ src/org/apache/flex/runtimelocale/command/ src/org/apache/flex/runti...

Author: rzwaga
Date: Tue Jan 15 21:44:01 2013
New Revision: 1433677

URL: http://svn.apache.org/viewvc?rev=1433677&view=rev
Log:
initial commit of the Apache Flex Installer Locale Editor utility

Added:
    flex/utilities/trunk/installerLocaleEditor/
    flex/utilities/trunk/installerLocaleEditor/libs/
    flex/utilities/trunk/installerLocaleEditor/libs/as3commons-logging-2.7.swc   (with props)
    flex/utilities/trunk/installerLocaleEditor/libs/spring-actionscript-flex-2.0.0-SNAPSHOT.swc   (with props)
    flex/utilities/trunk/installerLocaleEditor/src/
    flex/utilities/trunk/installerLocaleEditor/src/Main-app.xml
    flex/utilities/trunk/installerLocaleEditor/src/Main.mxml
    flex/utilities/trunk/installerLocaleEditor/src/assets/
    flex/utilities/trunk/installerLocaleEditor/src/assets/114.png   (with props)
    flex/utilities/trunk/installerLocaleEditor/src/assets/128.png   (with props)
    flex/utilities/trunk/installerLocaleEditor/src/assets/16.png   (with props)
    flex/utilities/trunk/installerLocaleEditor/src/assets/32.png   (with props)
    flex/utilities/trunk/installerLocaleEditor/src/assets/36.png   (with props)
    flex/utilities/trunk/installerLocaleEditor/src/assets/48.png   (with props)
    flex/utilities/trunk/installerLocaleEditor/src/assets/57.png   (with props)
    flex/utilities/trunk/installerLocaleEditor/src/assets/72.png   (with props)
    flex/utilities/trunk/installerLocaleEditor/src/helptext.txt
    flex/utilities/trunk/installerLocaleEditor/src/logging-config.xml
    flex/utilities/trunk/installerLocaleEditor/src/org/
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/IStatusReporter.as
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/AbstractApplicationModelAwareBaseCommand.as
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/AbstractBaseCommand.as
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/ApplicationErrorStatusCommand.as
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/ApplicationInfoStatusCommand.as
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/CreateLocaleRequestCommand.as
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/InitializeApplicationCommand.as
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/LocaleFileLoadedCommand.as
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/LocaleFileReadyCommand.as
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/LocaleFileSaveRequestCommand.as
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/LocaleFileShowRequestCommand.as
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/NewLocaleItemRequestCommand.as
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/NewLocaleRequestCommand.as
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/ReferenceLocaleRequestCommand.as
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/RemoveLocaleItemRequestCommand.as
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/RemoveLocaleRequestCommand.as
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/RequestAddMissingKeysCommand.as
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/SaveConfigurationRequestCommand.as
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/ShowHelpRequestCommand.as
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/ShowLocaleFileSelectorViewCommand.as
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/ShowLogFileRequestCommand.as
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/context/
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/context/MainConfiguration.mxml
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/context/StageObjectSelector.as
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/controller/
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/controller/ApplicationController.as
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/event/
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/event/ApplicationStatusEvent.as
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/event/InitializeApplicationEvent.as
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/event/LocaleDataEvent.as
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/event/LocaleEvent.as
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/event/LocaleFileEvent.as
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/event/LocaleFileLoadedEvent.as
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/event/LocaleItemEvent.as
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/event/ReferenceLocaleRequestEvent.as
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/event/SaveConfigurationEvent.as
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/event/ShowHelpRequestEvent.as
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/event/ShowLocaleFileSelectorViewEvent.as
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/event/ShowLogFileRequestEvent.as
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/ini/
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/ini/IniReader.as
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/model/
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/model/ApplicationModel.as
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/model/IApplicationModelAware.as
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/model/LocaleFileSelectorPM.as
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/model/MainViewPM.as
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/model/locale/
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/model/locale/LocaleDataVO.as
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/model/locale/LocaleItemDataVO.as
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/view/
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/view/HelpView.mxml
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/view/IInjectableView.as
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/view/LocaleFileSelectorView.mxml
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/view/LocaleView.mxml
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/view/MainView.mxml
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/view/NewLocaleView.mxml
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/view/TextFileContentView.mxml
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/view/itemrenderer/
    flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/view/itemrenderer/LocaleItemView.mxml

Added: flex/utilities/trunk/installerLocaleEditor/libs/as3commons-logging-2.7.swc
URL: http://svn.apache.org/viewvc/flex/utilities/trunk/installerLocaleEditor/libs/as3commons-logging-2.7.swc?rev=1433677&view=auto
==============================================================================
Binary file - no diff available.

Propchange: flex/utilities/trunk/installerLocaleEditor/libs/as3commons-logging-2.7.swc
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: flex/utilities/trunk/installerLocaleEditor/libs/spring-actionscript-flex-2.0.0-SNAPSHOT.swc
URL: http://svn.apache.org/viewvc/flex/utilities/trunk/installerLocaleEditor/libs/spring-actionscript-flex-2.0.0-SNAPSHOT.swc?rev=1433677&view=auto
==============================================================================
Binary file - no diff available.

Propchange: flex/utilities/trunk/installerLocaleEditor/libs/spring-actionscript-flex-2.0.0-SNAPSHOT.swc
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: flex/utilities/trunk/installerLocaleEditor/src/Main-app.xml
URL: http://svn.apache.org/viewvc/flex/utilities/trunk/installerLocaleEditor/src/Main-app.xml?rev=1433677&view=auto
==============================================================================
--- flex/utilities/trunk/installerLocaleEditor/src/Main-app.xml (added)
+++ flex/utilities/trunk/installerLocaleEditor/src/Main-app.xml Tue Jan 15 21:44:01 2013
@@ -0,0 +1,232 @@
+<?xml version="1.0" encoding="utf-8" standalone="no"?>
+<application xmlns="http://ns.adobe.com/air/application/3.1">
+
+	<!-- Adobe AIR Application Descriptor File Template.
+
+		Specifies parameters for identifying, installing, and launching AIR applications.
+
+		xmlns - The Adobe AIR namespace: http://ns.adobe.com/air/application/3.1
+				The last segment of the namespace specifies the version
+				of the AIR runtime required for this application to run.
+
+		minimumPatchLevel - The minimum patch level of the AIR runtime required to run
+				the application. Optional.
+	-->
+
+	<!-- A universally unique application identifier. Must be unique across all AIR applications.
+	Using a reverse DNS-style name as the id is recommended. (Eg. com.example.ExampleApplication.) Required. -->
+	<id>org.apache.flex.utilities.apacheflexinstallerlocaleeditor</id>
+
+	<!-- Used as the filename for the application. Required. -->
+	<filename>ApacheFlexInstallerLocaleEditor</filename>
+
+	<!-- The name that is displayed in the AIR application installer.
+	May have multiple values for each language. See samples or xsd schema file. Optional. -->
+	<name>Apache Flex Installer - Locale Editor</name>
+
+	<!-- A string value of the format <0-999>.<0-999>.<0-999> that represents application version which can be used to check for application upgrade.
+	Values can also be 1-part or 2-part. It is not necessary to have a 3-part value.
+	An updated version of application must have a versionNumber value higher than the previous version. Required for namespace >= 2.5 . -->
+	<versionNumber>1.0.1</versionNumber>
+
+	<!-- A string value (such as "v1", "2.5", or "Alpha 1") that represents the version of the application, as it should be shown to users. Optional. -->
+	<versionLabel>v1.0.1</versionLabel>
+
+	<!-- Description, displayed in the AIR application installer.
+	May have multiple values for each language. See samples or xsd schema file. Optional. -->
+	<description>Utility that makes it easier to manage the different locales for the Apache Flex Installer project.</description>
+
+	<!-- Copyright information. Optional -->
+	<!-- <copyright></copyright> -->
+
+	<!-- Publisher ID. Used if you're updating an application created prior to 1.5.3 -->
+	<!-- <publisherID></publisherID> -->
+
+	<!-- Settings for the application's initial window. Required. -->
+	<initialWindow>
+		<!-- The main SWF or HTML file of the application. Required. -->
+		<!-- Note: In Flash Builder, the SWF reference is set automatically. -->
+		<content>[This value will be overwritten by Flash Builder in the output app.xml]</content>
+
+		<!-- The title of the main window. Optional. -->
+		<!-- <title></title> -->
+
+		<!-- The type of system chrome to use (either "standard" or "none"). Optional. Default standard. -->
+		<!-- <systemChrome></systemChrome> -->
+
+		<!-- Whether the window is transparent. Only applicable when systemChrome is none. Optional. Default false. -->
+		<!-- <transparent></transparent> -->
+
+		<!-- Whether the window is initially visible. Optional. Default false. -->
+		<!-- <visible></visible> -->
+
+		<!-- Whether the user can minimize the window. Optional. Default true. -->
+		<!-- <minimizable></minimizable> -->
+
+		<!-- Whether the user can maximize the window. Optional. Default true. -->
+		<!-- <maximizable></maximizable> -->
+
+		<!-- Whether the user can resize the window. Optional. Default true. -->
+		<!-- <resizable></resizable> -->
+
+		<!-- The window's initial width in pixels. Optional. -->
+		<!-- <width></width> -->
+
+		<!-- The window's initial height in pixels. Optional. -->
+		<!-- <height></height> -->
+
+		<!-- The window's initial x position. Optional. -->
+		<!-- <x></x> -->
+
+		<!-- The window's initial y position. Optional. -->
+		<!-- <y></y> -->
+
+		<!-- The window's minimum size, specified as a width/height pair in pixels, such as "400 200". Optional. -->
+		<!-- <minSize></minSize> -->
+
+		<!-- The window's initial maximum size, specified as a width/height pair in pixels, such as "1600 1200". Optional. -->
+		<!-- <maxSize></maxSize> -->
+
+		<!-- The initial aspect ratio of the app when launched (either "portrait" or "landscape"). Optional. Mobile only. Default is the natural orientation of the device -->
+
+		<!-- <aspectRatio></aspectRatio> -->
+
+		<!-- Whether the app will begin auto-orienting on launch. Optional. Mobile only. Default false -->
+
+		<!-- <autoOrients></autoOrients> -->
+
+		<!-- Whether the app launches in full screen. Optional. Mobile only. Default false -->
+
+		<!-- <fullScreen></fullScreen> -->
+
+		<!-- The render mode for the app (either auto, cpu, gpu, or direct). Optional. Default auto -->
+
+		<!-- <renderMode></renderMode> -->
+
+		<!-- Whether or not to pan when a soft keyboard is raised or lowered (either "pan" or "none").  Optional.  Defaults "pan." -->
+		<!-- <softKeyboardBehavior></softKeyboardBehavior> -->
+		<autoOrients>false</autoOrients>
+		<fullScreen>false</fullScreen>
+		<visible>false</visible>
+	</initialWindow>
+
+	<!-- We recommend omitting the supportedProfiles element, -->
+	<!-- which in turn permits your application to be deployed to all -->
+	<!-- devices supported by AIR. If you wish to restrict deployment -->
+	<!-- (i.e., to only mobile devices) then add this element and list -->
+	<!-- only the profiles which your application does support. -->
+	<!-- <supportedProfiles>desktop extendedDesktop mobileDevice extendedMobileDevice</supportedProfiles> -->
+
+	<!-- The subpath of the standard default installation location to use. Optional. -->
+	<!-- <installFolder></installFolder> -->
+
+	<!-- The subpath of the Programs menu to use. (Ignored on operating systems without a Programs menu.) Optional. -->
+	<!-- <programMenuFolder></programMenuFolder> -->
+
+	<!-- The icon the system uses for the application. For at least one resolution,
+	specify the path to a PNG file included in the AIR package. Optional. -->
+	<icon>
+		<image16x16>assets/16.png</image16x16>
+		<image32x32>assets/32.png</image32x32>
+		<image36x36>assets/36.png</image36x36>
+		<image48x48>assets/48.png</image48x48>
+		<image57x57>assets/57.png</image57x57>
+		<image72x72>assets/72.png</image72x72>
+		<image114x114>assets/114.png</image114x114>
+		<image128x128>assets/128.png</image128x128>
+	</icon>
+
+	<!-- Whether the application handles the update when a user double-clicks an update version
+	of the AIR file (true), or the default AIR application installer handles the update (false).
+	Optional. Default false. -->
+	<!-- <customUpdateUI></customUpdateUI> -->
+
+	<!-- Whether the application can be launched when the user clicks a link in a web browser.
+	Optional. Default false. -->
+	<!-- <allowBrowserInvocation></allowBrowserInvocation> -->
+
+	<!-- Listing of file types for which the application can register. Optional. -->
+	<!-- <fileTypes> -->
+
+	<!-- Defines one file type. Optional. -->
+	<!-- <fileType> -->
+
+	<!-- The name that the system displays for the registered file type. Required. -->
+	<!-- <name></name> -->
+
+	<!-- The extension to register. Required. -->
+	<!-- <extension></extension> -->
+
+	<!-- The description of the file type. Optional. -->
+	<!-- <description></description> -->
+
+	<!-- The MIME content type. -->
+	<!-- <contentType></contentType> -->
+
+	<!-- The icon to display for the file type. Optional. -->
+	<!-- <icon>
+		<image16x16></image16x16>
+		<image32x32></image32x32>
+		<image48x48></image48x48>
+		<image128x128></image128x128>
+	</icon> -->
+
+	<!-- </fileType> -->
+	<!-- </fileTypes> -->
+
+	<!-- iOS specific capabilities -->
+	<!-- <iPhone> -->
+	<!-- A list of plist key/value pairs to be added to the application Info.plist -->
+	<!-- <InfoAdditions>
+		<![CDATA[
+			<key>UIDeviceFamily</key>
+			<array>
+				<string>1</string>
+				<string>2</string>
+			</array>
+			<key>UIStatusBarStyle</key>
+			<string>UIStatusBarStyleBlackOpaque</string>
+			<key>UIRequiresPersistentWiFi</key>
+			<string>YES</string>
+		]]>
+	</InfoAdditions> -->
+	<!-- A list of plist key/value pairs to be added to the application Entitlements.plist -->
+	<!-- <Entitlements>
+		<![CDATA[
+			<key>keychain-access-groups</key>
+			<array>
+				<string></string>
+				<string></string>
+			</array>
+		]]>
+	</Entitlements> -->
+	<!-- Display Resolution for the app (either "standard" or "high"). Optional. Default "standard" -->
+	<!-- <requestedDisplayResolution></requestedDisplayResolution> -->
+	<!-- </iPhone> -->
+
+	<!-- Specify Android specific tags that get passed to AndroidManifest.xml file. -->
+	<!--<android> -->
+	<!--	<manifestAdditions>
+		<![CDATA[
+			<manifest android:installLocation="auto">
+				<uses-permission android:name="android.permission.INTERNET"/>
+				<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
+				<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
+				<uses-feature android:required="true" android:name="android.hardware.touchscreen.multitouch"/>
+				<application android:enabled="true">
+					<activity android:excludeFromRecents="false">
+						<intent-filter>
+							<action android:name="android.intent.action.MAIN"/>
+							<category android:name="android.intent.category.LAUNCHER"/>
+						</intent-filter>
+					</activity>
+				</application>
+			</manifest>
+		]]>
+		</manifestAdditions> -->
+	<!-- Color depth for the app (either "32bit" or "16bit"). Optional. Default 16bit before namespace 3.0, 32bit after -->
+	<!-- <colorDepth></colorDepth> -->
+	<!-- </android> -->
+	<!-- End of the schema for adding the android specific tags in AndroidManifest.xml file -->
+
+</application>

Added: flex/utilities/trunk/installerLocaleEditor/src/Main.mxml
URL: http://svn.apache.org/viewvc/flex/utilities/trunk/installerLocaleEditor/src/Main.mxml?rev=1433677&view=auto
==============================================================================
--- flex/utilities/trunk/installerLocaleEditor/src/Main.mxml (added)
+++ flex/utilities/trunk/installerLocaleEditor/src/Main.mxml Tue Jan 15 21:44:01 2013
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="utf-8"?>
+<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
+					   xmlns:s="library://ns.adobe.com/flex/spark"
+					   xmlns:mx="library://ns.adobe.com/flex/mx"
+					   xmlns:sas="http://www.springactionscript.org/mxml/config"
+					   preinitialize="windowedapplication1_preinitializeHandler(event)"
+					   applicationComplete="windowedapplication1_applicationCompleteHandler(event)"
+					   title="Apache Flex Installer Locale Editor"
+					   xmlns:view="org.apache.flex.runtimelocale.view.*"
+					   currentState="appInitState"
+					   close="windowedapplication1_closeHandler(event)">
+	<s:states>
+		<s:State name="appInitState"/>
+		<s:State name="appReadyState"/>
+	</s:states>
+	<fx:Script>
+		<![CDATA[
+			import flash.utils.setTimeout;
+			import mx.events.FlexEvent;
+			import mx.utils.ObjectUtil;
+			import org.apache.flex.runtimelocale.context.MainConfiguration;
+			import org.apache.flex.runtimelocale.event.ApplicationStatusEvent;
+			import org.apache.flex.runtimelocale.event.InitializeApplicationEvent;
+			import org.apache.flex.runtimelocale.event.SaveConfigurationEvent;
+			import org.apache.flex.runtimelocale.event.ShowHelpRequestEvent;
+			import org.apache.flex.runtimelocale.event.ShowLocaleFileSelectorViewEvent;
+			import org.as3commons.logging.api.ILogSetup;
+			import org.as3commons.logging.api.ILogger;
+			import org.as3commons.logging.api.LOGGER_FACTORY;
+			import org.as3commons.logging.api.getClassLogger;
+			import org.as3commons.logging.setup.SimpleTargetSetup;
+			import org.as3commons.logging.setup.target.AirFileTarget;
+			import org.as3commons.logging.setup.target.TraceTarget;
+			import org.as3commons.logging.setup.target.mergeTargets;
+			import org.as3commons.logging.util.xml.xmlToSetup;
+
+			private static const logger:ILogger = getClassLogger(Main);
+
+			protected function handleUncaught(event:UncaughtErrorEvent):void {
+				if (applicationContext) {
+					trace(event.error);
+					applicationContext.eventBus.dispatchEvent(new ApplicationStatusEvent(ApplicationStatusEvent.APPLICATION_ERROR_STATUS, "An expected error occured: " + event.text, "Unexpected error"));
+				}
+			}
+
+			protected function windowedapplication1_applicationCompleteHandler(event:FlexEvent):void {
+				pruneLogFiles();
+				loaderInfo.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, handleUncaught);
+				statusText.setStyle("color", 0x008800);
+				statusText.setStyle("fontWeight", "bold");
+				//Pfff, ugly, but I want to center the popup after the window has been
+				//maximised, and this was the only way I could get it do so.
+				//(I secretly suck)
+				setTimeout(function():void {
+					applicationContext.eventBus.dispatchEvent(new InitializeApplicationEvent(InitializeApplicationEvent.APP_INITIALIZE));
+					setUpLogging();
+					applicationContext.eventBus.dispatchEvent(new ShowLocaleFileSelectorViewEvent(ShowLocaleFileSelectorViewEvent.SHOW_LOCALE_FILE_SELECTOR));
+					if (applicationContext.propertiesProvider.getProperty("showhelp") == "true") {
+						applicationContext.eventBus.dispatchEvent(new ShowHelpRequestEvent(ShowHelpRequestEvent.SHOW_HELP_REQUEST));
+					}
+				}, 500);
+			}
+
+			protected function windowedapplication1_closeHandler(event:Event):void {
+				applicationContext.eventBus.dispatchEvent(new SaveConfigurationEvent(SaveConfigurationEvent.SAVE_CONFIGURATION_REQUEST));
+			}
+
+			protected function windowedapplication1_preinitializeHandler(event:FlexEvent):void {
+				maximize();
+			}
+
+			private function compareCreationDates(f1:File, f2:File):Number {
+				return ObjectUtil.dateCompare(f1.creationDate, f2.creationDate);
+			}
+
+			private function pruneLogFiles():void {
+				var listing:Array = File.applicationStorageDirectory.getDirectoryListing();
+				var logListing:Array = [];
+				for each (var file:File in listing) {
+					if (file.extension == "log") {
+						logListing[logListing.length] = file;
+					}
+				}
+				if (logListing.length > 5) {
+					logListing.sort(compareCreationDates, Array.NUMERIC);
+					var len:int = logListing.length - 5;
+					var logFile:File;
+					for (var i:int = 0; i < len; ++i) {
+						logFile = logListing[i];
+						logFile.deleteFile();
+						logger.info("Deleted old logfile: {0}", [logFile.nativePath]);
+					}
+				}
+			}
+
+			private function setUpLogging():void {
+				if (applicationContext.propertiesProvider.getProperty('logging') == "true") {
+					var file:File = File.applicationDirectory.resolvePath("logging-config.xml");
+					if (file.exists) {
+						try {
+							var fileStream:FileStream = new FileStream();
+							fileStream.open(file, FileMode.READ);
+							fileStream.position = 0;
+							var content:String = fileStream.readMultiByte(fileStream.bytesAvailable, "utf-8");
+							var xml:XML = new XML(content);
+							var mergedSetup:ILogSetup = xmlToSetup(xml, {}, {console: new TraceTarget(), file: new AirFileTarget()});
+							LOGGER_FACTORY.setup = mergedSetup;
+						} catch (e:Error) {
+							LOGGER_FACTORY.setup = new SimpleTargetSetup(mergeTargets(new TraceTarget(), new AirFileTarget()));
+							logger.error("Error encountered while reading XML logging configuration: {0}", [e.message]);
+							logger.info("Logging defaults used");
+						} finally {
+							fileStream.close();
+						}
+					} else {
+						LOGGER_FACTORY.setup = new SimpleTargetSetup(mergeTargets(new TraceTarget(), new AirFileTarget()));
+						logger.info("Logging defaults used");
+					}
+					logger.info("Application initializing");
+					pruneLogFiles();
+				}
+			}
+			//
+			{
+				MainConfiguration;
+			}
+		]]>
+	</fx:Script>
+	<fx:Declarations>
+		<sas:MXMLApplicationContext configurations="{[MainConfiguration]}"
+									id="applicationContext"/>
+	</fx:Declarations>
+	<view:MainView id="mainView"
+				   width="100%"
+				   height="100%"
+				   includeIn="appReadyState"/>
+</s:WindowedApplication>

Added: flex/utilities/trunk/installerLocaleEditor/src/assets/114.png
URL: http://svn.apache.org/viewvc/flex/utilities/trunk/installerLocaleEditor/src/assets/114.png?rev=1433677&view=auto
==============================================================================
Binary file - no diff available.

Propchange: flex/utilities/trunk/installerLocaleEditor/src/assets/114.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: flex/utilities/trunk/installerLocaleEditor/src/assets/128.png
URL: http://svn.apache.org/viewvc/flex/utilities/trunk/installerLocaleEditor/src/assets/128.png?rev=1433677&view=auto
==============================================================================
Binary file - no diff available.

Propchange: flex/utilities/trunk/installerLocaleEditor/src/assets/128.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: flex/utilities/trunk/installerLocaleEditor/src/assets/16.png
URL: http://svn.apache.org/viewvc/flex/utilities/trunk/installerLocaleEditor/src/assets/16.png?rev=1433677&view=auto
==============================================================================
Binary file - no diff available.

Propchange: flex/utilities/trunk/installerLocaleEditor/src/assets/16.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: flex/utilities/trunk/installerLocaleEditor/src/assets/32.png
URL: http://svn.apache.org/viewvc/flex/utilities/trunk/installerLocaleEditor/src/assets/32.png?rev=1433677&view=auto
==============================================================================
Binary file - no diff available.

Propchange: flex/utilities/trunk/installerLocaleEditor/src/assets/32.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: flex/utilities/trunk/installerLocaleEditor/src/assets/36.png
URL: http://svn.apache.org/viewvc/flex/utilities/trunk/installerLocaleEditor/src/assets/36.png?rev=1433677&view=auto
==============================================================================
Binary file - no diff available.

Propchange: flex/utilities/trunk/installerLocaleEditor/src/assets/36.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: flex/utilities/trunk/installerLocaleEditor/src/assets/48.png
URL: http://svn.apache.org/viewvc/flex/utilities/trunk/installerLocaleEditor/src/assets/48.png?rev=1433677&view=auto
==============================================================================
Binary file - no diff available.

Propchange: flex/utilities/trunk/installerLocaleEditor/src/assets/48.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: flex/utilities/trunk/installerLocaleEditor/src/assets/57.png
URL: http://svn.apache.org/viewvc/flex/utilities/trunk/installerLocaleEditor/src/assets/57.png?rev=1433677&view=auto
==============================================================================
Binary file - no diff available.

Propchange: flex/utilities/trunk/installerLocaleEditor/src/assets/57.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: flex/utilities/trunk/installerLocaleEditor/src/assets/72.png
URL: http://svn.apache.org/viewvc/flex/utilities/trunk/installerLocaleEditor/src/assets/72.png?rev=1433677&view=auto
==============================================================================
Binary file - no diff available.

Propchange: flex/utilities/trunk/installerLocaleEditor/src/assets/72.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: flex/utilities/trunk/installerLocaleEditor/src/helptext.txt
URL: http://svn.apache.org/viewvc/flex/utilities/trunk/installerLocaleEditor/src/helptext.txt?rev=1433677&view=auto
==============================================================================
--- flex/utilities/trunk/installerLocaleEditor/src/helptext.txt (added)
+++ flex/utilities/trunk/installerLocaleEditor/src/helptext.txt Tue Jan 15 21:44:01 2013
@@ -0,0 +1,26 @@
+To use this application first checkout this Apache Flex repository:
+
+https://svn.apache.org/repos/asf/incubator/flex/utilities/trunk/installer
+
+After this use the file selector dialog in this application to locate the following file:
+
+<SVN_CHECKOUT_DIRECTORY>/installer/src/org/apache/flex/packageflexsdk/resource/RuntimeLocale.as
+
+Select the file and wait while the application parses the .as file.
+
+Note #1: This might take quite a while when running the application in debug mode from your IDE. In release mode the parsing still takes quite a bit of time but is acceptable compared to debug mode.
+
+Note #2: The parser is a little bit more strict than the MXMLC parser you're used to. Especially lines that are not suffixed with a semi-colon (;) will raise parsing errors. So the first time you try to open the file will very likely result in a number of parsing errors.
+The parsing errors indicate on which line the problem occurs so correcting these errors shouldn't be too much of a problem.
+
+After the file is parsed you'll be presented with a tabnavigator in which each tab represents a single locale.
+Each tab is divided in three columns, the left column indicates the translation key, the second column the actual translated text and the third column shows the translated text as defined in the reference locale.
+By default the reference local is US English, but can be changed using the dropdown in the topleft corner.
+
+After entering the appropriate translations press the 'Save locale file' button in the topright corner.
+To view the Actionscript output, use the 'View AS3 output' button, also in the topright corner.
+
+If you have any questions or criticism about this application please use the Apache Flex developers mailinglist,
+or open a JIRA ticket.
+
+Thanks to Michael Schmalle for creating the ASBlocks library (https://github.com/teotigraphix/as3-commons-asblocks) which made building this application a breeze.
\ No newline at end of file

Added: flex/utilities/trunk/installerLocaleEditor/src/logging-config.xml
URL: http://svn.apache.org/viewvc/flex/utilities/trunk/installerLocaleEditor/src/logging-config.xml?rev=1433677&view=auto
==============================================================================
--- flex/utilities/trunk/installerLocaleEditor/src/logging-config.xml (added)
+++ flex/utilities/trunk/installerLocaleEditor/src/logging-config.xml Tue Jan 15 21:44:01 2013
@@ -0,0 +1,10 @@
+<setup xmlns="http://as3commons.org/logging/1">
+	<rule name="/^org\.apache\./"
+		  level="DEBUG">
+		<target-ref ref="file"/>
+		<target-ref ref="console"/>
+	</rule>
+	<!-- rule name="/^org\.springextensions\./" level="DEBUG">
+		 <target-ref ref="console" />
+	</rule-->
+</setup>

Added: flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/IStatusReporter.as
URL: http://svn.apache.org/viewvc/flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/IStatusReporter.as?rev=1433677&view=auto
==============================================================================
--- flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/IStatusReporter.as (added)
+++ flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/IStatusReporter.as Tue Jan 15 21:44:01 2013
@@ -0,0 +1,7 @@
+package org.apache.flex.runtimelocale
+{
+	public interface IStatusReporter
+	{
+		
+	}
+}
\ No newline at end of file

Added: flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/AbstractApplicationModelAwareBaseCommand.as
URL: http://svn.apache.org/viewvc/flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/AbstractApplicationModelAwareBaseCommand.as?rev=1433677&view=auto
==============================================================================
--- flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/AbstractApplicationModelAwareBaseCommand.as (added)
+++ flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/AbstractApplicationModelAwareBaseCommand.as Tue Jan 15 21:44:01 2013
@@ -0,0 +1,22 @@
+package org.apache.flex.runtimelocale.command {
+	import flash.events.Event;
+	import org.apache.flex.runtimelocale.model.ApplicationModel;
+	import org.apache.flex.runtimelocale.model.IApplicationModelAware;
+
+	public class AbstractApplicationModelAwareBaseCommand extends AbstractBaseCommand implements IApplicationModelAware {
+
+		public function AbstractApplicationModelAwareBaseCommand(event:Event) {
+			super(event);
+		}
+
+		private var _applicationModel:ApplicationModel;
+
+		public function get applicationModel():ApplicationModel {
+			return _applicationModel;
+		}
+
+		public function set applicationModel(value:ApplicationModel):void {
+			_applicationModel = value;
+		}
+	}
+}

Added: flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/AbstractBaseCommand.as
URL: http://svn.apache.org/viewvc/flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/AbstractBaseCommand.as?rev=1433677&view=auto
==============================================================================
--- flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/AbstractBaseCommand.as (added)
+++ flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/AbstractBaseCommand.as Tue Jan 15 21:44:01 2013
@@ -0,0 +1,28 @@
+package org.apache.flex.runtimelocale.command {
+	import flash.events.Event;
+	import flash.events.EventDispatcher;
+
+	import org.apache.flex.runtimelocale.IStatusReporter;
+	import org.as3commons.async.command.ICommand;
+
+	public class AbstractBaseCommand extends EventDispatcher implements ICommand, IStatusReporter {
+		private var _event:Event;
+
+		public function AbstractBaseCommand(event:Event) {
+			super();
+			_event = event;
+		}
+
+		public function get event():Event {
+			return _event;
+		}
+
+		public function set event(value:Event):void {
+			_event = value;
+		}
+
+		public function execute():* {
+			return null;
+		}
+	}
+}

Added: flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/ApplicationErrorStatusCommand.as
URL: http://svn.apache.org/viewvc/flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/ApplicationErrorStatusCommand.as?rev=1433677&view=auto
==============================================================================
--- flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/ApplicationErrorStatusCommand.as (added)
+++ flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/ApplicationErrorStatusCommand.as Tue Jan 15 21:44:01 2013
@@ -0,0 +1,20 @@
+package org.apache.flex.runtimelocale.command {
+	import flash.events.Event;
+
+	import mx.controls.Alert;
+
+	import org.apache.flex.runtimelocale.event.ApplicationStatusEvent;
+
+	public class ApplicationErrorStatusCommand extends AbstractBaseCommand {
+		public function ApplicationErrorStatusCommand(event:Event) {
+			super(event);
+		}
+
+		override public function execute():* {
+			var errorEvent:ApplicationStatusEvent = event as ApplicationStatusEvent;
+			if (errorEvent) {
+				Alert.show(errorEvent.statusMessage, errorEvent.caption);
+			}
+		}
+	}
+}

Added: flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/ApplicationInfoStatusCommand.as
URL: http://svn.apache.org/viewvc/flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/ApplicationInfoStatusCommand.as?rev=1433677&view=auto
==============================================================================
--- flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/ApplicationInfoStatusCommand.as (added)
+++ flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/ApplicationInfoStatusCommand.as Tue Jan 15 21:44:01 2013
@@ -0,0 +1,33 @@
+package org.apache.flex.runtimelocale.command {
+	import flash.events.Event;
+	import flash.utils.setTimeout;
+	import mx.core.FlexGlobals;
+	import org.apache.flex.runtimelocale.event.ApplicationStatusEvent;
+	import spark.components.WindowedApplication;
+	import spark.components.supportClasses.TextBase;
+
+	public class ApplicationInfoStatusCommand extends AbstractBaseCommand {
+
+		public function ApplicationInfoStatusCommand(event:Event) {
+			super(event);
+		}
+
+		override public function execute():* {
+			var infoEvent:ApplicationStatusEvent = event as ApplicationStatusEvent;
+			if (infoEvent) {
+				var app:WindowedApplication = (FlexGlobals.topLevelApplication as WindowedApplication);
+				app.status = infoEvent.statusMessage;
+				flashStatusText(app.statusText);
+			}
+		}
+
+		private function flashStatusText(statusText:TextBase):void {
+			statusText.setStyle("backgroundColor", 0x000000);
+			statusText.setStyle("color", 0xFFFFFF);
+			setTimeout(function():void {
+				statusText.setStyle("backgroundColor", 0xDDDDDD);
+				statusText.setStyle("color", 0x008800);
+			}, 1000);
+		}
+	}
+}

Added: flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/CreateLocaleRequestCommand.as
URL: http://svn.apache.org/viewvc/flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/CreateLocaleRequestCommand.as?rev=1433677&view=auto
==============================================================================
--- flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/CreateLocaleRequestCommand.as (added)
+++ flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/CreateLocaleRequestCommand.as Tue Jan 15 21:44:01 2013
@@ -0,0 +1,141 @@
+package org.apache.flex.runtimelocale.command {
+	import flash.events.Event;
+	import mx.controls.Alert;
+	import org.antlr.runtime.TokenConstants;
+	import org.apache.flex.runtimelocale.event.ApplicationStatusEvent;
+	import org.apache.flex.runtimelocale.event.LocaleEvent;
+	import org.apache.flex.runtimelocale.model.locale.LocaleDataVO;
+	import org.apache.flex.runtimelocale.model.locale.LocaleItemDataVO;
+	import org.as3commons.asblocks.dom.IASMethod;
+	import org.as3commons.asblocks.dom.IASStatement;
+	import org.as3commons.asblocks.dom.Visibility;
+	import org.as3commons.asblocks.impl.AS3FragmentParser;
+	import org.as3commons.asblocks.impl.ASTASClassType;
+	import org.as3commons.asblocks.impl.ASTASExpressionStatement;
+	import org.as3commons.asblocks.impl.ASTASField;
+	import org.as3commons.asblocks.impl.ASTASMethod;
+	import org.as3commons.asblocks.impl.ASTASStringLiteral;
+	import org.as3commons.asblocks.impl.ASTScriptElement;
+	import org.as3commons.asblocks.impl.ContainerDelegate;
+	import org.as3commons.asblocks.impl.TokenBuilder;
+	import org.as3commons.asblocks.parser.antlr.LinkedListToken;
+	import org.as3commons.asblocks.parser.antlr.LinkedListTree;
+	import org.as3commons.asblocks.parser.antlr.as3.AS3Parser;
+	import org.as3commons.collections.ArrayList;
+	import org.as3commons.collections.framework.IIterator;
+	import org.as3commons.logging.api.ILogger;
+	import org.as3commons.logging.api.getClassLogger;
+
+	public class CreateLocaleRequestCommand extends AbstractApplicationModelAwareBaseCommand {
+
+		private static const INSTALL_METHOD_PREFIX:String = "install_";
+
+		private static const logger:ILogger = getClassLogger(CreateLocaleRequestCommand);
+
+		public function CreateLocaleRequestCommand(event:Event) {
+			super(event);
+		}
+
+		override public function execute():* {
+			var localeEvent:LocaleEvent = event as LocaleEvent;
+			if (localeEvent) {
+				if (applicationModel.availableLocales.getItemIndex(localeEvent.localeName) > -1) {
+					event.preventDefault();
+					logger.info("'{0}' already exists, aborting CreateLocaleRequestCommand", [localeEvent.localeName]);
+					Alert.show(localeEvent.localeName + " already exists");
+				} else {
+					createLocale(localeEvent.localeName);
+				}
+			}
+		}
+
+		private function addContentStatements(method:IASMethod):void {
+			for each (var localeItem:LocaleItemDataVO in applicationModel.referenceLocale.content) {
+				addKey(localeItem.key, method);
+			}
+		}
+
+		private function addField(type:ASTASClassType, localeName:String):void {
+			var field:ASTASField = type.newField(localeName.toUpperCase(), Visibility.PUBLIC, "String") as ASTASField;
+			field.setStatic(true);
+			field.setConstant(true);
+			var literal:ASTASStringLiteral = new ASTASStringLiteral(AS3FragmentParser.parseExpression('"' + localeName + '"'));
+			field.setInitializer(literal);
+			logger.info("Added static constant field to .as file: {0}", [field.toString()]);
+		}
+
+		private function addKey(key:String, method:IASMethod):void {
+			var newStatement:ASTASExpressionStatement = new ASTASExpressionStatement(AS3FragmentParser.parseExprStatement('		content[' + key + ']="";'));
+			method.addStatement(newStatement);
+		}
+
+		private function addMethod(type:ASTASClassType, localeName:String):ASTASMethod {
+			var method:ASTASMethod = type.newMethod(INSTALL_METHOD_PREFIX + localeName, Visibility.PRIVATE, "void") as ASTASMethod;
+
+			var ast:LinkedListTree = AS3FragmentParser.parseStatement("var locale:String = " + localeName.toUpperCase() + ";");
+			method.addStatement(new ASTASExpressionStatement(ast));
+
+			ast = AS3FragmentParser.parseStatement("var resource:ResourceBundle = new ResourceBundle(locale, ViewResourceConstants.BUNDLE_NAME);");
+			method.addStatement(new ASTASExpressionStatement(ast));
+
+			ast = AS3FragmentParser.parseStatement("var content:Object = resource.content;");
+			method.addStatement(new ASTASExpressionStatement(ast));
+
+			addContentStatements(method);
+			ast = AS3FragmentParser.parseStatement("_resourceManager.addResourceBundle(resource);");
+			method.addStatement(new ASTASExpressionStatement(ast));
+			logger.info("Added method to .as file: {0}()", [INSTALL_METHOD_PREFIX + localeName]);
+			return method;
+		}
+
+		private function addMethodInvocation(type:ASTASClassType, localeName:String):void {
+			var method:ASTASMethod = type.getMethod("installResources") as ASTASMethod;
+			var newAST:LinkedListTree = AS3FragmentParser.parseStatement(INSTALL_METHOD_PREFIX + localeName + "();");
+			for (var i:int = 0; i < 4; ++i) {
+				var tab:LinkedListToken = TokenBuilder.newToken(AS3Parser.WS, "\t");
+				tab.channel = TokenConstants.HIDDEN_CHANNEL;
+				newAST.addToken(0, tab);
+			}
+			newAST.addToken(0, TokenBuilder.newNewline());
+			insertInvocation(method.getStatements() as ArrayList, method, newAST);
+			logger.info("Added invocation of method '{0}'() to method '{1}' to .as file", [INSTALL_METHOD_PREFIX + localeName, "installResources()"]);
+		}
+
+		private function createLocale(localeName:String):void {
+			logger.info("Creating new locale '{0}', using '{1}' as the reference locale", [localeName, applicationModel.referenceLocale.name]);
+			var type:ASTASClassType = applicationModel.localeCompilationUnit.getType() as ASTASClassType;
+			addField(type, localeName);
+			var method:ASTASMethod = addMethod(type, localeName);
+			var data:LocaleDataVO = new LocaleDataVO(method, localeName);
+			applicationModel.localeData[applicationModel.localeData.length] = data;
+
+			addMethodInvocation(type, localeName);
+
+			dispatchEvent(new LocaleEvent(LocaleEvent.LOCALE_CREATED, null, data));
+			logger.info("Finished creating locale '{0}'", [localeName]);
+			dispatchEvent(new ApplicationStatusEvent(ApplicationStatusEvent.APPLICATION_INFO_STATUS, "New locale '" + localeName + "' created succesfully!"));
+		}
+
+		private function insertInvocation(statements:ArrayList, container:ASTScriptElement, newAST:LinkedListTree):void {
+			var iterator:IIterator = statements.iterator();
+			var idx:int = 0;
+			while (iterator.hasNext()) {
+				var statement:IASStatement = iterator.next();
+				if (statement is ContainerDelegate) {
+					insertInvocation((statement as ContainerDelegate).getStatements() as ArrayList, statement as ASTScriptElement, newAST);
+				} else {
+					if (statement is ASTASExpressionStatement) {
+						var expr:ASTASExpressionStatement = statement as ASTASExpressionStatement;
+						if (expr.toString().substr(0, INSTALL_METHOD_PREFIX.length) == INSTALL_METHOD_PREFIX) {
+							var containerAST:LinkedListTree = container.getAST();
+							containerAST = containerAST.getChild(containerAST.childCount - 1) as LinkedListTree;
+							containerAST.addChildAtWithTokens(idx + 1, newAST);
+							break;
+						}
+					}
+				}
+				idx++;
+			}
+		}
+	}
+}

Added: flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/InitializeApplicationCommand.as
URL: http://svn.apache.org/viewvc/flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/InitializeApplicationCommand.as?rev=1433677&view=auto
==============================================================================
--- flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/InitializeApplicationCommand.as (added)
+++ flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/InitializeApplicationCommand.as Tue Jan 15 21:44:01 2013
@@ -0,0 +1,79 @@
+package org.apache.flex.runtimelocale.command {
+	import flash.events.Event;
+	import flash.filesystem.File;
+	import flash.filesystem.FileMode;
+	import flash.filesystem.FileStream;
+	import org.apache.flex.runtimelocale.event.ApplicationStatusEvent;
+	import org.apache.flex.runtimelocale.ini.IniReader;
+	import org.as3commons.logging.api.ILogger;
+	import org.as3commons.logging.api.getClassLogger;
+	import org.springextensions.actionscript.context.IApplicationContext;
+	import org.springextensions.actionscript.context.IApplicationContextAware;
+	import org.springextensions.actionscript.ioc.config.property.impl.Properties;
+
+	public class InitializeApplicationCommand extends AbstractApplicationModelAwareBaseCommand implements IApplicationContextAware {
+
+		private static const logger:ILogger = getClassLogger(InitializeApplicationCommand);
+
+		public function InitializeApplicationCommand(event:Event) {
+			super(event);
+		}
+
+		private var _applicationContext:IApplicationContext;
+
+		public function get applicationContext():IApplicationContext {
+			return _applicationContext;
+		}
+
+		public function set applicationContext(value:IApplicationContext):void {
+			_applicationContext = value;
+		}
+
+		override public function execute():* {
+			var iniFile:File = File.applicationStorageDirectory.resolvePath('config.ini');
+			if (!iniFile.exists) {
+				createIniWithDefaults(iniFile.nativePath);
+			}
+			readIni(iniFile.nativePath);
+		}
+
+		private function createIniWithDefaults(iniPath:String):void {
+			logger.info("Creating '{0}' for first use", [iniPath]);
+			var configContent:Array = [];
+			configContent[configContent.length] = "localefilepath=";
+			configContent[configContent.length] = "logging=true";
+			configContent[configContent.length] = "showhelp=true";
+
+			var iniFile:File = new File(iniPath);
+			var stream:FileStream = new FileStream();
+			try {
+				stream.open(iniFile, FileMode.WRITE);
+				stream.writeUTFBytes(configContent.join("\n"));
+			} catch (e:Error) {
+				dispatchEvent(new ApplicationStatusEvent(ApplicationStatusEvent.APPLICATION_ERROR_STATUS, e.message, "Error saving config file"));
+			} finally {
+				stream.close();
+			}
+		}
+
+		private function readIni(iniPath:String):void {
+			var iniReader:IniReader = new IniReader();
+			var configProperties:Object = iniReader.readFromFile(iniPath);
+			setDefaults(configProperties);
+			applicationModel.configurationProperties = configProperties;
+			for (var key:String in configProperties) {
+				_applicationContext.propertiesProvider ||= new Properties();
+				_applicationContext.propertiesProvider.setProperty(key, configProperties[key]);
+			}
+		}
+
+		private function setDefaults(configProperties:Object):void {
+			if (!configProperties['logging']) {
+				configProperties['logging'] = 'true';
+			}
+			if (!configProperties['showhelp']) {
+				configProperties['showhelp'] = 'true';
+			}
+		}
+	}
+}

Added: flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/LocaleFileLoadedCommand.as
URL: http://svn.apache.org/viewvc/flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/LocaleFileLoadedCommand.as?rev=1433677&view=auto
==============================================================================
--- flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/LocaleFileLoadedCommand.as (added)
+++ flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/LocaleFileLoadedCommand.as Tue Jan 15 21:44:01 2013
@@ -0,0 +1,65 @@
+package org.apache.flex.runtimelocale.command {
+	import flash.events.Event;
+	import mx.core.FlexGlobals;
+	import mx.managers.CursorManager;
+	import org.apache.flex.runtimelocale.event.ApplicationStatusEvent;
+	import org.apache.flex.runtimelocale.event.LocaleFileEvent;
+	import org.apache.flex.runtimelocale.event.LocaleFileLoadedEvent;
+	import org.apache.flex.runtimelocale.event.ShowLocaleFileSelectorViewEvent;
+	import org.as3commons.asblocks.dom.IASCompilationUnit;
+	import org.as3commons.asblocks.impl.ASTASParser;
+	import org.as3commons.async.operation.impl.AbstractOperation;
+	import org.as3commons.logging.api.ILogger;
+	import org.as3commons.logging.api.getClassLogger;
+
+	public class LocaleFileLoadedCommand extends AbstractApplicationModelAwareBaseCommand {
+
+		private static const logger:ILogger = getClassLogger(LocaleFileLoadedCommand);
+
+		public function LocaleFileLoadedCommand(event:Event) {
+			super(event);
+		}
+
+		override public function execute():* {
+			var loadedEvent:LocaleFileLoadedEvent = event as LocaleFileLoadedEvent;
+			if (loadedEvent) {
+				logger.info("Executing LocaleFileLoadedCommand for file path '{0}'", [loadedEvent.filePath]);
+				applicationModel.currentLocalFilePath = loadedEvent.filePath;
+				var operation:AbstractOperation = new AbstractOperation();
+				operation.result = this;
+				parseContent(loadedEvent.fileContent, operation);
+				return operation;
+			}
+		}
+
+		private function parseContent(fileContent:String, operation:AbstractOperation):void {
+			dispatchEvent(new ApplicationStatusEvent(ApplicationStatusEvent.APPLICATION_INFO_STATUS, "Parsing locale file, hold on, this may take a while..."));
+			CursorManager.setBusyCursor();
+			var count:int = 0;
+			//Somehow I have to wait 2 frames for the statusbar and cursor to actually update,
+			//if I don't hack it like this the parser will already block the UI thread...
+			var handleNextFrame:Function = function():void {
+				if (++count == 2) {
+					logger.info("Starting processing locale file");
+					FlexGlobals.topLevelApplication.stage.removeEventListener(Event.ENTER_FRAME, handleNextFrame);
+					var parser:ASTASParser = new ASTASParser();
+					try {
+						var unit:IASCompilationUnit = parser.parse(fileContent);
+						applicationModel.localeCompilationUnit = unit;
+						dispatchEvent(new ApplicationStatusEvent(ApplicationStatusEvent.APPLICATION_INFO_STATUS, "Locale file parsed succesfully!"));
+						dispatchEvent(new LocaleFileEvent(LocaleFileEvent.FILE_READY));
+						operation.dispatchCompleteEvent();
+					} catch (e:Error) {
+						logger.info("Error parsing file: {0}", [e.message]);
+						dispatchEvent(new ShowLocaleFileSelectorViewEvent(ShowLocaleFileSelectorViewEvent.SHOW_LOCALE_FILE_SELECTOR));
+						dispatchEvent(new ApplicationStatusEvent(ApplicationStatusEvent.APPLICATION_ERROR_STATUS, e.message, "Error parsing file"));
+						operation.dispatchErrorEvent();
+					} finally {
+						CursorManager.removeBusyCursor();
+					}
+				}
+			};
+			FlexGlobals.topLevelApplication.stage.addEventListener(Event.ENTER_FRAME, handleNextFrame)
+		}
+	}
+}

Added: flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/LocaleFileReadyCommand.as
URL: http://svn.apache.org/viewvc/flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/LocaleFileReadyCommand.as?rev=1433677&view=auto
==============================================================================
--- flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/LocaleFileReadyCommand.as (added)
+++ flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/LocaleFileReadyCommand.as Tue Jan 15 21:44:01 2013
@@ -0,0 +1,67 @@
+package org.apache.flex.runtimelocale.command {
+	import flash.events.Event;
+	import mx.collections.ArrayCollection;
+	import org.apache.flex.runtimelocale.event.ReferenceLocaleRequestEvent;
+	import org.apache.flex.runtimelocale.model.locale.LocaleDataVO;
+	import org.as3commons.asblocks.dom.IASCompilationUnit;
+	import org.as3commons.asblocks.impl.ASTASClassType;
+	import org.as3commons.asblocks.impl.ASTASMethod;
+	import org.as3commons.collections.framework.IIterator;
+	import org.as3commons.collections.framework.IList;
+	import org.as3commons.logging.api.ILogger;
+	import org.as3commons.logging.api.getClassLogger;
+
+	public class LocaleFileReadyCommand extends AbstractApplicationModelAwareBaseCommand {
+
+		public static const LOCALE_METHOD_PREFIX:String = "install_";
+		public static const LOCALE_METHOD_PREFIX_LEN:int = "install_".length;
+
+		private static const logger:ILogger = getClassLogger(LocaleFileReadyCommand);
+
+		public function LocaleFileReadyCommand(event:Event) {
+			super(event);
+		}
+
+		override public function execute():* {
+			var unit:IASCompilationUnit = applicationModel.localeCompilationUnit;
+			var type:ASTASClassType = unit.getType() as ASTASClassType;
+			var localeMethods:Vector.<ASTASMethod> = filterOutLocaleMethods(type.getMethods());
+			makeLocaleList(localeMethods);
+			extractLocaleDataFromMethods(localeMethods);
+			dispatchEvent(new ReferenceLocaleRequestEvent(ReferenceLocaleRequestEvent.REFERENCE_LOCALE_REQUEST, "en_US"));
+		}
+
+		private function extractLocaleDataFromMethods(localeMethods:Vector.<ASTASMethod>):void {
+			logger.info("Creating locale data from install methods");
+			var list:Vector.<LocaleDataVO> = new Vector.<LocaleDataVO>();
+			for each (var method:ASTASMethod in localeMethods) {
+				var name:String = method.getName().substr(-5, 5);
+				list[list.length] = new LocaleDataVO(method, name);
+			}
+			applicationModel.localeData = list;
+		}
+
+		private function filterOutLocaleMethods(methods:IList):Vector.<ASTASMethod> {
+			var result:Vector.<ASTASMethod> = new Vector.<ASTASMethod>();
+			var iterator:IIterator = methods.iterator();
+			while (iterator.hasNext()) {
+				var method:ASTASMethod = iterator.next();
+				if (method.getName().substr(0, LOCALE_METHOD_PREFIX_LEN) == LOCALE_METHOD_PREFIX) {
+					result[result.length] = method;
+				}
+			}
+			return result;
+		}
+
+		private function makeLocaleList(localeMethods:Vector.<ASTASMethod>):void {
+			logger.info("Extracting locale list");
+			var locales:Array = [];
+			for each (var method:ASTASMethod in localeMethods) {
+				var name:String = method.getName().substr(-5, 5);
+				locales[locales.length] = name;
+				logger.info("Extracting locale name '{0}' for list", [name]);
+			}
+			applicationModel.availableLocales = new ArrayCollection(locales);
+		}
+	}
+}

Added: flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/LocaleFileSaveRequestCommand.as
URL: http://svn.apache.org/viewvc/flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/LocaleFileSaveRequestCommand.as?rev=1433677&view=auto
==============================================================================
--- flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/LocaleFileSaveRequestCommand.as (added)
+++ flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/LocaleFileSaveRequestCommand.as Tue Jan 15 21:44:01 2013
@@ -0,0 +1,60 @@
+package org.apache.flex.runtimelocale.command {
+	import flash.events.Event;
+	import flash.filesystem.File;
+	import flash.filesystem.FileMode;
+	import flash.filesystem.FileStream;
+	import org.apache.flex.runtimelocale.IStatusReporter;
+	import org.apache.flex.runtimelocale.event.ApplicationStatusEvent;
+	import org.as3commons.logging.api.ILogger;
+	import org.as3commons.logging.api.getClassLogger;
+
+	public class LocaleFileSaveRequestCommand extends AbstractApplicationModelAwareBaseCommand implements IStatusReporter {
+
+		//ASBlocks doesn't save the comments all the way at the top of a file,
+		//I expect this to be a temporary bug so for now I just re-add the header
+		//before saving the file.
+		public static const FILE_HEADER:String = '////////////////////////////////////////////////////////////////////////////////' + "\n" + //
+			'//' + "\n" + //
+			'// Licensed to the Apache Software Foundation (ASF) under one or more' + "\n" + //
+			'// contributor license agreements. See the NOTICE file distributed with' + "\n" + //
+			'// this work for additional information regarding copyright ownership.' + "\n" + //
+			'// The ASF licenses this file to You under the Apache License, Version 2.0' + "\n" + //
+			'// (the "License"); you may not use this file except in compliance with' + "\n" + //
+			'// the License. You may obtain a copy of the License at' + "\n" + //
+			'//' + "\n" + //
+			'// http://www.apache.org/licenses/LICENSE-2.0' + "\n" + //
+			'//' + "\n" + //
+			'// Unless required by applicable law or agreed to in writing, software' + "\n" + //
+			'// distributed under the License is distributed on an "AS IS" BASIS,' + "\n" + //
+			'// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.' + "\n" + //
+			'// See the License for the specific language governing permissions and' + "\n" + //
+			'// limitations under the License.' + "\n" + //
+			'//' + "\n" + //
+			'////////////////////////////////////////////////////////////////////////////////' + "\n" + //
+			'' + "\n" + //
+			'' + "\n" + //
+			'';
+
+		private static const logger:ILogger = getClassLogger(LocaleFileSaveRequestCommand);
+
+		public function LocaleFileSaveRequestCommand(event:Event) {
+			super(event);
+		}
+
+		override public function execute():* {
+			var localeFile:File = new File(applicationModel.currentLocalFilePath);
+			var stream:FileStream = new FileStream();
+			try {
+				stream.open(localeFile, FileMode.WRITE);
+				stream.writeUTFBytes(FILE_HEADER + applicationModel.localeCompilationUnit.toString());
+				dispatchEvent(new ApplicationStatusEvent(ApplicationStatusEvent.APPLICATION_INFO_STATUS, "'" + applicationModel.currentLocalFilePath + "' saved succesfully!"));
+			} catch (e:Error) {
+				logger.error("Error saving locale .as file '{0}': {1}", [applicationModel.currentLocalFilePath, e.message]);
+				dispatchEvent(new ApplicationStatusEvent(ApplicationStatusEvent.APPLICATION_ERROR_STATUS, e.message, "Error saving locale file"));
+			} finally {
+				stream.close();
+			}
+			logger.error("Saved locale .as file '{0}'", [applicationModel.currentLocalFilePath]);
+		}
+	}
+}

Added: flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/LocaleFileShowRequestCommand.as
URL: http://svn.apache.org/viewvc/flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/LocaleFileShowRequestCommand.as?rev=1433677&view=auto
==============================================================================
--- flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/LocaleFileShowRequestCommand.as (added)
+++ flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/LocaleFileShowRequestCommand.as Tue Jan 15 21:44:01 2013
@@ -0,0 +1,27 @@
+package org.apache.flex.runtimelocale.command {
+	import flash.display.DisplayObject;
+	import flash.events.Event;
+	import mx.core.FlexGlobals;
+	import mx.managers.PopUpManager;
+	import org.apache.flex.runtimelocale.view.TextFileContentView;
+	import org.as3commons.logging.api.ILogger;
+	import org.as3commons.logging.api.getClassLogger;
+
+	public class LocaleFileShowRequestCommand extends AbstractApplicationModelAwareBaseCommand {
+
+		private static const logger:ILogger = getClassLogger(LocaleFileShowRequestCommand);
+
+		public function LocaleFileShowRequestCommand(event:Event) {
+			super(event);
+		}
+
+		override public function execute():* {
+			var view:TextFileContentView = new TextFileContentView();
+			view.fileContent = LocaleFileSaveRequestCommand.FILE_HEADER + applicationModel.localeCompilationUnit.toString();
+			view.filePath = applicationModel.currentLocalFilePath;
+			PopUpManager.addPopUp(view, (FlexGlobals.topLevelApplication as DisplayObject));
+			PopUpManager.centerPopUp(view);
+			logger.info("Executed LocaleFileShowRequestCommand");
+		}
+	}
+}

Added: flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/NewLocaleItemRequestCommand.as
URL: http://svn.apache.org/viewvc/flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/NewLocaleItemRequestCommand.as?rev=1433677&view=auto
==============================================================================
--- flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/NewLocaleItemRequestCommand.as (added)
+++ flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/NewLocaleItemRequestCommand.as Tue Jan 15 21:44:01 2013
@@ -0,0 +1,64 @@
+package org.apache.flex.runtimelocale.command {
+	import flash.display.Sprite;
+	import flash.events.Event;
+	import mx.controls.Alert;
+	import mx.core.FlexGlobals;
+	import mx.events.CloseEvent;
+	import mx.events.CollectionEvent;
+	import mx.events.CollectionEventKind;
+	import org.apache.flex.runtimelocale.event.LocaleItemEvent;
+	import org.apache.flex.runtimelocale.model.ApplicationModel;
+	import org.apache.flex.runtimelocale.model.locale.LocaleDataVO;
+	import org.as3commons.logging.api.ILogger;
+	import org.as3commons.logging.api.getClassLogger;
+
+	public class NewLocaleItemRequestCommand extends AbstractApplicationModelAwareBaseCommand {
+
+		private static const logger:ILogger = getClassLogger(NewLocaleItemRequestCommand);
+
+		public function NewLocaleItemRequestCommand(event:Event) {
+			super(event);
+		}
+
+		override public function execute():* {
+			var localeEvent:LocaleItemEvent = event as LocaleItemEvent;
+			if (localeEvent) {
+				var localeData:LocaleDataVO = localeEvent.localeData;
+				if (localeData === applicationModel.referenceLocale) {
+					var appModel:ApplicationModel = applicationModel;
+					var closeHandler:Function = function(closeEvent:CloseEvent):void {
+						if (closeEvent.detail == Alert.YES) {
+							for each (var otherLocaleData:LocaleDataVO in appModel.localeData) {
+								addKey(otherLocaleData, localeEvent.itemKey);
+							}
+						} else {
+							addKey(localeData, localeEvent.itemKey);
+							addMissingKeys(appModel, localeEvent.itemKey);
+						}
+						logger.info("Executed NewLocaleItemRequestCommand");
+					};
+					Alert.show("You are currently editing the reference locale, do you want to add the translation key '" + //
+						localeEvent.itemKey + "' to all the other locales as well?", "Confirm", Alert.YES | Alert.NO, //
+						(FlexGlobals.topLevelApplication as Sprite), closeHandler);
+				} else {
+					addKey(localeData, localeEvent.itemKey);
+					logger.info("Executed NewLocaleItemRequestCommand");
+				}
+			}
+		}
+
+		private function addKey(localeData:LocaleDataVO, itemKey:String):void {
+			if (localeData.getItemByKey(itemKey) == null) {
+				localeData.addKey(itemKey);
+			}
+		}
+
+		private function addMissingKeys(appModel:ApplicationModel, itemKey:String):void {
+			for each (var localeData:LocaleDataVO in appModel.localeData) {
+				if (localeData.getItemByKey(itemKey) == null) {
+					localeData.missingKeys.addItem(itemKey);
+				}
+			}
+		}
+	}
+}

Added: flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/NewLocaleRequestCommand.as
URL: http://svn.apache.org/viewvc/flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/NewLocaleRequestCommand.as?rev=1433677&view=auto
==============================================================================
--- flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/NewLocaleRequestCommand.as (added)
+++ flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/NewLocaleRequestCommand.as Tue Jan 15 21:44:01 2013
@@ -0,0 +1,29 @@
+package org.apache.flex.runtimelocale.command {
+	import flash.display.DisplayObject;
+	import flash.events.Event;
+	import mx.core.FlexGlobals;
+	import mx.managers.PopUpManager;
+	import org.apache.flex.runtimelocale.event.LocaleEvent;
+	import org.apache.flex.runtimelocale.view.NewLocaleView;
+	import org.as3commons.logging.api.ILogger;
+	import org.as3commons.logging.api.getClassLogger;
+
+	public class NewLocaleRequestCommand extends AbstractBaseCommand {
+
+		private static const logger:ILogger = getClassLogger(NewLocaleRequestCommand);
+
+		public function NewLocaleRequestCommand(event:Event) {
+			super(event);
+		}
+
+		override public function execute():* {
+			var localeEvent:LocaleEvent = event as LocaleEvent;
+			if (localeEvent) {
+				var popup:NewLocaleView = new NewLocaleView();
+				PopUpManager.addPopUp(popup, (FlexGlobals.topLevelApplication as DisplayObject), true);
+				PopUpManager.centerPopUp(popup);
+				logger.info("Executed NewLocaleRequestCommand, now showing NewLocaleView popup");
+			}
+		}
+	}
+}

Added: flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/ReferenceLocaleRequestCommand.as
URL: http://svn.apache.org/viewvc/flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/ReferenceLocaleRequestCommand.as?rev=1433677&view=auto
==============================================================================
--- flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/ReferenceLocaleRequestCommand.as (added)
+++ flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/ReferenceLocaleRequestCommand.as Tue Jan 15 21:44:01 2013
@@ -0,0 +1,58 @@
+package org.apache.flex.runtimelocale.command {
+	import flash.events.Event;
+	import mx.collections.ArrayCollection;
+	import org.apache.flex.runtimelocale.event.ReferenceLocaleRequestEvent;
+	import org.apache.flex.runtimelocale.model.locale.LocaleDataVO;
+	import org.apache.flex.runtimelocale.model.locale.LocaleItemDataVO;
+	import org.as3commons.logging.api.ILogger;
+	import org.as3commons.logging.api.getClassLogger;
+
+	public class ReferenceLocaleRequestCommand extends AbstractApplicationModelAwareBaseCommand {
+
+		private static const logger:ILogger = getClassLogger(ReferenceLocaleRequestCommand);
+
+		public function ReferenceLocaleRequestCommand(event:Event) {
+			super(event);
+		}
+
+		override public function execute():* {
+			var refEvent:ReferenceLocaleRequestEvent = event as ReferenceLocaleRequestEvent;
+			if (refEvent) {
+				var referenceLocale:LocaleDataVO = findLocale(refEvent.localeName);
+				if (referenceLocale) {
+					applicationModel.referenceLocale = referenceLocale;
+					addMissingKeysToLocales(applicationModel.referenceLocale, applicationModel.localeData);
+					logger.info("Set '{0}' as the enw reference locale", [refEvent.localeName]);
+				}
+				logger.info("Executed ReferenceLocaleRequestCommand");
+			}
+		}
+
+		private function addMissingKeysToLocale(referenceLocale:LocaleDataVO, localeData:LocaleDataVO):void {
+			var missingKeys:Array = [];
+			for each (var item:LocaleItemDataVO in referenceLocale.content) {
+				if (localeData.getItemByKey(item.key) == null) {
+					missingKeys[missingKeys.length] = item.key;
+				}
+			}
+			localeData.missingKeys = new ArrayCollection(missingKeys);
+		}
+
+		private function addMissingKeysToLocales(referenceLocale:LocaleDataVO, localeDatas:Vector.<LocaleDataVO>):void {
+			for each (var localeData:LocaleDataVO in localeDatas) {
+				if (referenceLocale !== localeData) {
+					addMissingKeysToLocale(referenceLocale, localeData);
+				}
+			}
+		}
+
+		private function findLocale(locale:String):LocaleDataVO {
+			for each (var data:LocaleDataVO in applicationModel.localeData) {
+				if (data.name == locale) {
+					return data;
+				}
+			}
+			return null;
+		}
+	}
+}

Added: flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/RemoveLocaleItemRequestCommand.as
URL: http://svn.apache.org/viewvc/flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/RemoveLocaleItemRequestCommand.as?rev=1433677&view=auto
==============================================================================
--- flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/RemoveLocaleItemRequestCommand.as (added)
+++ flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/RemoveLocaleItemRequestCommand.as Tue Jan 15 21:44:01 2013
@@ -0,0 +1,59 @@
+package org.apache.flex.runtimelocale.command {
+	import flash.display.Sprite;
+	import flash.events.Event;
+	import mx.controls.Alert;
+	import mx.core.FlexGlobals;
+	import mx.events.CloseEvent;
+	import org.apache.flex.runtimelocale.event.LocaleItemEvent;
+	import org.apache.flex.runtimelocale.model.ApplicationModel;
+	import org.apache.flex.runtimelocale.model.locale.LocaleDataVO;
+	import org.apache.flex.runtimelocale.model.locale.LocaleItemDataVO;
+	import org.as3commons.logging.api.ILogger;
+	import org.as3commons.logging.api.getClassLogger;
+
+	public class RemoveLocaleItemRequestCommand extends AbstractApplicationModelAwareBaseCommand {
+
+		private static const logger:ILogger = getClassLogger(RemoveLocaleItemRequestCommand);
+
+		public function RemoveLocaleItemRequestCommand(event:Event) {
+			super(event);
+		}
+
+		override public function execute():* {
+			var localeEvent:LocaleItemEvent = event as LocaleItemEvent;
+			if (localeEvent) {
+				var localeData:LocaleDataVO = localeEvent.localeData;
+				if (localeData === applicationModel.referenceLocale) {
+					var appModel:ApplicationModel = applicationModel;
+					var closeHandler:Function = function(closeEvent:CloseEvent):void {
+						if (closeEvent.detail == Alert.YES) {
+							for each (var otherLocaleData:LocaleDataVO in appModel.localeData) {
+								deleteKey(otherLocaleData, localeEvent.itemKey);
+								logger.info("Deleted translation key '{0}' from locale '{1}'", [localeEvent.itemKey, otherLocaleData.name]);
+							}
+						} else {
+							deleteKey(localeData, localeEvent.itemKey);
+							logger.info("Deleted translation key '{0}' from locale '{1}'", [localeEvent.itemKey, localeData.name]);
+						}
+					};
+					Alert.show("You are currently editing the reference locale, do you want to delete the translation key '" + localeEvent.itemKey + "' from all the other locales as well?", "Confirm", Alert.YES | Alert.NO, (FlexGlobals.topLevelApplication as Sprite), closeHandler);
+				} else {
+					deleteKey(localeData, localeEvent.itemKey);
+					logger.info("Deleted translation key '{0}' from locale '{1}'", [localeEvent.itemKey, localeData.name]);
+				}
+			}
+		}
+
+		private function deleteKey(localeData:LocaleDataVO, itemKey:String):void {
+			var localeItem:LocaleItemDataVO = localeData.getItemByKey(itemKey);
+			if (localeItem) {
+				localeData.removeItem(localeItem);
+			} else {
+				var idx:int = localeData.missingKeys.getItemIndex(itemKey);
+				if (idx > -1) {
+					localeData.missingKeys.removeItemAt(idx);
+				}
+			}
+		}
+	}
+}

Added: flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/RemoveLocaleRequestCommand.as
URL: http://svn.apache.org/viewvc/flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/RemoveLocaleRequestCommand.as?rev=1433677&view=auto
==============================================================================
--- flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/RemoveLocaleRequestCommand.as (added)
+++ flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/RemoveLocaleRequestCommand.as Tue Jan 15 21:44:01 2013
@@ -0,0 +1,84 @@
+package org.apache.flex.runtimelocale.command {
+	import flash.events.Event;
+	import mx.controls.Alert;
+	import mx.events.CloseEvent;
+	import org.apache.flex.runtimelocale.event.ApplicationStatusEvent;
+	import org.apache.flex.runtimelocale.event.LocaleEvent;
+	import org.apache.flex.runtimelocale.model.ApplicationModel;
+	import org.apache.flex.runtimelocale.model.locale.LocaleDataVO;
+	import org.as3commons.asblocks.dom.IASStatement;
+	import org.as3commons.asblocks.impl.ASTASClassType;
+	import org.as3commons.asblocks.impl.ASTASExpressionStatement;
+	import org.as3commons.asblocks.impl.ASTASMethod;
+	import org.as3commons.asblocks.impl.ContainerDelegate;
+	import org.as3commons.async.operation.impl.AbstractOperation;
+	import org.as3commons.collections.ArrayList;
+	import org.as3commons.collections.framework.IIterator;
+	import org.as3commons.collections.framework.IList;
+	import org.as3commons.logging.api.ILogger;
+	import org.as3commons.logging.api.getClassLogger;
+
+	public class RemoveLocaleRequestCommand extends AbstractApplicationModelAwareBaseCommand {
+
+		private static const logger:ILogger = getClassLogger(RemoveLocaleRequestCommand);
+
+		public function RemoveLocaleRequestCommand(event:Event) {
+			super(event);
+		}
+
+		override public function execute():* {
+			var operation:AbstractOperation = new AbstractOperation();
+			var localeEvent:LocaleEvent = event as LocaleEvent;
+			if (localeEvent) {
+				var appModel:ApplicationModel = applicationModel;
+				var closeHandler:Function = function(closeEvent:CloseEvent):void {
+					removeLocale(appModel, localeEvent.localeData);
+					dispatchEvent(new LocaleEvent(LocaleEvent.LOCALE_REMOVED, null, localeEvent.localeData));
+					dispatchEvent(new ApplicationStatusEvent(ApplicationStatusEvent.APPLICATION_INFO_STATUS, "Locale " + localeEvent.localeData.name + " was removed successfully!"));
+					operation.dispatchCompleteEvent(this);
+					logger.info("Executed RemoveLocaleRequestCommand");
+				};
+				Alert.show("Are you sure you want to completely remove the locale '" + localeEvent.localeData.name + "'?", "Confirmation", Alert.YES | Alert.NO, null, closeHandler);
+			}
+			return operation;
+		}
+
+		private function findInvocation(statements:IList, localeName:String, container:*):void {
+			var iterator:IIterator = statements.iterator();
+			var idx:int = 0;
+			while (iterator.hasNext()) {
+				var statement:IASStatement = iterator.next();
+				if (statement is ContainerDelegate) {
+					findInvocation((statement as ContainerDelegate).getStatements() as ArrayList, localeName, statement);
+				} else {
+					if (statement is ASTASExpressionStatement) {
+						var str:String = statement.toString();
+						if (str == "install_" + localeName + "();") {
+							container.removeStatement(statement);
+							break;
+						}
+					}
+				}
+				idx++;
+			}
+		}
+
+		private function removeLocale(appModel:ApplicationModel, localeData:LocaleDataVO):void {
+			var idx:int = appModel.localeData.indexOf(localeData);
+			if (idx > -1) {
+				appModel.localeData.splice(idx, 1);
+				removeLocaleFromAS3File(appModel.localeCompilationUnit.getType() as ASTASClassType, localeData.name);
+			}
+		}
+
+		private function removeLocaleFromAS3File(type:ASTASClassType, localeName:String):void {
+			type.removeMethod("install_" + localeName);
+			logger.info("Removed method '{0}' from. as file", ["install_" + localeName]);
+			type.removeField(localeName.toUpperCase());
+			logger.info("Removed constant static field '{0}' from. as file", [localeName.toUpperCase()]);
+			var method:ASTASMethod = type.getMethod("installResources") as ASTASMethod;
+			findInvocation(method.getStatements() as ArrayList, localeName, method);
+			logger.info("Removed invocation method '{0}'() from. as file", ["install_" + localeName]);
+		}
+	}
+}

Added: flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/RequestAddMissingKeysCommand.as
URL: http://svn.apache.org/viewvc/flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/RequestAddMissingKeysCommand.as?rev=1433677&view=auto
==============================================================================
--- flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/RequestAddMissingKeysCommand.as (added)
+++ flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/RequestAddMissingKeysCommand.as Tue Jan 15 21:44:01 2013
@@ -0,0 +1,36 @@
+package org.apache.flex.runtimelocale.command {
+	import flash.events.Event;
+	import mx.events.CollectionEvent;
+	import mx.events.CollectionEventKind;
+	import mx.managers.CursorManager;
+	import org.apache.flex.runtimelocale.event.LocaleDataEvent;
+	import org.apache.flex.runtimelocale.model.locale.LocaleDataVO;
+	import org.as3commons.logging.api.ILogger;
+	import org.as3commons.logging.api.getClassLogger;
+
+	public class RequestAddMissingKeysCommand extends AbstractBaseCommand {
+
+		private static const logger:ILogger = getClassLogger(RequestAddMissingKeysCommand);
+
+		public function RequestAddMissingKeysCommand(event:Event) {
+			super(event);
+		}
+
+		override public function execute():* {
+			var localeEvent:LocaleDataEvent = event as LocaleDataEvent;
+			if (localeEvent) {
+				var localeData:LocaleDataVO = localeEvent.localeData;
+				CursorManager.setBusyCursor();
+				try {
+					for each (var key:String in localeData.missingKeys) {
+						localeData.addKey(key);
+					}
+					localeData.missingKeys.removeAll();
+					logger.info("Added all misssing translation keys to locale '{0}'", [localeData.name]);
+				} finally {
+					CursorManager.removeBusyCursor();
+				}
+			}
+		}
+	}
+}

Added: flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/SaveConfigurationRequestCommand.as
URL: http://svn.apache.org/viewvc/flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/SaveConfigurationRequestCommand.as?rev=1433677&view=auto
==============================================================================
--- flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/SaveConfigurationRequestCommand.as (added)
+++ flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/SaveConfigurationRequestCommand.as Tue Jan 15 21:44:01 2013
@@ -0,0 +1,39 @@
+package org.apache.flex.runtimelocale.command {
+	import flash.events.Event;
+	import flash.filesystem.File;
+	import flash.filesystem.FileMode;
+	import flash.filesystem.FileStream;
+	import org.apache.flex.runtimelocale.event.ApplicationStatusEvent;
+	import org.as3commons.logging.api.ILogger;
+	import org.as3commons.logging.api.getClassLogger;
+
+	public class SaveConfigurationRequestCommand extends AbstractApplicationModelAwareBaseCommand {
+
+		private static const logger:ILogger = getClassLogger(SaveConfigurationRequestCommand);
+
+		public function SaveConfigurationRequestCommand(event:Event) {
+			super(event);
+		}
+
+		override public function execute():* {
+			var properties:Object = applicationModel.configurationProperties;
+			var configContent:Array = [];
+			for (var key:String in properties) {
+				configContent[configContent.length] = key + "=" + properties[key];
+			}
+
+			var iniFile:File = File.applicationStorageDirectory.resolvePath('config.ini');
+			var stream:FileStream = new FileStream();
+			try {
+				stream.open(iniFile, FileMode.WRITE);
+				stream.writeUTFBytes(configContent.join("\n"));
+			} catch (e:Error) {
+				logger.error("Error saving config file {0}: {1}", [iniFile.nativePath, e.message]);
+				dispatchEvent(new ApplicationStatusEvent(ApplicationStatusEvent.APPLICATION_ERROR_STATUS, e.message, "Error saving config file"));
+			} finally {
+				stream.close();
+			}
+			logger.info("Saved config file '{0}'", [iniFile.nativePath]);
+		}
+	}
+}

Added: flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/ShowHelpRequestCommand.as
URL: http://svn.apache.org/viewvc/flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/ShowHelpRequestCommand.as?rev=1433677&view=auto
==============================================================================
--- flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/ShowHelpRequestCommand.as (added)
+++ flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/ShowHelpRequestCommand.as Tue Jan 15 21:44:01 2013
@@ -0,0 +1,20 @@
+package org.apache.flex.runtimelocale.command {
+	import flash.display.DisplayObject;
+	import flash.events.Event;
+	import mx.core.FlexGlobals;
+	import mx.managers.PopUpManager;
+	import org.apache.flex.runtimelocale.view.HelpView;
+
+	public class ShowHelpRequestCommand extends AbstractBaseCommand {
+
+		public function ShowHelpRequestCommand(event:Event) {
+			super(event);
+		}
+
+		override public function execute():* {
+			var popup:HelpView = new HelpView();
+			PopUpManager.addPopUp(popup, (FlexGlobals.topLevelApplication as DisplayObject));
+			PopUpManager.centerPopUp(popup);
+		}
+	}
+}

Added: flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/ShowLocaleFileSelectorViewCommand.as
URL: http://svn.apache.org/viewvc/flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/ShowLocaleFileSelectorViewCommand.as?rev=1433677&view=auto
==============================================================================
--- flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/ShowLocaleFileSelectorViewCommand.as (added)
+++ flex/utilities/trunk/installerLocaleEditor/src/org/apache/flex/runtimelocale/command/ShowLocaleFileSelectorViewCommand.as Tue Jan 15 21:44:01 2013
@@ -0,0 +1,25 @@
+package org.apache.flex.runtimelocale.command {
+	import flash.display.DisplayObject;
+	import flash.events.Event;
+	import mx.core.FlexGlobals;
+	import mx.managers.PopUpManager;
+	import org.apache.flex.runtimelocale.view.LocaleFileSelectorView;
+	import org.as3commons.logging.api.ILogger;
+	import org.as3commons.logging.api.getClassLogger;
+
+	public class ShowLocaleFileSelectorViewCommand extends AbstractBaseCommand {
+
+		private static const logger:ILogger = getClassLogger(ShowLocaleFileSelectorViewCommand);
+
+		public function ShowLocaleFileSelectorViewCommand(event:Event) {
+			super(event);
+		}
+
+		override public function execute():* {
+			var selectorView:LocaleFileSelectorView = new LocaleFileSelectorView();
+			PopUpManager.addPopUp(selectorView, (FlexGlobals.topLevelApplication as DisplayObject));
+			PopUpManager.centerPopUp(selectorView);
+			logger.info("Executed ShowLocaleFileSelectorViewCommand, now showing LocaleFileSelectorView popup");
+		}
+	}
+}