start/stop execution

This commit is contained in:
Vadim Lopatin 2015-12-09 14:17:53 +03:00
parent f2db9a74fc
commit 02d5b816e6
6 changed files with 26 additions and 5 deletions

View File

@ -100,6 +100,7 @@ class ProgramExecutionNoDebug : Thread, ProgramExecution {
}
// finished
Log.d("ProgramExecutionNoDebug: finished, execution status: ", _status);
_listener.onProgramExecutionStatus(this, _status, _exitCode);
}

View File

@ -85,9 +85,9 @@ const Action ACTION_PROJECT_REFRESH = new Action(IDEActions.RefreshProject, "MEN
const Action ACTION_PROJECT_UPDATE_DEPENDENCIES = new Action(IDEActions.UpdateProjectDependencies, "MENU_PROJECT_UPDATE_DEPENDENCIES"c);
const Action ACTION_DEBUG_START = new Action(IDEActions.DebugStart, "MENU_DEBUG_START_DEBUGGING"c, "debug-run"c, KeyCode.F5, 0);
const Action ACTION_DEBUG_START_NO_DEBUG = new Action(IDEActions.DebugStartNoDebug, "MENU_DEBUG_START_NO_DEBUGGING"c, null, KeyCode.F5, KeyFlag.Control);
const Action ACTION_DEBUG_CONTINUE = new Action(IDEActions.DebugContinue, "MENU_DEBUG_CONTINUE"c);
const Action ACTION_DEBUG_STOP = (new Action(IDEActions.DebugStop, "MENU_DEBUG_STOP"c)).disableByDefault();
const Action ACTION_DEBUG_PAUSE = (new Action(IDEActions.DebugPause, "MENU_DEBUG_PAUSE"c)).disableByDefault();
const Action ACTION_DEBUG_CONTINUE = new Action(IDEActions.DebugContinue, "MENU_DEBUG_CONTINUE"c, "debug-run");
const Action ACTION_DEBUG_STOP = (new Action(IDEActions.DebugStop, "MENU_DEBUG_STOP"c, "debug-stop")).disableByDefault();
const Action ACTION_DEBUG_PAUSE = (new Action(IDEActions.DebugPause, "MENU_DEBUG_PAUSE"c, "debug-pause")).disableByDefault();
const Action ACTION_EDIT_COPY = (new Action(EditorActions.Copy, "MENU_EDIT_COPY"c, "edit-copy"c, KeyCode.KEY_C, KeyFlag.Control)).addAccelerator(KeyCode.INS, KeyFlag.Control).disableByDefault();
const Action ACTION_EDIT_PASTE = (new Action(EditorActions.Paste, "MENU_EDIT_PASTE"c, "edit-paste"c, KeyCode.KEY_V, KeyFlag.Control)).addAccelerator(KeyCode.INS, KeyFlag.Shift).disableByDefault();
const Action ACTION_EDIT_CUT = (new Action(EditorActions.Cut, "MENU_EDIT_CUT"c, "edit-cut"c, KeyCode.KEY_X, KeyFlag.Control)).addAccelerator(KeyCode.DEL, KeyFlag.Shift).disableByDefault();

View File

@ -91,12 +91,19 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener {
/// stop current program execution
void stopExecution() {
if (_execution) {
_logPanel.logLine("Stopping program execution");
Log.d("Stopping execution");
_execution.stop();
destroy(_execution);
//destroy(_execution);
_execution = null;
}
}
/// returns true if program execution or debugging is active
@property bool isExecutionActive() {
return _execution !is null;
}
/// called when program execution is stopped
protected void onProgramExecutionStatus(ProgramExecution process, ExecutionStatus status, int exitCode) {
executeInUiThread(delegate() {
@ -571,6 +578,8 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener {
tb = res.getOrAddToolbar("Edit");
tb.addButtons(ACTION_EDIT_COPY, ACTION_EDIT_PASTE, ACTION_EDIT_CUT, ACTION_SEPARATOR,
ACTION_EDIT_UNDO, ACTION_EDIT_REDO, ACTION_EDIT_INDENT, ACTION_EDIT_UNINDENT);
tb = res.getOrAddToolbar("Debug");
tb.addButtons(ACTION_DEBUG_STOP, ACTION_DEBUG_CONTINUE, ACTION_DEBUG_PAUSE);
return res;
}
@ -602,7 +611,6 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener {
case IDEActions.CleanWorkspace:
case IDEActions.DebugStart:
case IDEActions.DebugStartNoDebug:
case IDEActions.DebugContinue:
case IDEActions.UpdateProjectDependencies:
case IDEActions.RefreshProject:
case IDEActions.SetStartupProject:
@ -613,6 +621,13 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener {
else
a.state = ACTION_STATE_DISABLE;
return true;
case IDEActions.DebugStop:
a.state = isExecutionActive ? ACTION_STATE_ENABLED : ACTION_STATE_DISABLE;
return true;
case IDEActions.DebugContinue:
case IDEActions.DebugPause:
a.state = isExecutionActive && _execution.isDebugger ? ACTION_STATE_ENABLED : ACTION_STATE_DISABLE;
return true;
default:
return super.handleActionStateRequest(a);
}
@ -673,6 +688,9 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener {
case IDEActions.DebugContinue:
buildAndRunProject();
return true;
case IDEActions.DebugStop:
stopExecution();
return true;
case IDEActions.UpdateProjectDependencies:
buildProject(BuildOperation.Upgrade);
return true;

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 B

View File

@ -31,6 +31,8 @@ res/hdpi/hdpi_run-build.png
res/hdpi/hdpi_text-d.png
res/mdpi/cr3_logo.png
res/mdpi/debug-run.png
res/mdpi/debug-pause.png
res/mdpi/debug-stop.png
res/mdpi/dlangui-logo1.png
res/mdpi/document-close.png
res/mdpi/document-open-recent.png