类org.eclipse.ui.texteditor.MarkerUtilities源码实例Demo

下面列出了怎么用org.eclipse.ui.texteditor.MarkerUtilities的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: eclipse-cs   文件: GraphStatsView.java

/**
 * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object,
 *      int)
 */
@Override
public Image getColumnImage(Object obj, int index) {
  Image image = null;
  IMarker marker = (IMarker) obj;

  if (index == 0) {
    int severity = MarkerUtilities.getSeverity(marker);
    ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();

    if (IMarker.SEVERITY_ERROR == severity) {
      image = sharedImages.getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
    } else if (IMarker.SEVERITY_WARNING == severity) {
      image = sharedImages.getImage(ISharedImages.IMG_OBJS_WARN_TSK);
    } else if (IMarker.SEVERITY_INFO == severity) {
      image = sharedImages.getImage(ISharedImages.IMG_OBJS_INFO_TSK);
    }
  }
  return image;
}
 
源代码2 项目: eclipse-cs   文件: MarkerStatsView.java

@Override
public Image getColumnImage(Object obj, int index) {
  Image image = null;
  IMarker marker = (IMarker) obj;

  if (index == 0) {
    int severity = MarkerUtilities.getSeverity(marker);
    ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();

    if (IMarker.SEVERITY_ERROR == severity) {
      image = sharedImages.getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
    } else if (IMarker.SEVERITY_WARNING == severity) {
      image = sharedImages.getImage(ISharedImages.IMG_OBJS_WARN_TSK);
    } else if (IMarker.SEVERITY_INFO == severity) {
      image = sharedImages.getImage(ISharedImages.IMG_OBJS_INFO_TSK);
    }
  }
  return image;
}
 
源代码3 项目: n4js   文件: ProjectTestsUtils.java

/***/
@SafeVarargs
public static IMarker[] assertMarkers(String assertMessage, final IResource resource, String markerType, int count,
		final Predicate<IMarker>... markerPredicates) throws CoreException {

	IMarker[] markers = resource.findMarkers(markerType, true, IResource.DEPTH_INFINITE);
	List<IMarker> markerList = from(Arrays.asList(markers))
			.filter(m -> allPredicatesApply(markerPredicates, m))
			.toList();

	if (markerList.size() != count) {
		StringBuilder message = new StringBuilder(assertMessage);
		message.append("\nbut was:");
		for (IMarker marker : markerList) {
			message.append("\n");
			message.append("line " + MarkerUtilities.getLineNumber(marker) + ": ");
			message.append(marker.getAttribute(IMarker.MESSAGE, "<no message>"));
		}
		Assert.assertEquals(message.toString(), count, markerList.size());
	}
	return markers;
}
 
源代码4 项目: n4js   文件: ProjectTestsUtils.java

/**
 * Asserts that the given resource (usually an N4JS file) contains issues with the given messages and no other
 * issues. Each message given should be prefixed with the line numer where the issues occurs, e.g.:
 *
 * <pre>
 * line 5: Couldn't resolve reference to identifiable element 'unknown'.
 * </pre>
 *
 * Column information is not provided, so this method is not intended for several issues within a single line.
 *
 * @param msg
 *            human-readable, informative message prepended to the standard message in case of assertion failure.
 * @param resource
 *            resource to be validated.
 * @param expectedMessages
 *            expected issues messages to check or empty array to assert no issues.
 * @throws CoreException
 *             in case of mishap.
 */
public static void assertIssues(String msg, final IResource resource, String... expectedMessages)
		throws CoreException {
	waitForAutoBuild();

	final IMarker[] markers = resource.findMarkers(MarkerTypes.ANY_VALIDATION, true, IResource.DEPTH_INFINITE);
	final String[] actualMessages = new String[markers.length];
	for (int i = 0; i < markers.length; i++) {
		final IMarker m = markers[i];
		actualMessages[i] = "line " + MarkerUtilities.getLineNumber(m) + ": " + m.getAttribute(IMarker.MESSAGE);
	}
	Set<String> actual = new TreeSet<>(Arrays.asList(actualMessages));
	Set<String> expected = new TreeSet<>(Arrays.asList(expectedMessages));

	if (!actual.equals(expected)) {
		StringBuilder message = new StringBuilder(msg != null ? msg : "");
		message.append("\nexpected:\n");
		message.append(expectedMessages.length > 0 ? Joiner.on('\n').join(expectedMessages) : "<none>");
		message.append("\nactual:\n");
		message.append(actualMessages.length > 0 ? Joiner.on('\n').join(actualMessages) : "<none>");
		Assert.fail(message.toString());
	}
}
 

