Search in sources :

Example 1 with SVNConflictVersion

use of org.tigris.subversion.svnclientadapter.SVNConflictVersion in project subclipse by subclipse.

the class ResourceStatus method readFromVersion4Stream.

private void readFromVersion4Stream(StatusFromBytesStream dis) throws IOException {
    fileExternal = dis.readBoolean();
    treeConflicted = dis.readBoolean();
    if (treeConflicted) {
        int action = dis.readInt();
        int reason = dis.readInt();
        int operation = dis.readInt();
        String leftReposURL = dis.readString();
        long leftPegRevision = dis.readLong();
        String leftPathInRepos = dis.readString();
        int leftNodeKind = dis.readInt();
        SVNConflictVersion srcLeftVersion = new SVNConflictVersion(leftReposURL, leftPegRevision, leftPathInRepos, leftNodeKind);
        String rightReposURL = dis.readString();
        long rightPegRevision = dis.readLong();
        String rightPathInRepos = dis.readString();
        int rightNodeKind = dis.readInt();
        SVNConflictVersion srcRightVersion = new SVNConflictVersion(rightReposURL, rightPegRevision, rightPathInRepos, rightNodeKind);
        conflictDescriptor = new SVNConflictDescriptor(url, action, reason, operation, srcLeftVersion, srcRightVersion);
    } else
        conflictDescriptor = null;
}
Also used : SVNConflictVersion(org.tigris.subversion.svnclientadapter.SVNConflictVersion) SVNConflictDescriptor(org.tigris.subversion.svnclientadapter.SVNConflictDescriptor)

Example 2 with SVNConflictVersion

use of org.tigris.subversion.svnclientadapter.SVNConflictVersion in project subclipse by subclipse.

the class SVNPropertyPage method addSecondSection.

