1. Sergey Kolos
  2. lispdev

Commits

sk  committed f09e301

Added default restart.

  • Participants
  • Parent commits bd5fd28
  • Branches default

Comments (0)

Files changed (1)

File src/org/lispdev/replview/RestartActionDelegate.java

View file
 import org.eclipse.ui.IViewActionDelegate;
 import org.eclipse.ui.IViewPart;
 import org.lispdev.swank.debug.LispDebugTarget;
+import org.lispdev.swank.debug.LispStackFrame;
 import org.lispdev.swank.debug.LispThread;
 import org.lispdev.swank.runnables.SwankDebugRunnable.DebugInfo;
 import org.lispdev.swank.runnables.SwankDebugRunnable.DebugInfo.SwankDebugRestart;
   @Override
   public void run(IAction action)
   {
-    MessageBox box = new MessageBox(view.getSite().getShell(),SWT.ICON_INFORMATION);
-    box.setMessage("Hello! You clicked view action!");
-    box.open();
+    if( thread != null && thread.isSuspended() )
+    {
+      thread.getSwank().sendQuitDebug(null, thread.getDebugInfo().thread);
+    }
+    else
+    {
+      MessageBox box =
+        new MessageBox(view.getSite().getShell(),SWT.ICON_INFORMATION);
+      box.setMessage("Thread is not suspended");
+      box.open();
+    }
   }
 
   @Override
       action.setMenuCreator(this);
       this.action = action;
     }
+    thread = null;
     if( selection instanceof TreeSelection )
     {
       Object obj = ((TreeSelection)selection).getFirstElement();
       if(obj instanceof LispDebugTarget)
       {
         thread = ((LispDebugTarget)obj).getMainThread();
-        action.setEnabled(true);
       }
       else if( obj instanceof LispThread )
       {
         thread = (LispThread)obj;
-        action.setEnabled(true);
       }
-      else
+      else if( obj instanceof LispStackFrame )
       {
-        thread = null;
-        action.setEnabled(false);
+        thread = (LispThread)((LispStackFrame)obj).getThread();
       }
     }
-    else
-    {
-      thread = null;
-      action.setEnabled(false);
-    }
+    action.setEnabled(thread != null && thread.isSuspended());
   }
 
   @Override