Package org.eclipse.egit.core.project

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


      Repository repo = getRepository(event);
      IWorkbenchPage workBenchPage = HandlerUtil
          .getActiveWorkbenchWindowChecked(event).getActivePage();
      if (input instanceof IFile) {
        IFile resource = (IFile) input;
        final RepositoryMapping map = RepositoryMapping
            .getMapping(resource);
        final String gitPath = map.getRepoRelativePath(resource);
        final String commit1Path = getRenamedPath(gitPath, commit1);
        final String commit2Path = getRenamedPath(gitPath, commit2);
        CompareUtils.openInCompare(commit1, commit2, commit1Path,
            commit2Path, map.getRepository(), workBenchPage);
      } else if (input instanceof File) {
        File fileInput = (File) input;
        final String gitPath = getRepoRelativePath(repo, fileInput);
        final String commit1Path = getRenamedPath(gitPath, commit1);
        final String commit2Path = getRenamedPath(gitPath, commit2);
View Full Code Here


  public boolean visit(IResourceDelta delta) throws CoreException {
    final IResource resource = delta.getResource();
    // If the resource is not part of a project under
    // Git revision control
    final RepositoryMapping mapping = RepositoryMapping
        .getMapping(resource);
    if (mapping == null || mapping.getRepository() != repository)
      // Ignore the change
      return true;

    if (resource instanceof IFolder
        && delta.getKind() == IResourceDelta.ADDED) {
      filesToUpdate.add(mapping.getRepoRelativePath(resource) + "/"); //$NON-NLS-1$
      resourcesToUpdate.add(resource);
      return true;
    }

    // If the file has changed but not in a way that we
    // care about (e.g. marker changes to files) then
    // ignore
    if (delta.getKind() == IResourceDelta.CHANGED
        && (delta.getFlags() & INTERESTING_CHANGES) == 0)
      return true;

    // skip any non-FILE resources
    if (resource.getType() != IResource.FILE)
      return true;

    if (resource.getName().equals(GITIGNORE_NAME)) {
      gitIgnoreChanged = true;
      return false;
    }

    String repoRelativePath = mapping.getRepoRelativePath(resource);
    if (repoRelativePath!= null)
      filesToUpdate.add(repoRelativePath);
    resourcesToUpdate.add(resource);

    return true;
View Full Code Here

  GitFileHistory(final IResource rsrc, final int flags,
      final IProgressMonitor monitor) {
    resource = rsrc;

    final RepositoryMapping rm = RepositoryMapping.getMapping(resource);
    if (rm == null) {
      Activator.logError(NLS.bind(CoreText.GitFileHistory_gitNotAttached,
          resource.getProject().getName()), null);
      db = null;
      walk = null;
    } else {
      db = rm.getRepository();
      walk = new KidWalk(db);
      gitPath = rm.getRepoRelativePath(resource);
      if (gitPath == null || gitPath.length() == 0) {
        walk.setTreeFilter(TreeFilter.ANY_DIFF);
      } else {
        walk.setTreeFilter(AndTreeFilter.create(PathFilterGroup
            .createFromStrings(Collections.singleton(gitPath)),
View Full Code Here

    boolean errorOccurred = false;
    List<ObjectId> ids = new ArrayList<ObjectId>();
    String gitPath = null;
    if (input instanceof IFile) {
      IFile resource = (IFile) input;
      final RepositoryMapping map = RepositoryMapping
          .getMapping(resource);
      gitPath = map.getRepoRelativePath(resource);
      Iterator<?> it = selection.iterator();
      while (it.hasNext()) {
        RevCommit commit = (RevCommit) it.next();
        String commitPath = getRenamedPath(gitPath, commit);
        IFileRevision rev = null;
        try {
          rev = CompareUtils.getFileRevision(commitPath, commit,
              map.getRepository(), null);
        } catch (IOException e) {
          Activator.logError(NLS.bind(
              UIText.GitHistoryPage_errorLookingUpPath,
              commitPath, commit.getId()), e);
          errorOccurred = true;
View Full Code Here

    List<IProject> result = new ArrayList<IProject>();
    final IProject[] projects = ResourcesPlugin.getWorkspace().getRoot()
        .getProjects();
    for (IProject project : projects)
      if (project.isAccessible()) {
        RepositoryMapping mapping = RepositoryMapping
            .getMapping(project);
        if (mapping != null && mapping.getRepository() == repository)
          result.add(project);
      }
    return result.toArray(new IProject[result.size()]);
  }
View Full Code Here

      return ((HistoryPageInput) input).getRepository();
    if (input instanceof RepositoryTreeNode)
      return ((RepositoryTreeNode) input).getRepository();
    if (input instanceof IResource) {
      IResource resource = (IResource) input;
      RepositoryMapping mapping = RepositoryMapping.getMapping(resource);
      if (mapping != null)
        return mapping.getRepository();
      // for closed projects team framework doesn't allow to get mapping
      // so try again using a path based approach
      Repository repository = Activator.getDefault().getRepositoryCache()
          .getRepository(resource);
      if (repository != null)
        return repository;
    }
    if (input instanceof IAdaptable) {
      IResource resource = (IResource) ((IAdaptable) input)
          .getAdapter(IResource.class);
      if (resource != null) {
        RepositoryMapping mapping = RepositoryMapping
            .getMapping(resource);
        if (mapping != null)
          return mapping.getRepository();
      }

    }

    Repository repo = AdapterUtils.adapt(input, Repository.class);
View Full Code Here

          .getActiveWorkbenchWindowChecked(event).getActivePage();
      // IFile and File just for compatibility; the action should not be
      // available in this case in the UI
      if (input instanceof IFile) {
        IFile resource = (IFile) input;
        final RepositoryMapping map = RepositoryMapping
            .getMapping(resource);
        final String gitPath = map.getRepoRelativePath(resource);
        final String commit1Path = getRenamedPath(gitPath, commit1);
        final String commit2Path = getRenamedPath(gitPath, commit2);

        CompareUtils.openInCompare(commit1, commit2, commit1Path,
            commit2Path, map.getRepository(), workBenchPage);
      } else if (input instanceof File) {
        File fileInput = (File) input;
        Repository repo = getRepository(event);
        final String gitPath = getRepoRelativePath(repo, fileInput);
        final String commit1Path = getRenamedPath(gitPath, commit1);
View Full Code Here

    Object input = page.getInputInternal().getSingleItem();
    if (input == null)
      return null;
    if (input instanceof IFile) {
      IFile file = (IFile) input;
      RepositoryMapping mapping = RepositoryMapping.getMapping(file);
      if (mapping != null)
        return mapping.getRepoRelativePath(file);
    } else if (input instanceof File)
      return getRepoRelativePath(repo, (File) input);
    return null;
  }
View Full Code Here

    Object input = getPage(event).getInputInternal().getSingleFile();
    IWorkbenchPage workBenchPage = HandlerUtil
        .getActiveWorkbenchWindowChecked(event).getActivePage();
    if (input instanceof IFile) {
      IFile file = (IFile) input;
      final RepositoryMapping mapping = RepositoryMapping.getMapping(file
          .getProject());
      final String gitPath = mapping.getRepoRelativePath(file);
      final String commitPath = getRenamedPath(gitPath, commit);
      ITypedElement right = CompareUtils.getFileRevisionTypedElement(
          commitPath, commit, mapping.getRepository());
      final GitCompareFileRevisionEditorInput in = new GitCompareFileRevisionEditorInput(
          SaveableCompareEditorInput.createFileElement(file), right,
          null);
      CompareUtils.openInCompare(workBenchPage, in);
    } else if (input instanceof File) {
View Full Code Here

   */
  public static ISchedulingRule getRuleForRepositories(IResource[] resources) {
    ISchedulingRule result = null;
    Set<Repository> repositories = new HashSet<Repository>();
    for (IResource resource : resources) {
      RepositoryMapping mapping = RepositoryMapping.getMapping(resource);
      if (mapping != null)
        repositories.add(mapping.getRepository());
    }
    for (Repository repository : repositories) {
      ISchedulingRule rule = getRule(repository);
      result = MultiRule.combine(result, rule);
    }
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.