use of org.eclipse.core.resources.IMarker in project xtext-xtend by eclipse.
the class ActiveAnnotationsInSameProjectTest method assertHasErrors.
public void assertHasErrors(final IFile file, final String msgPart) {
try {
final IMarker[] findMarkers = file.findMarkers(IMarker.PROBLEM, true, IResource.DEPTH_INFINITE);
for (final IMarker iMarker : findMarkers) {
{
final String message = MarkerUtilities.getMessage(iMarker);
if (((MarkerUtilities.getSeverity(iMarker) == IMarker.SEVERITY_ERROR) && message.contains(msgPart))) {
return;
}
}
}
IPath _fullPath = file.getFullPath();
String _plus = ((("Expected an error marker containing \'" + msgPart) + "\' on ") + _fullPath);
String _plus_1 = (_plus + " but found ");
final Function1<IMarker, String> _function = (IMarker it) -> {
return MarkerUtilities.getMessage(it);
};
String _join = IterableExtensions.join(ListExtensions.<IMarker, String>map(((List<IMarker>) Conversions.doWrapArray(findMarkers)), _function), ",");
String _plus_2 = (_plus_1 + _join);
Assert.fail(_plus_2);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.core.resources.IMarker in project xtext-xtend by eclipse.
the class ActiveAnnotationsInSameProjectTest method assertNoErrorsInWorkspace.
public void assertNoErrorsInWorkspace() {
try {
final IMarker[] findMarkers = ResourcesPlugin.getWorkspace().getRoot().findMarkers(IMarker.PROBLEM, true, IResource.DEPTH_INFINITE);
for (final IMarker iMarker : findMarkers) {
String _message = MarkerUtilities.getMessage(iMarker);
int _severity = MarkerUtilities.getSeverity(iMarker);
boolean _equals = (_severity == IMarker.SEVERITY_ERROR);
Assert.assertFalse(_message, _equals);
}
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.core.resources.IMarker in project xtext-xtend by eclipse.
the class Bug452821Test method assertNoErrors.
private void assertNoErrors(final IFile file) {
try {
final IMarker[] findMarkers = file.findMarkers(IMarker.PROBLEM, true, IResource.DEPTH_INFINITE);
for (final IMarker iMarker : findMarkers) {
String _message = MarkerUtilities.getMessage(iMarker);
int _severity = MarkerUtilities.getSeverity(iMarker);
boolean _equals = (_severity == IMarker.SEVERITY_ERROR);
Assert.assertFalse(_message, _equals);
}
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.core.resources.IMarker in project xtext-xtend by eclipse.
the class CircularDepsBetweenJavaAndXtendTest method assertNoErrorsInWorkspace.
public void assertNoErrorsInWorkspace() {
try {
final IMarker[] findMarkers = ResourcesPlugin.getWorkspace().getRoot().findMarkers(IMarker.PROBLEM, true, IResource.DEPTH_INFINITE);
for (final IMarker iMarker : findMarkers) {
String _message = MarkerUtilities.getMessage(iMarker);
int _severity = MarkerUtilities.getSeverity(iMarker);
boolean _equals = (_severity == IMarker.SEVERITY_ERROR);
Assert.assertFalse(_message, _equals);
}
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.core.resources.IMarker in project eclipse.platform.text by eclipse.
the class AbstractDecoratedTextEditor method revealInEditor.
/**
* Selects and reveals the given offset and length in the given editor part.
*
* @param editor the editor part
* @param offset the offset
* @param length the length
* @since 3.7
*/
private static void revealInEditor(IEditorPart editor, final int offset, final int length) {
if (editor instanceof ITextEditor) {
((ITextEditor) editor).selectAndReveal(offset, length);
return;
}
// Support for non-text editor - try IGotoMarker interface
final IGotoMarker gotoMarkerTarget;
if (editor instanceof IGotoMarker)
gotoMarkerTarget = (IGotoMarker) editor;
else
gotoMarkerTarget = editor != null ? editor.getAdapter(IGotoMarker.class) : null;
if (gotoMarkerTarget != null) {
final IEditorInput input = editor.getEditorInput();
if (input instanceof IFileEditorInput) {
WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
@Override
protected void execute(IProgressMonitor monitor) throws CoreException {
IMarker marker = null;
try {
marker = ((IFileEditorInput) input).getFile().createMarker(IMarker.TEXT);
marker.setAttribute(IMarker.CHAR_START, offset);
marker.setAttribute(IMarker.CHAR_END, offset + length);
gotoMarkerTarget.gotoMarker(marker);
} finally {
if (marker != null)
marker.delete();
}
}
};
try {
op.run(null);
} catch (InvocationTargetException ex) {
// reveal failed
} catch (InterruptedException e) {
// $NON-NLS-1$
Assert.isTrue(false, "this operation can not be canceled");
}
}
return;
}
}
Aggregations