Я знаю, что это старый вопрос, но я нашел решение, подобное предложенному.Код, который делает то, что вы описываете, находится в org.eclipse.debug.core.model.LaunchConfigurationDelegate
.Он проверяет, есть ли в проекте ошибки, и показывает диалог, если это необходимо.Вот соответствующий код из Eclipse Luna:
/**
* Returns whether the given project contains any problem markers of the
* specified severity.
*
* @param proj the project to search
* @return whether the given project contains any problems that should
* stop it from launching
* @throws CoreException if an error occurs while searching for
* problem markers
*/
protected boolean existsProblems(IProject proj) throws CoreException {
IMarker[] markers = proj.findMarkers(IMarker.PROBLEM, true, IResource.DEPTH_INFINITE);
if (markers.length > 0) {
for (int i = 0; i < markers.length; i++) {
if (isLaunchProblem(markers[i])) {
return true;
}
}
}
return false;
}
/**
* Returns whether the given problem should potentially abort the launch.
* By default if the problem has an error severity, the problem is considered
* a potential launch problem. Subclasses may override to specialize error
* detection.
*
* @param problemMarker candidate problem
* @return whether the given problem should potentially abort the launch
* @throws CoreException if any exceptions occur while accessing marker attributes
*/
protected boolean isLaunchProblem(IMarker problemMarker) throws CoreException {
Integer severity = (Integer)problemMarker.getAttribute(IMarker.SEVERITY);
if (severity != null) {
return severity.intValue() >= IMarker.SEVERITY_ERROR;
}
return false;
}
Этот же код может работать на любом IResource
вместо IProject
.
Мне удалось легко найти его, приостановивиз отладчика, когда диалоговое окно было показано, и установка точки останова для соответствующего класса и отслеживание оттуда.