Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Eclipse Custom Editor mark error as native problem underline
Eclipse Custom Editor mark error as native problem underline [message #1850643] Fri, 11 March 2022 16:12 Go to next message
md md is currently offline md mdFriend
Messages: 9
Registered: November 2015
Junior Member
Hi,

I have written my custom editor in eclipse and adding markers and showing annotations when any syntax error occured on save.
But how can I underline the problem text in red as in Java Editor. Can I do it via the annotation object or?

   public IMarker createMarker(IResource res, int line) throws CoreException {
      IMarker marker = null;
      // note: you use the id that is defined in your plugin.xml
      if (res != null) {
         marker = res.createMarker("com.my.marker");
         marker.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
         marker.setAttribute(IMarker.CHAR_START, 0);
         marker.setAttribute(IMarker.CHAR_END, 2);
         marker.setAttribute(IMarker.LINE_NUMBER, 2);
         marker.setAttribute(IMarker.LOCATION, "Snake file");
         marker.setAttribute(IMarker.MESSAGE, "Syntax error");

         Annotation annotation = new Annotation("org.eclipse.ui.workbench.texteditor.error", false, "Hello World");
         getVerticalRuler().getModel().addAnnotation(annotation, new Position(0, 5));
         getVerticalRuler().update();
      return marker;
   }
Re: Eclipse Custom Editor mark error as native problem underline [message #1850645 is a reply to message #1850643] Fri, 11 March 2022 17:22 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4435
Registered: July 2009
Senior Member

You'd make use of a marker annotation specification: https://help.eclipse.org/latest/topic/org.eclipse.platform.doc.isv/reference/extension-points/org_eclipse_ui_editors_markerAnnotationSpecification.html .

_
Nitin Dahyabhai
Eclipse Web Tools Platform
Re: Eclipse Custom Editor mark error as native problem underline [message #1850686 is a reply to message #1850645] Mon, 14 March 2022 11:07 Go to previous message
md md is currently offline md mdFriend
Messages: 9
Registered: November 2015
Junior Member
Do you have an example, I cannot find the configuration in the specification for native problem underline, see appendix pls what config I am searching for.
  • Attachment: eeeeee.PNG
    (Size: 21.39KB, Downloaded 114 times)

[Updated on: Mon, 14 March 2022 11:07]

Report message to a moderator

Previous Topic:Prompt when Editor is closed
Next Topic:update site with all Jetty bundles with same version as the one installed in current Eclipse release
Goto Forum:
  


Current Time: Thu Apr 25 13:57:15 GMT 2024

Powered by FUDForum. Page generated in 0.03413 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top