-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ghci launch: use cabal flags and packages, automation tab
- Loading branch information
1 parent
6ae57fb
commit 8eb569f
Showing
23 changed files
with
1,440 additions
and
990 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
...java/src/net/sf/eclipsefp/haskell/debug/core/internal/launch/CommandOnChangeListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package net.sf.eclipsefp.haskell.debug.core.internal.launch; | ||
|
||
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; | ||
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; | ||
} | ||
|
||
public void resourceChanged( final IResourceChangeEvent event ) { | ||
try { | ||
event.getDelta().accept( new IResourceDeltaVisitor() { | ||
|
||
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 | ||
&& ResourceUtil.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 ); | ||
} | ||
} | ||
} |
Oops, something went wrong.