Lines 21-27
Link Here
|
21 |
import java.util.Iterator; |
21 |
import java.util.Iterator; |
22 |
import java.util.List; |
22 |
import java.util.List; |
23 |
|
23 |
|
|
|
24 |
import org.eclipse.compare.CompareEditorInput; |
25 |
import org.eclipse.compare.ITypedElement; |
26 |
import org.eclipse.compare.ResourceNode; |
24 |
import org.eclipse.compare.internal.merge.DocumentMerger; |
27 |
import org.eclipse.compare.internal.merge.DocumentMerger; |
|
|
28 |
import org.eclipse.compare.structuremergeviewer.DiffNode; |
29 |
import org.eclipse.compare.structuremergeviewer.ICompareInput; |
25 |
import org.eclipse.core.resources.IContainer; |
30 |
import org.eclipse.core.resources.IContainer; |
26 |
import org.eclipse.core.resources.IFile; |
31 |
import org.eclipse.core.resources.IFile; |
27 |
import org.eclipse.core.resources.IProject; |
32 |
import org.eclipse.core.resources.IProject; |
Lines 39-44
Link Here
|
39 |
import org.eclipse.jface.dialogs.TitleAreaDialog; |
44 |
import org.eclipse.jface.dialogs.TitleAreaDialog; |
40 |
import org.eclipse.jface.resource.ImageDescriptor; |
45 |
import org.eclipse.jface.resource.ImageDescriptor; |
41 |
import org.eclipse.jface.text.IDocument; |
46 |
import org.eclipse.jface.text.IDocument; |
|
|
47 |
import org.eclipse.jface.viewers.CheckboxTreeViewer; |
42 |
import org.eclipse.jface.viewers.DoubleClickEvent; |
48 |
import org.eclipse.jface.viewers.DoubleClickEvent; |
43 |
import org.eclipse.jface.viewers.IDoubleClickListener; |
49 |
import org.eclipse.jface.viewers.IDoubleClickListener; |
44 |
import org.eclipse.jface.viewers.ISelection; |
50 |
import org.eclipse.jface.viewers.ISelection; |
Lines 69-74
Link Here
|
69 |
import org.eclipse.swt.widgets.Listener; |
75 |
import org.eclipse.swt.widgets.Listener; |
70 |
import org.eclipse.swt.widgets.Shell; |
76 |
import org.eclipse.swt.widgets.Shell; |
71 |
import org.eclipse.swt.widgets.Text; |
77 |
import org.eclipse.swt.widgets.Text; |
|
|
78 |
import org.eclipse.ui.IWorkbenchPart; |
72 |
import org.eclipse.ui.model.BaseWorkbenchContentProvider; |
79 |
import org.eclipse.ui.model.BaseWorkbenchContentProvider; |
73 |
import org.eclipse.ui.model.WorkbenchLabelProvider; |
80 |
import org.eclipse.ui.model.WorkbenchLabelProvider; |
74 |
import org.eclipse.ui.views.navigator.ResourceComparator; |
81 |
import org.eclipse.ui.views.navigator.ResourceComparator; |
Lines 91-96
Link Here
|
91 |
dialog.setMinimumPageSize(INITIAL_WIDTH, INITIAL_HEIGHT); |
98 |
dialog.setMinimumPageSize(INITIAL_WIDTH, INITIAL_HEIGHT); |
92 |
dialog.open(); |
99 |
dialog.open(); |
93 |
} |
100 |
} |
|
|
101 |
public static void run(DiffNode diff, Shell shell) { |
102 |
final String title = CompareMessages.GenerateLocalDiff_title; |
103 |
final GenerateDiffFileWizard wizard = new GenerateDiffFileWizard(diff); |
104 |
wizard.setWindowTitle(title); |
105 |
WizardDialog dialog = new WizardDialog(shell, wizard); |
106 |
dialog.setMinimumPageSize(INITIAL_WIDTH, INITIAL_HEIGHT); |
107 |
dialog.setBlockOnOpen(false); |
108 |
dialog.open(); |
109 |
|
110 |
} |
94 |
|
111 |
|
95 |
protected class DirectionSelectionPage extends WizardPage { |
112 |
protected class DirectionSelectionPage extends WizardPage { |
96 |
|
113 |
|
Lines 213-218
Link Here
|
213 |
* The default values store used to initialize the selections. |
230 |
* The default values store used to initialize the selections. |
214 |
*/ |
231 |
*/ |
215 |
private final DefaultValuesStore store; |
232 |
private final DefaultValuesStore store; |
|
|
233 |
// private LocalPatchParticipant fParticipant; |
216 |
|
234 |
|
217 |
|
235 |
|
218 |
class LocationPageContentProvider extends BaseWorkbenchContentProvider { |
236 |
class LocationPageContentProvider extends BaseWorkbenchContentProvider { |
Lines 623-629
Link Here
|
623 |
public void createControl(Composite parent) { |
641 |
public void createControl(Composite parent) { |
624 |
|
642 |
|
625 |
final Composite composite= new Composite(parent, SWT.NULL); |
643 |
final Composite composite= new Composite(parent, SWT.NULL); |
626 |
composite.setLayout(new GridLayout()); |
644 |
GridLayout lay = new GridLayout(); |
|
|
645 |
lay.verticalSpacing = 15; |
646 |
composite.setLayout(lay); |
627 |
setControl(composite); |
647 |
setControl(composite); |
628 |
initializeDialogUnits(composite); |
648 |
initializeDialogUnits(composite); |
629 |
|
649 |
|
Lines 632-640
Link Here
|
632 |
|
652 |
|
633 |
//Create a location group |
653 |
//Create a location group |
634 |
setupLocationControls(composite); |
654 |
setupLocationControls(composite); |
635 |
|
655 |
|
636 |
initializeDefaultValues(); |
656 |
initializeDefaultValues(); |
637 |
|
657 |
|
|
|
658 |
|
659 |
if(startNode != null) { |
660 |
if(directionSelectionPage.isRightToLeft()) { |
661 |
CheckboxTreeViewer viewer = new CheckboxTreeViewer(composite, SWT.CHECK | SWT.H_SCROLL |
662 |
| SWT.V_SCROLL | SWT.BORDER | SWT.HORIZONTAL); |
663 |
|
664 |
viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); |
665 |
viewer.setContentProvider(new LocalChangesContentProvider(leftResource)); |
666 |
viewer.setLabelProvider(new LocalChangesLabelProvider()); |
667 |
viewer.setInput(leftResource.getWorkspace().getRoot()); |
668 |
} else { |
669 |
CheckboxTreeViewer viewer = new CheckboxTreeViewer(composite, SWT.CHECK | SWT.H_SCROLL |
670 |
| SWT.V_SCROLL | SWT.BORDER | SWT.HORIZONTAL); |
671 |
viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); |
672 |
viewer.setContentProvider(new LocalChangesContentProvider(rightResource)); |
673 |
viewer.setLabelProvider(new LocalChangesLabelProvider()); |
674 |
viewer.setInput(leftResource.getWorkspace().getRoot()); |
675 |
} |
676 |
} |
677 |
|
638 |
Dialog.applyDialogFont(parent); |
678 |
Dialog.applyDialogFont(parent); |
639 |
|
679 |
|
640 |
validatePage(); |
680 |
validatePage(); |
Lines 642-648
Link Here
|
642 |
updateEnablements(); |
682 |
updateEnablements(); |
643 |
setupListeners(); |
683 |
setupListeners(); |
644 |
} |
684 |
} |
645 |
|
685 |
|
|
|
686 |
|
646 |
/** |
687 |
/** |
647 |
* Setup the controls for the location. |
688 |
* Setup the controls for the location. |
648 |
*/ |
689 |
*/ |
Lines 1209-1214
Link Here
|
1209 |
private Text unified_customRelativeText; |
1250 |
private Text unified_customRelativeText; |
1210 |
private Button unified_customRelativeOption; |
1251 |
private Button unified_customRelativeOption; |
1211 |
|
1252 |
|
|
|
1253 |
private IResource rightResource; |
1254 |
private IResource leftResource; |
1255 |
|
1212 |
public GenerateDiffFileWizard() { |
1256 |
public GenerateDiffFileWizard() { |
1213 |
super(); |
1257 |
super(); |
1214 |
setWindowTitle(CompareMessages.GenerateLocalDiff_title); |
1258 |
setWindowTitle(CompareMessages.GenerateLocalDiff_title); |
Lines 1216-1221
Link Here
|
1216 |
defaultValuesStore = new DefaultValuesStore(); |
1260 |
defaultValuesStore = new DefaultValuesStore(); |
1217 |
} |
1261 |
} |
1218 |
|
1262 |
|
|
|
1263 |
private DiffNode startNode; |
1264 |
|
1265 |
public GenerateDiffFileWizard(DiffNode diff) { |
1266 |
this(); |
1267 |
startNode = diff; |
1268 |
ITypedElement left= diff.getLeft(); |
1269 |
if (left instanceof BufferedResourceNode) { |
1270 |
BufferedResourceNode bn= (BufferedResourceNode) left; |
1271 |
IResource resource= bn.getResource(); |
1272 |
leftResource = resource; |
1273 |
leftPath = resource.getFullPath().toString(); |
1274 |
} |
1275 |
ITypedElement right= diff.getRight(); |
1276 |
if (right instanceof BufferedResourceNode) { |
1277 |
BufferedResourceNode bn= (BufferedResourceNode) right; |
1278 |
IResource resource= bn.getResource(); |
1279 |
rightResource = resource; |
1280 |
rightPath = resource.getFullPath().toString(); |
1281 |
} |
1282 |
|
1283 |
} |
1284 |
|
1219 |
public GenerateDiffFileWizard(DocumentMerger merger, boolean rightToLeft) { |
1285 |
public GenerateDiffFileWizard(DocumentMerger merger, boolean rightToLeft) { |
1220 |
this(); |
1286 |
this(); |
1221 |
this.merger = merger; |
1287 |
this.merger = merger; |
Lines 1224-1229
Link Here
|
1224 |
this.leftPath = merger.getCompareConfiguration().getLeftLabel(leftDoc); |
1290 |
this.leftPath = merger.getCompareConfiguration().getLeftLabel(leftDoc); |
1225 |
this.rightPath = merger.getCompareConfiguration().getRightLabel(rightDoc); |
1291 |
this.rightPath = merger.getCompareConfiguration().getRightLabel(rightDoc); |
1226 |
this.rightToLeft = rightToLeft; |
1292 |
this.rightToLeft = rightToLeft; |
|
|
1293 |
IWorkbenchPart workbenchPart = merger.getCompareConfiguration().getContainer().getWorkbenchPart(); |
1294 |
|
1295 |
if(workbenchPart instanceof CompareEditor) { |
1296 |
|
1297 |
CompareEditor editor = (CompareEditor)workbenchPart; |
1298 |
|
1299 |
CompareEditorInput input = (CompareEditorInput)editor.getEditorInput(); |
1300 |
input.getCompareResult(); |
1301 |
if(input.getCompareResult() instanceof ICompareInput) { |
1302 |
ICompareInput node = (ICompareInput)input.getCompareResult(); |
1303 |
// ResourceNode leftResNode = (ResourceNode)node.getLeft(); |
1304 |
// ResourceNode rightResNode = (ResourceNode)node.getRight(); |
1305 |
|
1306 |
leftResource = ((ResourceNode)node.getLeft()).getResource(); |
1307 |
rightResource = ((ResourceNode)node.getRight()).getResource(); |
1308 |
} |
1309 |
|
1310 |
} |
1227 |
} |
1311 |
} |
1228 |
|
1312 |
|
1229 |
public void addPages() { |
1313 |
public void addPages() { |
Lines 1644-1647
Link Here
|
1644 |
} |
1728 |
} |
1645 |
} |
1729 |
} |
1646 |
|
1730 |
|
|
|
1731 |
|
1732 |
|
1647 |
} |
1733 |
} |