IPath relativePath = resource.getProjectRelativePath();
IPath modulePath = relativePath.removeFirstSegments(syncFolder.getProjectRelativePath()
.segmentCount()); // remove sync dir
IModuleResource moduleFile = null;
if (resource.getType() == IResource.FILE) {
moduleFile = new ModuleFile((IFile) resource, resource.getName(), modulePath);
} else if (resource.getType() == IResource.FOLDER) {
moduleFile = new ModuleFolder((IFolder) resource, resource.getName(), modulePath);