Package org.eclipse.compare

Examples of org.eclipse.compare.CompareConfiguration


      if (monitor.isCanceled())
        throw new InterruptedException();

      // set the labels
      CompareConfiguration config = getCompareConfiguration();
      config.setRightLabel(NLS.bind(LABELPATTERN, rightCommit
          .getShortMessage(), CompareUtils.truncatedRevision(rightCommit.name())));

      if (!useWorkspace)
        config.setLeftLabel(NLS.bind(LABELPATTERN, headCommit
            .getShortMessage(), CompareUtils.truncatedRevision(headCommit.name())));
      else
        config.setLeftLabel(UIText.GitMergeEditorInput_WorkspaceHeader);

      if (ancestorCommit != null)
        config.setAncestorLabel(NLS.bind(LABELPATTERN, ancestorCommit
            .getShortMessage(), CompareUtils.truncatedRevision(ancestorCommit.name())));

      // set title and icon
      setTitle(NLS.bind(UIText.GitMergeEditorInput_MergeEditorTitle,
          new Object[] {
View Full Code Here


   * @param left
   * @param right
   * @param page
   */
  public GitCompareFileRevisionEditorInput(ITypedElement left, ITypedElement right, IWorkbenchPage page) {
    super(new CompareConfiguration(), page);
    this.left = left;
    this.right = right;
  }
View Full Code Here

   * @param right
   * @param ancestor
   * @param page
   */
  public GitCompareFileRevisionEditorInput(ITypedElement left, ITypedElement right, ITypedElement ancestor, IWorkbenchPage page) {
    super(new CompareConfiguration(), page);
    this.left = left;
    this.right = right;
    this.ancestor = ancestor;
  }
View Full Code Here

      return new DiffNode(diffType, null, l, r);
    }
  }

  private void initLabels(ICompareInput input) {
    CompareConfiguration cc = getCompareConfiguration();
    if (getLeftRevision() != null) {
      String leftLabel = getFileRevisionLabel(getLeftRevision());
      cc.setLeftLabel(leftLabel);
    } else if (getResource() != null) {
      String label = NLS.bind(UIText.GitCompareFileRevisionEditorInput_LocalLabel, new Object[]{ input.getLeft().getName() });
      cc.setLeftLabel(label);
    } else {
      cc.setLeftLabel(left.getName());
    }
    if (getRightRevision() != null) {
      String rightLabel = getFileRevisionLabel(getRightRevision());
      cc.setRightLabel(rightLabel);
    } else {
      cc.setRightLabel(right.getName());
    }
    if (getAncestorRevision() != null) {
      String ancestorLabel = getFileRevisionLabel(getAncestorRevision());
      cc.setAncestorLabel(ancestorLabel);
    }

  }
View Full Code Here

                final TreeItem treeItem = (TreeItem)event.item;
                if (treeItem.getData("local") == null || !(treeItem.getData("local") instanceof Component)) { return; }

                final Component localComponent = (Component)treeItem.getData("local");
                final Component remoteComponent = (Component)treeItem.getData("remote");
                final CompareConfiguration componentCompareConfiguration = new CompareConfiguration();
                componentCompareConfiguration.setLeftEditable(false);
                componentCompareConfiguration.setRightEditable(false);
                componentCompareConfiguration.setLeftLabel(UpgradeMessages
                        .getString("UpgradeWizard.Compare.LocalFile.title"));
                componentCompareConfiguration.setRightLabel(UpgradeMessages
                        .getString("UpgradeWizard.Compare.RemoteFile.title"));

                final CompareEditorInput compareEditor = new CompareEditorInput(componentCompareConfiguration) {
                    @Override
                    public Control createContents(Composite parent) {
View Full Code Here

    return composite;
  }

  private Control createPreviewer(Composite parent) {
    final CompareConfiguration compareConfiguration = new CompareConfiguration();
    compareConfiguration.setLeftLabel(ResourceUtil.getString("CompareResultDialog.expectedLabel")); //$NON-NLS-1$
    compareConfiguration.setLeftEditable(false);
    compareConfiguration.setRightLabel(ResourceUtil.getString("CompareResultDialog.actualLabel")); //$NON-NLS-1$
    compareConfiguration.setRightEditable(false);
    compareConfiguration.setProperty(CompareConfiguration.IGNORE_WHITESPACE, Boolean.FALSE);

    fViewer = new CompareResultMergeViewer(parent, SWT.NONE, compareConfiguration);
    fViewer.setInput(new DiffNode(new CompareElement(fExpected), new CompareElement(fActual)));

    Control control = fViewer.getControl();
    control.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
          if(compareConfiguration != null) {
            compareConfiguration.dispose();
          }
        }
      });

    return control;
