Examples of IResourceVariant


Examples of org.eclipse.team.core.variants.IResourceVariant

  private String getGitPath(IFileRevision revision) {
    if (revision instanceof CommitFileRevision)
      return ((CommitFileRevision) revision).getGitPath();
    else if (revision instanceof IAdaptable) {
      final IResourceVariant variant = (IResourceVariant) ((IAdaptable) revision)
          .getAdapter(IResourceVariant.class);

      if (variant instanceof GitRemoteResource)
        return ((GitRemoteResource) variant).getPath();
    }
View Full Code Here

Examples of org.eclipse.team.core.variants.IResourceVariant

  private RevCommit getRevCommit(IFileRevision revision) {
    if (revision instanceof CommitFileRevision)
      return ((CommitFileRevision) revision).getRevCommit();
    else if (revision instanceof IAdaptable) {
      final IResourceVariant variant = (IResourceVariant) ((IAdaptable) revision)
          .getAdapter(IResourceVariant.class);
      if (variant instanceof GitRemoteResource) {
        final RevCommit commit = ((GitRemoteResource) variant)
            .getCommitId();
        try {
View Full Code Here

Examples of org.eclipse.team.core.variants.IResourceVariant

    // given
    GitResourceVariantTree grvt = new GitBaseResourceVariantTree(cache,
        dataSet);

    // then
    IResourceVariant actual = grvt.getResourceVariant(mainJava);
    assertNotNull(actual);
    assertEquals(fileName, actual.getName());

    InputStream actualIn = actual.getStorage(new NullProgressMonitor())
        .getContents();
    byte[] actualByte = getBytesAndCloseStream(actualIn);
    InputStream expectedIn = mainJava.getContents();
    byte[] expectedByte = getBytesAndCloseStream(expectedIn);
View Full Code Here

Examples of org.eclipse.team.core.variants.IResourceVariant

      for (int i = 0; i < syncInfos.length; i++) {
        if (monitor.isCanceled()) {
          return;
        }

        IResourceVariant remoteVariant = syncInfos[i].getRemote();
        IResource resource = syncInfos[i].getLocal();

        switch (syncInfos[i].getKind() & SyncInfo.CHANGE_MASK) {
          case SyncInfo.ADDITION :
            monitor.subTask(NLS.bind(Messages.OverrideWithRemoteOperation_CreatingResource, resource.getName()));
            switch (resource.getType()) {
              case IResource.FILE :
                IStorage storage = remoteVariant.getStorage(null);
                // create parent folders of the resource if applicable
                createParents(resource);
                ((IFile) resource).create(storage.getContents(), true, new SubProgressMonitor(monitor, 1));
                break;
              case IResource.FOLDER :
                // technically, the folder shouldn't exist if we're supposed
                // to be adding the resource, however, we precreate parents
                // of files when creating files and the parent folder may be
                // created as a side effect of that, so we add this check
                // here, note, not having this call was causing problems in
                // RemoteSyncInfo's calculateKind() method
                if (!resource.exists()) {
                  ((IFolder) resource).create(true, true, new SubProgressMonitor(monitor, 1));
                }
                break;
              default :
                monitor.worked(1);
                break;
            }
            break;
          case SyncInfo.CHANGE :
            switch (resource.getType()) {
              case IResource.FILE :
                monitor.subTask(NLS.bind(Messages.OverrideWithRemoteOperation_ReplacingResource, resource.getName()));
                IStorage storage = remoteVariant.getStorage(null);
                ((IFile) resource).setContents(storage.getContents(), true, true, new SubProgressMonitor(monitor, 1));
                break;
              default :
                monitor.worked(1);
                break;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.