我之前问过一个关于 VerticalRulers的问题,有了这个提示,我向 VerticalRuler 添加了第二个 Column 并尝试向它添加一个 Marker,但 Marker 总是出现在标准 Column 上,而不是我的。我添加了第二个行号列来说明我的问题。我该如何改变这种行为?谢谢你的帮助。
@Override
protected IVerticalRuler createVerticalRuler(){
IVerticalRuler ruler = super.createVerticalRuler();
ruler2 = (CompositeRuler) ruler;
column1 = new AnnotationRulerColumn(100);
ruler2.addDecorator(0, column1);
ruler2.addDecorator(2, createLineNumberRulerColumn());
column1.addAnnotationType("MARKER");
return ruler;
}
public String check_line(){
IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
IFileEditorInput input = (IFileEditorInput)editor.getEditorInput() ;
IFile file = input.getFile();
IResource res = (IResource) file;
try{
IMarker m = res.createMarker(IMarker.MARKER);
m.setAttribute(IMarker.LINE_NUMBER,2);
m.setAttribute(IMarker.MESSAGE, "lala");
m.setAttribute(IMarker.TEXT, "test");
m.setAttribute(IMarker.PRIORITY, IMarker.PRIORITY_HIGH);
m.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_INFO);
} catch (CoreException e) { ... }
return "marker created";
}