Browse Source

Merge pull request #781 from shaddockh/TSH-ATOMIC-NATIVE-EVENT-CLEANUP

Work on migrating native editor events to Typescript + ResourceEditor instantiation refactor
JoshEngebretson 9 years ago
parent
commit
8e88449544
22 changed files with 469 additions and 154 deletions
  1. 33 1
      Data/AtomicEditor/CodeEditor/Editor.html
  2. 2 0
      Script/AtomicEditor/editor/EditorEvents.ts
  3. 95 0
      Script/AtomicEditor/ui/ResourceEditorProvider.ts
  4. 6 36
      Script/AtomicEditor/ui/frames/ResourceFrame.ts
  5. 95 0
      Script/AtomicEditor/ui/resourceEditors/AbstractTextResourceEditorBuilder.ts
  6. 35 0
      Script/AtomicEditor/ui/resourceEditors/JavascriptResourceEditorBuilder.ts
  7. 35 0
      Script/AtomicEditor/ui/resourceEditors/JsonResourceEditorBuilder.ts
  8. 38 0
      Script/AtomicEditor/ui/resourceEditors/Scene3dResourceEditorBuilder.ts
  9. 35 0
      Script/AtomicEditor/ui/resourceEditors/TextFileResourceEditorBuilder.ts
  10. 34 0
      Script/AtomicEditor/ui/resourceEditors/TurboBadgerResourceEditorBuilder.ts
  11. 35 0
      Script/AtomicEditor/ui/resourceEditors/TypescriptResourceEditorBuilder.ts
  12. 0 1
      Script/AtomicWebViewEditor/clientExtensions/ClientExtensionEventNames.ts
  13. 0 18
      Script/AtomicWebViewEditor/clientExtensions/ClientExtensionServices.ts
  14. 0 16
      Script/AtomicWebViewEditor/clientExtensions/languageExtensions/typescript/TypescriptLanguageExtension.ts
  15. 0 11
      Script/AtomicWebViewEditor/clientExtensions/languageExtensions/typescript/workerprocess/TypescriptLanguageServiceWebWorker.ts
  16. 0 7
      Script/AtomicWebViewEditor/editor/editorCommands.ts
  17. 0 22
      Script/AtomicWebViewEditor/interop.ts
  18. 0 1
      Script/AtomicWebViewEditor/typings/WindowExt.d.ts
  19. 16 0
      Script/TypeScript/EditorWork.d.ts
  20. 8 0
      Script/tsconfig.json
  21. 0 11
      Source/Atomic/Resource/ResourceEvents.h
  22. 2 30
      Source/AtomicEditor/Editors/JSResourceEditor.cpp

+ 33 - 1
Data/AtomicEditor/CodeEditor/Editor.html

@@ -39,7 +39,39 @@
       }
       }
     });
     });
 
 
-    System.import('./source/editorCore/interop');
+    // Functions exposed to the host editor.  These
+    // are hooked in here so that they are available immediately from the host
+    // and when called will bring in the interop as a promise and call it once
+    // it has been loaded
+    function HOST_loadCode(url) {
+        System.import('./source/editorCore/interop').then((module) => {
+            module.default.getInstance().loadCode(url);
+        });
+    }
+
+    function HOST_saveCode() {
+        System.import('./source/editorCore/interop').then((module) => {
+            module.default.getInstance().saveCode();
+        });
+    }
+
+    function HOST_resourceRenamed(path, newPath) {
+        System.import('./source/editorCore/interop').then((module) => {
+            module.default.getInstance().resourceRenamed(path, newPath);
+        });
+    }
+
+    function HOST_resourceDeleted(path) {
+        System.import('./source/editorCore/interop').then((module) => {
+            module.default.getInstance().resourceDeleted(path);
+        });
+    }
+
+    function HOST_loadPreferences(prefUrl) {
+        System.import('./source/editorCore/interop').then((module) => {
+            module.default.getInstance().loadPreferences(prefUrl);
+        });
+    }
   </script>
   </script>
 
 
 </body>
 </body>

+ 2 - 0
Script/AtomicEditor/editor/EditorEvents.ts

@@ -159,3 +159,5 @@ export interface RemoveCurrentAssetAssignedEvent {
 }
 }
 
 
 export const UserPreferencesChangedNotification  = "UserPreferencesChangedNotification";
 export const UserPreferencesChangedNotification  = "UserPreferencesChangedNotification";
+export const WebViewLoadEnd = "WebViewLoadEnd";
+export const WebMessage = "WebMessage";

+ 95 - 0
Script/AtomicEditor/ui/ResourceEditorProvider.ts

