Package org.eclipse.egit.core.project

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


            RepositoryFinder finder = new RepositoryFinder(project);
            finder.setFindInChildren(false);
            Collection<RepositoryMapping> mappings = finder
                .find(new SubProgressMonitor(actMonitor, 1));
            if (!mappings.isEmpty()) {
              RepositoryMapping mapping = mappings.iterator()
                  .next();
              projectsToConnect.put(project, mapping
                  .getGitDirAbsolutePath().toFile());
            }

            if (selectedWorkingSets != null
                && selectedWorkingSets.length > 0)
View Full Code Here


  private List<IPath> getProjectPaths() {
    if (projectPaths == null) {
      projectPaths = new ArrayList<IPath>();
      for (IProject project : ResourcesPlugin.getWorkspace().getRoot()
          .getProjects()) {
        RepositoryMapping mapping = RepositoryMapping
            .getMapping(project);
        if (mapping != null
            && mapping.getRepository().equals(repository)) {
          projectPaths.add(project.getLocation());
        }
      }
    }
    return projectPaths;
View Full Code Here

  private TreeFilter createPathFilter(final Collection<? extends IResource> rs) {
    if (rs == null || rs.isEmpty())
      return null;
    final List<PathFilter> filters = new ArrayList<PathFilter>();
    for (IResource r : rs) {
      RepositoryMapping rm = RepositoryMapping.getMapping(r);
      if (rm != null) {
        String repoRelativePath = rm.getRepoRelativePath(r);
        if (repoRelativePath != null)
          if (repoRelativePath.equals("")) //$NON-NLS-1$
            // repository selected
            return TreeFilter.ALL;
          else
View Full Code Here

    if (element instanceof IResource) {
      IResource resource = (IResource) element;

      if (resource instanceof IStorage) {
        IStorage storage = (IStorage) resource;
        RepositoryMapping mapping = RepositoryMapping
            .getMapping(resource);

        if (mapping != null) {
          String repoRelativePath = mapping
              .getRepoRelativePath(resource);
          return new Data(mapping.getRepository(), repoRelativePath,
              storage, null);
        }
      }
    } else if (element instanceof CommitFileRevision) {
      CommitFileRevision revision = (CommitFileRevision) element;
View Full Code Here

  private Map<Repository, Set<IResource>> mapContainerResources(
      IResource[] resources) {
    Map<Repository, Set<IResource>> result = new HashMap<Repository, Set<IResource>>();

    for (IResource resource : resources) {
      RepositoryMapping rm = RepositoryMapping.getMapping(resource);
      if (rm == null)
        continue; // Linked resources may not be in a repo
      if (resource instanceof IProject)
        result.put(rm.getRepository(), new HashSet<IResource>());
      else if (resource instanceof IContainer) {
        Set<IResource> containers = result.get(rm.getRepository());
        if (containers == null) {
          containers = new HashSet<IResource>();
          result.put(rm.getRepository(), containers);
          containers.add(resource);
        } else if (containers.size() > 0)
          containers.add(resource);
      }
    }
View Full Code Here

   *            must be provided if warn = true
   * @return repository for current project, or null
   */
  private static Repository getRepository(boolean warn,
      IStructuredSelection selection, Shell shell) {
    RepositoryMapping mapping = null;

    IPath[] locations = getSelectedLocations(selection);
    if (GitTraceLocation.SELECTION.isActive())
      GitTraceLocation.getTrace().trace(
          GitTraceLocation.SELECTION.getLocation(), "selection=" //$NON-NLS-1$
              + selection + ", locations=" //$NON-NLS-1$
              + Arrays.toString(locations));

    for (IPath location : locations) {
      RepositoryMapping repositoryMapping = RepositoryMapping
          .getMapping(location);
      if (mapping == null)
        mapping = repositoryMapping;
      if (repositoryMapping == null)
        return null;
      if (mapping.getRepository() != repositoryMapping.getRepository()) {
        if (warn)
          MessageDialog.openError(shell,
              UIText.RepositoryAction_multiRepoSelectionTitle,
              UIText.RepositoryAction_multiRepoSelection);
        return null;
View Full Code Here

      return;
    final IResource selectedResource = getSelection();
    if (selectedResource == null || selectedResource.isLinked(IResource.CHECK_ANCESTORS))
      return;

    RepositoryMapping mapping = RepositoryMapping
        .getMapping(selectedResource.getProject());
    if (mapping == null)
      return;

    final Repository repo = mapping.getRepository();
    if (repo == null)
      return;

    List<Ref> refs = new LinkedList<Ref>();
    RefDatabase refDatabase = repo.getRefDatabase();
View Full Code Here

      Object firstElement = selection.getFirstElement();
      IResource resource = AdapterUtils.adapt(firstElement,
          IResource.class);
      if (resource instanceof IFile || resource instanceof IFolder) {
        RepositoryMapping m = RepositoryMapping.getMapping(resource);
        if (m != null)
          return testRepositoryProperties(m.getRepository(), args);
      }
    }
    return false;
  }
View Full Code Here

      return getRepositoryOfMapping(project);
    return null;
  }

  private static Repository getRepositoryOfMapping(IResource resource) {
    RepositoryMapping mapping = RepositoryMapping.getMapping(resource);
    if (mapping != null)
      return mapping.getRepository();
    return null;
  }
View Full Code Here

    return RuleUtil.getRuleForRepositories(rsrcList.toArray(new IResource[rsrcList.size()]));
  }

  private void addToCommand(IResource resource, Map<RepositoryMapping, AddCommand> addCommands) {
    IProject project = resource.getProject();
    RepositoryMapping map = RepositoryMapping.getMapping(project);
    AddCommand command = addCommands.get(map);
    if (command == null) {
      Repository repo = map.getRepository();
      Git git = new Git(repo);
      AdaptableFileTreeIterator it = new AdaptableFileTreeIterator(repo,
          resource.getWorkspace().getRoot());
      command = git.add().setWorkingTreeIterator(it);
      addCommands.put(map, command);
    }
    String filepattern = map.getRepoRelativePath(resource);
    if ("".equals(filepattern)) //$NON-NLS-1$
      filepattern = "."; //$NON-NLS-1$
    command.addFilepattern(filepattern);
  }
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.