Skip to content

Commit

Permalink
- Getting Started conditions updated
Browse files Browse the repository at this point in the history
- Moonshine internal fields are now updates based on downloads by Moonshine SDK Installer (reference #449)
  • Loading branch information
rat-moonshine committed Feb 26, 2019
1 parent a2ec4ce commit 8735a2c
Show file tree
Hide file tree
Showing 9 changed files with 236 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,16 @@ package actionScripts.plugins.git
override public function get author():String { return "Moonshine Project Team"; }
override public function get description():String { return "GitHub Plugin. Esc exits."; }

public var gitBinaryPathOSX:String;
private var _gitBinaryPathOSX:String;
public function get gitBinaryPathOSX():String
{
return _gitBinaryPathOSX;
}
public function set gitBinaryPathOSX(value:String):void
{
model.gitPath = _gitBinaryPathOSX = value;
}

public var modelAgainstProject:Dictionary = new Dictionary();
public var projectsNotAcceptedByUserToPermitAsGitOnMacOS:Dictionary = new Dictionary();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,15 @@ package actionScripts.plugins.svn
override public function get author():String { return "Moonshine Project Team"; }
override public function get description():String { return ResourceManager.getInstance().getString('resources','plugin.desc.subversion'); }

public var svnBinaryPath:String;
private var _svnBinaryPath:String;
public function get svnBinaryPath():String
{
return _svnBinaryPath;
}
public function set svnBinaryPath(value:String):void
{
model.svnPath = _svnBinaryPath = value;
}

private var checkoutWindow:SourceControlCheckout;
private var gitAuthWindow:GitAuthenticationPopup;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
////////////////////////////////////////////////////////////////////////////////
//
// Licensed 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
//
// No warranty of merchantability or fitness of any kind.
// Use this software at your own risk.
//
////////////////////////////////////////////////////////////////////////////////
package actionScripts.utils
{
import actionScripts.events.GlobalEventDispatcher;
import actionScripts.factory.FileLocation;
import actionScripts.locator.IDEModel;
import actionScripts.plugin.settings.event.SetSettingsEvent;
import actionScripts.plugin.settings.vo.ISetting;
import actionScripts.plugin.settings.vo.PathSetting;
import actionScripts.valueObjects.SDKReferenceVO;
import actionScripts.valueObjects.SDKTypes;

public class PathSetupHelperUtil
{
private static var model:IDEModel = IDEModel.getInstance();
private static var dispatcher:GlobalEventDispatcher = GlobalEventDispatcher.getInstance();

public static function updateFieldPath(type:String, path:String):void
{
switch (type)
{
case SDKTypes.FLEX:
case SDKTypes.ROYALE:
case SDKTypes.FLEXJS:
case SDKTypes.FEATHERS:
addProgramingSDK(path);
break;
case SDKTypes.OPENJAVA:
updateJavaPath(path);
break;
case SDKTypes.ANT:
updateAntPath(path);
break;
case SDKTypes.GIT:
updateGitPath(path);
break;
case SDKTypes.MAVEN:
updateMavenPath(path);
break;
case SDKTypes.SVN:
updateSVNPath(path);
break;
}
}

public static function updateAntPath(path:String):void
{
// update only if ant path not set
// or the existing ant path does not exists
if (!model.antHomePath || !model.antHomePath.fileBridge.exists)
{
model.antHomePath = new FileLocation(path);
var settings:Vector.<ISetting> = Vector.<ISetting>([
new PathSetting({antHomePath: path}, 'antHomePath', 'Ant Home', true, path)
]);

// save as moonshine settings
dispatcher.dispatchEvent(new SetSettingsEvent(SetSettingsEvent.SAVE_SPECIFIC_PLUGIN_SETTING,
null, "actionScripts.plugins.ant::AntBuildPlugin", settings));
}
}

public static function updateMavenPath(path:String):void
{
// update only if ant path not set
// or the existing ant path does not exists
if (!model.mavenPath)
{
model.mavenPath = path;
var settings:Vector.<ISetting> = Vector.<ISetting>([
new PathSetting({mavenPath: path}, 'mavenPath', 'Maven Home', true, path)
]);

// save as moonshine settings
dispatcher.dispatchEvent(new SetSettingsEvent(SetSettingsEvent.SAVE_SPECIFIC_PLUGIN_SETTING,
null, "actionScripts.plugins.maven::MavenBuildPlugin", settings));
}
}

public static function updateJavaPath(path:String):void
{
// update only if ant path not set
// or the existing ant path does not exists
if (!model.javaPathForTypeAhead || !model.javaPathForTypeAhead.fileBridge.exists)
{
model.javaPathForTypeAhead = new FileLocation(path);
var settings:Vector.<ISetting> = Vector.<ISetting>([
new PathSetting({currentJavaPath: path}, 'currentJavaPath', 'Java Development Kit Path', true, path)
]);

// save as moonshine settings
dispatcher.dispatchEvent(new SetSettingsEvent(SetSettingsEvent.SAVE_SPECIFIC_PLUGIN_SETTING,
null, "actionScripts.plugins.as3project.mxmlc::MXMLCPlugin", settings));
}
}

public static function updateSVNPath(path:String):void
{
// update only if ant path not set
// or the existing ant path does not exists
if (!model.svnPath)
{
model.svnPath = path;
var settings:Vector.<ISetting> = Vector.<ISetting>([
new PathSetting({svnBinaryPath: path}, 'svnBinaryPath', 'SVN Binary', false)
]);

// save as moonshine settings
dispatcher.dispatchEvent(new SetSettingsEvent(SetSettingsEvent.SAVE_SPECIFIC_PLUGIN_SETTING,
null, "actionScripts.plugins.svn::SVNPlugin", settings));
}
}

public static function updateGitPath(path:String):void
{
// update only if ant path not set
// or the existing ant path does not exists
if (!model.gitPath)
{
model.gitPath = path;
var settings:Vector.<ISetting> = Vector.<ISetting>([
new PathSetting({gitBinaryPathOSX: path}, 'gitBinaryPathOSX', 'Git Path', true)
]);

// save as moonshine settings
dispatcher.dispatchEvent(new SetSettingsEvent(SetSettingsEvent.SAVE_SPECIFIC_PLUGIN_SETTING,
null, "actionScripts.plugins.git::GitHubPlugin", settings));
}
}

public static function addProgramingSDK(path:String):void
{
var sdkPath:FileLocation = new FileLocation(path);
var tmpSDK:SDKReferenceVO = SDKUtils.getSDKReference(sdkPath);
SDKUtils.isSDKAlreadySaved(tmpSDK);

// if only not already set
if (!model.defaultSDK || !model.defaultSDK.fileBridge.exists)
{
model.defaultSDK = sdkPath;

var settings:Vector.<ISetting> = Vector.<ISetting>([
new PathSetting({defaultFlexSDK: path}, 'defaultFlexSDK', 'Default Apache Flex®, Apache Royale® or Feathers SDK', true)
]);

// save as moonshine settings
dispatcher.dispatchEvent(new SetSettingsEvent(SetSettingsEvent.SAVE_SPECIFIC_PLUGIN_SETTING,
null, "actionScripts.plugins.as3project.mxmlc::MXMLCPlugin", settings));
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
import actionScripts.plugin.settings.vo.PluginSetting;
import actionScripts.ui.IContentWindow;
import actionScripts.utils.HelperUtils;
import actionScripts.utils.PathSetupHelperUtil;
import actionScripts.valueObjects.ComponentVO;
import actionScripts.valueObjects.FileWrapper;
private static const LABEL:String = "Getting Started";
Expand Down Expand Up @@ -136,6 +138,8 @@
private function onAnyComponentDownloaded(event:HelperEvent):void
{
// autoset moonshine internal fields as appropriate
var component:ComponentVO = event.value as ComponentVO;
PathSetupHelperUtil.updateFieldPath(component.type, component.installToPath);
}
]]>
Expand Down
6 changes: 4 additions & 2 deletions ide/MoonshineSharedCore/src/actionScripts/locator/IDEModel.as
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ package actionScripts.locator
import actionScripts.interfaces.IContextMenuBridge;
import actionScripts.interfaces.IFileBridge;
import actionScripts.interfaces.IFlexCoreBridge;
import actionScripts.interfaces.IJavaBridge;
import actionScripts.interfaces.ILanguageServerBridge;
import actionScripts.interfaces.IVisualEditorBridge;
import actionScripts.ui.IContentWindow;
import actionScripts.ui.MainView;
import actionScripts.utils.NoSDKNotifier;
import actionScripts.valueObjects.ProjectVO;
import actionScripts.interfaces.IJavaBridge;
import actionScripts.interfaces.ILanguageServerBridge;

[Bindable] public class IDEModel
{
Expand Down Expand Up @@ -71,6 +71,8 @@ package actionScripts.locator
public var antScriptFile:FileLocation;
public var mavenPath:String;
public var javaPathForTypeAhead:FileLocation;
public var svnPath:String;
public var gitPath:String;
public var isCodeCompletionJavaPresent:Boolean;
public var payaraServerLocation:FileLocation;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ package actionScripts.plugin.settings
import actionScripts.plugin.fullscreen.FullscreenPlugin;
import actionScripts.plugin.settings.event.RequestSettingEvent;
import actionScripts.plugin.settings.event.SetSettingsEvent;
import actionScripts.plugin.settings.vo.AbstractSetting;
import actionScripts.plugin.settings.vo.ISetting;
import actionScripts.plugin.settings.vo.PluginSetting;
import actionScripts.plugin.settings.vo.PluginSettingsWrapper;
Expand Down Expand Up @@ -464,8 +465,26 @@ package actionScripts.plugin.settings
if (!saveData.length()) return;

var settingsFile:FileLocation = generateSettingsPath(event.name);
var className:String = event.name.split("::").pop();
use namespace moonshine_internal;
var plug:IPlugin = pluginManager.getPluginByClassName(className);
commitClassSettings(null, saveData, settingsFile);
saveToCurrentPlugin(plug, settingsList);
}

private function saveToCurrentPlugin(plug:IPlugin, settingsList:Vector.<ISetting>):void
{
for each(var setting:AbstractSetting in settingsList)
{
if ((plug as Object).hasOwnProperty(setting.name))
{
// this is suppose to hold one field only
for each (var i:Object in setting.provider)
{
(plug as Object)[setting.name] = i;
}
}
}
}

private function commitClassSettings(plug:IPlugin, saveData:XML, settingsFile:FileLocation):Boolean
Expand Down
6 changes: 3 additions & 3 deletions ide/MoonshineSharedCore/src/actionScripts/utils/SDKUtils.as
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ package actionScripts.utils
for (var i:String in SDKS)
{
var targetDir:FileLocation = new FileLocation(downloadsFolder.fileBridge.nativePath +"/"+ SDKS[i]);
var bundledFlexSDK:SdkDescriptionVO = getSDKReference(targetDir);
var bundledFlexSDK:SDKReferenceVO = getSDKReference(targetDir);
if (bundledFlexSDK)
{
addSDKDirectory(bundledFlexSDK);
Expand Down Expand Up @@ -198,11 +198,11 @@ package actionScripts.utils
/**
* @local
*/
function addSDKDirectory(value:SdkDescriptionVO):void
function addSDKDirectory(value:SDKReferenceVO):void
{
var tmpPR:SDKReferenceVO = new SDKReferenceVO();
tmpPR.name = String(value.name);
tmpPR.path = value.sdkPath;
tmpPR.path = value.path;
tmpPR.status = BUNDLED;
model.userSavedSDKs.addItemAt(tmpPR, 0);
isFound = true;
Expand Down
6 changes: 3 additions & 3 deletions ide/MoonshineSharedCore/src/actionScripts/utils/UtilsCore.as
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ package actionScripts.utils
break;
}
}

var flexJSPrefixName:String = "Apache Flex (FlexJS) ";
var royalePrefixName:String = "Apache Royale ";

Expand Down Expand Up @@ -940,7 +940,7 @@ package actionScripts.utils

public static function isDefaultSDKAvailable():Boolean
{
if (!model.defaultSDK)
if (!model.defaultSDK || !model.defaultSDK.fileBridge.exists)
{
return false;
}
Expand All @@ -961,7 +961,7 @@ package actionScripts.utils

public static function isAntAvailable():Boolean
{
if (model.antHomePath)
if (!model.antHomePath || !model.antHomePath.fileBridge.exists)
{
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,12 @@ package actionScripts.valueObjects

public var version:String;
public var build:String;
public var type:String;
public var status:String;

private var _path:String;
public function set path(value:String):void
{
if (_path != value)
{
_path = value;

// set the type once
type = getType();
}
_path = value;
}
public function get path():String
{
Expand Down Expand Up @@ -95,6 +88,13 @@ package actionScripts.valueObjects
return _fileLocation;
}

private var _type:String;
public function get type():String
{
if (!_type) _type = getType();
return _type;
}

//--------------------------------------------------------------------------
//
// PRIVATE API
Expand Down Expand Up @@ -169,7 +169,7 @@ package actionScripts.valueObjects

compilerExtension = ConstantsCoreVO.IS_MACOS ? "" : ".bat";
compilerFile = fileLocation.resolvePath(JS_SDK_COMPILER_NEW + compilerExtension);
if (compilerFile.fileBridge.exists)
if (isFlexJSAfter7 && compilerFile.fileBridge.exists)
{
if (name.toLowerCase().indexOf("flexjs") != -1) return SDKTypes.FLEXJS;
}
Expand All @@ -179,10 +179,13 @@ package actionScripts.valueObjects
// We've found js/bin/mxmlc compiletion do not produce
// valid swf with prior 0.8 version; we shall need following
// executable for version less than 0.8
if (!isFlexJSAfter7) compilerFile = fileLocation.resolvePath(JS_SDK_COMPILER_OLD + compilerExtension);
if (compilerFile.fileBridge.exists)
else if (!isFlexJSAfter7)
{
if (name.toLowerCase().indexOf("flexjs") != -1) return SDKTypes.FLEXJS;
compilerFile = fileLocation.resolvePath(JS_SDK_COMPILER_OLD + compilerExtension);
if (compilerFile.fileBridge.exists)
{
if (name.toLowerCase().indexOf("flexjs") != -1) return SDKTypes.FLEXJS;
}
}

return null;
Expand Down

0 comments on commit 8735a2c

Please sign in to comment.