@@ -0,0 +1,95 @@
+//
+// Copyright (c) 2014-2016 THUNDERBEAST GAMES LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+import JavascriptResourceEditorBuilder from "./resourceEditors/JavascriptResourceEditorBuilder";
+import JsonResourceEditorBuilder from "./resourceEditors/JsonResourceEditorBuilder";
+import Scene3dResourceEditorBuilder from "./resourceEditors/Scene3dResourceEditorBuilder";
+import TextFileResourceEditorBuilder from "./resourceEditors/TextFileResourceEditorBuilder";
+import TurboBadgerResourceEditorBuilder from "./resourceEditors/TurboBadgerResourceEditorBuilder";
+import TypescriptResourceEditorBuilder from "./resourceEditors/TypescriptResourceEditorBuilder";
+
+export default class ResourceEditorProvider {
+    private standardEditorRegistry: Editor.Extensions.ResourceEditorBuilder[] = [];
+    private customEditorRegistry: Editor.Extensions.ResourceEditorBuilder[] = [];
+    private resourceFrame: Atomic.UIWidget;
+
+    constructor(resourceFrame: Atomic.UIWidget) {
+        this.resourceFrame = resourceFrame;
+    }
+
+    /**
+     * Register an internal core editor.
+     */
+    registerStandardEditor(editorBuilder: Editor.Extensions.ResourceEditorBuilder) {
+        this.standardEditorRegistry.push(editorBuilder);
+    }
+
+    /**
+     * Register a custom editor.  These editors will override editors in the standard editor list if
+     * they both resolve the ```canHandleResource``` call.
+     */
+    registerCustomEditor(editorBuilder) {
+        this.customEditorRegistry.push(editorBuilder);
+    }
+
+    /**
+     * Returns an editor for the provided resource type or null
+     */
+    getEditor(resourcePath: string, tabContainer) {
+        let editorBuilder: Editor.Extensions.ResourceEditorBuilder;
+        this.customEditorRegistry.forEach((builder) => {
+            if (builder.canHandleResource(resourcePath)) {
+                editorBuilder = builder;
+                return;
+            }
+        });
+
+        if (!editorBuilder) {
+            this.standardEditorRegistry.forEach((builder) => {
+                if (builder.canHandleResource(resourcePath)) {
+                    editorBuilder = builder;
+                    return;
+                }
+            });
+        }
+
+        if (editorBuilder) {
+            return editorBuilder.getEditor(this.resourceFrame, resourcePath, tabContainer);
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * Loads the built-in standard editors
+     */
+    loadStandardEditors() {
+        this.registerStandardEditor(new TextFileResourceEditorBuilder());
+        this.registerStandardEditor(new JavascriptResourceEditorBuilder());
+        this.registerStandardEditor(new JsonResourceEditorBuilder());
+        this.registerStandardEditor(new TypescriptResourceEditorBuilder());
+        this.registerStandardEditor(new Scene3dResourceEditorBuilder());
+
+        // this overrides the test resource editor so need to put it in the custom bucket
+        this.registerCustomEditor(new TurboBadgerResourceEditorBuilder());
+    }
+}

+ 6 - 36
Script/AtomicEditor/ui/frames/ResourceFrame.ts

@@ -23,6 +23,7 @@
 import ScriptWidget = require("ui/ScriptWidget");
 import ScriptWidget = require("ui/ScriptWidget");
 import EditorEvents = require("editor/EditorEvents");
 import EditorEvents = require("editor/EditorEvents");
 import UIEvents = require("ui/UIEvents");
 import UIEvents = require("ui/UIEvents");
+import ResourceEditorProvider from "../ResourceEditorProvider";
 
 
 // the root content of editor widgets (rootContentWidget property) are extended with an editor field
 // the root content of editor widgets (rootContentWidget property) are extended with an editor field
 // so we can access the editor they belong to from the widget itself
 // so we can access the editor they belong to from the widget itself
@@ -37,6 +38,7 @@ class ResourceFrame extends ScriptWidget {
     resourceViewContainer: Atomic.UILayout;
     resourceViewContainer: Atomic.UILayout;
     currentResourceEditor: Editor.ResourceEditor;
     currentResourceEditor: Editor.ResourceEditor;
     wasClosed: boolean;
     wasClosed: boolean;
+    resourceEditorProvider: ResourceEditorProvider;
 
 
     // editors have a rootCotentWidget which is what is a child of the tab container
     // editors have a rootCotentWidget which is what is a child of the tab container
 
 
@@ -94,22 +96,7 @@ class ResourceFrame extends ScriptWidget {
 
 
         }
         }
 
 
-        var ext = Atomic.getExtension(path);
-
-        var editor: Editor.ResourceEditor = null;
-
-        if (ext == ".js" || ext == ".txt" || ext == ".json" || ext == ".ts") {
-
-             editor = new Editor.JSResourceEditor(path, this.tabcontainer);
-
-        } else if (ext == ".scene") {
-
-            var sceneEditor3D = new Editor.SceneEditor3D(path, this.tabcontainer);
-            editor = sceneEditor3D;
-            this.sendEvent(EditorEvents.ActiveSceneEditorChange, { sceneEditor: sceneEditor3D });
-
-        }
-
+        var editor = this.resourceEditorProvider.getEditor(ev.path, this.tabcontainer);
         if (editor) {
         if (editor) {
 
 
             // cast and add editor lookup on widget itself
             // cast and add editor lookup on widget itself
@@ -226,23 +213,6 @@ class ResourceFrame extends ScriptWidget {
         }
         }
     }
     }
 
 
-    handleUserPreferencesChanged() {
-        let prefsPath = ToolCore.toolSystem.project.userPrefsFullPath;
-        if (Atomic.fileSystem.fileExists(prefsPath)) {
-            for (let editorKey in this.editors) {
-                let editor = this.editors[editorKey];
-                if (editor.typeName == "JSResourceEditor") {
-                    let jsEditor = <Editor.JSResourceEditor>editor;
-
-                    // Get a reference to the web client so we can call the load preferences method
-                    let webClient = jsEditor.webView.webClient;
-
-                    webClient.executeJavaScript(`HOST_loadPreferences("atomic://${prefsPath}");`);
-                }
-            }
-        }
-    }
-
     handleWidgetEvent(ev: Atomic.UIWidgetEvent) {
     handleWidgetEvent(ev: Atomic.UIWidgetEvent) {
 
 
         if (ev.type == Atomic.UI_EVENT_TYPE_TAB_CHANGED && ev.target == this.tabcontainer) {
         if (ev.type == Atomic.UI_EVENT_TYPE_TAB_CHANGED && ev.target == this.tabcontainer) {
@@ -289,7 +259,7 @@ class ResourceFrame extends ScriptWidget {
     handleProjectUnloaded(data) {
     handleProjectUnloaded(data) {
 
 
       for (var i in this.editors) {
       for (var i in this.editors) {
-          this.editors[i].close();
+           this.sendEvent(EditorEvents.EditorResourceClose, { editor: this.editors[i], navigateToAvailableResource: false });
       }
       }
 
 
     }
     }
@@ -307,6 +277,8 @@ class ResourceFrame extends ScriptWidget {
         this.resourceLayout = <Atomic.UILayout> this.getWidget("resourcelayout");
         this.resourceLayout = <Atomic.UILayout> this.getWidget("resourcelayout");
 
 
         this.resourceViewContainer.addChild(this);
         this.resourceViewContainer.addChild(this);
+        this.resourceEditorProvider = new ResourceEditorProvider(this);
+        this.resourceEditorProvider.loadStandardEditors();
 
 
         this.subscribeToEvent(EditorEvents.ProjectUnloadedNotification, (data) => this.handleProjectUnloaded(data));
         this.subscribeToEvent(EditorEvents.ProjectUnloadedNotification, (data) => this.handleProjectUnloaded(data));
         this.subscribeToEvent(EditorEvents.EditResource, (data) => this.handleEditResource(data));
         this.subscribeToEvent(EditorEvents.EditResource, (data) => this.handleEditResource(data));
@@ -315,11 +287,9 @@ class ResourceFrame extends ScriptWidget {
         this.subscribeToEvent(EditorEvents.EditorResourceClose, (ev: EditorEvents.EditorCloseResourceEvent) => this.handleCloseResource(ev));
         this.subscribeToEvent(EditorEvents.EditorResourceClose, (ev: EditorEvents.EditorCloseResourceEvent) => this.handleCloseResource(ev));
         this.subscribeToEvent(EditorEvents.RenameResourceNotification, (ev: EditorEvents.RenameResourceEvent) => this.handleRenameResource(ev));
         this.subscribeToEvent(EditorEvents.RenameResourceNotification, (ev: EditorEvents.RenameResourceEvent) => this.handleRenameResource(ev));
         this.subscribeToEvent(EditorEvents.DeleteResourceNotification, (data) => this.handleDeleteResource(data));
         this.subscribeToEvent(EditorEvents.DeleteResourceNotification, (data) => this.handleDeleteResource(data));
-        this.subscribeToEvent(EditorEvents.UserPreferencesChangedNotification, (data) => this.handleUserPreferencesChanged());
 
 
         this.subscribeToEvent(UIEvents.ResourceEditorChanged, (data) => this.handleResourceEditorChanged(data));
         this.subscribeToEvent(UIEvents.ResourceEditorChanged, (data) => this.handleResourceEditorChanged(data));
 
 
-
         this.subscribeToEvent("WidgetEvent", (data) => this.handleWidgetEvent(data));
         this.subscribeToEvent("WidgetEvent", (data) => this.handleWidgetEvent(data));
 
 
     }
     }

+ 95 - 0
Script/AtomicEditor/ui/resourceEditors/AbstractTextResourceEditorBuilder.ts

@@ -0,0 +1,95 @@
+//
+// Copyright (c) 2014-2016 THUNDERBEAST GAMES LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+import EditorEvents = require("../../editor/EditorEvents");
+export abstract class AbstractTextResourceEditorBuilder implements Editor.Extensions.ResourceEditorBuilder {
+
+    abstract canHandleResource(resourcePath: string): boolean;
+
+    /**
+     * Full path is the fully qualified path from the root of the filesystem.  In order to take advantage
+     * of the resource caching system, let's trim it down to just the path inside the resources directory
+     * including the Resources directory so that the casing is correct
+     */
+    private getNormalizedPath(path: string) {
+        const RESOURCES_MARKER = "resources/";
+        return path.substring(path.toLowerCase().indexOf(RESOURCES_MARKER));
+    }
+
+    getEditor(resourceFrame: Atomic.UIWidget, resourcePath: string, tabContainer: Atomic.UITabContainer): Editor.ResourceEditor {
+
+        const editor = new Editor.JSResourceEditor(resourcePath, tabContainer);
+
+        // one time subscriptions waiting for the web view to finish loading.  This event
+        // actually hits the editor instance before we can hook it, so listen to it on the
+        // frame and then unhook it
+        editor.subscribeToEvent(EditorEvents.WebViewLoadEnd, (data) => {
+            editor.unsubscribeFromEvent(EditorEvents.WebViewLoadEnd);
+            this.loadCode(<Editor.JSResourceEditor>editor, resourcePath);
+        });
+
+        // Cannot subscribe to WebMessage until the .ts side can return a Handler.Success() message
+        // editor.subscribeToEvent(EditorEvents.WebMessage, (data) => {
+        //     console.log("editor Got a web message: " + data.request);
+        //     for (let x in data) {
+        //         console.log(x + ":" + data[x]);
+        //     }
+        //     const request = JSON.parse(data.request);
+        //     switch (request.message) {
+        //         case "editorGetUserPrefs":
+        //             this.getUserPrefs(editor);
+        //             return true;
+        //     }
+        // });
+
+        editor.subscribeToEvent(EditorEvents.DeleteResourceNotification, (data) => {
+            const webClient = editor.webView.webClient;
+            webClient.executeJavaScript(`HOST_resourceDeleted("atomic://${this.getNormalizedPath(data.path)}");`);
+        });
+
+        editor.subscribeToEvent(EditorEvents.UserPreferencesChangedNotification, (data) => {
+            this.getUserPrefs(editor);
+        });
+
+        return editor;
+    }
+
+    /**
+     * Send the url of the user prefs to the web view so that it can request it
+     */
+    getUserPrefs(editor: Editor.JSResourceEditor) {
+        let prefsPath = ToolCore.toolSystem.project.userPrefsFullPath;
+        if (Atomic.fileSystem.fileExists(prefsPath)) {
+            // Get a reference to the web client so we can call the load preferences method
+            const webClient = editor.webView.webClient;
+            webClient.executeJavaScript(`HOST_loadPreferences("atomic://${prefsPath}");`);
+        }
+    }
+
+    /**
+     * Send the url of the code to the web view so that it can request it
+     */
+    loadCode(editor: Editor.JSResourceEditor, resourcePath: string) {
+        const webClient = editor.webView.webClient;
+        webClient.executeJavaScript(`HOST_loadCode("atomic://${this.getNormalizedPath(editor.fullPath)}");`);
+    }
+}

+ 35 - 0
Script/AtomicEditor/ui/resourceEditors/JavascriptResourceEditorBuilder.ts

@@ -0,0 +1,35 @@
+//
+// Copyright (c) 2014-2016 THUNDERBEAST GAMES LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+import {AbstractTextResourceEditorBuilder} from "./AbstractTextResourceEditorBuilder";
+
+export default class JavascriptResourceEditorBuilder extends AbstractTextResourceEditorBuilder {
+
+    constructor() {
+        super();
+    }
+
+    canHandleResource(resourcePath: string) : boolean {
+        var ext = Atomic.getExtension(resourcePath).toLowerCase();
+        return ext == ".js";
+    }
+}

+ 35 - 0
Script/AtomicEditor/ui/resourceEditors/JsonResourceEditorBuilder.ts

@@ -0,0 +1,35 @@
+//
+// Copyright (c) 2014-2016 THUNDERBEAST GAMES LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+import {AbstractTextResourceEditorBuilder} from "./AbstractTextResourceEditorBuilder";
+
+export default class JsonResourceEditorBuilder extends AbstractTextResourceEditorBuilder {
+
+    constructor() {
+        super();
+    }
+
+    canHandleResource(resourcePath: string) : boolean {
+        var ext = Atomic.getExtension(resourcePath).toLowerCase();
+        return ext == ".json";
+    }
+}

+ 38 - 0
Script/AtomicEditor/ui/resourceEditors/Scene3dResourceEditorBuilder.ts

@@ -0,0 +1,38 @@
+//
+// Copyright (c) 2014-2016 THUNDERBEAST GAMES LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+import EditorEvents = require("../../editor/EditorEvents");
+
+export default class Scene3dResourceEditorBuilder implements Editor.Extensions.ResourceEditorBuilder {
+
+    canHandleResource(resourcePath: string) : boolean {
+        var ext = Atomic.getExtension(resourcePath);
+        return ext == ".scene";
+    }
+
+    getEditor(resourceFram: Atomic.UIWidget, resourcePath: string, tabContainer: Atomic.UITabContainer) : Editor.ResourceEditor {
+
+        const editor = new Editor.SceneEditor3D(resourcePath, tabContainer);
+        editor.sendEvent(EditorEvents.ActiveSceneEditorChange, { sceneEditor: editor });
+
+        return editor;
+    }
+}

+ 35 - 0
Script/AtomicEditor/ui/resourceEditors/TextFileResourceEditorBuilder.ts

@@ -0,0 +1,35 @@
+//
+// Copyright (c) 2014-2016 THUNDERBEAST GAMES LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+import {AbstractTextResourceEditorBuilder} from "./AbstractTextResourceEditorBuilder";
+
+export default class TextResourceEditorBuilder extends AbstractTextResourceEditorBuilder {
+
+    constructor() {
+        super();
+    }
+
+    canHandleResource(resourcePath: string) : boolean {
+        var ext = Atomic.getExtension(resourcePath).toLowerCase();
+        return ext == ".txt";
+    }
+}

+ 34 - 0
Script/AtomicEditor/ui/resourceEditors/TurboBadgerResourceEditorBuilder.ts

@@ -0,0 +1,34 @@
+//
+// Copyright (c) 2014-2016 THUNDERBEAST GAMES LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+import {AbstractTextResourceEditorBuilder} from "./AbstractTextResourceEditorBuilder";
+
+export default class TurboBadgerResourceEditorBuilder extends AbstractTextResourceEditorBuilder {
+
+    constructor() {
+        super();
+    }
+
+    canHandleResource(resourcePath: string) : boolean {
+        return resourcePath.toLowerCase().search("\\.tb\\.txt$|\\.tb$") != -1;
+    }
+}

+ 35 - 0
Script/AtomicEditor/ui/resourceEditors/TypescriptResourceEditorBuilder.ts

@@ -0,0 +1,35 @@
+//
+// Copyright (c) 2014-2016 THUNDERBEAST GAMES LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+import {AbstractTextResourceEditorBuilder} from "./AbstractTextResourceEditorBuilder";
+
+export default class TypescriptResourceEditorBuilder extends AbstractTextResourceEditorBuilder {
+
+    constructor() {
+        super();
+    }
+
+    canHandleResource(resourcePath: string) : boolean {
+        var ext = Atomic.getExtension(resourcePath).toLowerCase();
+        return ext == ".ts";
+    }
+}

+ 0 - 1
Script/AtomicWebViewEditor/clientExtensions/ClientExtensionEventNames.ts

@@ -29,6 +29,5 @@ export default class ClientExtensionEventNames {
     static CodeSavedEvent = "CodeSavedEvent";
     static CodeSavedEvent = "CodeSavedEvent";
     static ResourceRenamedEvent = "ResourceRenamedEvent";
     static ResourceRenamedEvent = "ResourceRenamedEvent";
     static ResourceDeletedEvent = "ResourceDeletedEvent";
     static ResourceDeletedEvent = "ResourceDeletedEvent";
-    static ProjectUnloadedEvent = "ProjectUnloadedEvent";
     static PreferencesChangedEvent = "PreferencesChangedEvent";
     static PreferencesChangedEvent = "PreferencesChangedEvent";
 }
 }

+ 0 - 18
Script/AtomicWebViewEditor/clientExtensions/ClientExtensionServices.ts

@@ -95,7 +95,6 @@ export class WebViewServicesProvider extends ServicesProvider<Editor.ClientExten
         eventDispatcher.subscribeToEvent(ClientExtensionEventNames.CodeLoadedEvent, (ev) => this.codeLoaded(ev));
         eventDispatcher.subscribeToEvent(ClientExtensionEventNames.CodeLoadedEvent, (ev) => this.codeLoaded(ev));
         eventDispatcher.subscribeToEvent(ClientExtensionEventNames.ConfigureEditorEvent, (ev) => this.configureEditor(ev));
         eventDispatcher.subscribeToEvent(ClientExtensionEventNames.ConfigureEditorEvent, (ev) => this.configureEditor(ev));
         eventDispatcher.subscribeToEvent(ClientExtensionEventNames.ResourceRenamedEvent, (ev) => this.renameResource(ev));
         eventDispatcher.subscribeToEvent(ClientExtensionEventNames.ResourceRenamedEvent, (ev) => this.renameResource(ev));
-        eventDispatcher.subscribeToEvent(ClientExtensionEventNames.ProjectUnloadedEvent, (ev) => this.projectUnloaded());
         eventDispatcher.subscribeToEvent(ClientExtensionEventNames.ResourceDeletedEvent, (ev) => this.deleteResource(ev));
         eventDispatcher.subscribeToEvent(ClientExtensionEventNames.ResourceDeletedEvent, (ev) => this.deleteResource(ev));
         eventDispatcher.subscribeToEvent(ClientExtensionEventNames.CodeSavedEvent, (ev) => this.saveCode(ev));
         eventDispatcher.subscribeToEvent(ClientExtensionEventNames.CodeSavedEvent, (ev) => this.saveCode(ev));
         eventDispatcher.subscribeToEvent(ClientExtensionEventNames.PreferencesChangedEvent, (ev) => this.preferencesChanged());
         eventDispatcher.subscribeToEvent(ClientExtensionEventNames.PreferencesChangedEvent, (ev) => this.preferencesChanged());
@@ -186,23 +185,6 @@ export class WebViewServicesProvider extends ServicesProvider<Editor.ClientExten
         });
         });
     }
     }
 
 
