[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools.cdt] Re: Adding new files to project.

How are you adding the files? You need to use an IFile to create project resource (rather than just using a File).

One way to obtain an IFile given a projectName and fileName within the project is:

public IFile getProjectFile(String projectName, String fileName) {
	IFile file = null;
	IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
	IResource resource = root.findMember(new Path(projectName));
	if ((resource != null)
		&& (resource.exists() && (resource instanceof IContainer))) {
		IContainer container = (IContainer) resource;
		file = container.getFile(new Path(fileName));
	}
	return file ;
}

HTH

--
Derek


oren barzilai wrote:
Hello,

I have defined new project type and by the operation class I have added new files to my project on creation, but for some reason I can see those files only after I restart the eclipse.
I have tried to call "refreshLocal" after adding the files with no result.


What am I doing wrong?

thanks

Oren Barzilai