Search in sources :

Example 1 with CompareDialog

use of org.tigris.subversion.subclipse.ui.dialogs.CompareDialog in project subclipse by subclipse.

the class SvnWizardRevertPage method createControls.

public void createControls(Composite outerContainer) {
    Composite composite = new Composite(outerContainer, SWT.NULL);
    GridLayout layout = new GridLayout(1, false);
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    ResourceSelectionTree.IToolbarControlCreator toolbarControlCreator = new ResourceSelectionTree.IToolbarControlCreator() {

        public void createToolbarControls(ToolBarManager toolbarManager) {
            toolbarManager.add(new // $NON-NLS-1$
            ControlContribution(// $NON-NLS-1$
            "ignoreUnversioned") {

                protected Control createControl(Composite parent) {
                    includeUnversionedButton = new Button(parent, SWT.CHECK);
                    includeUnversionedButton.setText(// $NON-NLS-1$
                    Policy.bind("CommitDialog.includeUnversioned"));
                    includeUnversionedButton.setSelection(includeUnversioned);
                    includeUnversionedButton.addSelectionListener(new SelectionListener() {

                        public void widgetSelected(SelectionEvent e) {
                            includeUnversioned = includeUnversionedButton.getSelection();
                            if (!includeUnversioned) {
                                resourceSelectionTree.removeUnversioned();
                            } else {
                                resourceSelectionTree.addUnversioned();
                            }
                            selectedResources = resourceSelectionTree.getSelectedResources();
                            setPageComplete(canFinish());
                            if (!fromSyncView)
                                updatePreference(includeUnversioned);
                        }

                        public void widgetDefaultSelected(SelectionEvent e) {
                        }
                    });
                    return includeUnversionedButton;
                }
            });
        }

        public int getControlCount() {
            return 1;
        }
    };
    IResource[] dedupedResourcesToRevert = ResourceSelectionTree.dedupeResources(resourcesToRevert);
    if (dedupedResourcesToRevert.length != resourcesToRevert.length) {
        resourceRemoved = true;
    }
    resourceSelectionTree = new ResourceSelectionTree(composite, SWT.NONE, Policy.bind("GenerateSVNDiff.Changes"), dedupedResourcesToRevert, statusMap, null, true, toolbarControlCreator, // $NON-NLS-1$
    null);
    if (!resourceSelectionTree.showIncludeUnversionedButton())
        includeUnversionedButton.setVisible(false);
    // resourceSelectionTree.getTreeViewer().setAllChecked(true);
    resourceSelectionTree.getTreeViewer().addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            selectedResources = resourceSelectionTree.getSelectedResources();
        }
    });
    ((CheckboxTreeViewer) resourceSelectionTree.getTreeViewer()).addCheckStateListener(new ICheckStateListener() {

        public void checkStateChanged(CheckStateChangedEvent event) {
            selectedResources = resourceSelectionTree.getSelectedResources();
        }
    });
    resourceSelectionTree.getTreeViewer().addDoubleClickListener(new IDoubleClickListener() {

        public void doubleClick(DoubleClickEvent event) {
            IStructuredSelection sel = (IStructuredSelection) event.getSelection();
            Object sel0 = sel.getFirstElement();
            if (sel0 instanceof IFile) {
                final ISVNLocalResource localResource = SVNWorkspaceRoot.getSVNResourceFor((IFile) sel0);
                try {
                    new CompareDialog(getShell(), new SVNLocalCompareInput(localResource, SVNRevision.BASE, true)).open();
                } catch (Exception e1) {
                }
            }
        }
    });
    if (!includeUnversioned) {
        resourceSelectionTree.removeUnversioned();
    }
    resourceSelectionTree.getTreeViewer().getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    // Composite composite_1 = new Composite(composite, SWT.NONE);
    // composite_1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
    // composite_1.setLayout(new GridLayout());
    selectedResources = resourceSelectionTree.getSelectedResources();
    setPageComplete(canFinish());
    PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.REVERT_DIALOG);
}
Also used : IFile(org.eclipse.core.resources.IFile) ICheckStateListener(org.eclipse.jface.viewers.ICheckStateListener) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ISVNLocalResource(org.tigris.subversion.subclipse.core.ISVNLocalResource) ToolBarManager(org.eclipse.jface.action.ToolBarManager) GridLayout(org.eclipse.swt.layout.GridLayout) Control(org.eclipse.swt.widgets.Control) ResourceSelectionTree(org.tigris.subversion.subclipse.ui.util.ResourceSelectionTree) Button(org.eclipse.swt.widgets.Button) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) SelectionEvent(org.eclipse.swt.events.SelectionEvent) SVNLocalCompareInput(org.tigris.subversion.subclipse.ui.compare.SVNLocalCompareInput) Composite(org.eclipse.swt.widgets.Composite) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) CheckboxTreeViewer(org.eclipse.jface.viewers.CheckboxTreeViewer) CompareDialog(org.tigris.subversion.subclipse.ui.dialogs.CompareDialog) GridData(org.eclipse.swt.layout.GridData) CheckStateChangedEvent(org.eclipse.jface.viewers.CheckStateChangedEvent) IResource(org.eclipse.core.resources.IResource) SelectionListener(org.eclipse.swt.events.SelectionListener)

Aggregations

IFile (org.eclipse.core.resources.IFile)1 IResource (org.eclipse.core.resources.IResource)1 ToolBarManager (org.eclipse.jface.action.ToolBarManager)1 CheckStateChangedEvent (org.eclipse.jface.viewers.CheckStateChangedEvent)1 CheckboxTreeViewer (org.eclipse.jface.viewers.CheckboxTreeViewer)1 DoubleClickEvent (org.eclipse.jface.viewers.DoubleClickEvent)1 ICheckStateListener (org.eclipse.jface.viewers.ICheckStateListener)1 IDoubleClickListener (org.eclipse.jface.viewers.IDoubleClickListener)1 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 SelectionListener (org.eclipse.swt.events.SelectionListener)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Button (org.eclipse.swt.widgets.Button)1 Composite (org.eclipse.swt.widgets.Composite)1 Control (org.eclipse.swt.widgets.Control)1 ISVNLocalResource (org.tigris.subversion.subclipse.core.ISVNLocalResource)1 SVNLocalCompareInput (org.tigris.subversion.subclipse.ui.compare.SVNLocalCompareInput)1