java - Eclipse Plugin development: How to jump to Marker in the Source View from Problems View? -


i'm developing editor own language. add error marker source view code:

private void displayerror(interval interval, string message) {     int startindex = interval.a;     int stopindex = interval.b + 1;     annotation annotation =         new annotation("org.eclipse.ui.workbench.texteditor.error", false, message);     annotations.add(annotation);     annotationmodel.addannotation(annotation, new position(startindex, stopindex - startindex));     iworkspace workspace = resourcesplugin.getworkspace();      imarker marker;     try { //create marker display syntax errors in problems view         marker = workspace.getroot().createmarker(markerid);          marker.setattribute(imarker.severity, imarker.severity_error);         marker.setattribute(imarker.message, message);         marker.setattribute(imarker.char_start, startindex);         marker.setattribute(imarker.char_end, stopindex);         marker.setattribute(imarker.priority, imarker.priority_high);         //marker.setattribute(imarker.location, workspace.getroot().getlocationuri().tostring());         markerutilities.setcharstart(marker, startindex);         markerutilities.setcharend(marker, stopindex);         int linenumber = 0;         if(!content.isempty() && content.length()>=stopindex){  //convert startindex line number             string[] lines = content.substring(0, stopindex).split("\r\n|\r|\n");             linenumber = lines.length;         }         marker.setattribute(imarker.line_number, linenumber);         marker.setattribute(imarker.text, message);         marker.setattribute(ide.editor_id_attr, "de.se_rwth.langeditor");         markerannotation ma = new markerannotation("org.eclipse.ui.workbench.texteditor.error", marker);         annotationmodel.addannotation(ma, new position(startindex, stopindex - startindex));         annotations.add(ma);     } catch (coreexception e) {         e.printstacktrace();     }    } 

the marker correctly displayed in problems view. bt if double click on problem marker won't jump correct position in code. if right click on problem marker, option "go to" disabled. editor class, extends texteditor, implements igotomarker interface. gotomarker method implemented me this:

public void gotomarker(imarker marker) {         ide.gotomarker(this, marker);     } 

the getadapter method looks this:

public object getadapter(class adapter) {       if (icontentoutlinepage.class.equals(adapter)) {       return contentoutlinepage;     }     return super.getadapter(adapter);   } 

it great, if can me!

you creating marker on workspace root resource with:

marker = workspace.getroot().createmarker(markerid); 

this wrong, must create marker on actual ifile editing.


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -