Package org.eclipse.team.core.history

Examples of org.eclipse.team.core.history.IFileRevision


        else
          kind = IDiff.CHANGE;

        // For folders, we don't need file states
        if (info.getLocal().getType() == IResource.FILE) {
          IFileRevision before = asFileState(ancestor);
          IFileRevision after = asFileState(remote);
          return new ResourceDiff(info.getLocal(), kind, 0, before,
              after);
        }

        return new ResourceDiff(info.getLocal(), kind);
View Full Code Here


  private void registerOpenWorkspaceVersion(MenuManager menu,
      final ISelectionProvider selectionProvider) {
    FileRevisionTypedElement leftRevision = getLeftRevision();
    if (leftRevision != null) {
      IFileRevision fileRevision = leftRevision.getFileRevision();
      if (fileRevision instanceof OpenWorkspaceVersionEnabled) {
        OpenWorkspaceVersionEnabled workspaceVersion = (OpenWorkspaceVersionEnabled) fileRevision;
        final File workspaceFile = new File(workspaceVersion
            .getRepository().getWorkTree(),
            workspaceVersion.getGitPath());
View Full Code Here

    ITypedElement right = new GitCompareFileRevisionEditorInput.EmptyTypedElement(
        NLS.bind(UIText.GitHistoryPage_FileNotInCommit,
            getName(gitPath), truncatedRevision(commit.name())));

    try {
      IFileRevision nextFile = getFileRevision(gitPath, commit, db,
              blobId);
        if (nextFile != null) {
          String encoding = CompareCoreUtils.getResourceEncoding(db, gitPath);
          right = new FileRevisionTypedElement(nextFile, encoding);
        }
View Full Code Here

      throws IOException {

    TreeWalk w = TreeWalk.forPath(db, gitPath, commit.getTree());
    // check if file is contained in commit
    if (w != null) {
      final IFileRevision fileRevision = GitFileRevision.inCommit(db,
          commit, gitPath, blobId);
      return fileRevision;
    }
    return null;
  }
View Full Code Here

        file);
    ITypedElement base = getHeadTypedElement(repository, path);
    if (base == null)
      return;

    IFileRevision nextFile = new WorkspaceFileRevision(file);
    String encoding = null;
    try {
      encoding = file.getCharset();
    } catch (CoreException e) {
      Activator.handleError(UIText.CompareUtils_errorGettingEncoding, e, true);
View Full Code Here

  public static void compareHeadWithWorkingTree(Repository repository,
      String path) {
    ITypedElement base = getHeadTypedElement(repository, path);
    if (base == null)
      return;
    IFileRevision nextFile;
    nextFile = new WorkingTreeFileRevision(new File(
        repository.getWorkTree(), path));
    String encoding = ResourcesPlugin.getEncoding();
    ITypedElement next = new FileRevisionTypedElement(nextFile, encoding);
    GitCompareFileRevisionEditorInput input = new GitCompareFileRevisionEditorInput(
View Full Code Here

    return getIndexTypedElement(repository, repoRelativePath, encoding);
  }

  private static ITypedElement getIndexTypedElement(
      final Repository repository, final String gitPath, String encoding) {
    IFileRevision nextFile = GitFileRevision.inIndex(repository, gitPath);
    final EditableRevision next = new EditableRevision(nextFile, encoding);

    IContentChangeListener listener = new IContentChangeListener() {
      public void contentChanged(IContentChangeNotifier source) {
        final byte[] newContent = next.getModifiedContent();
View Full Code Here

    openInEditor(d.getOldPath(), commit, blob);
  }

  private void openInEditor(String path, RevCommit commit, ObjectId blob) {
    try {
      IFileRevision rev = CompareUtils.getFileRevision(path, commit,
          getRepository(), blob);
      if (rev != null) {
        IWorkbenchWindow window = PlatformUI.getWorkbench()
            .getActiveWorkbenchWindow();
        IWorkbenchPage page = window.getActivePage();
View Full Code Here

          .getActiveWorkbenchWindow();
      IWorkbenchPage page = window.getActivePage();
      RevCommit commit = d.getChange().equals(ChangeType.DELETE) ? d
          .getCommit().getParent(0) : d.getCommit();
      String path = d.getPath();
      IFileRevision rev = CompareUtils.getFileRevision(path, commit,
          getRepository(),
          d.getChange().equals(ChangeType.DELETE) ? d.getBlobs()[0]
              : d.getBlobs()[d.getBlobs().length - 1]);
      if (rev != null) {
        BlameOperation op = new BlameOperation(getRepository(),
            rev.getStorage(new NullProgressMonitor()), path,
            commit, window.getShell(), page);
        JobUtil.scheduleUserJob(op, UIText.ShowBlameHandler_JobName,
            JobFamilies.BLAME);
      } else {
        String message = NLS.bind(
View Full Code Here

      IResource resource = ResourceUtil.getResource(editorInput);
      if (resource != null)
        return new StructuredSelection(resource);
      if (editorInput instanceof FileRevisionEditorInput) {
        FileRevisionEditorInput fileRevisionEditorInput = (FileRevisionEditorInput) editorInput;
        IFileRevision fileRevision = fileRevisionEditorInput
            .getFileRevision();
        if (fileRevision != null)
          return new StructuredSelection(fileRevision);
      }
    }
View Full Code Here

TOP

Related Classes of org.eclipse.team.core.history.IFileRevision

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.