-
-    /**
-     * Called when the project is unloaded
-     */
-    projectUnloaded() {
-        this.registeredServices.forEach((service) => {
-            // Notify services that the project has been unloaded
-            try {
-                if (service.projectUnloaded) {
-                    service.projectUnloaded();
-                }
-            } catch (e) {
-                alert(`Extension Error:\n Error detected in extension ${service.name}\n \n ${e.stack}`);
-            }
-        });
-    }
-
     /**
     /**
      * Called when preferences changes
      * Called when preferences changes
      * @param  {Editor.EditorEvents.PreferencesChangedEvent} ev
      * @param  {Editor.EditorEvents.PreferencesChangedEvent} ev

+ 0 - 16
Script/AtomicWebViewEditor/clientExtensions/languageExtensions/typescript/TypescriptLanguageExtension.ts

@@ -286,22 +286,6 @@ export default class TypescriptLanguageExtension implements Editor.ClientExtensi
         }
         }
     }
     }
 
 
-    /**
-     * Handle when the project is unloaded so that resources can be freed
-     */
-    projectUnloaded() {
-        if (this.worker) {
-
-            console.log(`${this.name}: received a project unloaded event`);
-
-            const message: WorkerProcessTypes.WorkerProcessMessageData = {
-                command: ClientExtensionEventNames.ProjectUnloadedEvent
-            };
-
-            this.worker.port.postMessage(message);
-        }
-    }
-
     /**
     /**
      * Called when the user preferences have been changed (or initially loaded)
      * Called when the user preferences have been changed (or initially loaded)
      * @return {[type]}
      * @return {[type]}

+ 0 - 11
Script/AtomicWebViewEditor/clientExtensions/languageExtensions/typescript/workerprocess/TypescriptLanguageServiceWebWorker.ts

@@ -177,9 +177,6 @@ export default class TypescriptLanguageServiceWebWorker {
                 case ClientExtensionEventNames.ResourceDeletedEvent:
                 case ClientExtensionEventNames.ResourceDeletedEvent:
                     this.handleDelete(port, e.data);
                     this.handleDelete(port, e.data);
                     break;
                     break;
-                case ClientExtensionEventNames.ProjectUnloadedEvent:
-                    this.handleProjectUnloaded(port);
-                    break;
                 case WorkerProcessTypes.GetAnnotations:
                 case WorkerProcessTypes.GetAnnotations:
                     this.handleGetAnnotations(port, e.data);
                     this.handleGetAnnotations(port, e.data);
                     break;
                     break;
@@ -363,12 +360,4 @@ export default class TypescriptLanguageServiceWebWorker {
     handleRename(port: MessagePort, eventData: WorkerProcessTypes.RenameMessageData) {
     handleRename(port: MessagePort, eventData: WorkerProcessTypes.RenameMessageData) {
         this.languageService.renameProjectFile(eventData.path, eventData.newPath);
         this.languageService.renameProjectFile(eventData.path, eventData.newPath);
     }
     }
-
-    /**
-     * Called when the project has been closed
-     * @param  {MessagePort} port
-     */
-    handleProjectUnloaded(port: MessagePort) {
-        this.reset();
-    }
 }
 }

