Java Code Examples for org.eclipse.ui.texteditor.MarkerUtilities#getMessage()
The following examples show how to use
org.eclipse.ui.texteditor.MarkerUtilities#getMessage() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XBookmarksDialogHandler.java From xds-ide with Eclipse Public License 1.0 | 6 votes |
protected XBookmarksDialog.Model.Row getDescription (IMarker marker) { if (marker!= null && marker.exists()) { int markerNumber = marker.getAttribute(XBookmarksPlugin.BOOKMARK_NUMBER_ATTR, -1); if (markerNumber >=0 && markerNumber <= 9) { int line = MarkerUtilities.getLineNumber(marker); String resName = marker.getResource().getName(); String markerName = MarkerUtilities.getMessage(marker); String prefix = mkBookmarkNamePrefix(markerNumber); if (markerName.startsWith(prefix)) { markerName = markerName.substring(prefix.length()); if (markerName.startsWith(": ")) { //$NON-NLS-1$ markerName = markerName.substring(2); } markerName = markerName.trim(); if (markerName.isEmpty()) { markerName = prefix; } } return new XBookmarksDialog.Model.Row(new String[]{ "" + markerNumber + "." //$NON-NLS-1$ //$NON-NLS-2$ , resName + ":" + line //$NON-NLS-1$ , markerName}).setData(markerNumber); } } return null; }
Example 2
Source File: RebuildAffectedResourcesTest.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
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) { if (((MarkerUtilities.getSeverity(iMarker) == IMarker.SEVERITY_ERROR) && MarkerUtilities.getMessage(iMarker).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); } }
Example 3
Source File: ActiveAnnotationsInSameProjectTest.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
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); } }
Example 4
Source File: MarkerIdentity.java From dsl-devkit with Eclipse Public License 1.0 | 6 votes |
/** * Instantiates a new MarkerIdentity. * * @param annotation * the Annotation * @return MarkerIdentity - this */ public MarkerIdentity create(final Annotation annotation) { MarkerIdentity result = provider.get(); if (annotation instanceof XtextAnnotation) { Issue issue = ((XtextAnnotation) annotation).getIssue(); result.start = issue.getOffset(); result.end = result.start == ATTRIBUTE_MISSING ? ATTRIBUTE_MISSING : result.start + issue.getLength(); result.message = issue.getMessage(); } else if (annotation instanceof org.eclipse.ui.texteditor.MarkerAnnotation) { result.start = MarkerUtilities.getCharStart(((org.eclipse.ui.texteditor.MarkerAnnotation) annotation).getMarker()); result.end = MarkerUtilities.getCharEnd(((org.eclipse.ui.texteditor.MarkerAnnotation) annotation).getMarker()); result.message = MarkerUtilities.getMessage(((org.eclipse.ui.texteditor.MarkerAnnotation) annotation).getMarker()); } else { result.end = ATTRIBUTE_MISSING; result.start = ATTRIBUTE_MISSING; result.message = null; // NOPMD } result.problemCode = issueUtil.getCode(annotation); result.problemURI = issueUtil.getUriToProblem(annotation); result.resourceURI = result.problemURI == null ? null : result.problemURI.trimFragment(); return result; }
Example 5
Source File: IResourcesSetupUtil.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
public static void assertNoErrorsInWorkspace() throws CoreException { IMarker[] findMarkers = ResourcesPlugin.getWorkspace().getRoot().findMarkers(IMarker.PROBLEM, true, IResource.DEPTH_INFINITE); String msg = ""; for (IMarker iMarker : findMarkers) { if (MarkerUtilities.getSeverity(iMarker) == IMarker.SEVERITY_ERROR) msg += "\n - "+iMarker.getResource().getName()+":"+MarkerUtilities.getLineNumber(iMarker)+" - "+MarkerUtilities.getMessage(iMarker) + "("+MarkerUtilities.getMarkerType(iMarker)+")"; } if (msg.length()>0) Assert.fail("Workspace contained errors: "+msg); }
Example 6
Source File: IResourcesSetupUtil.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
public static void assertNoErrorsInWorkspace() throws CoreException { IMarker[] findMarkers = root().findMarkers(IMarker.PROBLEM, true, IResource.DEPTH_INFINITE); String msg = ""; for (IMarker iMarker : findMarkers) { if (MarkerUtilities.getSeverity(iMarker) == IMarker.SEVERITY_ERROR) msg += "\n - "+iMarker.getResource().getName()+":"+MarkerUtilities.getLineNumber(iMarker)+" - "+MarkerUtilities.getMessage(iMarker) + "("+MarkerUtilities.getMarkerType(iMarker)+")"; } if (msg.length()>0) Assert.fail("Workspace contained errors: "+msg); }
Example 7
Source File: ResolvingCrossReferenceDuringIndexingTest.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
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); } }
Example 8
Source File: CircularDepsBetweenJavaAndXtendTest.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
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); } }
Example 9
Source File: Bug452821Test.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
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); } }
Example 10
Source File: Bug473833Test.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
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); } }
Example 11
Source File: RebuildAffectedResourcesTest.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
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); } }
Example 12
Source File: JavaVersionSettingTest.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
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); } }
Example 13
Source File: ActiveAnnotationsInSameProjectTest.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
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); } }
Example 14
Source File: PerformanceTest.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
protected static void assertNoErrorsInWorkspace() throws CoreException { final IMarker[] markers = PerformanceTestProjectSetup.testProject.getProject().findMarkers(IMarker.PROBLEM, true, IResource.DEPTH_INFINITE); for (final IMarker marker : markers) { String _message = MarkerUtilities.getMessage(marker); int _severity = MarkerUtilities.getSeverity(marker); boolean _equals = (_severity == IMarker.SEVERITY_ERROR); Assert.assertFalse(_message, _equals); } }
Example 15
Source File: MarkerIdentity.java From dsl-devkit with Eclipse Public License 1.0 | 5 votes |
/** * Instantiates a new MarkerIdentity. * * @param marker * the marker * @return MarkerIdentity - this */ public MarkerIdentity create(final IMarker marker) { MarkerIdentity result = provider.get(); result.start = MarkerUtilities.getCharStart(marker); result.end = MarkerUtilities.getCharEnd(marker); result.problemCode = issueUtil.getCode(marker); result.problemURI = issueUtil.getUriToProblem(marker); result.resourceURI = result.problemURI == null ? null : result.problemURI.trimFragment(); result.message = MarkerUtilities.getMessage(marker); return result; }
Example 16
Source File: InternalBuilderTest.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
@Test public void test() throws CoreException, FileNotFoundException { System.out.println("JDT Version:" + JavaCore.getPlugin().getBundle().getVersion()); System.out.println("JDT UI Version:" + JavaPlugin.getDefault().getBundle().getVersion()); reportMemoryState("Starting build."); try { dumpMemoryIndex("Initial Memory Index state"); dumpDiskIndex(); clearJdtIndex(); dumpMemoryIndex("Memory Index state after clear disk"); dumpDiskIndex(); JavaModelManager.getIndexManager().resetIndex(new Path("/org.eclipse.xtext")); dumpMemoryIndex("Memory Index state after reset project"); dumpDiskIndex(); System.out.println("Saving index."); JavaModelManager.getIndexManager().saveIndexes(); dumpMemoryIndex("Memory Index state after save"); dumpDiskIndex(); setAutoBuild(true); waitForAutoBuild(); } finally { setAutoBuild(false); System.out.println("Stopping background indexing."); JavaModelManager.getIndexManager().shutdown(); clearJdtIndex(); reportMemoryState("Finished build."); } final IMarker[] markers = ResourcesPlugin.getWorkspace().getRoot() .findMarkers(IMarker.PROBLEM, true, IResource.DEPTH_INFINITE); List<String> errors = new ArrayList<String>(); for (IMarker marker : markers) { String msg = MarkerUtilities.getMessage(marker); if (MarkerUtilities.getSeverity(marker) == IMarker.SEVERITY_ERROR) { errors.add(msg + " in " + marker.getResource().getFullPath() + " line: " + MarkerUtilities.getLineNumber(marker)); } } List<String> top10; if (errors.size() > 10) { top10 = toList(take(errors, 10)); } else { top10 = errors; } assertTrue("Problems found (" + top10.size() + " of " + errors.size() + "): " + join(errors, ", "), errors.isEmpty()); }