Commits

Anonymous committed 762207d

Fixed load project action, so that it now starts lisp process if necessary and repl is set to input.

Comments (0)

Files changed (8)

org.lispdev.main/META-INF/MANIFEST.MF

  org.lispdev.editor;bundle-version="0.0.1",
  org.lispdev.preferences;bundle-version="0.0.0",
  org.lispdev.swank;bundle-version="1.0.0",
- org.lispdev.log;bundle-version="1.0.0"
+ org.lispdev.log;bundle-version="1.0.0",
+ org.lispdev.repl;bundle-version="1.0.0"
 Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Export-Package: org.lispdev.main

org.lispdev.main/src/org/lispdev/main/LoadProjectAction.java

 import org.eclipse.ui.IWorkbenchPart;
 import org.lispdev.editor.LispMarkers;
 import org.lispdev.log.Log;
+import org.lispdev.repl.AbstractRepl;
+import org.lispdev.repl.ReplPlugin;
 import org.lispdev.swank.SwankPlugin;
 import org.lispdev.swank.debug.LispProcess;
 import org.lispdev.swank.runnables.SwankCompilationRunnable;
           {
             CompilationInfo info = getInfo();
             final IProject proj = asdfile.getProject();
+
+            AbstractRepl repl = ReplPlugin.get().getRepl(config);
+            repl.doInput();
+
             addCompilationMarkers(info, proj);
           }
         });
   public Menu getMenu(Menu parent)
   {
     Menu menu = new Menu(parent);
-    for( ILaunchConfiguration p : SwankPlugin.get().getConfigs() )
+    for( ILaunchConfiguration p : SwankPlugin.getConfigs() )
     {
       final String label = p.getName();
       final ILaunchConfiguration pr = p;

org.lispdev.main/todo.txt

 Inspect it - get into debugger (this should not happen)
 Once in debugger inspect first frame - new debugger started? but
 nothing showed this. Sending frames for locals doesn't produce anything (no
-return from swank).
+return from swank).
+
+------------------------
+
+Active lisp connects with each other:
+repl, process (with its swank), config
+given config should be able to get repl or process. process can get through
+SwankPlugin, repl should be able to get through repl plugin

org.lispdev.repl/src/org/lispdev/repl/AbstractRepl.java

 import java.util.Hashtable;
 import java.util.Stack;
 
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.debug.core.ILaunchConfiguration;
 import org.lispdev.log.Trace;
 import org.lispdev.swank.ISwank;
+import org.lispdev.swank.SwankPlugin;
+import org.lispdev.swank.debug.LispProcess;
 import org.lispdev.swank.runnables.SwankDebugActivateRunnable;
 import org.lispdev.swank.runnables.SwankDebugReturnRunnable;
 import org.lispdev.swank.runnables.SwankDebugRunnable;
 public abstract class AbstractRepl
 {
   private final Stack<IState> states = new Stack<IState>();
+  private final ILaunchConfiguration config;
 
   public final ISwank swank;
 
   private final DebugRunnable debugRunnable;
   private final DebugStopRunnable debugStopRunnable;
 
-  public AbstractRepl(ISwank s)
+  public AbstractRepl(ILaunchConfiguration config)
   {
-    swank = s;
+    Assert.isNotNull(config);
+    LispProcess process = SwankPlugin.get().getProcess(config);
+    Assert.isNotNull(process);
+    swank = process.getSwank();
     readRunnable = new ReadRunnable(this);
     disconnectRunnable = new DisconnectRunnable(this);
     debugInfoRunnable = new DebugInfoRunnable();
     swank.addDebugListener(debugInfoRunnable);
     swank.addDebugActivateListener(debugRunnable);
     swank.addDebugReturnListener(debugStopRunnable);
+    ReplPlugin.get().launch2repl.put(config, this);
+    this.config = config;
+  }
+
+  public ILaunchConfiguration getConfig()
+  {
+    return config;
   }
 
   public abstract void appendOut(String text);

org.lispdev.repl/src/org/lispdev/repl/ReplPlugin.java

 package org.lispdev.repl;
 
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.debug.core.ILaunchConfiguration;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.lispdev.swank.SwankPlugin;
 import org.osgi.framework.BundleContext;
 
 /**
  * The activator class controls the plug-in life cycle
  */
-public class ReplPlugin extends AbstractUIPlugin {
+public class ReplPlugin extends AbstractUIPlugin
+{
 
-	// The plug-in ID
-	public static final String PLUGIN_ID = "org.lispdev.repl";
+  // The plug-in ID
+  public static final String ID = "org.lispdev.repl";
 
-	// The shared instance
-	private static ReplPlugin plugin;
-	
-	/**
-	 * The constructor
-	 */
-	public ReplPlugin() {
-	}
+  // The shared instance
+  private static ReplPlugin plugin;
 
-	/*
-	 * (non-Javadoc)
-	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
-	 */
-	public void start(BundleContext context) throws Exception {
-		super.start(context);
-		plugin = this;
-	}
+  /**
+   * The constructor
+   */
+  public ReplPlugin()
+  {}
 
-	/*
-	 * (non-Javadoc)
-	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
-	 */
-	public void stop(BundleContext context) throws Exception {
-		plugin = null;
-		super.stop(context);
-	}
+  @Override
+  public void start(BundleContext context) throws Exception
+  {
+    super.start(context);
+    plugin = this;
+  }
 
-	/**
-	 * Returns the shared instance
-	 *
-	 * @return the shared instance
-	 */
-	public static ReplPlugin getDefault() {
-		return plugin;
-	}
+  @Override
+  public void stop(BundleContext context) throws Exception
+  {
+    plugin = null;
+    super.stop(context);
+  }
 
+  /**
+   * Returns the shared instance
+   *
+   * @return the shared instance
+   */
+  public static ReplPlugin get()
+  {
+    return plugin;
+  }
+
+  protected final Map<ILaunchConfiguration, AbstractRepl> launch2repl =
+    new HashMap<ILaunchConfiguration, AbstractRepl>();
+
+  public AbstractRepl getRepl(ILaunchConfiguration config)
+  {
+    return launch2repl.get(config);
+  }
+
+  public AbstractRepl getActiveRepl()
+  {
+    return getRepl(SwankPlugin.get().getActiveConfig());
+  }
 }

org.lispdev.replview/src/org/lispdev/replview/ReplConsolePage.java

 package org.lispdev.replview;
 
 import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.ILaunchConfiguration;
 import org.eclipse.debug.core.model.IVariable;
 import org.eclipse.debug.ui.IDebugUIConstants;
 import org.eclipse.debug.ui.IDebugView;
 import org.lispdev.repl.AbstractRepl;
 import org.lispdev.repl.IState;
 import org.lispdev.repl.ReadState;
-import org.lispdev.swank.ISwank;
 import org.lispdev.swank.debug.LispDebugTarget;
 import org.lispdev.swank.debug.LispProcess;
 import org.lispdev.swank.debug.LispThread;
 
   private class Repl extends AbstractRepl implements IConsoleInputListener
   {
-    public Repl(ISwank s)
+    public Repl(ILaunchConfiguration s)
     {
       super(s);
     }
   @Override
   public void createControl(Composite parent)
   {
-    repl = new Repl(process.getSwank());
+    repl = new Repl(process.getLaunch().getLaunchConfiguration());
     replConsole = new LispConsoleViewer(parent/*comp*/, new VerticalRuler(10),
         SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.LEFT | SWT.BORDER,
         new IVariableResolver(){

org.lispdev.swank/src/org/lispdev/swank/SwankPlugin.java

   protected final Map<ILaunchConfiguration, LispProcess> launch2process =
     new HashMap<ILaunchConfiguration, LispProcess>();
 
-  public ILaunchConfiguration[] getConfigs()
+  public static ILaunchConfiguration[] getConfigs()
   {
     ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
     ILaunchConfigurationType type =

org.lispdev.swank/src/org/lispdev/swank/debug/LispProcess.java

 
 public class LispProcess extends PlatformObject implements IProcess
 {
-
   private final HashMap<String,String> attr = new HashMap<String,String>();
   /**
    * The name of the process