我需要在jdt插件中通过eclipse Imarker找出代码中错误的位置

时间:2015-11-26 14:10:30

标签: java eclipse plugins eclipse-plugin eclipse-jdt

The marker Properties

我需要获取文件夹详细信息,位置,元素详细信息。

     public ActionResult Register(string role)
    {
        var model = new RegisterViewModel
          {
              Name = role
          };
        //Are these parameters accurate?
        return View("Register", new RegisterViewModel { role = role });
     }

但在文件夹详细信息中没有详细信息属性。

1 个答案:

答案 0 :(得分:1)

使用以下方法获取包含标记的资源:

def phone():
    if input("Did you  buy your phone recently? ") == 'yes':
        if input("Did you drop your phone? ") == 'yes':
            print sol1
            return
        else: 
            print sol2 
            return

    else:
        phone() #this will make you go back to the start of your function, in this case the first question

IMarker marker = .... the marker IResource resource = marker.getResource(); 通常是一个文件:

IResource

行号由

给出
if (resource instanceof IFile) {

    IFile file = (IFile)resource;

    // The file name
    String name = file.getName();  

    IContainer folder = file.getParent();

    // The folder name
    String folderPath = folder.getFullPath().toString();
}

某些标记可​​能只有字符开头/结尾位置:

marker.getAttribute(IMarker.LINE_NUMBER);