/**
 * Asserts that the given {@code resource} has at least one marker with the given {@code issueCode}.
 */
private static void assertHasMarker(IResource resource, String issueCode) throws CoreException {
	final IMarker[] markers = resource.findMarkers(null, true, IResource.DEPTH_INFINITE);
	final StringBuilder allMarkersDescription = new StringBuilder();
	for (IMarker marker : markers) {
		final String markerIssueCode = marker.getAttribute(Issue.CODE_KEY, "");
		if (issueCode.equals(markerIssueCode)) {
			// assertion fulfilled
			return;
		}
		allMarkersDescription.append("\n");
		allMarkersDescription.append("line " + MarkerUtilities.getLineNumber(marker) + ": ");
		allMarkersDescription.append(marker.getAttribute(IMarker.MESSAGE, "<no message>"));
	}
	Assert.fail("Expected resource " + resource.getFullPath() + " to have at least one marker with issue code " +
			issueCode + " but was " + allMarkersDescription.toString());
}
 
源代码6 项目: JAADAS   文件: SootAttributesJavaHover.java

protected void addSootAttributeMarkers() {
	
	if (getAttrsHandler() == null)return;
	if (getAttrsHandler().getAttrList() == null) return;
	Iterator it = getAttrsHandler().getAttrList().iterator();
	HashMap markerAttr = new HashMap();
	
	while (it.hasNext()) {
		SootAttribute sa = (SootAttribute)it.next();
		if (((sa.getAllTextAttrs("<br>") == null) || (sa.getAllTextAttrs("<br>").length() == 0)) && 
			((sa.getAllLinkAttrs() == null) || (sa.getAllLinkAttrs().size() ==0))) continue;
		
		markerAttr.put(IMarker.LINE_NUMBER, new Integer(sa.getJavaStartLn()));
	
		try {
			MarkerUtilities.createMarker(getRec(), markerAttr, "ca.mcgill.sable.soot.sootattributemarker");
		}
		catch(CoreException e) {
			System.out.println(e.getMessage());
		}
	
	}

}
 

public void addSootAttributeMarkers(){//SootAttributesHandler handler, IFile rec) {
	
	if (getHandler().getAttrList() == null) return;
	Iterator it = getHandler().getAttrList().iterator();
	HashMap markerAttr = new HashMap();

	while (it.hasNext()) {
		SootAttribute sa = (SootAttribute)it.next();
		if (getHandler().isShowAllTypes() || typesContainsOneOf(sa.getAnalysisTypes())){
			if (((sa.getAllTextAttrs("") == null) || (sa.getAllTextAttrs("").length() == 0)) && 
				((sa.getAllLinkAttrs() == null) || (sa.getAllLinkAttrs().size() ==0))) continue;
			markerAttr.put(IMarker.LINE_NUMBER, new Integer(sa.getJimpleStartLn()));

			try {
				MarkerUtilities.createMarker(getRec(), markerAttr, "ca.mcgill.sable.soot.sootattributemarker");
			}
			catch(CoreException e) {
				System.out.println(e.getMessage());
			}
		}
	}
}
 

