Permalink
Browse files

initial commit: first go at command history in ghci console

  • Loading branch information...
1 parent 405eded commit fc7051ff0dd230811530038f926c88f490bac5c8 @JPMoresmau committed Jun 27, 2012
Showing with 525 additions and 100 deletions.
  1. +4 −4 net.sf.eclipsefp.haskell-feature/feature.xml
  2. +1 −1 net.sf.eclipsefp.haskell.debug.core/META-INF/MANIFEST.MF
  3. +7 −0 net.sf.eclipsefp.haskell.debug.core/plugin.xml
  4. +64 −60 ...lipsefp.haskell.debug.core/src/net/sf/eclipsefp/haskell/debug/core/internal/HaskellDebugCore.java
  5. +22 −13 ...g.core/src/net/sf/eclipsefp/haskell/debug/core/internal/launch/AbstractHaskellLaunchDelegate.java
  6. +5 −3 ...ell.debug.core/src/net/sf/eclipsefp/haskell/debug/core/internal/launch/HaskellLaunchDelegate.java
  7. +1 −0 .../src/net/sf/eclipsefp/haskell/debug/core/internal/launch/IInteractiveLaunchOperationDelegate.java
  8. +57 −0 ...askell.debug.core/src/net/sf/eclipsefp/haskell/debug/core/internal/launch/REPLProcessFactory.java
  9. +2 −2 net.sf.eclipsefp.haskell.debug.ui/META-INF/MANIFEST.MF
  10. BIN net.sf.eclipsefp.haskell.debug.ui/icons/etool16/history16.gif
  11. +1 −1 net.sf.eclipsefp.haskell.debug.ui/plugin.properties
  12. +12 −12 net.sf.eclipsefp.haskell.debug.ui/plugin.xml
  13. +2 −0 ...ll.debug.ui/src/net/sf/eclipsefp/haskell/debug/ui/internal/launch/InteractiveLaunchOperation.java
  14. +2 −0 ...ug.ui/src/net/sf/eclipsefp/haskell/debug/ui/internal/launch/ghci/GhciLaunchOperationDelegate.java
  15. +1 −0 ...rc/net/sf/eclipsefp/haskell/debug/ui/internal/launch/yesod/YesodDevelLaunchOperationDelegate.java
  16. +2 −0 net.sf.eclipsefp.haskell.debug.ui/src/net/sf/eclipsefp/haskell/debug/ui/internal/util/UITexts.java
  17. +2 −0 ...eclipsefp.haskell.debug.ui/src/net/sf/eclipsefp/haskell/debug/ui/internal/util/uitexts.properties
  18. +179 −0 net.sf.eclipsefp.haskell.debug.ui/src/net/sf/eclipsefp/haskell/debug/ui/repl/HistoryAction.java
  19. +82 −0 net.sf.eclipsefp.haskell.debug.ui/src/net/sf/eclipsefp/haskell/debug/ui/repl/HistoryParticipant.java
  20. +1 −1 net.sf.eclipsefp.haskell.hlint/META-INF/MANIFEST.MF
  21. +1 −1 net.sf.eclipsefp.haskell.hugs/META-INF/MANIFEST.MF
  22. +6 −2 net.sf.eclipsefp.haskell.ui/plugin.xml
  23. +71 −0 net.sf.eclipsefp.haskell.util/src/net/sf/eclipsefp/haskell/util/BinaryStreamRedirect.java
