private void protect(IResource resource) {
   IResource c = resource;
   while (c != null && !c.equals(getProject())) {
     trace("protect " + c); // $NON-NLS-1$
     protectedResources.add(c);
     try {
       c.setTeamPrivateMember(true);
     } catch (CoreException e) {
       Activator.logError(
           MessageFormat.format(CoreText.GitProjectData_FailedToMarkTeamPrivate, c.getFullPath()),
           e);
     }
     c = c.getParent();
   }
 }
  /**
   * Hide our private parts from the navigators other browsers.
   *
   * @throws CoreException
   */
  public void markTeamPrivateResources() throws CoreException {
    for (final Object rmObj : mappings) {
      final RepositoryMapping rm = (RepositoryMapping) rmObj;
      final IContainer c = rm.getContainer();
      if (c == null) continue; // Not fully mapped yet?

      final IResource dotGit = c.findMember(Constants.DOT_GIT);
      if (dotGit != null) {
        try {
          final Repository r = rm.getRepository();
          final File dotGitDir = dotGit.getLocation().toFile().getCanonicalFile();
          if (dotGitDir.equals(r.getDirectory())) {
            trace("teamPrivate " + dotGit); // $NON-NLS-1$
            dotGit.setTeamPrivateMember(true);
          }
        } catch (IOException err) {
          throw new CoreException(Activator.error(CoreText.Error_CanonicalFile, err));
        }
      }
    }
  }