Skip to content

Commit

Permalink
Added version detection of 8 and 11 in Moonshine Settings and tick th…
Browse files Browse the repository at this point in the history
…e getting-started listing (Moonshine-IDE/Moonshine-SDK-Installer#38) (#755)
  • Loading branch information
rat-moonshine committed Mar 10, 2021
1 parent b4179b5 commit 7fb0d5d
Show file tree
Hide file tree
Showing 10 changed files with 84 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ package actionScripts.impls
import actionScripts.plugin.findreplace.FindReplacePlugin;
import actionScripts.plugin.fullscreen.FullscreenPlugin;
import actionScripts.plugin.help.HelpPlugin;
import moonshine.plugin.help.view.TourDeFlexContentsView;
import actionScripts.plugin.locations.LocationsPlugin;
import actionScripts.plugin.organizeImports.OrganizeImportsPlugin;
import actionScripts.plugin.outline.OutlinePlugin;
Expand Down Expand Up @@ -122,6 +121,7 @@ package actionScripts.impls
import actionScripts.ui.tabview.TabEvent;
import actionScripts.utils.EnvironmentSetupUtils;
import actionScripts.utils.HelperUtils;
import actionScripts.utils.JavaVersionReader;
import actionScripts.utils.ModulesFinder;
import actionScripts.utils.SHClassTest;
import actionScripts.utils.SWFTrustPolicyModifier;
Expand All @@ -133,9 +133,11 @@ package actionScripts.impls
import components.containers.DownloadNewFlexSDK;
import components.popup.DefineFolderAccessPopup;

import moonshine.plugin.help.view.TourDeFlexContentsView;

import visualEditor.plugin.ExportToFlexPlugin;
import visualEditor.plugin.ExportToPrimeFacesPlugin;
import visualEditor.plugin.VisualEditorRefreshFilesPlugin;
import visualEditor.plugin.VisualEditorRefreshFilesPlugin;

public class IFlexCoreBridgeImp extends ProjectBridgeImplBase implements IFlexCoreBridge
{
Expand Down Expand Up @@ -567,5 +569,11 @@ package actionScripts.impls
{
return (new ModulesFinder());
}

public function getJavaVersion(javaPath:String=null, onComplete:Function=null):void
{
var javaVersionReader:JavaVersionReader = new JavaVersionReader();
javaVersionReader.readVersion(javaPath, onComplete);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
package actionScripts.impls
{
import actionScripts.interfaces.IHelperMoonshineBridge;
import actionScripts.locator.IDEModel;
import actionScripts.utils.MSDKIdownloadUtil;
import actionScripts.utils.SDKUtils;
import actionScripts.utils.UtilsCore;
Expand Down Expand Up @@ -122,5 +123,15 @@ package actionScripts.impls
{
_playerglobalExists = value;
}

public function get javaVersionForTypeahead():String
{
return IDEModel.getInstance().javaVersionForTypeAhead;
}

public function get javaVersionInJava8Path():String
{
return IDEModel.getInstance().javaVersionInJava8Path;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -314,12 +314,12 @@ package actionScripts.plugins.as3project.mxmlc
onSettingsClose();
javaPathSetting = new PathSetting(new JavaSettingsProvider(),
"currentJavaPath",
"Java Development Kit Path", true);
"Java Development Kit Root Path", true);
javaPathSetting.addEventListener(AbstractSetting.PATH_SELECTED, onJavaPathSelected, false, 0, true);

java8PathSetting = new PathSetting(new Java8SettingsProvider(),
"currentJava8Path",
"Java Development Kit 8 Path", true);
"Java Development Kit 8 Root Path", true);
java8PathSetting.addEventListener(AbstractSetting.PATH_SELECTED, onJavaPathSelected, false, 0, true);

return Vector.<ISetting>([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ package actionScripts.utils
javaSettingsProvider.currentJavaPath = path;

var settings:Vector.<ISetting> = Vector.<ISetting>([
new PathSetting({currentJavaPath: path}, 'currentJavaPath', 'Java Development Kit Path', true, path)
new PathSetting({currentJavaPath: path}, 'currentJavaPath', 'Java Development Kit Root Path', true, path)
]);

// save as moonshine settings
Expand All @@ -250,7 +250,7 @@ package actionScripts.utils
javaSettingsProvider.currentJava8Path = path;

var settings:Vector.<ISetting> = Vector.<ISetting>([
new PathSetting({currentJava8Path: path}, 'currentJava8Path', 'Java Development Kit 8 Path', true, path)
new PathSetting({currentJava8Path: path}, 'currentJava8Path', 'Java Development Kit 8 Root Path', true, path)
]);

// save as moonshine settings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ package actionScripts.interfaces
import actionScripts.events.NewProjectEvent;
import actionScripts.factory.FileLocation;
import actionScripts.plugin.actionscript.as3project.vo.AS3ProjectVO;
import actionScripts.ui.IPanelWindow;
import actionScripts.ui.editor.BasicTextEditor;
import actionScripts.ui.menu.vo.MenuItem;
import actionScripts.valueObjects.FileWrapper;
Expand Down Expand Up @@ -77,6 +76,7 @@ package actionScripts.interfaces
function isValidExecutableBy(type:String, originPath:String, validationPath:String=null):Boolean;
function getExternalEditors():ArrayCollection;
function getModulesFinder():IModulesFinder;
function getJavaVersion(javaPath:String=null, onComplete:Function=null):void;

/**
*
Expand Down
2 changes: 2 additions & 0 deletions ide/MoonshineSharedCore/src/actionScripts/locator/IDEModel.as
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ package actionScripts.locator
public var notesPath:String;
public var javaPathForTypeAhead:FileLocation;
public var java8Path:FileLocation;
public var javaVersionForTypeAhead:String;
public var javaVersionInJava8Path:String;
public var svnPath:String;
public var gitPath:String;
public var isCodeCompletionJavaPresent:Boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ package actionScripts.plugin.recentlyOpened
import actionScripts.plugin.IMenuPlugin;
import actionScripts.plugin.PluginBase;
import actionScripts.plugin.actionscript.as3project.vo.AS3ProjectVO;
import actionScripts.plugin.settings.providers.Java8SettingsProvider;
import actionScripts.plugin.settings.providers.JavaSettingsProvider;
import actionScripts.ui.LayoutModifier;
import actionScripts.ui.menu.vo.MenuItem;
import actionScripts.utils.OSXBookmarkerNotifiers;
Expand Down Expand Up @@ -217,8 +219,6 @@ package actionScripts.plugin.recentlyOpened
if (cookie.data.hasOwnProperty('isBundledSDKpromptDNS')) ConstantsCoreVO.IS_BUNDLED_SDK_PROMPT_DNS = (cookie.data["isBundledSDKpromptDNS"] == "true") ? true : false;
if (cookie.data.hasOwnProperty('isSDKhelperPromptDNS')) ConstantsCoreVO.IS_SDK_HELPER_PROMPT_DNS = (cookie.data["isSDKhelperPromptDNS"] == "true") ? true : false;
if (cookie.data.hasOwnProperty('isGettingStartedDNS')) ConstantsCoreVO.IS_GETTING_STARTED_DNS = (cookie.data["isGettingStartedDNS"] == "true") ? true : false;
if (cookie.data.hasOwnProperty('javaPathForTypeahead')) model.javaPathForTypeAhead = new FileLocation(cookie.data["javaPathForTypeahead"]);
if (cookie.data.hasOwnProperty('java8Path')) model.java8Path = new FileLocation(cookie.data["java8Path"]);
if (cookie.data.hasOwnProperty('devicesAndroid'))
{
ConstantsCoreVO.TEMPLATES_ANDROID_DEVICES = new ArrayCollection();
Expand All @@ -237,6 +237,20 @@ package actionScripts.plugin.recentlyOpened
{
ConstantsCoreVO.generateDevices();
}
if (cookie.data.hasOwnProperty('javaPathForTypeahead'))
{
model.javaPathForTypeAhead = new FileLocation(cookie.data["javaPathForTypeahead"]);

var javaSettingsProvider:JavaSettingsProvider = new JavaSettingsProvider();
javaSettingsProvider.currentJavaPath = model.javaPathForTypeAhead.fileBridge.nativePath;
}
if (cookie.data.hasOwnProperty('java8Path'))
{
model.java8Path = new FileLocation(cookie.data["java8Path"]);

var java8SettingsProvider:Java8SettingsProvider = new Java8SettingsProvider();
java8SettingsProvider.currentJava8Path = model.java8Path.fileBridge.nativePath;
}

LayoutModifier.parseCookie(cookie);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ package actionScripts.plugin.settings.providers
.getInstance()
.dispatchEvent(new FilePluginEvent(FilePluginEvent.EVENT_JAVA_TYPEAHEAD_PATH_SAVE, model.javaPathForTypeAhead));*/
}
else if (!model.javaVersionInJava8Path)
{
updateJavaVersion();
}
}

public function onSettingsClose():void
Expand Down Expand Up @@ -99,7 +103,19 @@ package actionScripts.plugin.settings.providers
}

model.java8Path = value;
updateJavaVersion();
cookie.flush();
}

private function updateJavaVersion():void
{
if (model.java8Path)
model.flexCore.getJavaVersion(model.java8Path.fileBridge.nativePath, onJavaVersionReadCompletes);
}

private function onJavaVersionReadCompletes(value:String):void
{
model.javaVersionInJava8Path = value;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
////////////////////////////////////////////////////////////////////////////////
package actionScripts.plugin.settings.providers
{
import flash.net.SharedObject;

import actionScripts.events.FilePluginEvent;
import actionScripts.events.GlobalEventDispatcher;
import actionScripts.factory.FileLocation;
Expand All @@ -26,8 +28,6 @@ package actionScripts.plugin.settings.providers
import actionScripts.plugin.settings.vo.ISetting;
import actionScripts.utils.SharedObjectConst;

import flash.net.SharedObject;

public class JavaSettingsProvider implements ISettingsProvider
{
private var model:IDEModel = IDEModel.getInstance();
Expand Down Expand Up @@ -66,6 +66,10 @@ package actionScripts.plugin.settings.providers
.getInstance()
.dispatchEvent(new FilePluginEvent(FilePluginEvent.EVENT_JAVA_TYPEAHEAD_PATH_SAVE, model.javaPathForTypeAhead));
}
else if (!model.javaVersionForTypeAhead)
{
updateJavaVersion();
}
}

public function onSettingsClose():void
Expand All @@ -82,6 +86,7 @@ package actionScripts.plugin.settings.providers
{
delete cookie.data["javaPathForTypeahead"];
model.javaPathForTypeAhead = null;
model.javaVersionForTypeAhead = null;

cookie.flush();
}
Expand All @@ -91,6 +96,18 @@ package actionScripts.plugin.settings.providers
{
model.javaPathForTypeAhead = new FileLocation(currentJavaPath);
model.flexCore.updateToCurrentEnvironmentVariable();
updateJavaVersion();
}

private function updateJavaVersion():void
{
if (model.javaPathForTypeAhead)
model.flexCore.getJavaVersion(model.javaPathForTypeAhead.fileBridge.nativePath, onJavaVersionReadCompletes);
}

private function onJavaVersionReadCompletes(value:String):void
{
model.javaVersionForTypeAhead = value;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,11 @@ package actionScripts.impls
return null;
}

public function getJavaVersion(javaPath:String=null, onComplete:Function=null):void
{

}

//--------------------------------------------------------------------------
//
// PRIVATE LISTENERS
Expand Down

0 comments on commit 7fb0d5d

Please sign in to comment.