From 513de5a5385dc533ba1e7b6cb25ad14f200554fe Mon Sep 17 00:00:00 2001 From: Arian Fornaris Date: Mon, 27 May 2019 16:44:49 -0400 Subject: [PATCH] Scener editor: reloads page when the editor is active. --- .../html/Editor.ts | 3 +-- .../html/out/Editor.js | 2 +- .../phasereditor/scene/ui/editor/SceneEditor.java | 15 +++++++++++++++ .../scene/ui/editor/SceneWebView.java | 2 ++ source/v2/releng/.project | 5 +++++ 5 files changed, 24 insertions(+), 3 deletions(-) diff --git a/source/v2/phasereditor/phasereditor.scene.ui.editor.html/html/Editor.ts b/source/v2/phasereditor/phasereditor.scene.ui.editor.html/html/Editor.ts index ee2fa9c8c..7363d7d92 100644 --- a/source/v2/phasereditor/phasereditor.scene.ui.editor.html/html/Editor.ts +++ b/source/v2/phasereditor/phasereditor.scene.ui.editor.html/html/Editor.ts @@ -213,8 +213,7 @@ namespace PhaserEditor2D { private onReloadPage() { this._socket.close(); - // window.location.reload(); - window.location.href = window.location.href; + window.location.reload(); } private onUpdateSceneProperties(msg: any) { diff --git a/source/v2/phasereditor/phasereditor.scene.ui.editor.html/html/out/Editor.js b/source/v2/phasereditor/phasereditor.scene.ui.editor.html/html/out/Editor.js index 46e3148f3..e3d57964d 100644 --- a/source/v2/phasereditor/phasereditor.scene.ui.editor.html/html/out/Editor.js +++ b/source/v2/phasereditor/phasereditor.scene.ui.editor.html/html/out/Editor.js @@ -157,7 +157,7 @@ var PhaserEditor2D; }; Editor.prototype.onReloadPage = function () { this._socket.close(); - window.location.href = window.location.href; + window.location.reload(); }; Editor.prototype.onUpdateSceneProperties = function (msg) { this.sceneProperties = msg.sceneProperties; diff --git a/source/v2/phasereditor/phasereditor.scene.ui.editor/src/phasereditor/scene/ui/editor/SceneEditor.java b/source/v2/phasereditor/phasereditor.scene.ui.editor/src/phasereditor/scene/ui/editor/SceneEditor.java index 6b389be22..c6c1f0cfb 100644 --- a/source/v2/phasereditor/phasereditor.scene.ui.editor/src/phasereditor/scene/ui/editor/SceneEditor.java +++ b/source/v2/phasereditor/phasereditor.scene.ui.editor/src/phasereditor/scene/ui/editor/SceneEditor.java @@ -133,6 +133,7 @@ public String getLabel() { private IContextActivation _searchContextActivation; private SceneEditorBlockProvider _blocksProvider; private IPartListener _partListener; + private boolean _pendingBuild; public SceneEditor() { _outlinerSelectionListener = new ISelectionChangedListener() { @@ -260,6 +261,16 @@ private void reloadMethod() { } public void build() { + if (this == getEditorSite().getPage().getActiveEditor()) { + realBuild(); + } else { + _pendingBuild = true; + } + } + + private void realBuild() { + _pendingBuild = false; + updatePropertyPagesContentWithSelection(); refreshOutline(); @@ -587,6 +598,10 @@ public void partActivated(IWorkbenchPart part) { var actionBars = getEditorSite().getActionBars(); _undoRedoGroup.fillActionBars(actionBars); actionBars.updateActionBars(); + + if (_pendingBuild) { + realBuild(); + } } } }; diff --git a/source/v2/phasereditor/phasereditor.scene.ui.editor/src/phasereditor/scene/ui/editor/SceneWebView.java b/source/v2/phasereditor/phasereditor.scene.ui.editor/src/phasereditor/scene/ui/editor/SceneWebView.java index 212084864..98ba71b81 100644 --- a/source/v2/phasereditor/phasereditor.scene.ui.editor/src/phasereditor/scene/ui/editor/SceneWebView.java +++ b/source/v2/phasereditor/phasereditor.scene.ui.editor/src/phasereditor/scene/ui/editor/SceneWebView.java @@ -42,6 +42,7 @@ public class SceneWebView extends Composite { private IBrowser _webView; private SceneEditor _editor; + public SceneWebView(SceneEditor editor, Composite parent, int style) { super(parent, style); var layout = new FillLayout(); @@ -50,6 +51,7 @@ public SceneWebView(SceneEditor editor, Composite parent, int style) { setLayout(layout); _editor = editor; + _webView = IBrowser.create(this, SWT.NONE); diff --git a/source/v2/releng/.project b/source/v2/releng/.project index 4a61a5344..72f1d7a51 100644 --- a/source/v2/releng/.project +++ b/source/v2/releng/.project @@ -19,5 +19,10 @@ 1 $%7BPARENT-1-PROJECT_LOC%7D/pom.xml + + scripts + 2 + /home/arian/Documents/PhaserEditor/Public/scripts +