Lines 200-207
Link Here
|
200 |
// If the compare is three-way, this method asks the user which resource |
200 |
// If the compare is three-way, this method asks the user which resource |
201 |
// to use as the ancestor. Returns false if the user cancels the prompt, |
201 |
// to use as the ancestor. Returns false if the user cancels the prompt, |
202 |
// true otherwise. |
202 |
// true otherwise. |
203 |
boolean setSelection(ISelection s, Shell shell) { |
203 |
boolean setSelection(ISelection s, Shell shell, boolean selectAncestor) { |
204 |
|
204 |
|
|
|
205 |
if (!selectAncestor) |
206 |
return showDialog(shell, s); |
207 |
|
205 |
IResource[] selection= Utilities.getResources(s); |
208 |
IResource[] selection= Utilities.getResources(s); |
206 |
|
209 |
|
207 |
fThreeWay= selection.length == 3; |
210 |
fThreeWay= selection.length == 3; |
Lines 223-234
Link Here
|
223 |
fLeftResource= selection[0]; |
226 |
fLeftResource= selection[0]; |
224 |
fRightResource= selection[1]; |
227 |
fRightResource= selection[1]; |
225 |
} |
228 |
} |
|
|
229 |
fLeft= getStructure(fLeftResource); |
230 |
fRight= getStructure(fRightResource); |
231 |
return true; |
232 |
} |
233 |
|
234 |
private boolean showDialog(Shell shell, ISelection s) { |
235 |
CompareWithOtherResourceDialog dialog = new CompareWithOtherResourceDialog(shell, s); |
236 |
if (dialog.open() != IDialogConstants.OK_ID) |
237 |
return false; |
238 |
IResource[] selection = dialog.getResult(); |
239 |
if (!resourcesOK(selection)) |
240 |
return false; |
226 |
|
241 |
|
|
|
242 |
fThreeWay = selection.length == 3; |
243 |
if (fThreeWay) { |
244 |
fAncestorResource = selection[0]; |
245 |
fAncestor = getStructure(fAncestorResource); |
246 |
fLeftResource = selection[1]; |
247 |
fRightResource = selection[2]; |
248 |
} else { |
249 |
fAncestorResource = null; |
250 |
fAncestor = null; |
251 |
fLeftResource = selection[0]; |
252 |
fRightResource = selection[1]; |
253 |
} |
227 |
fLeft= getStructure(fLeftResource); |
254 |
fLeft= getStructure(fLeftResource); |
228 |
fRight= getStructure(fRightResource); |
255 |
fRight= getStructure(fRightResource); |
229 |
return true; |
256 |
return true; |
230 |
} |
257 |
} |
231 |
|
258 |
|
|
|
259 |
private boolean resourcesOK(IResource[] resources) { |
260 |
for (int i = 0; i < resources.length; i++) |
261 |
if (resources[i] == null) |
262 |
return false; |
263 |
return true; |
264 |
} |
265 |
|
232 |
/* |
266 |
/* |
233 |
* Returns true if compare can be executed for the given selection. |
267 |
* Returns true if compare can be executed for the given selection. |
234 |
*/ |
268 |
*/ |