Package org.eclipse.compare

Examples of org.eclipse.compare.CompareEditorInput


                        return ;
                    }
                    IStructuredSelection sel = (IStructuredSelection)event.getSelection();
                    Object sel0 = sel.getFirstElement();
                    final IResource resource= (IResource)sel0;
                    CompareEditorInput compareEditorInput = null;
                    ISVNRemoteResource svnRemoteResource1 = null;
                    ISVNRemoteResource svnRemoteResource2 = null;
                    final ISVNLocalResource localResource= SVNWorkspaceRoot.getSVNResourceFor(resource);
                    String[] startAndStopVersion = getStartAndStopVersion();
                    SVNRevision[] fromAndToRevision = RbSVNUrlUtils.formateSVNRevisionUnify(startAndStopVersion[0], startAndStopVersion[1]);
                   
                    SVNRevision startVersion = fromAndToRevision[0];
                    SVNRevision stopVersion = fromAndToRevision[1];
                    //修复版本号
                    if( stopVersion instanceof SVNRevision.Number ){
                        stopVersion = RbSVNUrlUtils.reviseSVNRevision( resource, (SVNRevision.Number)fromAndToRevision[1], true, true, null );
                    }
                    if( startVersion instanceof SVNRevision.Number ){
                        startVersion = RbSVNUrlUtils.reviseSVNRevision( resource, (SVNRevision.Number)fromAndToRevision[0], false, true,
                                stopVersion instanceof SVNRevision.Number ? (SVNRevision.Number)stopVersion : null );
                    }
                    //尽可能少地访问SVN库,以提高性能
                    if( startVersion instanceof SVNRevision.Number && stopVersion instanceof SVNRevision.Number ){
                        if( ((SVNRevision.Number)startVersion).getNumber() == ((SVNRevision.Number)stopVersion).getNumber() ){
                            MessageDialog.openError(getShell(),
                                    RbSubclipseMessages.getString("ERROR_INFORMATION_LABLE"),
                                    RbSubclipseMessages.getString("ERROR_COMPARE_1")); //$NON-NLS-1$
                            return ;
                        }
                    }
                    if( !(startVersion instanceof SVNRevision.Number) && !(stopVersion instanceof SVNRevision.Number) ){
                        if( startVersion.equals(stopVersion) ){
                            MessageDialog.openError(getShell(),
                                    RbSubclipseMessages.getString("ERROR_INFORMATION_LABLE"),
                                    RbSubclipseMessages.getString("ERROR_COMPARE_1")); //$NON-NLS-1$
                            return ;
                        }
                    }
                   
                    try {
                        svnRemoteResource1 = localResource.getRemoteResource( startVersion );
                        svnRemoteResource2 = localResource.getRemoteResource( stopVersion );
                    } catch (Exception e) {
                        MessageDialog.openError(getShell(), RbSubclipseMessages.getString("ERROR_INFORMATION_LABLE"),
                                RbSubclipseMessages.getString("ERROR_COMPARE")+e.getMessage()); //$NON-NLS-1$
                        return ;
                    }
                   
                    if( svnRemoteResource1.isFolder() ){
                        MessageDialog.openInformation(getShell(), RbSubclipseMessages.getString("PROMPTING_INFORMATION_LABLE"),
                                RbSubclipseMessages.getString("ERROR_COMPARE_1")); //$NON-NLS-1$
                        return ;
                    }else{
                        ResourceEditionNode left = new ResourceEditionNode( svnRemoteResource1 );
                        ResourceEditionNode right = new ResourceEditionNode( svnRemoteResource2 );
                        compareEditorInput = new SVNCompareEditorInput(left, right);
                    }
                    if( null != compareEditorInput ){
                        try {
                            compareEditorInput.run( new NullProgressMonitor() );
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                        compareViewerPane.setTitleArgument( "Version Compare:" + svnRemoteResource1.getLastChangedRevision() + ":" + svnRemoteResource2.getLastChangedRevision());
                        compareViewerPane.setInput(compareEditorInput.getCompareResult());
                        showComparePane(true);
                        showCompareButton.setSelection(true);
                    }
                }
           
View Full Code Here


  public Object execute(final ExecutionEvent event) throws ExecutionException {
    int mergeMode = Activator.getDefault().getPreferenceStore().getInt(
        UIPreferences.MERGE_MODE);
    IPath[] locations = getSelectedLocations(event);
    CompareEditorInput input;
    if (mergeMode == 0) {
      MergeModeDialog dlg = new MergeModeDialog(getShell(event));
      if (dlg.open() != Window.OK)
        return null;
      input = new GitMergeEditorInput(dlg.useWorkspace(), locations);
View Full Code Here

      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

    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);

    if (page != null)
      openInCompare(page, in);
    else
View Full Code Here

      IPath location, String refName, IWorkbenchPage page)
      throws IOException {
    final String gitPath = getRepoRelativePath(location, repository);
    final ITypedElement base = new LocalNonWorkspaceTypedElement(location);

    CompareEditorInput in = prepareCompareInput(repository, gitPath, base,
        refName);

    if (page != null)
      openInCompare(page, in);
    else
View Full Code Here

        }
        IPath[] locations = locationList.toArray(new IPath[locationList
            .size()]);
        int mergeMode = Activator.getDefault().getPreferenceStore()
            .getInt(UIPreferences.MERGE_MODE);
        CompareEditorInput input;
        if (mergeMode == 0) {
          MergeModeDialog dlg = new MergeModeDialog(getParentShell());
          if (dlg.open() != Window.OK)
            return;
          input = new GitMergeEditorInput(dlg.useWorkspace(),
View Full Code Here

                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) {
                        Label lblCompareIntro = new Label(parent, SWT.WRAP);
                        lblCompareIntro.setText(UpgradeMessages.getString("UpgradeWizard.Compare.Content.message",
                                new String[] { upgradeModel.getIdeReleaseName() }));
                        lblCompareIntro.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
                        return super.createContents(parent);
                    }

                    @Override
                    protected Object prepareInput(IProgressMonitor monitor) throws InvocationTargetException,
                            InterruptedException {
                        ComponentCompareItem leftCompare = new ComponentCompareItem(localComponent);
                        ComponentCompareItem rightCompare = new ComponentCompareItem(remoteComponent);
                        return new DiffNode(leftCompare, rightCompare);
                    }
                };

                compareEditor.setTitle(UpgradeMessages.getString("UpgradeWizard.Compare.title",
                        new String[] { localComponent.getFileName() }));

                compareEditor.setFocus();

                if (compareResultOK(compareEditor, null)) {
                    Runnable runnable = new Runnable() {
                        public void run() {
                            CompareDialog dialog = new CompareDialog(getShell(), compareEditor);
View Full Code Here

TOP

Related Classes of org.eclipse.compare.CompareEditorInput

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.