+ 0 - 7
Script/AtomicWebViewEditor/editor/editorCommands.ts

@@ -77,13 +77,6 @@ export function loadCodeIntoEditor(code: string, filename: string, fileExt: stri
 
 
 }
 }
 
 
-/**
- * Called when the project is getting unloaded
- */
-export function projectUnloaded() {
-    serviceLocator.sendEvent(ClientExtensionEventNames.ProjectUnloadedEvent, null);
-}
-
 /**
 /**
  * Called when a resource is getting renamed
  * Called when a resource is getting renamed
  * @param  {string} path
  * @param  {string} path

+ 0 - 22
Script/AtomicWebViewEditor/interop.ts

@@ -78,23 +78,11 @@ export default class HostInteropType {
     static EDITOR_CHANGE = "editorChange";
     static EDITOR_CHANGE = "editorChange";
     static EDITOR_GET_USER_PREFS = "editorGetUserPrefs";
     static EDITOR_GET_USER_PREFS = "editorGetUserPrefs";
 
 
-    constructor() {
-        // Set up the window object so the host can call into it
-        window.HOST_loadCode = this.loadCode.bind(this);
-        window.HOST_saveCode = this.saveCode.bind(this);
-
-        window.HOST_projectUnloaded = this.projectUnloaded.bind(this);
-        window.HOST_resourceRenamed = this.resourceRenamed.bind(this);
-        window.HOST_resourceDeleted = this.resourceDeleted.bind(this);
-        window.HOST_loadPreferences = this.loadPreferences.bind(this);
-    }
-
     /**
     /**
      * Called from the host to notify the client what file to load
      * Called from the host to notify the client what file to load
      * @param  {string} codeUrl
      * @param  {string} codeUrl
      */
      */
     loadCode(codeUrl: string) {
     loadCode(codeUrl: string) {
-        console.log("Load Code called for :" + codeUrl);
         const fileExt = codeUrl.indexOf(".") != -1 ? codeUrl.split(".").pop() : "";
         const fileExt = codeUrl.indexOf(".") != -1 ? codeUrl.split(".").pop() : "";
         const filename = codeUrl.replace("atomic://", "");
         const filename = codeUrl.replace("atomic://", "");
 
 
@@ -194,13 +182,6 @@ export default class HostInteropType {
         });
         });
     }
     }
 
 
