Skip to content

Commit

Permalink
Scener editor: reloads page when the editor is active.
Browse files Browse the repository at this point in the history
  • Loading branch information
PhaserEditor2D committed May 27, 2019
1 parent 09d279f commit 513de5a
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ public String getLabel() {
private IContextActivation _searchContextActivation;
private SceneEditorBlockProvider _blocksProvider;
private IPartListener _partListener;
private boolean _pendingBuild;

public SceneEditor() {
_outlinerSelectionListener = new ISelectionChangedListener() {
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -587,6 +598,10 @@ public void partActivated(IWorkbenchPart part) {
var actionBars = getEditorSite().getActionBars();
_undoRedoGroup.fillActionBars(actionBars);
actionBars.updateActionBars();

if (_pendingBuild) {
realBuild();
}
}
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -50,6 +51,7 @@ public SceneWebView(SceneEditor editor, Composite parent, int style) {
setLayout(layout);

_editor = editor;


_webView = IBrowser.create(this, SWT.NONE);

Expand Down
5 changes: 5 additions & 0 deletions source/v2/releng/.project
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,10 @@
<type>1</type>
<locationURI>$%7BPARENT-1-PROJECT_LOC%7D/pom.xml</locationURI>
</link>
<link>
<name>scripts</name>
<type>2</type>
<location>/home/arian/Documents/PhaserEditor/Public/scripts</location>
</link>
</linkedResources>
</projectDescription>

0 comments on commit 513de5a

Please sign in to comment.