private void addSecondSection(Composite parent) {
    Composite composite = createDefaultComposite(parent);
    Label label = new Label(composite, SWT.NONE);
    // $NON-NLS-1$
    label.setText(Policy.bind("SVNPropertyPage.status"));
    statusValue = new Text(composite, SWT.READ_ONLY);
    statusValue.setBackground(composite.getBackground());
    label = new Label(composite, SWT.NONE);
    // $NON-NLS-1$
    label.setText(Policy.bind("SVNPropertyPage.propStatus"));
    propertiesValue = new Text(composite, SWT.READ_ONLY);
    propertiesValue.setBackground(composite.getBackground());
    if (urlCopiedFrom != null || status.getMovedFromAbspath() != null) {
        label = new Label(composite, SWT.NONE);
        if (status.getMovedFromAbspath() != null) {
            // $NON-NLS-1$
            label.setText(Policy.bind("SVNPropertyPage.movedFrom"));
        } else {
            // $NON-NLS-1$
            label.setText(Policy.bind("SVNPropertyPage.copiedFrom"));
        }
        copiedFromValue = new Text(composite, SWT.WRAP | SWT.READ_ONLY);
        copiedFromValue.setBackground(composite.getBackground());
        GridData gd = new GridData();
        gd.widthHint = 500;
        copiedFromValue.setLayoutData(gd);
    }
    if (status.getLastChangedRevision() != null) {
        label = new Label(composite, SWT.NONE);
        // $NON-NLS-1$
        label.setText(Policy.bind("SVNPropertyPage.changedRevision"));
        lastChangedRevisionValue = new Text(composite, SWT.READ_ONLY);
        lastChangedRevisionValue.setBackground(composite.getBackground());
        label = new Label(composite, SWT.NONE);
        // $NON-NLS-1$
        label.setText(Policy.bind("SVNPropertyPage.changedDate"));
        lastChangedDateValue = new Text(composite, SWT.READ_ONLY);
        lastChangedDateValue.setBackground(composite.getBackground());
        label = new Label(composite, SWT.NONE);
        // $NON-NLS-1$
        label.setText(Policy.bind("SVNPropertyPage.changedAuthor"));
        lastCommitAuthorValue = new Text(composite, SWT.READ_ONLY);
        lastCommitAuthorValue.setBackground(composite.getBackground());
    }
    if (lockOwnerText != null) {
        label = new Label(composite, SWT.NONE);
        // $NON-NLS-1$
        label.setText(Policy.bind("SVNPropertyPage.lockOwner"));
        lockOwner = new Text(composite, SWT.READ_ONLY);
        lockOwner.setBackground(composite.getBackground());
        label = new Label(composite, SWT.NONE);
        // $NON-NLS-1$
        label.setText(Policy.bind("SVNPropertyPage.lockCreationDate"));
        lockCreationDate = new Text(composite, SWT.READ_ONLY);
        lockCreationDate.setBackground(composite.getBackground());
        label = new Label(composite, SWT.NONE);
        // $NON-NLS-1$
        label.setText(Policy.bind("SVNPropertyPage.lockComment"));
        lockComment = new Label(composite, SWT.WRAP);
        GridData gd = new GridData();
        gd.widthHint = 500;
        lockComment.setLayoutData(gd);
    }
    if (status.hasTreeConflict()) {
        label = new Label(composite, SWT.NONE);
        // $NON-NLS-1$
        label.setText(Policy.bind("SVNPropertyPage.treeConflict"));
        treeConflict = new Text(composite, SWT.READ_ONLY);
        treeConflict.setBackground(composite.getBackground());
        SVNConflictDescriptor conflictDescriptor = status.getConflictDescriptor();
        if (// $NON-NLS-1$
        conflictDescriptor == null)
            // $NON-NLS-1$
            treeConflict.setText("true");
        else {
            SVNTreeConflict svnTreeConflict = new SVNTreeConflict(status);
            treeConflict.setText(svnTreeConflict.getDescription());
            SVNConflictVersion srcLeftVersion = svnTreeConflict.getConflictDescriptor().getSrcLeftVersion();
            if (srcLeftVersion != null) {
                new Label(composite, SWT.NONE);
                Text srcLeftVersionValue = new Text(composite, SWT.WRAP | SWT.READ_ONLY);
                GridData gd = new GridData();
                gd.widthHint = 500;
                srcLeftVersionValue.setLayoutData(gd);
                // $NON-NLS-1$
                srcLeftVersionValue.setText("Source  left: " + srcLeftVersion.toString());
                srcLeftVersionValue.setBackground(composite.getBackground());
            }
            SVNConflictVersion srcRightVersion = svnTreeConflict.getConflictDescriptor().getSrcRightVersion();
            if (srcRightVersion != null) {
                new Label(composite, SWT.NONE);
                Text srcRightVersionValue = new Text(composite, SWT.WRAP | SWT.READ_ONLY);
                GridData gd = new GridData();
                gd.widthHint = 500;
                srcRightVersionValue.setLayoutData(gd);
                srcRightVersionValue.setText(// $NON-NLS-1$
                "Source right: " + srcRightVersion.toString());
                srcRightVersionValue.setBackground(composite.getBackground());
            }
        }
    }
}
Also used : Composite(org.eclipse.swt.widgets.Composite) Label(org.eclipse.swt.widgets.Label) GridData(org.eclipse.swt.layout.GridData) SVNConflictVersion(org.tigris.subversion.svnclientadapter.SVNConflictVersion) Text(org.eclipse.swt.widgets.Text) SVNConflictDescriptor(org.tigris.subversion.svnclientadapter.SVNConflictDescriptor) SVNTreeConflict(org.tigris.subversion.subclipse.core.resources.SVNTreeConflict)

Example 3 with SVNConflictVersion

use of org.tigris.subversion.svnclientadapter.SVNConflictVersion in project subclipse by subclipse.

the class MergeResultsView method createPartControl.