public void addSootAttributeMarkers(){//SootAttributesHandler handler, IFile rec) {
	
	if (getHandler().getAttrList() == null) return;
	Iterator it = getHandler().getAttrList().iterator();
	HashMap markerAttr = new HashMap();

	while (it.hasNext()) {
		SootAttribute sa = (SootAttribute)it.next();
		if (getHandler().isShowAllTypes() || typesContainsOneOf(sa.getAnalysisTypes())) {
			if (((sa.getAllTextAttrs("<br>") == null) || (sa.getAllTextAttrs("<br>").length() == 0)) && 
				((sa.getAllLinkAttrs() == null) || (sa.getAllLinkAttrs().size() ==0))) continue;
			markerAttr.put(IMarker.LINE_NUMBER, new Integer(sa.getJavaStartLn()));
			try {
				MarkerUtilities.createMarker(getRec(), markerAttr, "ca.mcgill.sable.soot.sootattributemarker");
			}
			catch(CoreException e) {
				System.out.println(e.getMessage());
			}
		}
	}
}
 
源代码9 项目: texlipse   文件: MarkerHandler.java

/**
 * Creates warning markers for undefined references. 
 * 
 * @param editor The editor to add the errors to
 * @param errors The errors to add as instances of <code>DocumentReference</code>
 */
public void createReferencingErrorMarkers(ITextEditor editor, List<DocumentReference> errors) {
    
    IResource resource = (IResource) editor.getEditorInput().getAdapter(IResource.class);
    if (resource == null) return;
    IDocument document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
    
    for (DocumentReference msg : errors) {
        try {
            int beginOffset = document.getLineOffset(msg.getLine() - 1) + msg.getPos();
            
            Map<String, ? super Object> map = new HashMap<String, Object>();
            map.put(IMarker.LINE_NUMBER, Integer.valueOf(msg.getLine()));
            map.put(IMarker.CHAR_START, Integer.valueOf(beginOffset));
            map.put(IMarker.CHAR_END, Integer.valueOf(beginOffset + msg.getLength()));
            map.put(IMarker.MESSAGE, "Key " + msg.getKey() + " is undefined");
            map.put(IMarker.SEVERITY, Integer.valueOf(IMarker.SEVERITY_WARNING));
            
            MarkerUtilities.createMarker(resource, map, IMarker.PROBLEM);
        } catch (CoreException ce) {
            TexlipsePlugin.log("Creating marker", ce);
        } catch (BadLocationException ble) {
            TexlipsePlugin.log("Creating marker", ble);
        }
    }
}
 
源代码10 项目: texlipse   文件: AbstractProgramRunner.java

/**
    * Create a layout warning marker to the given resource.
    *
    * @param resource the file where the problem occurred
    * @param message error message
    * @param lineNumber line number
    * @param markerType
    * @param severity Severity of the error
    */
   @SuppressWarnings("unchecked")
protected static void createMarker(IResource resource, 
   		Integer lineNumber, String message, String markerType, int severity) {
   	int lineNr = -1;
   	if (lineNumber != null) {
   		lineNr = lineNumber;
   	}
   	IMarker marker = AbstractProgramRunner.findMarker(resource, lineNr, message, markerType);
   	if (marker == null) {
   		try {
   			HashMap map = new HashMap();
   			map.put(IMarker.MESSAGE, message);
   			map.put(IMarker.SEVERITY, new Integer (severity));

   			if (lineNumber != null)
   				map.put(IMarker.LINE_NUMBER, lineNumber);

   			MarkerUtilities.createMarker(resource, map, markerType);
   		} catch (CoreException e) {
   			throw new RuntimeException(e);
   		}
   	}
   }
 
源代码11 项目: xds-ide   文件: XBookmarksDialogHandler.java

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;
}
 

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);
  }
}
 

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);
  }
}
 
源代码14 项目: dsl-devkit   文件: MarkerIdentity.java

/**
 * 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;
}
 
源代码15 项目: eclipse-cs   文件: MarkerStat.java

/**
 * Reference the marker as one fo this category.
 * 
 * @param marker
 *          : the marker to add to this category
 */
public void addMarker(IMarker marker) {
  mMarkers.add(marker);

  int severity = MarkerUtilities.getSeverity(marker);
  if (severity > mMaxSeverity) {
    mMaxSeverity = severity;
  }
}
 
源代码16 项目: xtext-eclipse   文件: ProblemHoverTest.java

