mirror of https://github.com/buggins/dlangide.git
Merge pull request #232 from shiche/209-OpenIDEWithWorkspace
#209 Workspace can be opened from command line
This commit is contained in:
commit
99f14342e8
|
|
@ -86,7 +86,16 @@ extern (C) int UIAppMain(string[] args) {
|
||||||
//pragma(msg, w.click.return_t, "", w.click.params_t);
|
//pragma(msg, w.click.return_t, "", w.click.params_t);
|
||||||
|
|
||||||
IDEFrame frame = new IDEFrame(window);
|
IDEFrame frame = new IDEFrame(window);
|
||||||
|
|
||||||
|
// Open project, if it specified in command line
|
||||||
|
if (args.length > 1)
|
||||||
|
{
|
||||||
|
Action a = ACTION_FILE_OPEN_WORKSPACE.clone();
|
||||||
|
a.stringParam = args[1];
|
||||||
|
frame.handleAction(a);
|
||||||
|
// Mark that workspace opened to prevent auto open
|
||||||
|
frame.isOpenedWorkspace(true);
|
||||||
|
}
|
||||||
|
|
||||||
// open home screen tab
|
// open home screen tab
|
||||||
frame.showHomeScreen();
|
frame.showHomeScreen();
|
||||||
|
|
@ -185,4 +194,4 @@ unittest {
|
||||||
loaded.save("test_file2.json");
|
loaded.save("test_file2.json");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,8 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL
|
||||||
OutputPanel _logPanel;
|
OutputPanel _logPanel;
|
||||||
DockHost _dockHost;
|
DockHost _dockHost;
|
||||||
TabWidget _tabs;
|
TabWidget _tabs;
|
||||||
|
// Is any workspace already opened?
|
||||||
|
private auto openedWorkspace = false;
|
||||||
|
|
||||||
///Cache for parsed D files for autocomplete and symbol finding
|
///Cache for parsed D files for autocomplete and symbol finding
|
||||||
import dlangide.tools.d.dcdinterface;
|
import dlangide.tools.d.dcdinterface;
|
||||||
|
|
@ -131,6 +133,16 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL
|
||||||
@property bool isExecutionActive() {
|
@property bool isExecutionActive() {
|
||||||
return _execution !is null;
|
return _execution !is null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Is any workspace already opened?
|
||||||
|
@property bool isOpenedWorkspace() {
|
||||||
|
return openedWorkspace;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Is any workspace already opened?
|
||||||
|
@property void isOpenedWorkspace(bool opened) {
|
||||||
|
openedWorkspace = opened;
|
||||||
|
}
|
||||||
|
|
||||||
/// called when program execution is stopped
|
/// called when program execution is stopped
|
||||||
protected void onProgramExecutionStatus(ProgramExecution process, ExecutionStatus status, int exitCode) {
|
protected void onProgramExecutionStatus(ProgramExecution process, ExecutionStatus status, int exitCode) {
|
||||||
|
|
@ -460,9 +472,9 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL
|
||||||
_tabs.addTab(home, UIString.fromId("HOME"c), null, true);
|
_tabs.addTab(home, UIString.fromId("HOME"c), null, true);
|
||||||
_tabs.selectTab(HOME_SCREEN_ID, true);
|
_tabs.selectTab(HOME_SCREEN_ID, true);
|
||||||
auto _settings = new IDESettings(buildNormalizedPath(settingsDir, "settings.json"));
|
auto _settings = new IDESettings(buildNormalizedPath(settingsDir, "settings.json"));
|
||||||
// Auto open last project
|
// Auto open last workspace, if no workspace specified in command line and autoOpen flag set to true
|
||||||
const auto recentWorkspaces = settings.recentWorkspaces;
|
const auto recentWorkspaces = settings.recentWorkspaces;
|
||||||
if (recentWorkspaces.length > 0 && _settings.autoOpenLastProject())
|
if (!openedWorkspace && recentWorkspaces.length > 0 && _settings.autoOpenLastProject())
|
||||||
{
|
{
|
||||||
Action a = ACTION_FILE_OPEN_WORKSPACE.clone();
|
Action a = ACTION_FILE_OPEN_WORKSPACE.clone();
|
||||||
a.stringParam = recentWorkspaces[0];
|
a.stringParam = recentWorkspaces[0];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue