Commits

sk  committed 8cb2436

Removed ReplView.

  • Participants
  • Parent commits 59f8d58

Comments (0)

Files changed (3)

 <?eclipse version="3.4"?>
 <plugin>
    <extension
-         point="org.eclipse.ui.views">
-      <view
-            allowMultiple="true"
-            class="org.lispdev.replview.ReplView"
-            id="org.lispdev.replview.view"
-            name="Repl"
-            restorable="true">
-      </view>
-   </extension>
-   <extension
          point="org.eclipse.debug.core.launchConfigurationTypes">
       <launchConfigurationType
             delegate="org.lispdev.replview.LocalLispLaunchDelegate"

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

-package org.lispdev.replview;
-
-import java.util.Arrays;
-import java.util.HashMap;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationType;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.text.source.VerticalRuler;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.VerifyEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.part.ViewPart;
-import org.lispdev.console.ConsoleEnterTrigger;
-import org.lispdev.console.IConsoleInputListener;
-import org.lispdev.console.LispConsole;
-import org.lispdev.console.PartitionData;
-import org.lispdev.console.Prompt;
-import org.lispdev.repl.AbstractRepl;
-import org.lispdev.repl.IState;
-import org.lispdev.repl.ReadState;
-import org.lispdev.swank.ISwank;
-import org.lispdev.swank.LispNode;
-import org.lispdev.swank.LispProcess;
-import org.lispdev.swank.LispThread;
-
-public class ReplView extends ViewPart
-{
-  public static final String ID = "org.lispdev.replview.view";
-
-  private LispConsole replConsole;
-  private Repl repl;
-  private Label info;
-  private LispProcess process;
-  private ConsoleEnterTrigger enterTrigger;
-
-  public ReplView()
-  {
-  }
-
-  private class Repl extends AbstractRepl implements IConsoleInputListener
-  {
-    public Repl(ISwank s)
-    {
-      super(s);
-    }
-
-    @Override
-    public void appendOut(String text)
-    {
-      replConsole.appendText(text, null, true);
-    }
-
-    @Override
-    public void appendOutInspectable(String text, String id)
-    {
-      replConsole.appendText(text,"inspectable",id, null, true);
-    }
-
-    @Override
-    protected void applyState(IState s)
-    {
-      if( s instanceof ReadState )
-      {
-        replConsole.setPrompt(new Prompt("", "read-context","1",null,false));
-        enterTrigger.setDoIt(true);
-        enterTrigger.setStateMask(SWT.NONE);
-        doInput();
-      }
-    }
-
-    @Override
-    public void packageChanged(String pkg)
-    {
-      replConsole.setPrompt(
-          new Prompt(pkg.toUpperCase()+">", pkg, "1", null,null,SWT.BOLD,false));
-    }
-
-    @Override
-    public void saveCommandToHistory(String command)
-    {
-    }
-
-    @Override
-    public void run(String msg, int offset, PartitionData pd, VerifyEvent event)
-    {
-      replConsole.setPrompt(
-          new Prompt(swank.getCurrPackage().toUpperCase()+">",
-              swank.getCurrPackage(), "1", null,null,SWT.BOLD,false));
-      enterTrigger.setDoIt(false);
-      enterTrigger.setStateMask(SWT.SHIFT);
-      eval(msg);
-    }
-
-    @Override
-    public void doInput()
-    {
-      replConsole.startEdit();
-    }
-
-    @Override
-    public void disconnected()
-    {
-      if( info != null )
-      {
-        info.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_RED));
-        info.setText("Not connected");
-      }
-    }
-
-    @Override
-    public void connected()
-    {
-      if( info != null )
-      {
-        info.setText(swank.getLispVersion());
-      }
-    }
-
-    @Override
-    public void connecting()
-    {
-      if( info != null )
-      {
-        info.setForeground(
-            Display.getCurrent().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
-        info.setText("Connecting to Lisp ...");
-      }
-    }
-
-    @Override
-    public void disconnecting()
-    {
-      replConsole.appendText("Quitting Lisp ...\n", null, true);
-    }
-
-    @Override
-    public void debugStoped()
-    {
-      // TODO Auto-generated method stub
-
-    }
-
-    @Override
-    public void startDebug(LispNode debugInfo)
-    {
-      try
-      {
-        ((LispThread)process.getLaunch().getDebugTarget().getThreads()[0])
-          .setSuspended(debugInfo);
-      }
-      catch(DebugException e)
-      {
-        e.printStackTrace();
-      }
-    }
-
-  }
-
-  private void initSwank()
-  {
-    try
-    {
-      ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
-      ILaunchConfigurationType cfgType =
-        manager.getLaunchConfigurationType(LocalLispLaunchDelegate.ID);
-      ILaunchConfiguration cfg = cfgType.newInstance(null, "swank");
-      ILaunchConfigurationWorkingCopy wc = cfg.getWorkingCopy();
-      wc.setAttribute(LocalLispLaunchDelegate.ATTR_EXE,
-          "D:\\projects\\lispdev\\ws\\org.lispdev.swank\\sbcl\\sbcl.exe");
-      wc.setAttribute(LocalLispLaunchDelegate.ATTR_CMD_PARAMS,
-          Arrays.asList("--load",
-              "D:\\projects\\lispdev\\ws\\org.lispdev.swank\\slime\\swank-loader.lisp"));
-      wc.setAttribute(LocalLispLaunchDelegate.ATTR_ENV,
-          new HashMap<String,String>()
-          {private static final long serialVersionUID = 1L;
-          {put("SBCL_HOME","D:\\projects\\lispdev\\ws\\org.lispdev.swank\\sbcl\\");}});
-      wc.setAttribute(LocalLispLaunchDelegate.ATTR_EXT,
-          "D:\\projects\\lispdev\\ws\\org.lispdev.swank\\");
-      wc.setAttribute(LocalLispLaunchDelegate.ATTR_PORT, 4005);
-      cfg = wc.doSave();
-      ILaunch launch = cfg.launch(ILaunchManager.DEBUG_MODE, null, false);
-      cfg.delete();
-      if( launch.getProcesses() != null && launch.getProcesses().length > 0
-          && launch.getProcesses()[0] instanceof LispProcess )
-      {
-        process = (LispProcess)launch.getProcesses()[0];
-      }
-    }
-    catch ( CoreException e )
-    {
-      e.printStackTrace();
-    }
-  }
-
-  final IPropertyChangeListener fontListener = new IPropertyChangeListener(){
-
-    @Override
-    public void propertyChange(PropertyChangeEvent event)
-    {
-      if( event.getProperty().equals("org.eclipse.jface.textfont")
-          && replConsole != null )
-      {
-        replConsole.getTextWidget().setFont(JFaceResources.getTextFont());
-      }
-    }
-  };
-
-  @Override
-  public void dispose()
-  {
-    JFaceResources.getFontRegistry().removeListener(fontListener);
-  };
-
-  @Override
-  public void createPartControl(Composite parent)
-  {
-    GridLayout layout = new GridLayout(1, false);
-    layout.marginLeft = 1;
-    layout.marginTop = 1;
-    layout.marginRight = 1;
-    layout.marginBottom = 1;
-    parent.setLayout(layout);
-
-    GridData gd;
-
-    info = new Label(parent, SWT.BORDER);
-    gd = new GridData();
-    gd.horizontalAlignment = GridData.FILL;
-    gd.grabExcessHorizontalSpace = true;
-    gd.grabExcessVerticalSpace = false;
-    info.setLayoutData(gd);
-
-    // Put a border around our text viewer
-    Composite comp = new Composite(parent, SWT.BORDER);
-    layout = new GridLayout(1, false);
-    layout.marginLeft = 0;
-    layout.marginTop = 0;
-    layout.marginRight = 0;
-    layout.marginBottom = 0;
-    layout.horizontalSpacing = 0;
-    layout.marginHeight = 0;
-    layout.marginWidth = 0;
-    comp.setLayout(layout);
-    gd = new GridData();
-    gd.horizontalAlignment = GridData.FILL;
-    gd.verticalAlignment = GridData.FILL;
-    gd.grabExcessHorizontalSpace = true;
-    gd.grabExcessVerticalSpace = true;
-    comp.setLayoutData(gd);
-
-    replConsole = new LispConsole(comp, new VerticalRuler(10),
-        SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.LEFT | SWT.BORDER);
-    replConsole.getControl().setLayoutData(gd);
-    replConsole.getTextWidget().setFont(JFaceResources.getTextFont());
-    JFaceResources.getFontRegistry().addListener(fontListener);
-
-    enterTrigger =
-      new ConsoleEnterTrigger(replConsole,SWT.SHIFT,LispConsole.BEFORE,false);
-    initSwank();
-
-    repl = new Repl(process.getSwank());
-    enterTrigger.addInputListener(repl);
-    replConsole.getTextWidget().addVerifyKeyListener(enterTrigger);
-    replConsole.setPrompt(
-        new Prompt("CL-USER>","prompt","0",null,null,SWT.BOLD,false));
-    replConsole.startEdit();
-    repl.disconnected();
-  }
-
-  @Override
-  public void setFocus()
-  {
-  }
-
-}

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

 /**
  * The activator class controls the plug-in life cycle
  */
