Cannot cast eclipse project to IJavaProject

丶灬走出姿态 提交于 2019-12-01 16:29:42
Andrew Eisenberg

The code in your answer shouldn't work (typo?). Here is how you can create an IJavaProject:

import org.eclipse.jdt.core.JavaCore
...
    if (project.hasNature(JavaCore.NATURE_ID)) {
        targetProject = JavaCore.create(project);
    }

IProject is a type in the Eclipse Resources API and IJavaProject is a type in the Eclipse Java Model. They are not the same abstractions, but all IJavaProjects have an IProject.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!