Package org.eclipse.egit.core.project

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


   *             If HEAD or {@code refName} can't be resolved in the given
   *             repository.
   */
  private static void compareWorkspaceWithRef(Repository repository,
      IFile file, String refName, IWorkbenchPage page) throws IOException {
    final RepositoryMapping mapping = RepositoryMapping.getMapping(file);
    final String gitPath = mapping.getRepoRelativePath(file);
    final ITypedElement base = SaveableCompareEditorInput
        .createFileElement(file);

    CompareEditorInput in = prepareCompareInput(repository, gitPath, base,
        refName);
View Full Code Here


      if (includeLocal)
        compareWorkspaceWithRef(repository, (IFile) resources[0],
            rightRev, page);
      else {
        final IFile file = (IFile) resources[0];
        final RepositoryMapping mapping = RepositoryMapping
            .getMapping(file);
        final String gitPath = mapping.getRepoRelativePath(file);

        compareBetween(repository, gitPath, leftRev, rightRev, page);
      }
    } else
      GitModelSynchronize.synchronize(resources, repository, leftRev,
View Full Code Here

      CompareUI.openCompareEditor(in);
  }

  private static String getRepoRelativePath(IPath location,
      Repository repository) {
    RepositoryMapping mapping = RepositoryMapping.getMapping(location);
    final String gitPath;
    if (mapping != null)
      gitPath = mapping.getRepoRelativePath(location);
    else {
      IPath repoRoot = new Path(repository.getWorkTree().getPath());
      gitPath = location.makeRelativeTo(repoRoot).toString();
    }
    return gitPath;
View Full Code Here

   * @return typed element
   * @throws IOException
   */
  public static ITypedElement getIndexTypedElement(final IFile baseFile)
      throws IOException {
    final RepositoryMapping mapping = RepositoryMapping.getMapping(baseFile);
    final Repository repository = mapping.getRepository();
    final String gitPath = mapping.getRepoRelativePath(baseFile);
    final String encoding = CompareCoreUtils.getResourceEncoding(baseFile);
    return getIndexTypedElement(repository, gitPath, encoding);
  }
View Full Code Here

        super.buttonPressed(buttonId);
        // open the merge tool
        IProject[] projects = ResourcesPlugin.getWorkspace().getRoot()
            .getProjects();
        for (IProject project : projects) {
          RepositoryMapping mapping = RepositoryMapping
              .getMapping(project);
          if (mapping != null && mapping.getRepository().equals(repo)) {
            try {
              // make sure to refresh before opening the merge
              // tool
              project
                  .refreshLocal(IResource.DEPTH_INFINITE,
View Full Code Here

      monitor.beginTask(
          UIText.GitCompareEditorInput_CompareResourcesTaskName,
          IProgressMonitor.UNKNOWN);

      for (IResource resource : resources) {
        RepositoryMapping map = RepositoryMapping.getMapping(resource
            .getProject());
        if (repository != null && repository != map.getRepository())
          throw new InvocationTargetException(
              new IllegalStateException(
                  UIText.GitCompareEditorInput_ResourcesInDifferentReposMessagge));
        String repoRelativePath = map.getRepoRelativePath(resource);
        filterPathStrings.add(repoRelativePath);
        DiffNode node = new DiffNode(Differencer.NO_CHANGE) {
          @Override
          public Image getImage() {
            return FOLDER_IMAGE;
          }
        };
        diffRoots
            .put(new Path(map.getRepoRelativePath(resource)), node);
        repository = map.getRepository();
      }

      if (repository == null)
        throw new InvocationTargetException(
            new IllegalStateException(
View Full Code Here

  private void handleResourceChange(IResourceDelta delta) {
    IResourceDelta[] children = delta.getAffectedChildren();
    for (IResourceDelta resourceDelta : children) {
      IResource resource = resourceDelta.getResource();
      RepositoryMapping mapping = RepositoryMapping.getMapping(resource);
      if (mapping == null)
        continue;

      scanDeltaAndRefresh(mapping, resourceDelta);
    }
View Full Code Here

  private IProject[] getProjectsOfRepositories() {
    Set<IProject> ret = new HashSet<IProject>();
    final IProject[] projects = ResourcesPlugin.getWorkspace().getRoot()
        .getProjects();
    for (IProject project : projects) {
      RepositoryMapping mapping = RepositoryMapping.getMapping(project);
      if (mapping != null && mapping.getRepository() == repo)
        ret.add(project);
    }
    return ret.toArray(new IProject[ret.size()]);
  }
View Full Code Here

      repo = (Repository) o;
    else if (o instanceof IAdaptable) {
      IResource resource = (IResource) ((IAdaptable) o)
          .getAdapter(IResource.class);
      if (resource != null) {
        RepositoryMapping mapping = RepositoryMapping
            .getMapping(resource);
        if (mapping == null)
          return;

        repo = mapping.getRepository();
      }
    }
    if (repo == null)
      repo = AdapterUtils.adapt(o, Repository.class);
View Full Code Here

        RepositoryFinder finder = new RepositoryFinder(project);
        finder.setFindInChildren(false);
        Collection<RepositoryMapping> repos = finder.find(new SubProgressMonitor(monitor, 40));
        File suggestedRepo = projects.get(project);
        RepositoryMapping actualMapping= findActualRepository(repos, suggestedRepo);
        if (actualMapping != null) {
          GitProjectData projectData = new GitProjectData(project);
          try {
            projectData.setRepositoryMappings(Arrays.asList(actualMapping));
            projectData.store();
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.