public void createPartControl(Composite parent) {
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    layout.verticalSpacing = 2;
    layout.marginWidth = 0;
    layout.marginHeight = 2;
    parent.setLayout(layout);
    treeViewer = new TreeViewer(parent);
    treeViewer.setLabelProvider(labelProvider);
    treeViewer.setContentProvider(new MergeResultsViewContentProvider());
    treeViewer.setUseHashlookup(true);
    GridData layoutData = new GridData();
    layoutData.grabExcessHorizontalSpace = true;
    layoutData.grabExcessVerticalSpace = true;
    layoutData.horizontalAlignment = GridData.FILL;
    layoutData.verticalAlignment = GridData.FILL;
    treeViewer.getControl().setLayoutData(layoutData);
    treeViewer.setInput(this);
    treeViewer.addOpenListener(new IOpenListener() {

        public void open(OpenEvent event) {
            treeConflict = null;
            IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection();
            Object selectedItem = selection.getFirstElement();
            MergeResult mergeResult = null;
            if (selectedItem instanceof AdaptableMergeResult)
                mergeResult = (MergeResult) selectedItem;
            if (selectedItem instanceof AdaptableMergeResultsFolder) {
                MergeResultsFolder mergeResultsFolder = (MergeResultsFolder) selectedItem;
                mergeResult = mergeResultsFolder.getMergeResult();
            }
            if (mergeResult != null) {
                if (mergeResult.getResource() instanceof IFile && mergeResult.isConflicted() && !mergeResult.isResolved()) {
                    editConflicts(mergeResult);
                    return;
                }
                if (mergeResult.getResource() instanceof IFile && mergeResult.hasTreeConflict() && !mergeResult.isTreeConflictResolved()) {
                    boolean addAddConflict = false;
                    if (mergeResult.getResource() != null && mergeResult.getResource().exists()) {
                        treeConflict = getTreeConflict(mergeResult.getResource());
                        if (treeConflict != null && treeConflict.getDescription() != null && treeConflict.getDescription().contains("local add") && treeConflict.getDescription().contains("incoming add")) {
                            // $NON-NLS-1$ //$NON-NLS-2$
                            addAddConflict = true;
                        }
                        if (!addAddConflict) {
                            openAction.run();
                        }
                    }
                    if (!addAddConflict) {
                        return;
                    }
                }
                if (!mergeResult.getAction().equals(MergeResult.ACTION_DELETE)) {
                    final ISVNLocalResource localResource = SVNWorkspaceRoot.getSVNResourceFor(mergeResult.getResource());
                    if (!localResource.exists()) {
                        return;
                    }
                    BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {

                        public void run() {
                            try {
                                if (treeConflict != null) {
                                    if (!localResource.isFolder()) {
                                        SVNConflictDescriptor descriptor = treeConflict.getConflictDescriptor();
                                        SVNConflictVersion rightVersion = descriptor.getSrcRightVersion();
                                        try {
                                            ISVNRemoteFile remoteFile = new RemoteFile(localResource.getRepository(), new SVNUrl(rightVersion.getReposURL() + "/" + rightVersion.getPathInRepos()), new SVNRevision.Number(rightVersion.getPegRevision()));
                                            SVNLocalCompareInput compareInput = new SVNLocalCompareInput(localResource, remoteFile);
                                            CompareUI.openCompareEditorOnPage(compareInput, getSite().getPage());
                                        } catch (Exception e) {
                                        }
                                    }
                                    return;
                                }
                                CompareUI.openCompareEditorOnPage(new SVNLocalCompareInput(localResource, SVNRevision.BASE), getSite().getPage());
                            } catch (SVNException e) {
                                if (!e.operationInterrupted()) {
                                    Activator.handleError(Messages.MergeResultsView_compareError, e);
                                    MessageDialog.openError(Display.getCurrent().getActiveShell(), Messages.MergeResultsView_compareWithLatest, e.getLocalizedMessage());
                                }
                            } catch (SVNClientException e) {
                                Activator.handleError(Messages.MergeResultsView_compareError, e);
                                MessageDialog.openError(Display.getCurrent().getActiveShell(), Messages.MergeResultsView_compareWithLatest, e.getLocalizedMessage());
                            }
                        }
                    });
                }
            }
        }
    });
    treeViewer.getTree().addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            boolean mergeOutputSelected = false;
            IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection();
            Iterator iter = selection.iterator();
            while (iter.hasNext()) {
                if (iter.next() instanceof MergeOutput) {
                    mergeOutputSelected = true;
                    break;
                }
            }
            removeAction.setEnabled(mergeOutputSelected);
        }
    });
    createMenus();
    createToolbar();
    getSite().setSelectionProvider(treeViewer);
    if (Activator.getDefault().getPreferenceStore().getBoolean(CONFLICTS_ONLY_PREFERENCE))
        setContentDescription(Messages.MergeResultsView_conflictsMode);
}
Also used : IFile(org.eclipse.core.resources.IFile) TreeViewer(org.eclipse.jface.viewers.TreeViewer) MergeResult(com.collabnet.subversion.merge.MergeResult) AdaptableMergeResult(com.collabnet.subversion.merge.AdaptableMergeResult) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) SVNException(org.tigris.subversion.subclipse.core.SVNException) ISVNLocalResource(org.tigris.subversion.subclipse.core.ISVNLocalResource) GridLayout(org.eclipse.swt.layout.GridLayout) AdaptableMergeResultsFolder(com.collabnet.subversion.merge.AdaptableMergeResultsFolder) ISVNRemoteFile(org.tigris.subversion.subclipse.core.ISVNRemoteFile) SVNClientException(org.tigris.subversion.svnclientadapter.SVNClientException) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Iterator(java.util.Iterator) MergeOutput(com.collabnet.subversion.merge.MergeOutput) SVNConflictVersion(org.tigris.subversion.svnclientadapter.SVNConflictVersion) RemoteFile(org.tigris.subversion.subclipse.core.resources.RemoteFile) ISVNRemoteFile(org.tigris.subversion.subclipse.core.ISVNRemoteFile) AdaptableMergeResultsFolder(com.collabnet.subversion.merge.AdaptableMergeResultsFolder) MergeResultsFolder(com.collabnet.subversion.merge.MergeResultsFolder) AdaptableMergeResult(com.collabnet.subversion.merge.AdaptableMergeResult) SVNLocalCompareInput(org.tigris.subversion.subclipse.ui.compare.SVNLocalCompareInput) SVNUrl(org.tigris.subversion.svnclientadapter.SVNUrl) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SVNConflictDescriptor(org.tigris.subversion.svnclientadapter.SVNConflictDescriptor) SVNException(org.tigris.subversion.subclipse.core.SVNException) SVNClientException(org.tigris.subversion.svnclientadapter.SVNClientException) IOpenListener(org.eclipse.jface.viewers.IOpenListener) GridData(org.eclipse.swt.layout.GridData) SVNRevision(org.tigris.subversion.svnclientadapter.SVNRevision) OpenEvent(org.eclipse.jface.viewers.OpenEvent)

Aggregations

SVNConflictDescriptor (org.tigris.subversion.svnclientadapter.SVNConflictDescriptor)3 SVNConflictVersion (org.tigris.subversion.svnclientadapter.SVNConflictVersion)3 GridData (org.eclipse.swt.layout.GridData)2 AdaptableMergeResult (com.collabnet.subversion.merge.AdaptableMergeResult)1 AdaptableMergeResultsFolder (com.collabnet.subversion.merge.AdaptableMergeResultsFolder)1 MergeOutput (com.collabnet.subversion.merge.MergeOutput)1 MergeResult (com.collabnet.subversion.merge.MergeResult)1 MergeResultsFolder (com.collabnet.subversion.merge.MergeResultsFolder)1 Iterator (java.util.Iterator)1 IFile (org.eclipse.core.resources.IFile)1 IOpenListener (org.eclipse.jface.viewers.IOpenListener)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 OpenEvent (org.eclipse.jface.viewers.OpenEvent)1 TreeViewer (org.eclipse.jface.viewers.TreeViewer)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Composite (org.eclipse.swt.widgets.Composite)1 Label (org.eclipse.swt.widgets.Label)1 Text (org.eclipse.swt.widgets.Text)1