private void createCustomMarkerOnResource(IResource resource, int severenity) throws CoreException{
	HashMap<String, Object> attributes = new HashMap<String, Object>();
	attributes.put(IMarker.MESSAGE, CUSTOM_MARKER_TEST_MESSAGE);
	attributes.put(IMarker.LINE_NUMBER, 1);
	attributes.put(IMarker.LOCATION, resource.getFullPath().toPortableString());
	attributes.put(IMarker.SEVERITY, severenity); 
	MarkerUtilities.createMarker(resource, attributes, CUSTOM_MARKER_ID);
}
 
源代码17 项目: xtext-eclipse   文件: IssueUtil.java

/**
 * @deprecated As we are using IMarker.getAttributes() in {@link #createIssue(IMarker)}, we do not call this method any more
 * @since 2.3
 */
@Deprecated
protected CheckType getCheckType(IMarker marker) {
	String markerType = MarkerUtilities.getMarkerType(marker);
	if (markerTypeProvider != null)
		return markerTypeProvider.getCheckType(markerType);
	return MarkerTypes.toCheckType(markerType);
}
 
源代码18 项目: xtext-eclipse   文件: IResourcesSetupUtil.java

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);
}
 

private void copyProblemMarker(IFile javaFile, IEclipseTrace traceToSource, Set<IMarker> problemsInJava, IFile srcFile)
		throws CoreException {
	String sourceMarkerType = null;
	for (IMarker marker : problemsInJava) {
		String message = (String) marker.getAttribute(IMarker.MESSAGE);
		if (message == null) {
			continue;
		}
		Integer charStart = marker.getAttribute(IMarker.CHAR_START, 0);
		Integer charEnd = marker.getAttribute(IMarker.CHAR_END, 0);
		int severity = MarkerUtilities.getSeverity(marker);

		ILocationInEclipseResource associatedLocation = traceToSource.getBestAssociatedLocation(new TextRegion(charStart,
				charEnd - charStart));
		if (associatedLocation != null) {
			if (sourceMarkerType == null) {
				sourceMarkerType = determinateMarkerTypeByURI(associatedLocation.getSrcRelativeResourceURI());
			}
			if (!srcFile.equals(findIFile(associatedLocation, srcFile.getWorkspace()))) {
				LOG.error("File in associated location is not the same as main source file.");
			}
			IMarker xtendMarker = srcFile.createMarker(sourceMarkerType);
			xtendMarker.setAttribute(IMarker.MESSAGE, "Java problem: " + message);
			xtendMarker.setAttribute(IMarker.SEVERITY, severity);
			ITextRegionWithLineInformation region = associatedLocation.getTextRegion();
			xtendMarker.setAttribute(IMarker.LINE_NUMBER, region.getLineNumber());
			xtendMarker.setAttribute(IMarker.CHAR_START, region.getOffset());
			xtendMarker.setAttribute(IMarker.CHAR_END, region.getOffset() + region.getLength());
			xtendMarker.setAttribute(COPIED_FROM_FILE, javaFile.getFullPath().toString());
		}
	}

}
 

private Set<IMarker> findJavaProblemMarker(IFile javaFile, int maxSeverity) throws CoreException {
	Set<IMarker> problems = newHashSet();
	for (IMarker marker : javaFile.findMarkers(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER, true,
			IResource.DEPTH_ZERO)) {
		if (MarkerUtilities.getSeverity(marker) >= maxSeverity) {
			problems.add(marker);
		}
	}
	return problems;
}
 

/**
 * @return <code>true</code> if srcFile contains none-derived problem marker >= <code>maxSeverity</code>
 */
private boolean hasPlainXtextProblemMarker(IFile srcFile, int maxSeverity) throws CoreException {
	for (IMarker iMarker : srcFile.findMarkers(MarkerTypes.ANY_VALIDATION, true, IResource.DEPTH_ZERO)) {
		if (MarkerUtilities.getSeverity(iMarker) >= maxSeverity && iMarker.getAttribute(COPIED_FROM_FILE) == null) {
			return true;
		}
	}
	return false;
}
 
