Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a directory and package.d #374

Merged
merged 16 commits into from
May 8, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Folder added to its parent without reloading the whole workspace
As we know the parant, we can simple add a child to it. There is no need to reload the workspace. I also took the liberty of renaming refreshWorkspace to updateTreeGraph, to avoid confusion between updating the tree graph and reloading the workspace from disk.
  • Loading branch information
Zevenberge committed Dec 2, 2017
commit c1f4a3b1c2185bb8ffaefb2e78f4e50b2e72997f
36 changes: 22 additions & 14 deletions src/dlangide/ui/frame.d
Original file line number Diff line number Diff line change
Expand Up @@ -1138,7 +1138,7 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL
else
ed.editorTool = new DefaultEditorTool(this);
//openSourceFile(filename);
refreshWorkspace();
updateTreeGraph();
ProjectSourceFile file = _wsPanel.findSourceFileItem(filename, false);
if (file) {
ed.projectSourceFile = file;
Expand Down Expand Up @@ -1210,7 +1210,7 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL
buildProject(BuildOperation.Upgrade, cast(Project)a.objectParam);
return true;
case IDEActions.RefreshProject:
refreshWorkspace();
updateTreeGraph();
return true;
case IDEActions.RevealProjectInExplorer:
revealProjectInExplorer(cast(Project)a.objectParam);
Expand Down Expand Up @@ -1437,7 +1437,7 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL
if (cast(Workspace)obj) {
Workspace ws = cast(Workspace)obj;
ws.refresh();
refreshWorkspace();
updateTreeGraph();
} else if (cast(Project)obj) {
project = cast(Project)obj;
} else if (cast(ProjectFolder)obj) {
Expand All @@ -1456,7 +1456,7 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL
}
if (project) {
project.refresh();
refreshWorkspace();
updateTreeGraph();
}
}

Expand All @@ -1483,7 +1483,7 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL
Log.e("Cannot remove file");
}
project.refresh();
refreshWorkspace();
updateTreeGraph();
}
// else ignore
return true;
Expand All @@ -1500,7 +1500,7 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL
if (res) {
//res.project.reload();
res.project.refresh();
refreshWorkspace();
updateTreeGraph();
if (isSupportedSourceTextFileFormat(res.filename)) {
openSourceFile(res.filename, null, true);
}
Expand All @@ -1519,9 +1519,11 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL
if(result.id == ACTION_FILE_NEW_DIRECTORY.id) {
FileCreationResult res = cast(FileCreationResult)result.objectParam;
if (res) {
//res.project.reload();
res.project.refresh();
refreshWorkspace();
ProjectFolder newFolder = new ProjectFolder(res.filename);
if(folder) {
folder.addChild(newFolder);
}
updateTreeGraph();
}
}
};
Expand All @@ -1543,6 +1545,12 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL
ProjectFolder folder;
if (cast(Project)obj) {
project = cast(Project)obj;
folder = project.items;
import std.stdio;
writeln("Root filename:", folder.filename);
for(int i = 0; i < folder.childCount; i++) {
writeln("Child [", i, "]: ", folder.child(i).filename);
}
} else if (cast(ProjectFolder)obj) {
folder = cast(ProjectFolder)obj;
project = folder.project;
Expand Down Expand Up @@ -1579,12 +1587,12 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL
if (currentWorkspace is null || res.workspace !is currentWorkspace) {
// open new workspace
setWorkspace(res.workspace);
refreshWorkspace();
updateTreeGraph();
hideHomeScreen();
} else {
// project added to current workspace
loadProject(res.project);
refreshWorkspace();
updateTreeGraph();
hideHomeScreen();
}
}
Expand Down Expand Up @@ -1786,7 +1794,7 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL
currentWorkspace.addProject(project);
loadProject(project);
currentWorkspace.save();
refreshWorkspace();
updateTreeGraph();
hideHomeScreen();
}
return true;
Expand All @@ -1801,7 +1809,7 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL
}
}

void refreshWorkspace() {
void updateTreeGraph() {
_logPanel.logLine("Refreshing workspace");
_wsPanel.reloadItems();
closeRemovedDocuments();
Expand Down Expand Up @@ -1867,7 +1875,7 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL
void refreshProject(Project project) {
if (currentWorkspace && project.loadSelections()) {
currentWorkspace.cleanupUnusedDependencies();
refreshWorkspace();
updateTreeGraph();
}
}

Expand Down