Eclipse Add marker for linked resources

大兔子大兔子 提交于 2019-12-10 19:46:31

问题


I know that markers can be added only for IResource(s), could they be added for linked resources ?
I've got the linked resource name from .project, using org.eclipse.core.internal.Project.internalGetDescription() and getLinks(). But it seems that something is missing, Eclipse is complaining about the fact that the resource does not exist.
I'm creating the resource using Workspace.newResource([PATH]), where the PATH is an IPath built correctly using the linked resource name from .project and the rest of path towards the file name.

Maybe somebody has worked with this before ?


回答1:


Don't call Workspace.newResource([PATH]) directly, get the resource from the IProject or IWorkspaceRoot using its path and #getFile() or #getFolder(). That it's a linked resource shouldn't matter if you're doing this right. If you're still having problems, tell us exactly what its complaint is.



来源:https://stackoverflow.com/questions/12475038/eclipse-add-marker-for-linked-resources

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