【发布时间】:2011-12-01 04:58:18
【问题描述】:
我正在尝试在 Eclipse 的垂直标尺上添加一个标记/图标。我使用了以下代码
IEditorPart editor = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage().getActiveEditor();
IFileEditorInput input = (IFileEditorInput)editor.getEditorInput() ;
IFile file = input.getFile();
IProject activeProject = file.getProject();
IResource res = (IResource) activeProject;
IMarker m;
try {
m = res.createMarker("com.examples.problem");
m.setAttribute(IMarker.LOCATION, offset);
m.setAttribute(IMarker.MESSAGE, "Hello");
m.setAttribute(IMarker.LINE_NUMBER, offset);
} catch (CoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
其中偏移量是我想要标记的行号。 这段代码是一个标记,但不在标尺上,而是在控制台和错误日志旁边的问题视图上。知道如何解决吗?另外,如果有任何其他方法可以在标尺上添加切换/图标/标记,请提出建议。
【问题讨论】:
标签: java eclipse eclipse-plugin