Skip to main content
summaryrefslogtreecommitdiffstats
blob: 4daf9e54f319b10627c64d3191c95f65e36411a3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
 * (c) Copyright IBM Corp. 2000, 2001.
 * All Rights Reserved.
 */
package org.eclipse.compare.internal;

import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;

import org.eclipse.ui.IActionDelegate;
import org.eclipse.compare.CompareConfiguration;
import org.eclipse.compare.CompareUI;


public class CompareAction implements IActionDelegate {

	private ResourceCompareInput fInput;

	public void run(IAction action) {
		if (fInput != null) {
			CompareUI.openCompareEditor(fInput);
			fInput= null;	// don't reuse this input!
		}
	}

	public void selectionChanged(IAction action, ISelection selection) {
		if (fInput == null) {
			CompareConfiguration cc= new CompareConfiguration();
			// buffered merge mode: don't ask for confirmation
			// when switching between modified resources
			cc.setProperty(CompareEditor.CONFIRM_SAVE_PROPERTY, new Boolean(false));
						
			fInput= new ResourceCompareInput(cc);
		}
		action.setEnabled(fInput.setSelection(selection));
	}
}

Back to the top