From 40bb74dc18b4481bb5c2ceac0ffb07b513433ea2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Thomas?= Date: Tue, 26 Feb 2013 18:24:09 +0000 Subject: [PATCH] - 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 --- .../{SettingsContext.mxml => UIContext.mxml} | 6 +- .../infrastructure/command/ExitUICommand.as | 6 +- .../infrastructure/command/LaunchUICommand.as | 53 ++++- ...lWindowEvent.as => SettingsWindowEvent.as} | 4 +- .../message/ExitApplicationMessage.as | 9 + .../infrastructure/message/LaunchUIMessage.as | 6 - .../message/RequestExitApplicationMessage.as | 11 - .../behavior/validator/ToolPathValidator.as | 21 +- .../presentation/config/SettingsContext.mxml | 37 --- .../graphic/menu/ApplicationMenu.mxml | 8 +- .../graphic/settings/SettingsWindow.mxml | 10 +- .../application/config/ExecutorContext.mxml | 3 +- .../config/ExecutorContext.mxml | 64 ------ .../infrastructure/database/ApplicationDB.as | 80 ------- .../nativeProcess/NativeShellHelper.as | 217 ------------------ .../executor/infrastructure/util/LogUtil.as | 13 -- .../ApplicationContext.mxml | 5 +- .../developerToolSuite/MainApplication.mxml | 25 +- 18 files changed, 101 insertions(+), 477 deletions(-) rename fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/application/config/{SettingsContext.mxml => UIContext.mxml} (92%) rename fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/infrastructure/event/{ModalWindowEvent.as => SettingsWindowEvent.as} (67%) create mode 100644 fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/infrastructure/message/ExitApplicationMessage.as delete mode 100644 fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/infrastructure/message/LaunchUIMessage.as delete mode 100644 fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/infrastructure/message/RequestExitApplicationMessage.as delete mode 100644 fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.component-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/presentation/config/SettingsContext.mxml delete mode 100644 fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/config/ExecutorContext.mxml delete mode 100644 fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/database/ApplicationDB.as delete mode 100644 fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/nativeProcess/NativeShellHelper.as delete mode 100644 fthomas/developerToolSuite/trunk/org.apache.flex.utilities.developerToolSuite.executor-lib/src/main/flex/org/apache/flex/utilities/developerToolSuite/executor/infrastructure/util/LogUtil.as 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 bf82bee7f..762429a9b 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 @@ limitations under the License. - + + + + + 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 241ce093e..9a03db411 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 @@ package org.apache.flex.utilities.developerToolSuite.infrastructure.command { 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 f72559d67..9ace7d88d 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 @@ package org.apache.flex.utilities.developerToolSuite.infrastructure.command { 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 @@ package org.apache.flex.utilities.developerToolSuite.infrastructure.command { } [CommandComplete] - public function validateMavenPathCommand(trigger:ValidateMavenPathMessage):void { + public function validateMavenPathCommandCompleted(trigger:ValidateMavenPathMessage):void { _mavenCompleted = true; checkValidationsCompleted(); } @@ -77,7 +82,7 @@ package org.apache.flex.utilities.developerToolSuite.infrastructure.command { } [CommandComplete] - public function validateCygwinPathCommand(trigger:ValidateCygwinPathMessage):void { + public function validateCygwinPathCommandCompleted(trigger:ValidateCygwinPathMessage):void { _cygwinCompleted = true; checkValidationsCompleted(); } @@ -88,20 +93,46 @@ package org.apache.flex.utilities.developerToolSuite.infrastructure.command { 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 67% 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 f568e5239..e14d13ae4 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 000000000..0baaefcef --- /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 16be3dabb..000000000 --- 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 1ded05a5f..000000000 --- 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 64ba2f918..fce450852 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 @@ package org.apache.flex.utilities.developerToolSuite.presentation.behavior.valid //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 0aafcd352..000000000 --- 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 @@ - - - - - - - - - - - - - - - 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 6622a47a6..3e8d1030e 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 @@ See the License for the specific language governing permissions and limitations under the License. --> + xmlns:mx="library://ns.adobe.com/flex/mx"> 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 e81945188..bd8913170 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 @@ limitations under the License. - [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")] @@ -62,7 +62,7 @@ limitations under the License. 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 @@ limitations under the License. [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 @@ limitations under the License. private function closeWindow():void { PopUpManager.removePopUp(this); - dispatchEvent(new ModalWindowEvent(ModalWindowEvent.CLOSED)); + dispatchEvent(new SettingsWindowEvent(SettingsWindowEvent.CLOSED)); __window = null; } ]]> 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 76a65a05a..f2c841fa9 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 @@ limitations under the License. + xmlns:domain="org.apache.flex.utilities.developerToolSuite.executor.domain.*"> 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 01a443b7f..000000000 --- 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 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 5aea330e0..000000000 --- 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 74b12b9f1..000000000 --- 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. = 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 f529d607d..000000000 --- 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 823299bbb..41f30e9e0 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 @@ See the License for the specific language governing permissions and limitations under the License. --> + xmlns:menuGraphic="org.apache.flex.utilities.developerToolSuite.presentation.graphic.menu.*"> 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 393be7243..7858713eb 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 @@ limitations under the License. - + @@ -49,17 +49,24 @@ limitations under the License. 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 @@ limitations under the License. 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 @@ limitations under the License. settingsToSave.appBounds = appBounds.x + "," + appBounds.y + "," + appBounds.width + "," + appBounds.height; settingsToSave.appDisplayState = nativeWindow.displayState; - dispatch(new RequestExitApplicationMessage(settingsToSave)); + dispatch(new ExitApplicationMessage(settingsToSave)); } [MessageHandler]