- LaunchUICommand run w/o dispatching messages
- ToolPathValidator trigger resource changes
- Refactored a bit
git-svn-id: https://svn.apache.org/repos/asf/flex/whiteboard@1450334 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/application/config/SettingsContext.mxml b/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/application/config/UIContext.mxml
similarity index 92%
rename from fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/application/config/SettingsContext.mxml
rename to fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/application/config/UIContext.mxml
index bf82bee..762429a 100644
--- a/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/application/config/SettingsContext.mxml
+++ b/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/application/config/UIContext.mxml
@@ -23,7 +23,11 @@
<parsley:DynamicObject type="{GeneralMenu}"/>
<parsley:MapCommand type="{MenuActionCommand}"/>
- <parsley:MapCommand type="{LaunchUICommand}"/>
+
+ <parsley:CommandFactory id="launchUICommand">
+ <parsley:Command type="{LaunchUICommand}"/>
+ </parsley:CommandFactory>
+
<parsley:MapCommand type="{ExitUICommand}"/>
<menu:ApplicationMenuPM/>
diff --git a/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/infrastructure/command/ExitUICommand.as b/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/infrastructure/command/ExitUICommand.as
index 241ce09..9a03db4 100644
--- a/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/infrastructure/command/ExitUICommand.as
+++ b/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/infrastructure/command/ExitUICommand.as
@@ -9,14 +9,14 @@
import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.CommandCallBackError;
import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.CommandCallBackResult;
import org.apache.flex.utilities.developerToolSuite.infrastructure.message.ApplicationExitReadyMessage;
- import org.apache.flex.utilities.developerToolSuite.infrastructure.message.RequestExitApplicationMessage;
+ import org.apache.flex.utilities.developerToolSuite.infrastructure.message.ExitApplicationMessage;
public class ExitUICommand extends AbstractDBCommand {
- private var _msg:RequestExitApplicationMessage;
+ private var _msg:ExitApplicationMessage;
private var _terminateCommand:Function;
- public function execute(msg:RequestExitApplicationMessage):void {
+ public function execute(msg:ExitApplicationMessage):void {
log.debug("Executing Command with message: " + ObjectUtil.toString(msg));
this._msg = msg;
executeAsync();
diff --git a/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/infrastructure/command/LaunchUICommand.as b/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/infrastructure/command/LaunchUICommand.as
index f72559d..9ace7d8 100644
--- a/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/infrastructure/command/LaunchUICommand.as
+++ b/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/infrastructure/command/LaunchUICommand.as
@@ -1,14 +1,15 @@
package org.apache.flex.utilities.developerToolSuite.infrastructure.command {
import mx.logging.ILogger;
+ import org.apache.flex.utilities.developerToolSuite.executor.application.util.LogUtil;
import org.apache.flex.utilities.developerToolSuite.executor.domain.ISettingsModel;
import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.CommandCallBack;
import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.message.ValidateAntPathMessage;
import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.message.ValidateCygwinPathMessage;
+ import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.message.ValidateGitPathMessage;
import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.message.ValidateJavaPathMessage;
import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.message.ValidateMavenPathMessage;
- import org.apache.flex.utilities.developerToolSuite.executor.application.util.LogUtil;
- import org.apache.flex.utilities.developerToolSuite.infrastructure.message.LaunchUIMessage;
+ import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.message.ValidateSvnPathMessage;
import org.apache.flex.utilities.developerToolSuite.presentation.graphic.settings.SettingsWindow;
import org.spicefactory.parsley.core.context.Context;
@@ -31,29 +32,33 @@
private var _antCompleted:Boolean;
private var _mavenCompleted:Boolean;
private var _cygwinCompleted:Boolean;
+ private var _svnCompleted:Boolean;
+ private var _gitCompleted:Boolean;
- public function execute(msg:LaunchUIMessage):void {
+ public function execute():void {
dispatch(new ValidateJavaPathMessage(settings.JAVA_HOME));
dispatch(new ValidateAntPathMessage(settings.ANT_HOME));
dispatch(new ValidateMavenPathMessage(settings.MAVEN_HOME));
dispatch(new ValidateCygwinPathMessage(settings.CYGWIN_HOME));
+ dispatch(new ValidateSvnPathMessage());
+ dispatch(new ValidateGitPathMessage());
}
[CommandComplete]
- public function validateJavaPathCommandError(trigger:ValidateJavaPathMessage):void {
+ public function validateJavaPathCommandCompleted(trigger:ValidateJavaPathMessage):void {
_javaCompleted = true;
checkValidationsCompleted();
}
[CommandError]
- public function validateJavaPathCommand(trigger:ValidateJavaPathMessage):void {
+ public function validateJavaPathCommandError(trigger:ValidateJavaPathMessage):void {
_javaCompleted = true;
checkValidationsCompleted();
}
[CommandComplete]
- public function validateAntPathCommand(trigger:ValidateAntPathMessage):void {
+ public function validateAntPathCommandCompleted(trigger:ValidateAntPathMessage):void {
_antCompleted = true;
checkValidationsCompleted();
}
@@ -65,7 +70,7 @@
}
[CommandComplete]
- public function validateMavenPathCommand(trigger:ValidateMavenPathMessage):void {
+ public function validateMavenPathCommandCompleted(trigger:ValidateMavenPathMessage):void {
_mavenCompleted = true;
checkValidationsCompleted();
}
@@ -77,7 +82,7 @@
}
[CommandComplete]
- public function validateCygwinPathCommand(trigger:ValidateCygwinPathMessage):void {
+ public function validateCygwinPathCommandCompleted(trigger:ValidateCygwinPathMessage):void {
_cygwinCompleted = true;
checkValidationsCompleted();
}
@@ -88,20 +93,46 @@
checkValidationsCompleted();
}
+ [CommandComplete]
+ public function validateSvnPathCommandCompleted(trigger:ValidateSvnPathMessage):void {
+ _svnCompleted = true;
+ checkValidationsCompleted();
+ }
+
+ [CommandError]
+ public function validateSvnPathCommandError(fault:Error, trigger:ValidateSvnPathMessage):void {
+ _svnCompleted = true;
+ checkValidationsCompleted();
+ }
+
+ [CommandComplete]
+ public function validateGitPathCommandCompleted(trigger:ValidateGitPathMessage):void {
+ _gitCompleted = true;
+ checkValidationsCompleted();
+ }
+
+ [CommandError]
+ public function validateGiyPathCommandError(fault:Error, trigger:ValidateGitPathMessage):void {
+ _gitCompleted = true;
+ checkValidationsCompleted();
+ }
+
private function checkValidationsCompleted():void {
- if (_antCompleted && _mavenCompleted && _javaCompleted && _cygwinCompleted)
+ if (_antCompleted && _mavenCompleted && _javaCompleted && _cygwinCompleted && _svnCompleted && _gitCompleted) {
launchUI();
+ }
}
private function launchUI():void {
+ callback(CommandCallBack.DEFAULT_RESULT);
+
with (settings) {
- if (javaEnabled && antEnabled && mavenEnabled && cygwinEnabled) {
+ if (javaEnabled && antEnabled && mavenEnabled && cygwinEnabled && (_svnCompleted || _gitCompleted)) {
// open last project or create project
} else {
SettingsWindow.show(context);
}
}
- callback(CommandCallBack.DEFAULT_RESULT);
}
}
}
diff --git a/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/infrastructure/event/ModalWindowEvent.as b/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/infrastructure/event/SettingsWindowEvent.as
similarity index 70%
rename from fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/infrastructure/event/ModalWindowEvent.as
rename to fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/infrastructure/event/SettingsWindowEvent.as
index f568e52..e14d13a 100644
--- a/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/infrastructure/event/ModalWindowEvent.as
+++ b/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/infrastructure/event/SettingsWindowEvent.as
@@ -1,12 +1,12 @@
package org.apache.flex.utilities.developerToolSuite.infrastructure.event {
import flash.events.Event;
- public class ModalWindowEvent extends Event {
+ public class SettingsWindowEvent extends Event {
public static const OPENED:String = "opened";
public static const CLOSED:String = "closed";
- public function ModalWindowEvent(type:String) {
+ public function SettingsWindowEvent(type:String) {
super(type);
}
}
diff --git a/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/infrastructure/message/ExitApplicationMessage.as b/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/infrastructure/message/ExitApplicationMessage.as
new file mode 100644
index 0000000..0baaefc
--- /dev/null
+++ b/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/infrastructure/message/ExitApplicationMessage.as
@@ -0,0 +1,9 @@
+package org.apache.flex.utilities.developerToolSuite.infrastructure.message {
+ public class ExitApplicationMessage {
+ public var settings:Object;
+
+ public function ExitApplicationMessage(settings:Object) {
+ this.settings = settings;
+ }
+ }
+}
diff --git a/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/infrastructure/message/LaunchUIMessage.as b/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/infrastructure/message/LaunchUIMessage.as
deleted file mode 100644
index 16be3da..0000000
--- a/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/infrastructure/message/LaunchUIMessage.as
+++ /dev/null
@@ -1,6 +0,0 @@
-package org.apache.flex.utilities.developerToolSuite.infrastructure.message {
- public class LaunchUIMessage {
- public function LaunchUIMessage() {
- }
- }
-}
diff --git a/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/infrastructure/message/RequestExitApplicationMessage.as b/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/infrastructure/message/RequestExitApplicationMessage.as
deleted file mode 100644
index 1ded05a..0000000
--- a/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/infrastructure/message/RequestExitApplicationMessage.as
+++ /dev/null
@@ -1,11 +0,0 @@
-package org.apache.flex.utilities.developerToolSuite.infrastructure.message {
- import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.message.SaveSettingsMessage;
-
- public class RequestExitApplicationMessage{
- public var settings:Object;
-
- public function RequestExitApplicationMessage(settings:Object) {
- this.settings = settings;
- }
- }
-}
diff --git a/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/presentation/behavior/validator/ToolPathValidator.as b/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/presentation/behavior/validator/ToolPathValidator.as
index 64ba2f9..fce4508 100644
--- a/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/presentation/behavior/validator/ToolPathValidator.as
+++ b/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/presentation/behavior/validator/ToolPathValidator.as
@@ -31,21 +31,28 @@
//doValidation method should accept an Object type parameter
override protected function doValidation(value:Object):Array {
// create an array to return.
- var ValidatorResults:Array = new Array();
+ var validatorResults:Array = [];
// Call base class doValidation().
- ValidatorResults = super.doValidation(value);
+ validatorResults = super.doValidation(value);
// Return if there are errors.
- if (ValidatorResults.length > 0) {
- return ValidatorResults;
+ if (validatorResults.length > 0) {
+ return validatorResults;
}
if (Boolean(value) == false) {
- ValidatorResults.push(new ValidationResult(true, null, "Tool Home Path Error",
+ validatorResults.push(new ValidationResult(true, null, "Tool Home Path Error",
resourceManager.getString('SettingsWindow', errorStringResourceString)));
- return ValidatorResults;
+ return validatorResults;
}
- return ValidatorResults;
+ return validatorResults;
+ }
+
+ override protected function resourcesChanged():void {
+ super.resourcesChanged();
+
+ // Re-validate to get the localized error string displayed correctly.
+ validate();
}
}
}
diff --git a/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/presentation/config/SettingsContext.mxml b/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/presentation/config/SettingsContext.mxml
deleted file mode 100644
index 0aafcd3..0000000
--- a/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/presentation/config/SettingsContext.mxml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-<fx:Object xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:parsley="http://www.spicefactory.org/parsley"
- xmlns:menu="org.apache.flex.utilities.developerToolSuite.presentation.behavior.menu.*">
-
- <fx:Declarations>
- <parsley:DynamicObject type="{GeneralMenu}"/>
-
- <parsley:MapCommand type="{MenuActionCommand}"/>
- <parsley:MapCommand type="{LaunchUICommand}"/>
-
- <menu:ApplicationMenuPM/>
- </fx:Declarations>
-
- <fx:Script><![CDATA[
- import org.apache.flex.utilities.developerToolSuite.infrastructure.command.LaunchUICommand;
- import org.apache.flex.utilities.developerToolSuite.infrastructure.command.MenuActionCommand;
- import org.apache.flex.utilities.developerToolSuite.infrastructure.command.LaunchUICommand;
- import org.apache.flex.utilities.developerToolSuite.presentation.graphic.menu.GeneralMenu;
- ]]></fx:Script>
-</fx:Object>
diff --git a/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/presentation/graphic/menu/ApplicationMenu.mxml b/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/presentation/graphic/menu/ApplicationMenu.mxml
index 6622a47..3e8d103 100644
--- a/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/presentation/graphic/menu/ApplicationMenu.mxml
+++ b/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/presentation/graphic/menu/ApplicationMenu.mxml
@@ -16,9 +16,7 @@
limitations under the License.
-->
<mx:FlexNativeMenu 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:parsley="http://www.spicefactory.org/parsley">
+ xmlns:mx="library://ns.adobe.com/flex/mx">
<fx:Script><![CDATA[
import mx.events.FlexNativeMenuEvent;
@@ -40,14 +38,14 @@
labelFunction = model.getMenuItemLabel;
dataProvider = model.dataProvider;
addEventListener(FlexNativeMenuEvent.ITEM_CLICK, menu_itemClickHandler);
- ResourceManager.getInstance().addEventListener(Event.CHANGE, localeChangeHandler);
+ ResourceManager.getInstance().addEventListener(Event.CHANGE, resourceManager_changeHandler);
}
private function menu_itemClickHandler(event:FlexNativeMenuEvent):void {
dispatch(new MenuActionMessage(event.item));
}
- private function localeChangeHandler(event:Event):void {
+ private function resourceManager_changeHandler(event:Event):void {
dataProvider = model.dataProvider;
}
]]></fx:Script>
diff --git a/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/presentation/graphic/settings/SettingsWindow.mxml b/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/presentation/graphic/settings/SettingsWindow.mxml
index e819451..bd89131 100644
--- a/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/presentation/graphic/settings/SettingsWindow.mxml
+++ b/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/presentation/graphic/settings/SettingsWindow.mxml
@@ -31,8 +31,8 @@
</fx:Declarations>
<fx:Metadata>
- [Event(name="opened", type="org.apache.flex.utilities.developerToolSuite.infrastructure.event.ModalWindowEvent")]
- [Event(name="closed", type="org.apache.flex.utilities.developerToolSuite.infrastructure.event.ModalWindowEvent")]
+ [Event(name="opened", type="org.apache.flex.utilities.developerToolSuite.infrastructure.event.SettingsWindowEvent")]
+ [Event(name="closed", type="org.apache.flex.utilities.developerToolSuite.infrastructure.event.SettingsWindowEvent")]
[ManagedEvents("opened,closed")]
</fx:Metadata>
@@ -62,7 +62,7 @@
import mx.events.ResizeEvent;
import mx.managers.PopUpManager;
- import org.apache.flex.utilities.developerToolSuite.infrastructure.event.ModalWindowEvent;
+ import org.apache.flex.utilities.developerToolSuite.infrastructure.event.SettingsWindowEvent;
import org.spicefactory.parsley.core.context.Context;
private static var __window:SettingsWindow;
@@ -85,7 +85,7 @@
[Init]
public function init():void {
- dispatchEvent(new ModalWindowEvent(ModalWindowEvent.OPENED));
+ dispatchEvent(new SettingsWindowEvent(SettingsWindowEvent.OPENED));
}
private function addedToStageHandler(event:Event):void {
@@ -102,7 +102,7 @@
private function closeWindow():void {
PopUpManager.removePopUp(this);
- dispatchEvent(new ModalWindowEvent(ModalWindowEvent.CLOSED));
+ dispatchEvent(new SettingsWindowEvent(SettingsWindowEvent.CLOSED));
__window = null;
}
]]></fx:Script>
diff --git a/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/application/config/ExecutorContext.mxml b/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/application/config/ExecutorContext.mxml
index 76a65a0..f2c841f 100644
--- a/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/application/config/ExecutorContext.mxml
+++ b/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/application/config/ExecutorContext.mxml
@@ -18,8 +18,7 @@
<fx:Object xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:parsley="http://www.spicefactory.org/parsley"
xmlns:database="org.apache.flex.utilities.developerToolSuite.executor.application.database.*"
- xmlns:domain="org.apache.flex.utilities.developerToolSuite.executor.domain.*"
- xmlns:nativeprocess="org.apache.flex.utilities.developerToolSuite.executor.application.nativeProcess.*">
+ xmlns:domain="org.apache.flex.utilities.developerToolSuite.executor.domain.*">
<fx:Declarations>
<database:ApplicationDB/>
diff --git a/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/config/ExecutorContext.mxml b/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/config/ExecutorContext.mxml
deleted file mode 100644
index 01a443b..0000000
--- a/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/config/ExecutorContext.mxml
+++ /dev/null
@@ -1,64 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-<fx:Object xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:parsley="http://www.spicefactory.org/parsley"
- xmlns:database="org.apache.flex.utilities.developerToolSuite.executor.infrastructure.database.*"
- xmlns:domain="org.apache.flex.utilities.developerToolSuite.executor.domain.*"
- xmlns:nativeprocess="org.apache.flex.utilities.developerToolSuite.executor.infrastructure.nativeProcess.*">
-
- <fx:Declarations>
- <database:ApplicationDB/>
-
- <parsley:MapCommand messageType="{InitApplicationMessage}">
- <parsley:CommandSequence>
- <parsley:Command type="{InitDBCommand}"/>
- <parsley:Command type="{GetEnvironmentVariablesCommand}"/>
- <parsley:Command type="{GetSettingsFromDBCommand}"/>
- </parsley:CommandSequence>
- </parsley:MapCommand>
-
-
- <parsley:MapCommand type="{ChangeLanguageCommand}"/>
- <parsley:MapCommand type="{SaveSettingsCommand}"/>
- <parsley:MapCommand type="{SaveSettingCommand}"/>
- <parsley:MapCommand type="{ValidateJavaPathCommand}"/>
- <parsley:MapCommand type="{ValidateAntPathCommand}"/>
- <parsley:MapCommand type="{ValidateMavenPathCommand}"/>
- <parsley:MapCommand type="{ValidateSvnPathCommand}"/>
- <parsley:MapCommand type="{ValidateGitPathCommand}"/>
- <parsley:MapCommand type="{ValidateCygwinPathCommand}"/>
-
- <domain:SettingModel id="applicationModel"/>
- </fx:Declarations>
-
- <fx:Script><![CDATA[
- import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.ChangeLanguageCommand;
- import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.GetEnvironmentVariablesCommand;
- import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.GetSettingsFromDBCommand;
- import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.InitDBCommand;
- import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.SaveSettingCommand;
- import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.SaveSettingsCommand;
- import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.ValidateAntPathCommand;
- import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.ValidateCygwinPathCommand;
- import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.ValidateGitPathCommand;
- import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.ValidateJavaPathCommand;
- import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.ValidateMavenPathCommand;
- import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.ValidateSvnPathCommand;
- import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.message.InitApplicationMessage;
- ]]></fx:Script>
-</fx:Object>
diff --git a/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/database/ApplicationDB.as b/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/database/ApplicationDB.as
deleted file mode 100644
index 5aea330..0000000
--- a/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/database/ApplicationDB.as
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-package org.apache.flex.utilities.developerToolSuite.executor.infrastructure.database {
- import flash.data.SQLConnection;
- import flash.data.SQLStatement;
- import flash.events.SQLErrorEvent;
- import flash.events.SQLEvent;
- import flash.filesystem.File;
- import flash.net.Responder;
-
- import mx.logging.ILogger;
- import mx.utils.ObjectUtil;
-
- import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.util.LogUtil;
-
- public class ApplicationDB {
-
- private static var LOG:ILogger = LogUtil.getLogger(ApplicationDB);
-
- public static const DATABASE_NAME:String = "DTSDB.db";
- private static var _conn:SQLConnection;
-
- public var DBReady:Boolean;
-
- public function ApplicationDB() {
- }
-
- public function connect():void {
- if (DBReady) {
- return;
- }
-
- LOG.debug("Connecting async DB: " + ApplicationDB.DATABASE_NAME);
- _conn = new SQLConnection();
-
- _conn.addEventListener(SQLEvent.OPEN, openHandler);
- _conn.addEventListener(SQLErrorEvent.ERROR, errorHandler);
-
- // The database file is in the application storage directory
- var folder:File = File.applicationStorageDirectory;
- var dbFile:File = folder.resolvePath(DATABASE_NAME);
-
- _conn.openAsync(dbFile);
- }
-
- public function close():void {
- LOG.debug("Closing async DB: " + ApplicationDB.DATABASE_NAME);
- _conn.close();
- DBReady = false;
- }
-
- private function openHandler(event:SQLEvent):void {
- DBReady = true;
- LOG.debug("the database was opened successfully");
- }
-
- private function errorHandler(event:SQLErrorEvent):void {
- LOG.error("Error while opening the DB: " + ObjectUtil.toString(event.error));
- }
-
- public function executeSqlStatement(stmt:SQLStatement, responder:Responder):void {
- stmt.sqlConnection = _conn;
- stmt.execute(-1, responder);
- }
- }
-}
diff --git a/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/nativeProcess/NativeShellHelper.as b/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/nativeProcess/NativeShellHelper.as
deleted file mode 100644
index 74b12b9..0000000
--- a/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/nativeProcess/NativeShellHelper.as
+++ /dev/null
@@ -1,217 +0,0 @@
-package org.apache.flex.utilities.developerToolSuite.executor.infrastructure.nativeProcess {
- import flash.desktop.NativeProcess;
- import flash.desktop.NativeProcessStartupInfo;
- import flash.events.Event;
- import flash.events.EventDispatcher;
- import flash.events.IOErrorEvent;
- import flash.events.NativeProcessExitEvent;
- import flash.events.ProgressEvent;
- import flash.filesystem.File;
- import flash.system.Capabilities;
-
- import mx.logging.ILogger;
-
- import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.util.LogUtil;
-
- public class NativeShellHelper extends EventDispatcher {
-
- // Use trace during tests as AIR thru Maven doesn't support resource xml config files for logging.
- private static var LOG:ILogger;
-
- private static var _gcLocker:GCLocker;
-
- private var _process:NativeProcess;
- private var _isRunning:Boolean;
-
- private var _isLogEnabled:Boolean;
-
- public function NativeShellHelper() {
- super();
- if (!LOG) {
- LOG = LogUtil.getLogger(NativeShellHelper);
- }
- if (!_gcLocker) {
- _gcLocker = new GCLocker();
- }
- _process = new NativeProcess();
- }
-
- public function get process():NativeProcess {
- return _process;
- }
-
- public function get isRunning():Boolean {
- return _isRunning;
- }
-
- public function run(command:Vector.<String> = null, shell:String = null):void {
-
- if (_isRunning) {
- throw new Error("NativeProcessHelper is currently busy");
- return;
- }
- _isRunning = true;
-
- //Avoid the garbage collection
- _gcLocker.lock(this);
-
- if (!shell) {
- shell = getShellPath();
- }
-
- LOG.debug("Executing: " + shell + " " + command.join(" "));
-
- var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
-
- var file:File = File.applicationDirectory.resolvePath(shell);
- nativeProcessStartupInfo.executable = file;
- nativeProcessStartupInfo.arguments = command;
-
- _process.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, dispatch2, false, 0, true);
- _process.addEventListener(ProgressEvent.STANDARD_ERROR_DATA, dispatch2, false, 0, true);
- _process.addEventListener(IOErrorEvent.STANDARD_OUTPUT_IO_ERROR, dispatch2, false, 0, true);
- _process.addEventListener(IOErrorEvent.STANDARD_ERROR_IO_ERROR, dispatch2, false, 0, true);
- _process.addEventListener(NativeProcessExitEvent.EXIT, exitHandler, false, -100, true);
- _process.start(nativeProcessStartupInfo);
- }
-
- public function logMessages():void {
- if (_isLogEnabled) {
- return;
- }
- _isLogEnabled = true;
- _process.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, outputDataLogHandler, false, 0, true);
- _process.addEventListener(ProgressEvent.STANDARD_ERROR_DATA, errorDataLogHandler, false, 0, true);
- _process.addEventListener(IOErrorEvent.STANDARD_OUTPUT_IO_ERROR, IOErrorLogHandler, false, 0, true);
- _process.addEventListener(IOErrorEvent.STANDARD_ERROR_IO_ERROR, IOErrorLogHandler, false, 0, true);
- _process.addEventListener(NativeProcessExitEvent.EXIT, exitLogHandler, false, 0, true);
- }
-
- private function errorDataLogHandler(event:ProgressEvent):void {
- trace(_process.standardError.readUTFBytes(_process.standardError.bytesAvailable));
- //LOG.error(_process.standardError.readUTFBytes(_process.standardError.bytesAvailable));
- }
-
- private function exitLogHandler(event:NativeProcessExitEvent):void {
- trace("Process exited with " + event.exitCode);
- //LOG.info("Process exited with " + event.exitCode);
-
- }
-
- private function IOErrorLogHandler(event:IOErrorEvent):void {
- trace(event.toString());
- //LOG.error(event.toString());
- }
-
- private function outputDataLogHandler(event:ProgressEvent):void {
- var output:String = _process.standardOutput.readUTFBytes(_process.standardOutput.bytesAvailable);
- trace("Output: " + output);
- //LOG.info("Output: " + output);
- }
-
- private function dispatch2(e:Event):void {
- this.dispatchEvent(e);
- }
-
- private function exitHandler(e:Event):void {
- _gcLocker.release(this);
- _process = null;
- _isRunning = false;
- this.dispatchEvent(e);
- }
-
- public static function get OS():String {
- var os:String;
-
- if (Capabilities.os.toLowerCase().indexOf("win") > -1) {
- os = "win";
- } else if (Capabilities.os.toLowerCase().indexOf("mac") > -1) {
- os = "mac";
- } else if (Capabilities.os.toLowerCase().indexOf("linux") > -1) {
- os = "linux";
- }
-
- return os;
- }
-
- public function get OS():String {
- return NativeShellHelper.OS;
- }
-
- public function getShellPath():String {
- var shellPath:String;
-
- if (OS == "win") {
- shellPath = "C:/Windows/System32/cmd.exe";
- } else if (OS == "mac") {
- shellPath = "/Applications/Utilities/Terminal.app";
- } else if (OS == "linux") {
-
- var file:File;
- try {
- file = new File("/bin/bash");
- if (file.exists) {
- shellPath = file.nativePath;
- }
- } catch (err:Error) {
- }
- ;
-
- if (!shellPath) {
- try {
- file = new File("/bin/bsh");
- if (file.exists) {
- shellPath = file.nativePath;
- }
- } catch (err:Error) {
- }
- ;
- }
-
- if (!shellPath) {
- try {
- file = new File("/bin/csh");
- if (file.exists) {
- shellPath = file.nativePath;
- }
- } catch (err:Error) {
- }
- ;
- }
- }
- if (!shellPath) {
- throw new Error("Unsupported System");
- }
-
- return shellPath;
- }
-
- public static function formatPath(path:String):String {
- return path.replace(/\\/g, "/");
- }
-
- public function formatPath(path:String):String {
- return NativeShellHelper.formatPath(path);
- }
- }
-}
-internal class GCLocker {
-
- private var _lockedRefs:Array;
-
- public function GCLocker() {
- _lockedRefs = [];
- }
-
- public function release(ref:*):void {
- var i:int = _lockedRefs.indexOf(ref);
-
- if (i >= 0) {
- _lockedRefs.splice(i, 1);
- }
- }
-
- public function lock(ref:*):void {
- _lockedRefs[_lockedRefs.length] = ref;
- }
-}
diff --git a/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/util/LogUtil.as b/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/util/LogUtil.as
deleted file mode 100644
index f529d60..0000000
--- a/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/util/LogUtil.as
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.apache.flex.utilities.developerToolSuite.executor.infrastructure.util {
- import avmplus.getQualifiedClassName;
-
- import mx.logging.ILogger;
- import mx.logging.Log;
-
- public class LogUtil {
- public static function getLogger(category:*):ILogger {
- var className:String = getQualifiedClassName(category).replace("::", ".");
- return Log.getLogger(className);
- }
- }
-}
diff --git a/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.host-swf/src/main/flex/org/apache/flex/utilities/developerToolSuite/ApplicationContext.mxml b/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.host-swf/src/main/flex/org/apache/flex/utilities/developerToolSuite/ApplicationContext.mxml
index 823299b..41f30e9 100644
--- a/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.host-swf/src/main/flex/org/apache/flex/utilities/developerToolSuite/ApplicationContext.mxml
+++ b/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.host-swf/src/main/flex/org/apache/flex/utilities/developerToolSuite/ApplicationContext.mxml
@@ -16,10 +16,7 @@
limitations under the License.
-->
<fx:Object xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:parsley="http://www.spicefactory.org/parsley"
- xmlns:menu="org.apache.flex.utilities.developerToolSuite.presentation.behavior.menu.*"
- xmlns:menuGraphic="org.apache.flex.utilities.developerToolSuite.presentation.graphic.menu.*"
- xmlns:domain="org.apache.flex.utilities.developerToolSuite.executor.domain.*">
+ xmlns:menuGraphic="org.apache.flex.utilities.developerToolSuite.presentation.graphic.menu.*">
<fx:Declarations>
<menuGraphic:ApplicationMenu/>
diff --git a/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.host-swf/src/main/flex/org/apache/flex/utilities/developerToolSuite/MainApplication.mxml b/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.host-swf/src/main/flex/org/apache/flex/utilities/developerToolSuite/MainApplication.mxml
index 393be72..7858713 100644
--- a/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.host-swf/src/main/flex/org/apache/flex/utilities/developerToolSuite/MainApplication.mxml
+++ b/fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.host-swf/src/main/flex/org/apache/flex/utilities/developerToolSuite/MainApplication.mxml
@@ -27,7 +27,7 @@
<parsley:ContextBuilder>
<parsley:ViewSettings autowireComponents="true"/>
<parsley:FlexConfig type="{ApplicationContext}"/>
- <parsley:FlexConfig type="{SettingsContext}"/>
+ <parsley:FlexConfig type="{UIContext}"/>
<parsley:FlexConfig type="{ExecutorContext}"/>
</parsley:ContextBuilder>
<parsley:Configure/>
@@ -49,17 +49,24 @@
import mx.logging.targets.TraceTarget;
import mx.managers.PopUpManager;
- import org.apache.flex.utilities.developerToolSuite.application.config.SettingsContext;
+ import org.apache.flex.utilities.developerToolSuite.application.config.UIContext;
import org.apache.flex.utilities.developerToolSuite.executor.application.config.ExecutorContext;
import org.apache.flex.utilities.developerToolSuite.executor.application.util.LogUtil;
import org.apache.flex.utilities.developerToolSuite.executor.domain.ISettingsModel;
import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.message.ApplicationReadyMessage;
import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.message.InitApplicationMessage;
- import org.apache.flex.utilities.developerToolSuite.infrastructure.event.ModalWindowEvent;
+ import org.apache.flex.utilities.developerToolSuite.infrastructure.event.SettingsWindowEvent;
import org.apache.flex.utilities.developerToolSuite.infrastructure.message.ApplicationExitReadyMessage;
- import org.apache.flex.utilities.developerToolSuite.infrastructure.message.LaunchUIMessage;
- import org.apache.flex.utilities.developerToolSuite.infrastructure.message.RequestExitApplicationMessage;
+ import org.apache.flex.utilities.developerToolSuite.infrastructure.message.ExitApplicationMessage;
import org.apache.flex.utilities.developerToolSuite.presentation.graphic.menu.ApplicationMenu;
+ import org.spicefactory.parsley.core.command.ManagedCommandFactory;
+ import org.spicefactory.parsley.core.context.Context;
+
+ [Inject]
+ public var context:Context;
+
+ [Inject]
+ public var launchUICommand:ManagedCommandFactory;
[Inject]
[Bindable]
@@ -106,16 +113,16 @@
LogUtil.getLogger(this).info('Application ready');
- dispatch(new LaunchUIMessage());
+ launchUICommand.newInstance().execute();
}
[MessageHandler(selector='opened')]
- public function modalWindowOpenedHandler(event:ModalWindowEvent):void {
+ public function settingsWindowOpenedHandler(event:SettingsWindowEvent):void {
menu = null;
}
[MessageHandler(selector='closed')]
- public function modalWindowClosedHandler(event:ModalWindowEvent):void {
+ public function settingsWindowClosedHandler(event:SettingsWindowEvent):void {
menu = applicationMenu;
}
@@ -151,7 +158,7 @@
settingsToSave.appBounds = appBounds.x + "," + appBounds.y + "," + appBounds.width + "," + appBounds.height;
settingsToSave.appDisplayState = nativeWindow.displayState;
- dispatch(new RequestExitApplicationMessage(settingsToSave));
+ dispatch(new ExitApplicationMessage(settingsToSave));
}
[MessageHandler]