-    /**
-     * Notify that the project has been unloaded
-     */
-    projectUnloaded() {
-        editorCommands.projectUnloaded();
-    }
-
     /**
     /**
      * Notify that a resource has been renamed
      * Notify that a resource has been renamed
      * @param  {string} path
      * @param  {string} path
@@ -225,7 +206,6 @@ export default class HostInteropType {
      * @param  {string} prefUrl
      * @param  {string} prefUrl
      */
      */
     loadPreferences(prefUrl: string) {
     loadPreferences(prefUrl: string) {
-        console.log("Load preferences called for :" + prefUrl);
         // load prefs
         // load prefs
         this.getResource(prefUrl).then((prefsJson: string) => {
         this.getResource(prefUrl).then((prefsJson: string) => {
             let prefs = JSON.parse(prefsJson);
             let prefs = JSON.parse(prefsJson);
@@ -235,5 +215,3 @@ export default class HostInteropType {
         });
         });
     }
     }
 }
 }
-
-HostInteropType.getInstance().editorLoaded();

+ 0 - 1
Script/AtomicWebViewEditor/typings/WindowExt.d.ts

@@ -28,7 +28,6 @@ interface Window {
     HOST_loadCode: (codeUrl) => void;
     HOST_loadCode: (codeUrl) => void;
     HOST_saveCode: () => void;
     HOST_saveCode: () => void;
 
 
-    HOST_projectUnloaded: () => void;
     HOST_resourceRenamed: (path: string, newPath: string) => void;
     HOST_resourceRenamed: (path: string, newPath: string) => void;
     HOST_resourceDeleted: (path: string) => void;
     HOST_resourceDeleted: (path: string) => void;
     HOST_loadPreferences: (path: string) => void;
     HOST_loadPreferences: (path: string) => void;

+ 16 - 0
Script/TypeScript/EditorWork.d.ts

@@ -219,6 +219,22 @@ declare module Editor.Extensions {
          */
          */
         unregister(service: T);
         unregister(service: T);
     }
     }
