Package org.eclipse.compare.contentmergeviewer

Examples of org.eclipse.compare.contentmergeviewer.IMergeViewerContentProvider


    internalRefresh(getInput());
  }

  private void internalRefresh(Object input) {

    IMergeViewerContentProvider content = getMergeContentProvider();
    if (content != null) {
      Object ancestor = content.getAncestorContent(input);
      boolean oldFlag = fIsThreeWay;
      if (Utilities.isHunk(input)) {
        fIsThreeWay = true;
      } else if (input instanceof ICompareInput)
        fIsThreeWay = (((ICompareInput) input).getKind() & Differencer.DIRECTION_MASK) != 0;
      else
        fIsThreeWay = ancestor != null;

      if (fAncestorItem != null)
        fAncestorItem.setVisible(fIsThreeWay);

      if (fAncestorVisible && oldFlag != fIsThreeWay)
        fComposite.layout(true);

      Object left = content.getLeftContent(input);
      Object right = content.getRightContent(input);
      updateContent(ancestor, left, right);

      updateHeader();
      ToolBarManager tbm = CompareViewerPane.getToolBarManager(fComposite
          .getParent());
View Full Code Here


   * Subclasses may extend this method, although this is generally not
   * required.
   */
  protected void updateToolItems() {

    IMergeViewerContentProvider content = getMergeContentProvider();

    Object input = getInput();

    if (fCopyLeftToRightAction != null) {
      boolean enable = content.isRightEditable(input);
      // if (enable && input instanceof ICompareInput) {
      // ITypedElement e= ((ICompareInput) input).getLeft();
      // if (e == null)
      // enable= false;
      // }
      fCopyLeftToRightAction.setEnabled(enable);
    }

    if (fCopyRightToLeftAction != null) {
      boolean enable = content.isLeftEditable(input);
      // if (enable && input instanceof ICompareInput) {
      // ITypedElement e= ((ICompareInput) input).getRight();
      // if (e == null)
      // enable= false;
      // }
View Full Code Here

   * Subclasses may extend this method, although this is generally not
   * required.
   */
  protected void updateHeader() {

    IMergeViewerContentProvider content = getMergeContentProvider();
    Object input = getInput();

    // Only change a label if there is a new label available
    if (fAncestorLabel != null) {
      Image ancestorImage = content.getAncestorImage(input);
      if (ancestorImage != null)
        fAncestorLabel.setImage(ancestorImage);
      String ancestorLabel = content.getAncestorLabel(input);
      if (ancestorLabel != null)
        fAncestorLabel.setText(TextProcessor.process(ancestorLabel));
    }
    if (fLeftLabel != null) {
      Image leftImage = content.getLeftImage(input);
      if (leftImage != null)
        fLeftLabel.setImage(leftImage);
      String leftLabel = content.getLeftLabel(input);
      if (leftLabel != null)
        fLeftLabel.setText(TextProcessor.process(leftLabel));
    }
    if (fRightLabel != null) {
      Image rightImage = content.getRightImage(input);
      if (rightImage != null)
        fRightLabel.setImage(rightImage);
      String rightLabel = content.getRightLabel(input);
      if (rightLabel != null)
        fRightLabel.setText(TextProcessor.process(rightLabel));
    }
  }
View Full Code Here

    resetDiffs();
    fHasErrors = false; // start with no errors

    CompareConfiguration cc = getCompareConfiguration();
    IMergeViewerContentProvider cp = getMergeContentProvider();

    if (cp instanceof MergeViewerContentProvider) {
      MergeViewerContentProvider mcp = (MergeViewerContentProvider) cp;
      mcp.setAncestorError(null);
      mcp.setLeftError(null);
      mcp.setRightError(null);
    }

    // Record current contributors so we disconnect after creating the new
    // ones.
    // This is done in case the old and new use the same document.
    ContributorInfo oldLeftContributor = fLeftContributor;
    ContributorInfo oldRightContributor = fRightContributor;
    ContributorInfo oldAncestorContributor = fAncestorContributor;

    // Create the new contributor
    fLeftContributor = createLegInfoFor(left, LEFT_CONTRIBUTOR);
    fRightContributor = createLegInfoFor(right, RIGHT_CONTRIBUTOR);
    fAncestorContributor = createLegInfoFor(ancestor, ANCESTOR_CONTRIBUTOR);

    fLeftContributor.transferContributorStateFrom(oldLeftContributor);
    fRightContributor.transferContributorStateFrom(oldRightContributor);
    fAncestorContributor
        .transferContributorStateFrom(oldAncestorContributor);

    // Now disconnect the old ones
    disconnect(oldLeftContributor);
    disconnect(oldRightContributor);
    disconnect(oldAncestorContributor);

    // Get encodings from streams. If an encoding is null, abide by the
    // other one
    // Defaults to workbench encoding only if both encodings are null
    fLeftContributor.setEncodingIfAbsent(fRightContributor);
    fRightContributor.setEncodingIfAbsent(fLeftContributor);
    fAncestorContributor.setEncodingIfAbsent(fLeftContributor);

    // set new documents
    fLeftContributor.setDocument(fLeft,
        cc.isLeftEditable() && cp.isLeftEditable(input));
    fLeftLineCount = fLeft.getLineCount();

    fRightContributor.setDocument(fRight,
        cc.isRightEditable() && cp.isRightEditable(input));
    fRightLineCount = fRight.getLineCount();

    fAncestorContributor.setDocument(fAncestor, false);

    // if the input is part of a patch hunk, toggle synchronized scrolling
View Full Code Here

    }
    return 0;
  }

  private void setError(char type, String message) {
    IMergeViewerContentProvider cp = getMergeContentProvider();
    if (cp instanceof MergeViewerContentProvider) {
      MergeViewerContentProvider mcp = (MergeViewerContentProvider) cp;
      switch (type) {
      case ANCESTOR_CONTRIBUTOR:
        mcp.setAncestorError(message);
View Full Code Here

    updateStatus(fCurrentDiff);
    updateResolveStatus();

    if (fCurrentDiff != null) {
      IMergeViewerContentProvider cp = getMergeContentProvider();
      if (cp != null) {
        if (!isPatchHunk()) {
          rightToLeft = cp.isLeftEditable(getInput());
          leftToRight = cp.isRightEditable(getInput());
        }
      }
    }

    if (fDirectionLabel != null) {
View Full Code Here

   * (java.lang.Object, org.eclipse.core.runtime.IProgressMonitor)
   */
  protected void flushContentOld(Object oldInput, IProgressMonitor monitor) {

    // check and handle any shared buffers
    IMergeViewerContentProvider content = getMergeContentProvider();
    Object leftContent = content.getLeftContent(oldInput);
    Object rightContent = content.getRightContent(oldInput);

    if (leftContent != null && getCompareConfiguration().isLeftEditable()
        && isLeftDirty()) {
      if (fLeftContributor.hasSharedDocument(leftContent)) {
        if (flush(fLeftContributor))
View Full Code Here

  protected void flushContent(Object oldInput, IProgressMonitor monitor) {
    flushLeftSide(oldInput, monitor);
    flushRightSide(oldInput, monitor);

    IMergeViewerContentProvider content = getMergeContentProvider();

    if (!(content instanceof MergeViewerContentProvider) || isLeftDirty()
        || isRightDirty()) {
      super.flushContent(oldInput, monitor);
    }
View Full Code Here

      return true;
    return false;
  }

  void flushLeftSide(Object oldInput, IProgressMonitor monitor) {
    IMergeViewerContentProvider content = getMergeContentProvider();
    Object leftContent = content.getLeftContent(oldInput);

    if (leftContent != null && getCompareConfiguration().isLeftEditable()
        && isLeftDirty()) {
      if (fLeftContributor.hasSharedDocument(leftContent)) {
        if (flush(fLeftContributor))
View Full Code Here

      super.flushLeftSide(oldInput, monitor);
    }
  }

  void flushRightSide(Object oldInput, IProgressMonitor monitor) {
    IMergeViewerContentProvider content = getMergeContentProvider();
    Object rightContent = content.getRightContent(oldInput);

    if (rightContent != null && getCompareConfiguration().isRightEditable()
        && isRightDirty()) {
      if (fRightContributor.hasSharedDocument(rightContent)) {
        if (flush(fRightContributor))
View Full Code Here

TOP

Related Classes of org.eclipse.compare.contentmergeviewer.IMergeViewerContentProvider

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.