源代码22 项目: xtext-eclipse   文件: IResourcesSetupUtil.java

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);
}
 
源代码23 项目: texlipse   文件: MarkerHandler.java

/**
 * Creates markers from a given list of <code>ParseErrorMessage</code>s.
 * 
 * @param editor The editor to add the errors to
 * @param markers The markers to add as instances of <code>ParseErrorMessage</code>
 * @param markerType The type of the markers as <code>IMarker</code> types
 */
private void createMarkers(ITextEditor editor, List<ParseErrorMessage> markers, final String markerType) {
    IResource resource = (IResource) editor.getEditorInput().getAdapter(IResource.class);
    if (resource == null) return;
    //IResource resource = ((FileEditorInput)editor.getEditorInput()).getFile();
    IDocument document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
    
    for (ParseErrorMessage msg : markers) {
        try {
            int beginOffset = document.getLineOffset(msg.getLine() - 1) + msg.getPos();
            
            Map<String, ? super Object> map = new HashMap<String, Object>();
            map.put(IMarker.LINE_NUMBER, Integer.valueOf(msg.getLine()));
            map.put(IMarker.CHAR_START, Integer.valueOf(beginOffset));
            map.put(IMarker.CHAR_END, Integer.valueOf(beginOffset + msg.getLength()));
            map.put(IMarker.MESSAGE, msg.getMsg());
            
            // we can do this since we're referring to a static field
            if (IMarker.PROBLEM == markerType)
                map.put(IMarker.SEVERITY, Integer.valueOf(msg.getSeverity()));
            
            if (IMarker.TASK == markerType)
                map.put(IMarker.PRIORITY, Integer.valueOf(msg.getSeverity()));
            
            MarkerUtilities.createMarker(resource, map, markerType);
        } catch (CoreException ce) {
            TexlipsePlugin.log("Creating marker", ce);
        } catch (BadLocationException ble) {
            TexlipsePlugin.log("Creating marker", ble);
        }
    }
}
 
源代码24 项目: texlipse   文件: MarkerHandler.java

/**
 * Adds a fatal error to the problem log.
 * 
 * @param editor The editor to add the errors to
 * @param error The error message 
 */
public void addFatalError(ITextEditor editor, String error) {
    IResource resource = (IResource) editor.getEditorInput().getAdapter(IResource.class);
    if (resource == null) return;
    //IDocument document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
    try {
        Map<String, ? super Object> map = new HashMap<String, Object>();
        map.put(IMarker.MESSAGE, error);
        map.put(IMarker.SEVERITY, Integer.valueOf(IMarker.SEVERITY_ERROR));
        
        MarkerUtilities.createMarker(resource, map, IMarker.PROBLEM);
    } catch (CoreException ce) {
        TexlipsePlugin.log("Creating marker", ce);
    }
}
 
源代码25 项目: texlipse   文件: MarkerHandler.java

/**
 * Creates an error marker on the given line
 * 
 * @param resource The resource to create the error to
 * @param message The message for the marker
 * @param lineNumber The line number to create the error on
 */
public void createErrorMarker(IResource resource, String message, int lineNumber) {
    try {
        Map<String, ? super Object> map = new HashMap<String, Object>();
        map.put(IMarker.LINE_NUMBER, Integer.valueOf(lineNumber));
        map.put(IMarker.MESSAGE, message);
        
        map.put(IMarker.SEVERITY, Integer.valueOf(IMarker.SEVERITY_ERROR));
        
        MarkerUtilities.createMarker(resource, map, IMarker.PROBLEM);
    } catch (CoreException ce) {
        TexlipsePlugin.log("Creating marker", ce);
    }
}
 

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);
  }
}
 

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);
  }
}
 
源代码28 项目: xtext-xtend   文件: Bug452821Test.java

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);
  }
}
 
源代码29 项目: xtext-xtend   文件: Bug473833Test.java

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);
  }
}
 

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);
  }
}
 
 类所在包
 同包方法