Package org.eclipse.compare

Examples of org.eclipse.compare.ITypedElement


        }

        private ErlNode getErlNode(final Object e) {
            if (e instanceof DiffNode) {
                final DiffNode d = (DiffNode) e;
                final ITypedElement left = d.getLeft();
                if (left instanceof ErlNode) {
                    return (ErlNode) left;
                }
                final ITypedElement right = d.getRight();
                if (right instanceof ErlNode) {
                    return (ErlNode) right;
                }
            }
            return null;
View Full Code Here


            s = document.get();
        }
        if (module == null) {
            String name = "comptemp";
            if (element instanceof ITypedElement) {
                final ITypedElement typedElement = (ITypedElement) element;
                name = typedElement.getName();
            }
            module = model.getModuleFromText(model, name, s, s);
        }
        ErlNode root = null;
        if (element != null && document != null) {
View Full Code Here

        if (input == null) {
            return null;
        }

        IResourceProvider rp = null;
        ITypedElement te = input.getLeft();

        if (te instanceof IResourceProvider) {
            rp = (IResourceProvider) te;
        }
View Full Code Here

          && subscriber instanceof GitResourceVariantTreeSubscriber) {
        try {
          final IFileRevision revision = ((GitResourceVariantTreeSubscriber) subscriber)
              .getSourceFileRevision((IFile) resource);
          if (revision == null) {
            final ITypedElement newSource = new GitCompareFileRevisionEditorInput.EmptyTypedElement(
                resource.getName());
            ((ResourceDiffCompareInput) input).setLeft(newSource);
          } else if (!(revision instanceof WorkspaceFileRevision)) {
            final ITypedElement newSource = new FileRevisionTypedElement(
                revision, getLocalEncoding(resource));
            ((ResourceDiffCompareInput) input).setLeft(newSource);
          }
        } catch (TeamException e) {
          // Keep the input from super as-is
View Full Code Here

      }
    }
  }

  private void handleGitObjectComparison(GitModelBlob obj, boolean reuseEditor) {
    ITypedElement left;
    ITypedElement right;
    if (obj instanceof GitModelWorkingFile) {
      IFile file = ResourceUtil.getFileForLocation(obj.getLocation());
      if (file == null)
        left = new LocalNonWorkspaceTypedElement(obj.getLocation());
      else
View Full Code Here

   *         {@link CompareEditorInput}
   */
  public static ITypedElement getFileRevisionTypedElement(
      final String gitPath, final RevCommit commit, final Repository db,
      ObjectId blobId) {
    ITypedElement right = new GitCompareFileRevisionEditorInput.EmptyTypedElement(
        NLS.bind(UIText.GitHistoryPage_FileNotInCommit,
            getName(gitPath), truncatedRevision(commit.name())));

    try {
      IFileRevision nextFile = getFileRevision(gitPath, commit, db,
View Full Code Here

   *         {@link CompareEditorInput}
   */
  public static ITypedElement getFileRevisionTypedElementForCommonAncestor(
      final String gitPath, ObjectId commit1, ObjectId commit2,
      Repository db) {
    ITypedElement ancestor = null;
    RevCommit commonAncestor = null;
    try {
      commonAncestor = RevUtils.getCommonAncestor(db, commit1, commit2);
    } catch (IOException e) {
      Activator.logError(NLS.bind(UIText.CompareUtils_errorCommonAncestor,
          commit1.getName(), commit2.getName()), e);
    }
    if (commonAncestor != null) {
      ITypedElement ancestorCandidate = CompareUtils
          .getFileRevisionTypedElement(gitPath, commonAncestor, db);
      if (!(ancestorCandidate instanceof EmptyTypedElement))
        ancestor = ancestorCandidate;
    }
    return ancestor;
View Full Code Here

   *            the page to open the compare editor in
   */
  public static void openInCompare(RevCommit commit1, RevCommit commit2,
      String commit1Path, String commit2Path, Repository repository,
      IWorkbenchPage workBenchPage) {
    final ITypedElement base = CompareUtils.getFileRevisionTypedElement(
        commit1Path, commit1, repository);
    final ITypedElement next = CompareUtils.getFileRevisionTypedElement(
        commit2Path, commit2, repository);
    CompareEditorInput in = new GitCompareFileRevisionEditorInput(base,
        next, null);
    CompareUtils.openInCompare(workBenchPage, in);
  }
View Full Code Here

   */
  public static void compareHeadWithWorkspace(Repository repository,
      IFile file) {
    String path = RepositoryMapping.getMapping(file).getRepoRelativePath(
        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);
    }
    ITypedElement next = new FileRevisionTypedElement(nextFile, encoding);
    GitCompareFileRevisionEditorInput input = new GitCompareFileRevisionEditorInput(
        next, base, null);
    CompareUI.openCompareDialog(input);
  }
View Full Code Here

   */
  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

TOP

Related Classes of org.eclipse.compare.ITypedElement

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.