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
|
@ -87,6 +87,15 @@ extern (C) int UIAppMain(string[] args) {
|
||||||
|
|
||||||
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();
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -132,6 +134,16 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL
|
||||||
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) {
|
||||||
executeInUiThread(delegate() {
|
executeInUiThread(delegate() {
|
||||||
|
@ -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