Java Code Examples for org.eclipse.wst.validation.internal.provisional.core.IMessage#setOffset()

The following examples show how to use org.eclipse.wst.validation.internal.provisional.core.IMessage#setOffset() . 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: XmlSourceValidator.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a message from a given {@link ElementProblem}.
 */
@VisibleForTesting
void createMessage(IReporter reporter, ElementProblem problem, int offset) {
  IMessage message = new LocalizedMessage(problem.getIMessageSeverity(), problem.getMessage());
  message.setTargetObject(this);
  message.setMarkerId(problem.getMarkerId());
  // TODO offset by line
  int lineNumber = problem.getStart().getLineNumber() + 1;
  message.setLineNo(lineNumber);
  message.setOffset(offset);
  message.setLength(problem.getLength());
  message.setAttribute(IQuickAssistProcessor.class.getName(), problem.getQuickAssistProcessor());
  reporter.addMessage(this, message);
}
 
Example 2
Source File: ReporterMessagePlacementStrategy.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
public IMessage placeValidationResult(IResource resource, IDocument document,
    IRegion position, String message, int severity) {
  IMessage validationMessage = new LocalizedMessage(
      severityFromIMarkerSeverity(severity), message);
  validationMessage.setLength(position.getLength());
  validationMessage.setOffset(position.getOffset());

  reporter.addMessage(validator, validationMessage);
  return validationMessage;
}