@@ -100,7 +100,7 @@ available at http://www.eclipse.org/legal/epl-v10.html.
id="net.sf.eclipsefp.haskell.hugs"
download-size="0"
install-size="0"
- version="2.3.0"
+ version="2.3.1"
unpack="false"/>
<plugin
@@ -114,14 +114,14 @@ available at http://www.eclipse.org/legal/epl-v10.html.
id="net.sf.eclipsefp.haskell.debug.ui"
download-size="0"
install-size="0"
- version="2.3.0"
+ version="2.3.1"
unpack="false"/>
<plugin
id="net.sf.eclipsefp.haskell.debug.core"
download-size="0"
install-size="0"
- version="2.3.0"
+ version="2.3.1"
unpack="false"/>
<plugin
@@ -149,7 +149,7 @@ available at http://www.eclipse.org/legal/epl-v10.html.
id="net.sf.eclipsefp.haskell.hlint"
download-size="0"
install-size="0"
- version="2.3.0"
+ version="2.3.1"
unpack="false"/>
<plugin
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %bundleName
Bundle-SymbolicName: net.sf.eclipsefp.haskell.debug.core;singleton:=true
-Bundle-Version: 2.3.0
+Bundle-Version: 2.3.1
Bundle-Activator: net.sf.eclipsefp.haskell.debug.core.internal.HaskellDebugCore
Bundle-Vendor: %bundleVendor
Require-Bundle: org.eclipse.core.runtime,
@@ -87,6 +87,13 @@
id="net.sf.eclipsefp.haskell.debug.core.sourcePathComputer">
</sourcePathComputer>
</extension>
+ <extension point="org.eclipse.debug.core.processFactories">
+ <processFactory
+ id="net.sf.eclipsefp.haskell.debug.core.launch.REPLProcessFactory"
+ class="net.sf.eclipsefp.haskell.debug.core.internal.launch.REPLProcessFactory">
+ </processFactory>
+ </extension>
+
<!-- <extension
point="org.eclipse.debug.core.launchConfigurationTypes">
<launchConfigurationType
@@ -1,60 +1,64 @@
-// Copyright (c) 2008 by Leif Frenzel. All rights reserved.
-// This code is made available under the terms of the Eclipse Public License,
-// version 1.0 (EPL). See http://www.eclipse.org/legal/epl-v10.html
-package net.sf.eclipsefp.haskell.debug.core.internal;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.core.runtime.Status;
-import org.osgi.framework.BundleContext;
-
-/** <p>The main plugin class for the Haskell Debug Core.</p>
- *
- * @author Leif Frenzel
- */
-public class HaskellDebugCore extends Plugin {
-
- public static final String ID_HASKELL_DEBUG_MODEL = "net.sf.eclipsefp.haskell.debug"; //$NON-NLS-1$
-
- public static final String ID_EXT_POINT_INTERACTIVE_DELEGATES = "interactiveDelegates"; //$NON-NLS-1$
-
- // The shared instance
- private static HaskellDebugCore plugin;
-
- public static HaskellDebugCore getDefault() {
- return plugin;
- }
-
- public static String getPluginId() {
- return getDefault().getBundle().getSymbolicName();
- }
-
- public IConfigurationElement[] getExtensions(final String key) {
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- return registry.getConfigurationElementsFor(getPluginId(), key);
- }
-
- // interface methods of Activator
- /////////////////////////////////
-
- @Override
- public void start( final BundleContext context ) throws Exception {
- super.start( context );
- plugin = this;
- }
-
- @Override
- public void stop( final BundleContext context ) throws Exception {
- plugin = null;
- super.stop( context );
- }
-
- public static void log( final String message, final Throwable thr ) {
- String id = getPluginId();
- Status status = new Status( IStatus.ERROR, id, IStatus.OK, message, thr );
- getDefault().getLog().log( status );
- }
-}
+// Copyright (c) 2008 by Leif Frenzel. All rights reserved.
+// This code is made available under the terms of the Eclipse Public License,
+// version 1.0 (EPL). See http://www.eclipse.org/legal/epl-v10.html
+package net.sf.eclipsefp.haskell.debug.core.internal;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+import org.osgi.framework.BundleContext;
+
+/** <p>The main plugin class for the Haskell Debug Core.</p>
+ *
+ * @author Leif Frenzel
+ */
+public class HaskellDebugCore extends Plugin {
+
+ public static final String ID_HASKELL_DEBUG_MODEL = "net.sf.eclipsefp.haskell.debug"; //$NON-NLS-1$
+
+ public static final String ID_EXT_POINT_INTERACTIVE_DELEGATES = "interactiveDelegates"; //$NON-NLS-1$
+
+ /**
+ * constant for command history enablement on process
+ */
+ public static final String PROCESS_COMMAND_HISTORY ="net.sf.eclipse.haskell.debug.commandHistory" ; //$NON-NLS-1$
+ // The shared instance
+ private static HaskellDebugCore plugin;
+
+ public static HaskellDebugCore getDefault() {
+ return plugin;
+ }
+
+ public static String getPluginId() {
+ return getDefault().getBundle().getSymbolicName();
+ }
+
+ public IConfigurationElement[] getExtensions(final String key) {
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ return registry.getConfigurationElementsFor(getPluginId(), key);
+ }
+
+ // interface methods of Activator
+ /////////////////////////////////
+
+ @Override
+ public void start( final BundleContext context ) throws Exception {
+ super.start( context );
+ plugin = this;
+ }
+
+ @Override
+ public void stop( final BundleContext context ) throws Exception {
+ plugin = null;
+ super.stop( context );
+ }
+
+ public static void log( final String message, final Throwable thr ) {
+ String id = getPluginId();
+ Status status = new Status( IStatus.ERROR, id, IStatus.OK, message, thr );
+ getDefault().getLog().log( status );
+ }
+}
@@ -11,6 +11,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import net.sf.eclipsefp.haskell.core.HaskellCorePlugin;
import net.sf.eclipsefp.haskell.core.util.ResourceUtil;
import net.sf.eclipsefp.haskell.debug.core.internal.HaskellDebugCore;
import net.sf.eclipsefp.haskell.debug.core.internal.util.CoreTexts;
@@ -116,20 +117,27 @@ public void launch( final ILaunchConfiguration configuration,
@Override
protected IStatus run( final IProgressMonitor mon ) {
- while( !theProcess.isTerminated() ) {
- try {
- if( mon.isCanceled()) {
- theProcess.terminate();
- return Status.CANCEL_STATUS;
+ try {
+ while( !theProcess.isTerminated() ) {
+ try {
+ if( mon.isCanceled()) {
+ theProcess.terminate();
+ return Status.CANCEL_STATUS;
+ }
+ Thread.sleep( 50 );
+ } catch( InterruptedException iex ) {
+ // ignored
+ } catch ( DebugException ex ) {
+ // ignored
}
- Thread.sleep( 50 );
- } catch( InterruptedException iex ) {
- // ignored
- } catch ( DebugException ex ) {
- // ignored
+ }
+ } finally {
+ try {
+ postProcessFinished(configuration);
+ } catch(CoreException ce){
+ HaskellCorePlugin.log( ce );
}
}
- postProcessFinished(configuration);
return Status.OK_STATUS;
}
};
@@ -161,7 +169,7 @@ protected abstract void preProcessCreation(final ILaunchConfiguration configurat
final String mode,final ILaunch launch,Map<String, String> processAttribs) throws CoreException;
protected abstract void preProcessDefinitionCreation(final ILaunchConfiguration configuration,
final String mode,final ILaunch launch) throws CoreException;
- protected abstract void postProcessFinished(final ILaunchConfiguration configuration);
+ protected abstract void postProcessFinished(final ILaunchConfiguration configuration) throws CoreException;
private IProcess createProcess( final ILaunchConfiguration configuration,
final String mode, final ILaunch launch, final IPath location,
@@ -177,12 +185,13 @@ private IProcess createProcess( final ILaunchConfiguration configuration,
}
try {
preProcessDefinitionCreation( configuration, mode, launch );
- Process proc = pb.start();
+
Map<String, String> processAttrs = new HashMap<String, String>();
String programName = determineProgramName( location );
processAttrs.put( IProcess.ATTR_PROCESS_TYPE, programName );
preProcessCreation( configuration, mode, launch, processAttrs );
IProcess process = null;
+ Process proc = pb.start();
if( proc != null ) {
//String loc = location.toOSString();
process = DebugPlugin.newProcess( launch, proc, configuration.getName(), processAttrs );
@@ -30,19 +30,21 @@
*/
public class HaskellLaunchDelegate extends AbstractHaskellLaunchDelegate {
+
// static final String DEBUG_PROCESS_TYPE = "net.sf.eclipsefp.haskell.debug.ui.internal.launch.ghci.GhciProcessType"; //$NON-NLS-1$
@Override
protected void preProcessCreation( final ILaunchConfiguration configuration,
final String mode, final ILaunch launch, final Map<String, String> processAttribs ) {
- /*if (mode.equals( ILaunchManager.DEBUG_MODE )){
- processAttribs.put( IProcess.ATTR_PROCESS_TYPE, DEBUG_PROCESS_TYPE );
- }*/
+ // NOOP
}
@Override
protected void postProcessCreation( final ILaunchConfiguration configuration,
final String mode, final ILaunch launch, final IProcess process ) throws CoreException{
+
+ process.setAttribute( HaskellDebugCore.PROCESS_COMMAND_HISTORY, Boolean.TRUE.toString() );
+
if (mode.equals( ILaunchManager.DEBUG_MODE )){
HaskellDebugTarget hdt=new HaskellDebugTarget( launch, process );
launch.addDebugTarget(hdt);
@@ -32,4 +32,5 @@
* @return the reload command, or null
*/
String getReloadCommand();
+
}
@@ -0,0 +1,57 @@
+/**
+ * Copyright (c) 2012 by JP Moresmau
+ * This code is made available under the terms of the Eclipse Public License,
+ * version 1.0 (EPL). See http://www.eclipse.org/legal/epl-v10.html
+ */
+package net.sf.eclipsefp.haskell.debug.core.internal.launch;
+
+import java.util.Map;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.IProcessFactory;
+import org.eclipse.debug.core.model.IProcess;
+import org.eclipse.debug.core.model.IStreamsProxy;
+import org.eclipse.debug.core.model.RuntimeProcess;
+
+
+/**
+ * @author JP Moresmau
+ *
+ */
+public class REPLProcessFactory implements IProcessFactory {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.core.IProcessFactory#newProcess(org.eclipse.debug.core.ILaunch, java.lang.Process, java.lang.String, java.util.Map)
+ */
+ @Override
+ public IProcess newProcess( final ILaunch launch, final Process process,
+ final String name, final Map attributes ) {
+ return new REPLProcess( launch, process, name, attributes );
+ }
+
+
+ public class REPLProcess extends RuntimeProcess {
+
+
+
+ public REPLProcess( final ILaunch launch, final Process process, final String name,
+ final Map attributes ) {
+ super( launch, process, name, attributes );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.core.model.RuntimeProcess#getSystemProcess()
+ */
+ @Override
+ public Process getSystemProcess() {
+ return super.getSystemProcess();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.core.model.RuntimeProcess#createStreamsProxy()
+ */
+ @Override
+ protected IStreamsProxy createStreamsProxy() {
+ return null;
+ }
+ }
+}
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %bundleName
Bundle-SymbolicName: net.sf.eclipsefp.haskell.debug.ui;singleton:=true
-Bundle-Version: 2.3.0
+Bundle-Version: 2.3.1
Bundle-Activator: net.sf.eclipsefp.haskell.debug.ui.internal.HaskellDebugUI
Bundle-Vendor: %bundleVendor
Require-Bundle: net.sf.eclipsefp.haskell.ghccompiler,
@@ -18,7 +18,7 @@ Require-Bundle: net.sf.eclipsefp.haskell.ghccompiler,
org.eclipse.ui.editors;bundle-version="3.5.0",
net.sf.eclipsefp.haskell.util,
net.sf.eclipsefp.haskell.compat,
- org.eclipse.ui.console;bundle-version="3.2.0",
+ org.eclipse.ui.console,
org.eclipse.ui.navigator
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Localization: plugin
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -41,4 +41,4 @@ runHaskellProfilingShortcut_desc = Executes the built executable from this proje
toggle_breakpoint=Toggle Breakpoint
-haskellInteractiveLaunchType_name = Haskell interactive session
+haskellInteractiveLaunchType_name = Haskell interactive session
Oops, something went wrong.

0 comments on commit fc7051f

Please sign in to comment.