+
+    /**
+     * Interface that describes a Resource Editor Factory that will build out the editor for the relevant resource type
+     */
+    export interface ResourceEditorBuilder {
+        /**
+         * Returns true if this builder can generate an editor for this resource type
+         */
+        canHandleResource(resourcePath: string) : boolean;
+        /**
+         * Generates a resource editor for the provided resource type
+         * @param  resourcePath
+         * @param  tabContainer
+         */
+        getEditor(resourceFrame: Atomic.UIWidget, resourcePath: string, tabContainer: Atomic.UITabContainer) : Editor.ResourceEditor;
+    }
 }
 }
 
 
 declare module Editor.Modal {
 declare module Editor.Modal {

+ 8 - 0
Script/tsconfig.json

@@ -94,6 +94,14 @@
         "./AtomicEditor/ui/modal/UIResourceOps.ts",
         "./AtomicEditor/ui/modal/UIResourceOps.ts",
         "./AtomicEditor/ui/playmode/PlayerOutput.ts",
         "./AtomicEditor/ui/playmode/PlayerOutput.ts",
         "./AtomicEditor/ui/playmode/PlayMode.ts",
         "./AtomicEditor/ui/playmode/PlayMode.ts",
+        "./AtomicEditor/ui/ResourceEditorProvider.ts",
+        "./AtomicEditor/ui/resourceEditors/AbstractTextResourceEditorBuilder.ts",
+        "./AtomicEditor/ui/resourceEditors/JavascriptResourceEditorBuilder.ts",
+        "./AtomicEditor/ui/resourceEditors/JsonResourceEditorBuilder.ts",
+        "./AtomicEditor/ui/resourceEditors/Scene3dResourceEditorBuilder.ts",
+        "./AtomicEditor/ui/resourceEditors/TextFileResourceEditorBuilder.ts",
+        "./AtomicEditor/ui/resourceEditors/TurboBadgerResourceEditorBuilder.ts",
+        "./AtomicEditor/ui/resourceEditors/TypescriptResourceEditorBuilder.ts",
         "./AtomicEditor/ui/ScriptWidget.ts",
         "./AtomicEditor/ui/ScriptWidget.ts",
         "./AtomicEditor/ui/Shortcuts.ts",
         "./AtomicEditor/ui/Shortcuts.ts",
         "./AtomicEditor/ui/UIEvents.ts",
         "./AtomicEditor/ui/UIEvents.ts",

+ 0 - 11
Source/Atomic/Resource/ResourceEvents.h

@@ -84,17 +84,6 @@ EVENT(E_RENAMERESOURCENOTIFICATION, RenameResourceNotification)
     PARAM(P_RESOURCE, Asset);                       // Resource pointer
     PARAM(P_RESOURCE, Asset);                       // Resource pointer
 }
 }
 
 
