mirror of https://github.com/buggins/dlangide.git
project context menu in workspace tree
This commit is contained in:
parent
a32119b914
commit
adc2f7f4ec
|
@ -128,15 +128,16 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener {
|
|||
});
|
||||
}
|
||||
|
||||
protected void buildAndRunProject() {
|
||||
protected void buildAndRunProject(Project project) {
|
||||
if (!currentWorkspace)
|
||||
return;
|
||||
Project project = currentWorkspace.startupProject;
|
||||
if (!project)
|
||||
project = currentWorkspace.startupProject;
|
||||
if (!project) {
|
||||
window.showMessageBox(UIString("Cannot run project"d), UIString("Startup project is not specified"d));
|
||||
return;
|
||||
}
|
||||
buildProject(BuildOperation.Build, delegate(int result) {
|
||||
buildProject(BuildOperation.Build, project, delegate(int result) {
|
||||
if (!result) {
|
||||
runProject();
|
||||
}
|
||||
|
@ -678,26 +679,26 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener {
|
|||
return true;
|
||||
case IDEActions.BuildProject:
|
||||
case IDEActions.BuildWorkspace:
|
||||
buildProject(BuildOperation.Build);
|
||||
buildProject(BuildOperation.Build, cast(Project)a.objectParam);
|
||||
return true;
|
||||
case IDEActions.RebuildProject:
|
||||
case IDEActions.RebuildWorkspace:
|
||||
buildProject(BuildOperation.Rebuild);
|
||||
buildProject(BuildOperation.Rebuild, cast(Project)a.objectParam);
|
||||
return true;
|
||||
case IDEActions.CleanProject:
|
||||
case IDEActions.CleanWorkspace:
|
||||
buildProject(BuildOperation.Clean);
|
||||
buildProject(BuildOperation.Clean, cast(Project)a.objectParam);
|
||||
return true;
|
||||
case IDEActions.DebugStart:
|
||||
case IDEActions.DebugStartNoDebug:
|
||||
case IDEActions.DebugContinue:
|
||||
buildAndRunProject();
|
||||
buildAndRunProject(cast(Project)a.objectParam);
|
||||
return true;
|
||||
case IDEActions.DebugStop:
|
||||
stopExecution();
|
||||
return true;
|
||||
case IDEActions.UpdateProjectDependencies:
|
||||
buildProject(BuildOperation.Upgrade);
|
||||
buildProject(BuildOperation.Upgrade, cast(Project)a.objectParam);
|
||||
return true;
|
||||
case IDEActions.RefreshProject:
|
||||
refreshWorkspace();
|
||||
|
@ -1075,16 +1076,22 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener {
|
|||
}
|
||||
}
|
||||
|
||||
void buildProject(BuildOperation buildOp, BuildResultListener listener = null) {
|
||||
if (!currentWorkspace || !currentWorkspace.startupProject) {
|
||||
void buildProject(BuildOperation buildOp, Project project, BuildResultListener listener = null) {
|
||||
if (!currentWorkspace) {
|
||||
_logPanel.logLine("No workspace is opened");
|
||||
return;
|
||||
}
|
||||
if (!project)
|
||||
project = currentWorkspace.startupProject;
|
||||
if (!project) {
|
||||
_logPanel.logLine("No project is opened");
|
||||
return;
|
||||
}
|
||||
ProjectSettings projectSettings = currentWorkspace.startupProject.settings;
|
||||
ProjectSettings projectSettings = project.settings;
|
||||
string toolchain = projectSettings.getToolchain(_settings);
|
||||
string arch = projectSettings.getArch(_settings);
|
||||
bool verbose = projectSettings.buildVerbose;
|
||||
Builder op = new Builder(this, currentWorkspace.startupProject, _logPanel, currentWorkspace.projectConfiguration, currentWorkspace.buildConfiguration, buildOp,
|
||||
Builder op = new Builder(this, project, _logPanel, currentWorkspace.projectConfiguration, currentWorkspace.buildConfiguration, buildOp,
|
||||
verbose,
|
||||
toolchain,
|
||||
arch,
|
||||
|
|
|
@ -79,9 +79,15 @@ class WorkspacePanel : DockWindow {
|
|||
ACTION_FILE_WORKSPACE_CLOSE);
|
||||
|
||||
_projectPopupMenu = new MenuItem();
|
||||
_projectPopupMenu.add(ACTION_FILE_NEW_SOURCE_FILE,
|
||||
_projectPopupMenu.add(ACTION_PROJECT_SET_STARTUP,
|
||||
ACTION_PROJECT_FOLDER_REFRESH,
|
||||
ACTION_PROJECT_FOLDER_OPEN_ITEM,
|
||||
ACTION_FILE_NEW_SOURCE_FILE,
|
||||
//ACTION_PROJECT_FOLDER_OPEN_ITEM,
|
||||
ACTION_PROJECT_BUILD,
|
||||
ACTION_PROJECT_REBUILD,
|
||||
ACTION_PROJECT_CLEAN,
|
||||
ACTION_PROJECT_UPDATE_DEPENDENCIES,
|
||||
ACTION_PROJECT_SETTINGS,
|
||||
//ACTION_PROJECT_FOLDER_REMOVE_ITEM
|
||||
);
|
||||
|
||||
|
@ -172,12 +178,25 @@ class WorkspacePanel : DockWindow {
|
|||
foreach(project; _workspace.projects) {
|
||||
TreeItem p = root.newChild(project.filename, project.name, project.isDependency ? "project-d-dependency" : "project-d");
|
||||
p.intParam = ProjectItemType.Project;
|
||||
p.objectParam = project;
|
||||
addProjectItems(p, project.items);
|
||||
}
|
||||
} else {
|
||||
_tree.items.newChild("none", "No workspace"d, "project-development");
|
||||
}
|
||||
_tree.onTreeContentChange(null);
|
||||
if (_workspace) {
|
||||
TreeItem root = _tree.items.child(0);
|
||||
for (int i = 0; i < root.childCount; i++) {
|
||||
TreeItem child = root.child(i);
|
||||
if (child.intParam == ProjectItemType.Project) {
|
||||
Object obj = child.objectParam;
|
||||
Project prj = cast(Project)obj;
|
||||
if (prj && prj.isDependency)
|
||||
child.collapse();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@property void workspace(Workspace w) {
|
||||
|
|
Loading…
Reference in New Issue