eclipse - ResourceException when creating IMarker on IFile (linked resource) -
eclipse - ResourceException when creating IMarker on IFile (linked resource) -
i have problems updating "old" eclipse plugin. here , original plugin did:
(parse compiler output on console file name , error info --> still works)
--> set link location within file --> set marker location in file
what did in past ifile path string of file , generated link , marker it:
ifile ifile; iworkspace workspace = resourcesplugin.getworkspace(); ipath path = new path(filename); ifiles[] files = workspace.getroot().findfilesforlocation(path); ... ifile = ifiles[0]; map attributes = new hashmap(); attributes.put(imarker.severity, new integer (severity)); markerutilities.setlinenumber(attributes, linenumber); markerutilities.setmessage(attributes, message); markerutilities.createmarker(ifile, attributes, imarker
since findfilesforlocation deprecated, tried find way not succeeding whatsoever. using changed code ifile results in exception: org.eclipse.core.internal.resources.resourceexception: resource '/path/to/file.c' not exist. possible relates fact source file linked project, , not physically within project?
iworkspace workspace = resourcesplugin.getworkspace(); ipath location = new path(filename); ifile ifile = workspace.getroot().getfile(location);
can help?
thank you!
i guessing filename
qualified path file want get. i'm guessing file looking in workspace, if linked (if not, won't work. first need add together file project before getting ifile it).
you need this:
ifiles[] files = workspace.getroot().findfilesforlocationuri("file:" + filename);
then find files in workspace correspond file in file system.
the reason why effort above giving resourceexception
trying pass in file scheme path ifile object workspace. eclipse workspace abstraction on underlying filesystem , cannot straight work absolute paths.
eclipse eclipse-plugin
Comments
Post a Comment