X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=plugins%2Fnet.mograsim.plugin.core%2Fsrc%2Fnet%2Fmograsim%2Fplugin%2Flaunch%2FMachineProcess.java;h=f38669023094076c9d32f6945e2f72a96e6d5697;hb=071016cea4c9942b7f5c26f4b7f0bbeb8ca37baf;hp=b22d9c5c1b4b3fc6c2cf7341ecaf5693799a0b7b;hpb=a873ef940ba160f284ba6fa3fee1b9704bf68858;p=Mograsim.git diff --git a/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/launch/MachineProcess.java b/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/launch/MachineProcess.java index b22d9c5c..f3866902 100644 --- a/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/launch/MachineProcess.java +++ b/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/launch/MachineProcess.java @@ -90,11 +90,9 @@ public class MachineProcess extends PlatformObject implements IProcess, ISuspend public void suspend() throws DebugException { if (isTerminated()) - throw new DebugException(new Status(IStatus.ERROR, MograsimActivator.PLUGIN_ID, DebugException.TARGET_REQUEST_FAILED, - "Can't suspend a terminated MachineProcess", null)); + throwDebugException("Can't suspend a terminated MachineProcess"); if (isSuspended()) - throw new DebugException(new Status(IStatus.ERROR, MograsimActivator.PLUGIN_ID, DebugException.TARGET_REQUEST_FAILED, - "Can't suspend a suspended MachineProcess", null)); + throwDebugException("Can't suspend a suspended MachineProcess"); exec.pauseLiveExecution(); fireSuspendEvent(DebugEvent.CLIENT_REQUEST); @@ -110,11 +108,9 @@ public class MachineProcess extends PlatformObject implements IProcess, ISuspend public void resume() throws DebugException { if (isTerminated()) - throw new DebugException(new Status(IStatus.ERROR, MograsimActivator.PLUGIN_ID, DebugException.TARGET_REQUEST_FAILED, - "Can't resume a terminated MachineProcess", null)); + throwDebugException("Can't resume a terminated MachineProcess"); if (!isSuspended()) - throw new DebugException(new Status(IStatus.ERROR, MograsimActivator.PLUGIN_ID, DebugException.TARGET_REQUEST_FAILED, - "Can't resume a non-suspended MachineProcess", null)); + throwDebugException("Can't resume a non-suspended MachineProcess"); exec.unpauseLiveExecution(); fireResumeEvent(DebugEvent.CLIENT_REQUEST); @@ -147,8 +143,7 @@ public class MachineProcess extends PlatformObject implements IProcess, ISuspend public int getExitValue() throws DebugException { if (!isTerminated()) - throw new DebugException(new Status(IStatus.ERROR, MograsimActivator.PLUGIN_ID, DebugException.TARGET_REQUEST_FAILED, - "Can't get the exit value of a running process", null)); + throwDebugException("Can't get the exit value of a running process"); return 0; } @@ -262,4 +257,10 @@ public class MachineProcess extends PlatformObject implements IProcess, ISuspend if (manager != null) manager.fireDebugEventSet(new DebugEvent[] { event }); } + + private static void throwDebugException(String message) throws DebugException + { + throw new DebugException( + new Status(IStatus.ERROR, MograsimActivator.PLUGIN_ID, DebugException.TARGET_REQUEST_FAILED, message, null)); + } } \ No newline at end of file