-/// Resource was deleted
-EVENT(E_DELETERESOURCENOTIFICATION, DeleteResourceNotification)
-{
-    PARAM(P_RESOURCEPATH, Path);                    // String
-}
-
-/// Project was unloaded
-EVENT(E_PROJECTUNLOADEDNOTIFICATION, ProjecUnloadedNotification)
-{
-}
-    
 /// Language changed.
 /// Language changed.
 EVENT(E_CHANGELANGUAGE, ChangeLanguage)
 EVENT(E_CHANGELANGUAGE, ChangeLanguage)
 {
 {

+ 2 - 30
Source/AtomicEditor/Editors/JSResourceEditor.cpp

@@ -84,12 +84,9 @@ JSResourceEditor ::JSResourceEditor(Context* context, const String &fullpath, UI
 
 
     webView_->GetWebTexture2D()->SetClearColor(Color(.23f, .23f, .23f, 1));
     webView_->GetWebTexture2D()->SetClearColor(Color(.23f, .23f, .23f, 1));
 
 
-    SubscribeToEvent(webClient_, E_WEBVIEWLOADEND, HANDLER(JSResourceEditor, HandleWebViewLoadEnd));
     SubscribeToEvent(messageHandler_, E_WEBMESSAGE, HANDLER(JSResourceEditor, HandleWebMessage));
     SubscribeToEvent(messageHandler_, E_WEBMESSAGE, HANDLER(JSResourceEditor, HandleWebMessage));
 
 
     SubscribeToEvent(E_RENAMERESOURCENOTIFICATION, HANDLER(JSResourceEditor, HandleRenameResourceNotification));
     SubscribeToEvent(E_RENAMERESOURCENOTIFICATION, HANDLER(JSResourceEditor, HandleRenameResourceNotification));
-    SubscribeToEvent(E_DELETERESOURCENOTIFICATION, HANDLER(JSResourceEditor, HandleDeleteResourceNotification));
-    SubscribeToEvent(E_PROJECTUNLOADEDNOTIFICATION, HANDLER(JSResourceEditor, HandleProjectUnloadedNotification));
 
 
     c->AddChild(webView_->GetInternalWidget());
     c->AddChild(webView_->GetInternalWidget());
 
 
@@ -110,6 +107,7 @@ String getNormalizedPath(const String& path)
     return path.SubstringUTF8(path.ToLower().Find(RESOURCES_MARKER));
     return path.SubstringUTF8(path.ToLower().Find(RESOURCES_MARKER));
 }
 }
 
 
+// This needs to stay in place until these properties are accessible from the .ts side
 void JSResourceEditor::HandleRenameResourceNotification(StringHash eventType, VariantMap& eventData)
 void JSResourceEditor::HandleRenameResourceNotification(StringHash eventType, VariantMap& eventData)
 {
 {
     using namespace RenameResourceNotification;
     using namespace RenameResourceNotification;
@@ -124,25 +122,7 @@ void JSResourceEditor::HandleRenameResourceNotification(StringHash eventType, Va
     }
     }
 }
 }
 
 
