Package org.eclipse.egit.core.project

Examples of org.eclipse.egit.core.project.RepositoryMapping


   *         could be found, false otherwise
   * @throws IOException
   * @since 2.3
   */
  public static boolean isIgnored(IPath path) throws IOException {
    RepositoryMapping mapping = RepositoryMapping.getMapping(path);
    if (mapping == null)
      return true; // Linked resources may not be mapped
    Repository repository = mapping.getRepository();
    WorkingTreeIterator treeIterator = IteratorService
        .createInitialIterator(repository);
    if (treeIterator == null)
      return true;
    String repoRelativePath = mapping.getRepoRelativePath(path);
    TreeWalk walk = new TreeWalk(repository);
    try {
      walk.addTree(treeIterator);
      walk.setFilter(PathFilter.create(repoRelativePath));
      while (walk.next()) {
View Full Code Here


      boolean showTag = false;
      Repository repo = null;
      RevCommit selection = null;
      Ref ref = null;
      if (o instanceof IResource) {
        RepositoryMapping mapping = RepositoryMapping
            .getMapping((IResource) o);
        if (mapping != null) {
          repo = mapping.getRepository();
          input = new HistoryPageInput(repo,
              new IResource[] { (IResource) o });
          showHead = true;
        }
      } else if (o instanceof RepositoryTreeNode) {
        RepositoryTreeNode repoNode = (RepositoryTreeNode) o;
        repo = repoNode.getRepository();
        switch (repoNode.getType()) {
        case FILE:
          File file = ((FileNode) repoNode).getObject();
          input = new HistoryPageInput(repo, new File[] { file });
          showHead = true;
          break;
        case FOLDER:
          File folder = ((FolderNode) repoNode).getObject();
          input = new HistoryPageInput(repo, new File[] { folder });
          showHead = true;
          break;
        case REF:
          input = new HistoryPageInput(repo);
          ref = ((RefNode) repoNode).getObject();
          showRef = true;
          break;
        case ADDITIONALREF:
          input = new HistoryPageInput(repo);
          ref = ((AdditionalRefNode) repoNode).getObject();
          showRef = true;
          break;
        case TAG:
          input = new HistoryPageInput(repo);
          ref = ((TagNode) repoNode).getObject();
          showTag = true;
          break;
        default:
          input = new HistoryPageInput(repo);
          showHead = true;
          break;
        }
      } else if (o instanceof HistoryPageInput)
        input = (HistoryPageInput) o;
      else if (o instanceof IAdaptable) {
        IResource resource = (IResource) ((IAdaptable) o)
            .getAdapter(IResource.class);
        if (resource != null) {
          RepositoryMapping mapping = RepositoryMapping
              .getMapping(resource);
          repo = mapping.getRepository();
          input = new HistoryPageInput(repo,
              new IResource[] { resource });
        }
      }
      if (repo == null) {
View Full Code Here

      throws IllegalStateException {
    final ArrayList<FilterPath> paths;
    if (inResources != null) {
      paths = new ArrayList<FilterPath>(inResources.length);
      for (final IResource r : inResources) {
        final RepositoryMapping map = RepositoryMapping.getMapping(r);
        if (map == null)
          continue;
        if (db != map.getRepository())
          throw new IllegalStateException(
              UIText.RepositoryAction_multiRepoSelection);

        if (showAllFilter == ShowFilter.SHOWALLFOLDER) {
          final String path;
          // if the resource's parent is the workspace root, we will
          // get nonsense from map.getRepoRelativePath(), so we
          // check here and use the project instead
          if (r.getParent() instanceof IWorkspaceRoot)
            path = map.getRepoRelativePath(r.getProject());
          else
            path = map.getRepoRelativePath(r.getParent());
          if (path != null && path.length() > 0)
            paths.add(new FilterPath(path, false));
        } else if (showAllFilter == ShowFilter.SHOWALLPROJECT) {
          final String path = map.getRepoRelativePath(r.getProject());
          if (path != null && path.length() > 0)
            paths.add(new FilterPath(path, false));
        } else if (showAllFilter == ShowFilter.SHOWALLREPO) {
          // nothing
        } else /* if (showAllFilter == ShowFilter.SHOWALLRESOURCE) */{
          final String path = map.getRepoRelativePath(r);
          if (path != null && path.length() > 0)
            paths.add(new FilterPath(path, r.getType() == IResource.FILE));
        }
      }
    } else if (inFiles != null) {
View Full Code Here

        .getPluginId(), UIText.GitVariableResolver_InternalError));
  }

  private String getGitRepoRelativePath(String argument) throws CoreException {
    IResource res = getResource(argument);
    RepositoryMapping mapping = RepositoryMapping.getMapping(res);
    if (mapping != null) {
      String repoRelativePath = mapping.getRepoRelativePath(res);
      if (repoRelativePath.equals("")) //$NON-NLS-1$
        return "."; //$NON-NLS-1$
      else
        return repoRelativePath;
    }
View Full Code Here

    return ""; //$NON-NLS-1$
  }

  private String getGitDir(String argument) throws CoreException {
    IResource res = getResource(argument);
    RepositoryMapping mapping = RepositoryMapping.getMapping(res);
    if (mapping != null)
      return mapping.getRepository().getDirectory().getAbsolutePath();
    else
      return ""; //$NON-NLS-1$
  }
View Full Code Here

      return ""; //$NON-NLS-1$
  }

  private String getGitWorkTree(String argument) throws CoreException {
    IResource res = getResource(argument);
    RepositoryMapping mapping = RepositoryMapping.getMapping(res);
    if (mapping != null)
      return mapping.getWorkTree().getAbsolutePath();
    else
      return ""; //$NON-NLS-1$
  }
View Full Code Here

      return ""; //$NON-NLS-1$
  }

  private String getGitBranch(String argument) throws CoreException {
    IResource res = getResource(argument);
    RepositoryMapping mapping = RepositoryMapping.getMapping(res);
    if (mapping != null)
      try {
        return mapping.getRepository().getBranch();
      } catch (IOException e) {
        throw new CoreException(new Status(IStatus.ERROR, Activator.getPluginId(), e.getMessage()));
      }
    else
      return ""; //$NON-NLS-1$
View Full Code Here

  }

  private ITypedElement getCachedFileElement(GitModelBlob blob) {
    try {
      IPath location = blob.getLocation();
      RepositoryMapping mapping = RepositoryMapping.getMapping(location);
      Repository repo = mapping.getRepository();
      String repoRelativePath = mapping.getRepoRelativePath(location);
      return CompareUtils.getIndexTypedElement(repo, repoRelativePath);
    } catch (IOException e) {
      return null;
    }
  }
View Full Code Here

      return null;
    }
  }

  private ITypedElement getHeadFileElement(GitModelBlob blob) {
    RepositoryMapping mapping = RepositoryMapping.getMapping(blob.getLocation());
    Repository repo = mapping.getRepository();
    String gitPath = mapping.getRepoRelativePath(blob.getLocation());
    return CompareUtils.getHeadTypedElement(repo, gitPath);
  }
View Full Code Here

    }
  }

  private void showResource(final IResource resource) {
    IProject project = resource.getProject();
    RepositoryMapping mapping = RepositoryMapping.getMapping(project);
    if (mapping == null)
      return;
    if (mapping.getRepository() != currentRepository)
      reload(mapping.getRepository());
  }
View Full Code Here

TOP

Related Classes of org.eclipse.egit.core.project.RepositoryMapping

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.