View Full Code Here

    viewer.getTree().setHeaderVisible(true);
    viewer.getTree().setLinesVisible(true);

    labelProvider = WorkbenchLabelProvider.getDecoratingWorkbenchLabelProvider();
    final SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss"); //$NON-NLS-1$
    final CompareConfiguration config = new CompareConfiguration();

    TreeViewerColumn resourceColumn = new TreeViewerColumn(viewer, SWT.LEAD);
    resourceColumn.getColumn().setText("Changes");
    resourceColumn.getColumn().setWidth(100);
    resourceColumn.setLabelProvider(new ColumnLabelProvider() {
      public String getText(Object element) {
        if (element instanceof BatchModelChange) {
          StringBuffer buffer = new StringBuffer();
          BatchModelChange batchChange = (BatchModelChange) element;
          buffer.append(batchChange.isOutgoing() ? "Outgoing"
              : "Incoming");
          buffer.append(" (");
          buffer.append(formatter.format(new Date(batchChange
              .getTime())));
          buffer.append(')');
          return buffer.toString();
        } else {
          return new Path(((ResourceChangeMessage) element).getPath())
              .lastSegment();
        }
      }

      public Image getImage(Object element) {
        if (element instanceof BatchModelChange) {
          Image image = PlatformUI.getWorkbench().getSharedImages()
              .getImage(ISharedImages.IMG_OBJ_FOLDER);
          int kind = 0;
          if (((BatchModelChange) element).isOutgoing()) {
            kind = (kind & ~SyncInfo.OUTGOING)
                | SyncInfo.INCOMING | SyncInfo.CHANGE;
          } else {
            kind = (kind & ~SyncInfo.OUTGOING)
                | SyncInfo.OUTGOING | SyncInfo.CHANGE;
          }
          return config.getImage(image, kind);
        } else {
          ResourceChangeMessage message = (ResourceChangeMessage) element;
          int type = message.getType();
          IPath path = new Path(message.getPath());

          Image image = null;
          if (type == IResource.FILE) {
            image = labelProvider.getImage(ResourcesPlugin
                .getWorkspace().getRoot().getFile(path));
          } else {
            image = labelProvider.getImage(ResourcesPlugin
                .getWorkspace().getRoot().getFolder(path));
          }

          if (message.isConflicted()) {
            return config.getImage(image, SyncInfo.CHANGE
                | SyncInfo.CONFLICTING);
          }

          int imageKind = 0;
          switch (message.getKind()) {
          case IResourceDelta.ADDED:
            imageKind = (imageKind & ~SyncInfo.CHANGE)
                | SyncInfo.DELETION;
            break;
          case IResourceDelta.CHANGED:
            imageKind = (imageKind & ~SyncInfo.CHANGE)
                | SyncInfo.CHANGE;
            break;
          case IResourceDelta.REMOVED:
            imageKind = (imageKind & ~SyncInfo.CHANGE)
                | SyncInfo.ADDITION;
            break;
          default:
            return null;
          }
          return config.getImage(image, imageKind);
        }
      }
    });

    TreeViewerColumn pathColumn = new TreeViewerColumn(viewer, SWT.LEAD);
View Full Code Here

TOP

Related Classes of org.eclipse.compare.CompareConfiguration

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.