-void JSResourceEditor::HandleDeleteResourceNotification(StringHash eventType, VariantMap& eventData)
-{
-    using namespace DeleteResourceNotification;
-    const String& path = eventData[P_RESOURCEPATH].GetString();
-
-    webClient_->ExecuteJavaScript(ToString("HOST_resourceDeleted(\"%s\");", getNormalizedPath(path).CString()));
-}
-
-void JSResourceEditor::HandleProjectUnloadedNotification(StringHash eventType, VariantMap& eventData)
-{
-    webClient_->ExecuteJavaScript("HOST_projectUnloaded();");
-}
-
-void JSResourceEditor::HandleWebViewLoadEnd(StringHash eventType, VariantMap& eventData)
-{
-    // need to wait until we get an editor load complete message since we could
-    // still be streaming things in.
-}
-
+// This needs to stay in place until there is a way for the .ts side to provide back a "success" method
 void JSResourceEditor::HandleWebMessage(StringHash eventType, VariantMap& eventData)
 void JSResourceEditor::HandleWebMessage(StringHash eventType, VariantMap& eventData)
 {
 {
     using namespace WebMessage;
     using namespace WebMessage;
@@ -151,7 +131,6 @@ void JSResourceEditor::HandleWebMessage(StringHash eventType, VariantMap& eventD
     const String& EDITOR_CHANGE = "editorChange";
     const String& EDITOR_CHANGE = "editorChange";
     const String& EDITOR_SAVE_CODE = "editorSaveCode";
     const String& EDITOR_SAVE_CODE = "editorSaveCode";
     const String& EDITOR_SAVE_FILE = "editorSaveFile";
     const String& EDITOR_SAVE_FILE = "editorSaveFile";
-    const String& EDITOR_LOAD_COMPLETE = "editorLoadComplete";
     const String& EDITOR_GET_USER_PREFS = "editorGetUserPrefs";
     const String& EDITOR_GET_USER_PREFS = "editorGetUserPrefs";
 
 
     String normalizedPath = getNormalizedPath(fullpath_);
     String normalizedPath = getNormalizedPath(fullpath_);
@@ -162,13 +141,6 @@ void JSResourceEditor::HandleWebMessage(StringHash eventType, VariantMap& eventD
     {
     {
         SetModified(true);
         SetModified(true);
     }
     }
-    else if (request == EDITOR_LOAD_COMPLETE)
-    {
-        // We need to wait until the editor javascript is all required in to call the
-        // method to load the code.  The HandleWebViewLoadEnd event is getting called
-        // too soon.
-        webClient_->ExecuteJavaScript(ToString("HOST_loadCode(\"atomic://%s\");", normalizedPath.CString()));
-    }
     else
     else
     {
     {
         JSONValue jvalue;
         JSONValue jvalue;