Package org.eclipse.egit.core.project

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


        addExpandedPathsBelowFolder(folder, unstagedViewer,
            pathsToExpandInStaged);
      } else {
        IResource resource = AdapterUtils.adapt(element, IResource.class);
        if (resource != null) {
          RepositoryMapping mapping = RepositoryMapping.getMapping(resource);
          if (mapping != null && mapping.getRepository() == currentRepository) {
            String path = mapping.getRepoRelativePath(resource);
            // If resource corresponds to root of working directory
            if ("".equals(path)) //$NON-NLS-1$
              addPaths.add("."); //$NON-NLS-1$
            else
              addPaths.add(path);
View Full Code Here


      repositoryFinder.setFindInChildren(false);
      try {
        Collection<RepositoryMapping> mappings;
        mappings = repositoryFinder.find(new NullProgressMonitor());
        Iterator<RepositoryMapping> mi = mappings.iterator();
        RepositoryMapping m = mi.hasNext() ? mi.next() : null;
        if (m == null) {
          // no mapping found, enable repository creation
          TreeItem treeItem = new TreeItem(tree, SWT.NONE);
          updateProjectTreeItem(treeItem, project);
          treeItem.setText(1, project.getLocation().toOSString());
          treeItem.setText(2, ""); //$NON-NLS-1$
          treeItem.setData(new ProjectAndRepo(project, "")); //$NON-NLS-1$
          allProjectsInExistingRepos = false;
        } else if (!mi.hasNext()) {
          // exactly one mapping found
          TreeItem treeItem = new TreeItem(tree, SWT.NONE);
          updateProjectTreeItem(treeItem, project);
          treeItem.setText(1, project.getLocation().toOSString());
          fillTreeItemWithGitDirectory(m, treeItem, false);
          treeItem.setData(new ProjectAndRepo(project, m
              .getGitDirAbsolutePath().toOSString()));
          treeItem.setChecked(true);
        }

        else {
          TreeItem treeItem = new TreeItem(tree, SWT.NONE);
          updateProjectTreeItem(treeItem, project);
          treeItem.setText(1, project.getLocation().toOSString());
          treeItem.setData(new ProjectAndRepo(project, "")); //$NON-NLS-1$

          TreeItem treeItem2 = new TreeItem(treeItem, SWT.NONE);
          updateProjectTreeItem(treeItem2, project);
          fillTreeItemWithGitDirectory(m, treeItem2, true);
          treeItem2.setData(new ProjectAndRepo(project, m
              .getGitDirAbsolutePath().toOSString()));
          while (mi.hasNext()) { // fill in additional mappings
            m = mi.next();
            treeItem2 = new TreeItem(treeItem, SWT.NONE);
            updateProjectTreeItem(treeItem2, project);
            fillTreeItemWithGitDirectory(m, treeItem2, true);
            treeItem2.setData(new ProjectAndRepo(m.getContainer()
                .getProject(), m.getGitDirAbsolutePath()
                .toOSString()));
          }
          treeItem.setExpanded(true);
          allProjectsInExistingRepos = false;
        }
View Full Code Here

    RevCommit commit = null;
    try {
      commitOperation.execute(monitor);
      commit = commitOperation.getCommit();
      CommitMessageComponentStateManager.deleteState(repository);
      RepositoryMapping mapping = RepositoryMapping
          .findRepositoryMapping(repository);
      if (mapping != null)
        mapping.fireRepositoryChanged();
    } catch (CoreException e) {
      if (e.getCause() instanceof JGitInternalException)
        return Activator.createErrorStatus(e.getLocalizedMessage(),
            e.getCause());
      return Activator.createErrorStatus(
View Full Code Here

      includedResourceIterable = Arrays.asList(ROOT.getProjects());
    else
      includedResourceIterable = includedResources;
    for (IResource res : includedResourceIterable) {
      IProject project = res.getProject();
      RepositoryMapping mapping = RepositoryMapping.getMapping(project);
      if (mapping != null && mapping.getRepository() == repo)
        projects.add(project);
    }

    // do not set field if includedResources is null, some methods expect
    // #getIncludedResources() to return <null> to know it should
View Full Code Here

   *            list of resources to be synchronized
   */
  public void setIncludedResources(Set<IResource> includedResources) {
    this.includedResources = includedResources;
    Set<String> paths = new HashSet<String>();
    RepositoryMapping rm = RepositoryMapping.findRepositoryMapping(repo);
    for (IResource resource : includedResources) {
      String repoRelativePath = rm.getRepoRelativePath(resource);
      if (repoRelativePath != null && repoRelativePath.length() > 0)
        paths.add(repoRelativePath);
    }

    if (!paths.isEmpty())
View Full Code Here

    if (filterResources == null)
      return TreeFilter.ALL;

    List<TreeFilter> filters = new ArrayList<TreeFilter>();
    for (IResource resource : filterResources) {
      RepositoryMapping mapping = RepositoryMapping.getMapping(resource);
      if (mapping != null) {
        DiffConfig diffConfig = mapping.getRepository().getConfig().get(DiffConfig.KEY);
        String path = mapping.getRepoRelativePath(resource);
        if (path != null && !"".equals(path)) { //$NON-NLS-1$
          if (resource.getType() == IResource.FILE)
            filters.add(FollowFilter.create(path, diffConfig));
          else
            filters.add(AndTreeFilter.create(
View Full Code Here

      return;
    Repository selectedRepo = null;
    Object first = ssel.getFirstElement();
    if (first instanceof IResource) {
      IResource resource = (IResource) ssel.getFirstElement();
      RepositoryMapping mapping = RepositoryMapping.getMapping(resource
          .getProject());
      if (mapping != null)
        selectedRepo = mapping.getRepository();
    }
    if (selectedRepo == null && first instanceof IAdaptable) {
      IResource adapted = (IResource) ((IAdaptable) ssel
          .getFirstElement()).getAdapter(IResource.class);
      if (adapted != null) {
        RepositoryMapping mapping = RepositoryMapping
            .getMapping(adapted);
        if (mapping != null)
          selectedRepo = mapping.getRepository();
      }
    }
    if (selectedRepo == null && first instanceof RepositoryTreeNode) {
      RepositoryTreeNode repoNode = (RepositoryTreeNode) ssel
          .getFirstElement();
View Full Code Here

    this.commitIndex = true;
  }


  private void setRepository(IFile file) throws CoreException {
    RepositoryMapping mapping = RepositoryMapping.getMapping(file);
    if (mapping == null)
      throw new CoreException(Activator.error(NLS.bind(
          CoreText.CommitOperation_couldNotFindRepositoryMapping,
          file), null));
    repo = mapping.getRepository();
  }
View Full Code Here

  }

  private Collection<String> buildFileList(Collection<IFile> files) throws CoreException {
    Collection<String> result = new HashSet<String>();
    for (IFile file : files) {
      RepositoryMapping mapping = RepositoryMapping.getMapping(file);
      if (mapping == null)
        throw new CoreException(Activator.error(NLS.bind(CoreText.CommitOperation_couldNotFindRepositoryMapping, file), null));
      String repoRelativePath = mapping.getRepoRelativePath(file);
      result.add(repoRelativePath);
    }
    return result;
  }
View Full Code Here

    Map<GitSynchronizeData, Collection<String>> updateRequests = new HashMap<GitSynchronizeData, Collection<String>>();
    for (IResource resource : resources) {
      IProject project = resource.getProject();
      GitSynchronizeData data = gsds.getData(project.getName());
      if (data != null) {
        RepositoryMapping mapping = RepositoryMapping
            .getMapping(project);
        // mapping may be null if the project has been closed
        if (mapping != null) {
          Collection<String> paths = updateRequests.get(data);
          if (paths == null) {
            paths = new ArrayList<String>();
            updateRequests.put(data, paths);
          }

          String path = mapping.getRepoRelativePath(resource);
          // null path may be returned, check for this
          if (path == null)
            // unknown, force a refresh of the whole repository
            path = ""; //$NON-NLS-1$
          paths.add(path);
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.