-public class ReplViewPlugin extends AbstractUIPlugin {
+public class ReplViewPlugin extends AbstractUIPlugin
+{
 
-	// The plug-in ID
-	public static final String PLUGIN_ID = "org.lispdev.replview";
+  // The plug-in ID
+  public static final String PLUGIN_ID = "org.lispdev.replview";
 
-	// The shared instance
-	private static ReplViewPlugin plugin;
+  // The shared instance
+  private static ReplViewPlugin plugin;
 
-	/**
-	 * The constructor
-	 */
-	public ReplViewPlugin() {
-	}
+  /**
+   * The constructor
+   */
+  public ReplViewPlugin()
+  {}
 
-	/*
-	 * (non-Javadoc)
-	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
-	 */
-	@Override
-  public void start(BundleContext context) throws Exception {
-		super.start(context);
-		plugin = this;
-	}
+  /*
+   * (non-Javadoc)
+   *
+   * @see
+   * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
+   * )
+   */
+  @Override
+  public void start(BundleContext context) throws Exception
+  {
+    super.start(context);
+    plugin = this;
+  }
 
-	/*
-	 * (non-Javadoc)
-	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
-	 */
-	@Override
-  public void stop(BundleContext context) throws Exception {
-		plugin = null;
-		super.stop(context);
-	}
+  /*
+   * (non-Javadoc)
+   *
+   * @see
+   * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
+   * )
+   */
+  @Override
+  public void stop(BundleContext context) throws Exception
+  {
+    plugin = null;
+    super.stop(context);
+  }
 
-	/**
-	 * Returns the shared instance
-	 *
-	 * @return the shared instance
-	 */
-	public static ReplViewPlugin getDefault() {
-		return plugin;
-	}
+  /**
+   * Returns the shared instance
+   *
+   * @return the shared instance
+   */
+  public static ReplViewPlugin getDefault()
+  {
+    return plugin;
+  }
 
 }