Skip to content

Commit

Permalink
- Once closed tabs reopens when project reopens - fixed (reference #669)
Browse files Browse the repository at this point in the history
  • Loading branch information
rat-moonshine committed May 12, 2020
1 parent 2894c19 commit dcfdb71
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
19 changes: 12 additions & 7 deletions ide/MoonshineSharedCore/src/actionScripts/ui/tabview/TabView.as
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ package actionScripts.ui.tabview
import actionScripts.events.GlobalEventDispatcher;
import actionScripts.locator.IDEModel;
import actionScripts.ui.IContentWindow;
import actionScripts.ui.IFileContentWindow;
import actionScripts.ui.editor.BasicTextEditor;
import actionScripts.utils.SharedObjectUtil;
import actionScripts.utils.UtilsCore;
import actionScripts.valueObjects.ConstantsCoreVO;
import actionScripts.valueObjects.HamburgerMenuTabsVO;
import actionScripts.valueObjects.HamburgerMenuTabsVO;

/*
TODO:
Expand Down Expand Up @@ -325,14 +326,14 @@ package actionScripts.ui.tabview
for (var i:int = numTabs - 2; i > -1; i--)
{
var tab:TabViewTab = tabContainer.getChildAt(i) as TabViewTab;
removeTabFromCache(tab.data as BasicTextEditor);
removeTabFromCache(tab.data as IFileContentWindow);
}

for each (var item:HamburgerMenuTabsVO in model.hamburgerTabs)
{
if (item.tabData is BasicTextEditor)
{
removeTabFromCache(item.tabData as BasicTextEditor);
removeTabFromCache(item.tabData as IFileContentWindow);
}
}
}
Expand Down Expand Up @@ -516,14 +517,18 @@ package actionScripts.ui.tabview
invalidateDisplayList();
}

private function removeTabFromCache(editor:BasicTextEditor):void
private function removeTabFromCache(editor:IFileContentWindow):void
{
if (editor)
{
SharedObjectUtil.removeLocationOfClosingProjectFile(
var projectPath:String = ("projectPath" in editor) ? editor["projectPath"] : null;
if (editor.currentFile)
{
SharedObjectUtil.removeLocationOfClosingProjectFile(
editor.currentFile.name,
editor.currentFile.fileBridge.nativePath,
editor.projectPath);
editor.currentFile.fileBridge.nativePath,
projectPath);
}
}
}
}
Expand Down
20 changes: 10 additions & 10 deletions ide/MoonshineSharedCore/src/actionScripts/ui/tabview/TabViewTab.as
Original file line number Diff line number Diff line change
Expand Up @@ -333,19 +333,19 @@ package actionScripts.ui.tabview
private function closeThisTab():void
{
dispatchEvent(new Event(EVENT_TAB_CLOSE));

if (data is BasicTextEditor)
{
var editor:BasicTextEditor = data as BasicTextEditor;

if(editor.currentFile)
if (data is IFileContentWindow)
{
var projectPath:String = data.hasOwnProperty("projectPath") ? data["projectPath"] : null;
var editor:IFileContentWindow = data as IFileContentWindow;
if (editor.currentFile)
{
SharedObjectUtil.removeLocationOfClosingProjectFile(
editor.currentFile.name,
editor.currentFile.fileBridge.nativePath,
editor.projectPath);
editor.currentFile.name,
editor.currentFile.fileBridge.nativePath,
projectPath);
}
}
}
}
}
}

0 comments on commit dcfdb71

Please sign in to comment.