Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Avoid reloading changes files multiple times in GHCi

  • Loading branch information...
commit 1556a564b94cc69c306cf0304d3d24edd3e63057 1 parent 7333a41
JP Moresmau authored
2  docs/releasenotes/net.sf.eclipsefp.haskell_2.5.0.txt
View
@@ -16,7 +16,7 @@ Fixes:
- Syntax highlighting more stable on big files
- Haskell test results does not reclaim focus on each refresh, less flicker on update
- Quick fix on multiple GHC suggestions
-
+ - Avoid reloading changes files multiple times in GHCi (https://sourceforge.net/p/eclipsefp/discussion/371922/thread/6125472d/?limit=50)
Features:
- Cabal Packages view shows a green tick on installed packages and versions when you display the list of all hackage packages.
128 ....haskell.debug.core/src/net/sf/eclipsefp/haskell/debug/core/internal/launch/CommandOnChangeListener.java
View
@@ -1,64 +1,64 @@
-package net.sf.eclipsefp.haskell.debug.core.internal.launch;
-
-import net.sf.eclipsefp.haskell.debug.core.internal.HaskellDebugCore;
-import net.sf.eclipsefp.haskell.debug.core.internal.util.CoreTexts;
-import net.sf.eclipsefp.haskell.util.FileUtil;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.IResourceDeltaVisitor;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.model.IProcess;
-
-/**
- *
- * @author JP Moresmau
- *
- */
-public class CommandOnChangeListener implements IResourceChangeListener {
- private final IProcess p;
- private final String[] commands;
- private final String projectName;
-
- public CommandOnChangeListener( final IProcess p, final String projectName, final String... command ) {
- super();
- this.p = p;
- this.commands = command;
- this.projectName=projectName;
- }
-
- @Override
- public void resourceChanged( final IResourceChangeEvent event ) {
- try {
- event.getDelta().accept( new IResourceDeltaVisitor() {
-
- @Override
- public boolean visit( final IResourceDelta delta )
- throws CoreException {
- if (delta.getResource().getProject()==null || delta.getResource().getProject().getName().equals(projectName)){
- if( delta.getKind() == IResourceDelta.REMOVED || (delta.getKind() == IResourceDelta.CHANGED && (delta.getFlags() & IResourceDelta.CONTENT)>0)) {
- if( delta.getResource() instanceof IFile
- && FileUtil.hasHaskellExtension( delta.getResource() ) ) {
- runCommand();
- return false;
- }
- }
- return true;
- }
- return false;
-
- }
-
- });
- } catch( CoreException ex ) {
- HaskellDebugCore.log(CoreTexts.commandonchange_failed, ex );
- }
- }
-
- protected void runCommand() throws CoreException {
- for (String s:commands){
- HaskellLaunchDelegate.commandToProcess( p, s );
- }
- }
-}
+package net.sf.eclipsefp.haskell.debug.core.internal.launch;
+
+import net.sf.eclipsefp.haskell.debug.core.internal.HaskellDebugCore;
+import net.sf.eclipsefp.haskell.debug.core.internal.util.CoreTexts;
+import net.sf.eclipsefp.haskell.util.FileUtil;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IResourceDeltaVisitor;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.model.IProcess;
+
+/**
+ *
+ * @author JP Moresmau
+ *
+ */
+public class CommandOnChangeListener implements IResourceChangeListener {
+ private final IProcess p;
+ private final String[] commands;
+ private final String projectName;
+
+ public CommandOnChangeListener( final IProcess p, final String projectName, final String... command ) {
+ super();
+ this.p = p;
+ this.commands = command;
+ this.projectName=projectName;
+ }
+
+ @Override
+ public void resourceChanged( final IResourceChangeEvent event ) {
+ try {
+ event.getDelta().accept( new IResourceDeltaVisitor() {
+
+ @Override
+ public boolean visit( final IResourceDelta delta )
+ throws CoreException {
+ if (delta.getResource().getProject()==null || delta.getResource().getProject().getName().equals(projectName)){
+ if( delta.getKind() == IResourceDelta.REMOVED || (delta.getKind() == IResourceDelta.CHANGED && (delta.getFlags() & IResourceDelta.CONTENT)>0 && (delta.getFlags() & IResourceDelta.MARKERS)>0)) {
+ if( delta.getResource() instanceof IFile
+ && FileUtil.hasHaskellExtension( delta.getResource() ) ) {
+ runCommand();
+ return false;
+ }
+ }
+ return true;
+ }
+ return false;
+
+ }
+
+ });
+ } catch( CoreException ex ) {
+ HaskellDebugCore.log(CoreTexts.commandonchange_failed, ex );
+ }
+ }
+
+ protected void runCommand() throws CoreException {
+ for (String s:commands){
+ HaskellLaunchDelegate.commandToProcess( p, s );
+ }
+ }
+}
2  ...fp.haskell.debug.core/src/net/sf/eclipsefp/haskell/debug/core/internal/launch/HaskellLaunchDelegate.java
View
@@ -104,7 +104,7 @@ private void registerReloadListener(final ILaunchConfiguration configuration,fin
commandOnReload?command:null);
ResourcesPlugin.getWorkspace().addResourceChangeListener(
- cocl, IResourceChangeEvent.PRE_BUILD );
+ cocl, IResourceChangeEvent.POST_CHANGE );
ILaunchesListener2 ll=new ILaunchesListener2() {
Please sign in to comment.
Something went wrong with that request. Please try again.