I just realized that PyDev has rather powerful scripting support. Unfortunately I don't have the time to do it all for you (but if you complete this, please post it here :)
If you create a file named pyedit_nose.py
that looks like this in an otherwise empty folder :
assert cmd is not None
assert editor is not None
if cmd == 'onSave':
from java.lang import Runtime
from java.io import BufferedReader
from java.io import InputStreamReader
from org.eclipse.core.resources import ResourcesPlugin
from org.eclipse.core.resources import IMarker
from org.eclipse.core.resources import IResource
proc = Runtime.getRuntime().exec('ls -al')
extra_message = BufferedReader(InputStreamReader(proc.inputStream)).readLine()
r = ResourcesPlugin.getWorkspace().getRoot()
for marker in r.findMarkers(IMarker.PROBLEM, False, IResource.DEPTH_INFINITE):
if marker.getAttribute(IMarker.MESSAGE).startsWith("Some test failed!"):
marker.delete()
for rr in r.getProjects():
marker = rr.createMarker(IMarker.PROBLEM)
marker.setAttribute(IMarker.MESSAGE, "Some test failed! " + extra_message)
marker.setAttribute(IMarker.PRIORITY, IMarker.PRIORITY_HIGH)
marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR)
and set up Preferences->PyDev->Scripting Pydev to point to this directory you will get all projects in your workspace marked with an error every time a file is saved.
By executing a script that returns the test results in some easy to parse format rather than ls
and parsing the output you should be able to put your markers in the right places.
See this for some starting points:
- Jython Scripting in Pydev
- IMarker is what represents a marker.
- IResource is what you attach your markers to. Can be workspaces, projects, files, directories etc.
resource.createMarker(IMarker.PROBLEM)
creates a problem marker.
- IProject is a type of
IResource
that represents a project. Use the members()
method to get the contents.