Lines 35-40
Link Here
|
35 |
import org.eclipse.jface.dialogs.Dialog; |
35 |
import org.eclipse.jface.dialogs.Dialog; |
36 |
import org.eclipse.jface.dialogs.IDialogConstants; |
36 |
import org.eclipse.jface.dialogs.IDialogConstants; |
37 |
import org.eclipse.jface.dialogs.IDialogSettings; |
37 |
import org.eclipse.jface.dialogs.IDialogSettings; |
|
|
38 |
import org.eclipse.jface.dialogs.IMessageProvider; |
38 |
import org.eclipse.jface.dialogs.MessageDialog; |
39 |
import org.eclipse.jface.dialogs.MessageDialog; |
39 |
import org.eclipse.jface.dialogs.TitleAreaDialog; |
40 |
import org.eclipse.jface.dialogs.TitleAreaDialog; |
40 |
import org.eclipse.jface.resource.ImageDescriptor; |
41 |
import org.eclipse.jface.resource.ImageDescriptor; |
Lines 594-600
Link Here
|
594 |
* selected to save the patch in the clipboard or file system. |
595 |
* selected to save the patch in the clipboard or file system. |
595 |
*/ |
596 |
*/ |
596 |
public String getWorkspaceLocation() { |
597 |
public String getWorkspaceLocation() { |
597 |
|
|
|
598 |
if (pageValid && selectedLocation == WORKSPACE) { |
598 |
if (pageValid && selectedLocation == WORKSPACE) { |
599 |
final String filename= wsPathText.getText().trim(); |
599 |
final String filename= wsPathText.getText().trim(); |
600 |
return filename; |
600 |
return filename; |
Lines 1017-1030
Link Here
|
1017 |
return unified_customRelativeText.getText(); |
1017 |
return unified_customRelativeText.getText(); |
1018 |
} |
1018 |
} |
1019 |
|
1019 |
|
1020 |
public Group getUnifiedGroup() { |
|
|
1021 |
return unifiedGroup; |
1022 |
} |
1023 |
|
1024 |
public RadioButtonGroup getUnifiedRadioGroup() { |
1025 |
return unifiedRadioGroup; |
1026 |
} |
1027 |
|
1028 |
private void initializeDefaultValues() { |
1020 |
private void initializeDefaultValues() { |
1029 |
// Radio buttons for format |
1021 |
// Radio buttons for format |
1030 |
diffTypeRadioGroup.setSelection(store.getFormatSelection(), true); |
1022 |
diffTypeRadioGroup.setSelection(store.getFormatSelection(), true); |
Lines 1074-1079
Link Here
|
1074 |
try { |
1066 |
try { |
1075 |
value= dialogSettings.getInt(PREF_LAST_SELECTION); |
1067 |
value= dialogSettings.getInt(PREF_LAST_SELECTION); |
1076 |
} catch (NumberFormatException e) { |
1068 |
} catch (NumberFormatException e) { |
|
|
1069 |
// do nothing |
1077 |
} |
1070 |
} |
1078 |
|
1071 |
|
1079 |
switch (value) { |
1072 |
switch (value) { |
Lines 1220-1225
Link Here
|
1220 |
} |
1213 |
} |
1221 |
targetFileEdited = true; |
1214 |
targetFileEdited = true; |
1222 |
} |
1215 |
} |
|
|
1216 |
validateCustomPatchRoot(this.getPath()); |
1217 |
} |
1218 |
|
1219 |
private void validateCustomPatchRoot(String path) { |
1220 |
if (this.getRootSelection() == OptionsPage.ROOT_CUSTOM |
1221 |
&& !ResourcesPlugin.getWorkspace().validatePath(path, |
1222 |
IResource.FILE).isOK()) { |
1223 |
this.setMessage(CompareMessages.GenerateLocalDiff_4, |
1224 |
IMessageProvider.WARNING); |
1225 |
return; |
1226 |
} |
1227 |
this.setMessage(null); |
1223 |
} |
1228 |
} |
1224 |
|
1229 |
|
1225 |
protected void performSpecificActions() { |
1230 |
protected void performSpecificActions() { |
Lines 1237-1272
Link Here
|
1237 |
unifiedRadioGroup.setEnablement(false, new int[] { |
1242 |
unifiedRadioGroup.setEnablement(false, new int[] { |
1238 |
ROOT_WORKSPACE, ROOT_PROJECT, ROOT_SELECTION }); |
1243 |
ROOT_WORKSPACE, ROOT_PROJECT, ROOT_SELECTION }); |
1239 |
} |
1244 |
} |
|
|
1245 |
|
1246 |
private void createCustomRelativeControl() { |
1247 |
unified_customRelativeOption = new Button(unifiedGroup, SWT.RADIO); |
1248 |
unified_customRelativeOption.setText(CompareMessages.GenerateDiffFileWizard_13); |
1249 |
unified_customRelativeOption.setSelection(true); |
1250 |
unified_customRelativeOption.setLayoutData(new GridData( |
1251 |
SWT.BEGINNING, SWT.CENTER, false, false, 1, 1)); |
1252 |
|
1253 |
unified_customRelativeText = new Text(unifiedGroup, SWT.BORDER); |
1254 |
unified_customRelativeText.setLayoutData(new GridData( |
1255 |
SWT.FILL, SWT.CENTER, true, false, 1, 1)); |
1256 |
|
1257 |
unified_customRelativeText.addModifyListener(new ModifyListener(){ |
1258 |
public void modifyText(ModifyEvent e) { |
1259 |
if(e.widget instanceof Text) { |
1260 |
String text = ((Text)e.widget).getText(); |
1261 |
validateCustomPatchRoot(text); |
1262 |
} |
1263 |
} |
1264 |
}); |
1265 |
|
1266 |
unifiedRadioGroup.add(OptionsPage.ROOT_CUSTOM, unified_customRelativeOption); |
1267 |
unified_customRelativeOption.addSelectionListener(new SelectionAdapter() { |
1268 |
public void widgetSelected(SelectionEvent e) { |
1269 |
unifiedRadioGroup.setSelection(OptionsPage.ROOT_CUSTOM, false); |
1270 |
} |
1271 |
}); |
1272 |
optionsPage.updateDiffTypeEnablements(new int[] {OptionsPage.FORMAT_CONTEXT, OptionsPage.FORMAT_STANDARD}, OptionsPage.FORMAT_UNIFIED); |
1273 |
optionsPage.updateUnifiedEnablements(new int[] {OptionsPage.ROOT_PROJECT, OptionsPage.ROOT_WORKSPACE, OptionsPage.ROOT_SELECTION}, OptionsPage.ROOT_CUSTOM); |
1274 |
} |
1240 |
}; |
1275 |
}; |
1241 |
optionsPage.setDescription(pageDescription); |
1276 |
optionsPage.setDescription(pageDescription); |
1242 |
addPage(optionsPage); |
1277 |
addPage(optionsPage); |
1243 |
} |
1278 |
} |
1244 |
|
1279 |
|
1245 |
private void createCustomRelativeControl() { |
|
|
1246 |
Group unifiedGroup = optionsPage.getUnifiedGroup(); |
1247 |
final RadioButtonGroup unifiedRadioGroup = optionsPage.getUnifiedRadioGroup(); |
1248 |
unified_customRelativeOption = new Button(unifiedGroup, SWT.RADIO); |
1249 |
unified_customRelativeOption.setText(CompareMessages.GenerateDiffFileWizard_13); |
1250 |
unified_customRelativeOption.setSelection(true); |
1251 |
unified_customRelativeOption.setLayoutData(new GridData( |
1252 |
SWT.BEGINNING, SWT.CENTER, false, false, 1, 1)); |
1253 |
|
1254 |
unified_customRelativeText = new Text(unifiedGroup, SWT.BORDER); |
1255 |
unified_customRelativeText.setLayoutData(new GridData( |
1256 |
SWT.FILL, SWT.CENTER, true, false, 1, 1)); |
1257 |
|
1258 |
optionsPage.getUnifiedRadioGroup().add(OptionsPage.ROOT_CUSTOM, unified_customRelativeOption); |
1259 |
unified_customRelativeOption.addSelectionListener(new SelectionAdapter() { |
1260 |
public void widgetSelected(SelectionEvent e) { |
1261 |
unifiedRadioGroup.setSelection(OptionsPage.ROOT_CUSTOM, false); |
1262 |
} |
1263 |
}); |
1264 |
optionsPage.updateDiffTypeEnablements(new int[] {OptionsPage.FORMAT_CONTEXT, OptionsPage.FORMAT_STANDARD}, OptionsPage.FORMAT_UNIFIED); |
1265 |
optionsPage.updateUnifiedEnablements(new int[] {OptionsPage.ROOT_PROJECT, OptionsPage.ROOT_WORKSPACE, OptionsPage.ROOT_SELECTION}, OptionsPage.ROOT_CUSTOM); |
1266 |
} |
1267 |
|
1268 |
/** |
1280 |
/** |
1269 |
* Declares the wizard banner iamge descriptor |
1281 |
* Declares the wizard banner image descriptor |
1270 |
*/ |
1282 |
*/ |
1271 |
protected void initializeDefaultPageImageDescriptor() { |
1283 |
protected void initializeDefaultPageImageDescriptor() { |
1272 |
final String iconPath= "icons/full/"; //$NON-NLS-1$ |
1284 |
final String iconPath= "icons/full/"; //$NON-NLS-1$ |
Lines 1280-1295
Link Here
|
1280 |
} |
1292 |
} |
1281 |
} |
1293 |
} |
1282 |
|
1294 |
|
1283 |
/* (Non-javadoc) |
1295 |
/* |
1284 |
* Method declared on IWizard. |
1296 |
* (non-Javadoc) |
|
|
1297 |
* |
1298 |
* @see org.eclipse.jface.wizard.Wizard#needsProgressMonitor() |
1285 |
*/ |
1299 |
*/ |
1286 |
public boolean needsProgressMonitor() { |
1300 |
public boolean needsProgressMonitor() { |
1287 |
return true; |
1301 |
return true; |
1288 |
} |
1302 |
} |
1289 |
|
1303 |
|
1290 |
/** |
1304 |
/* |
1291 |
* Completes processing of the wizard. If this method returns <code> |
1305 |
* (non-Javadoc) |
1292 |
* true</code>, the wizard will close; otherwise, it will stay active. |
1306 |
* |
|
|
1307 |
* @see org.eclipse.jface.wizard.Wizard#performFinish() |
1293 |
*/ |
1308 |
*/ |
1294 |
public boolean performFinish() { |
1309 |
public boolean performFinish() { |
1295 |
final int location = locationPage.getSelectedLocation(); |
1310 |
final int location = locationPage.getSelectedLocation(); |
Lines 1300-1325
Link Here
|
1300 |
return false; |
1315 |
return false; |
1301 |
} |
1316 |
} |
1302 |
|
1317 |
|
1303 |
//Validation of patch root |
|
|
1304 |
if(optionsPage.getRootSelection() == OptionsPage.ROOT_CUSTOM) { |
1305 |
String path = optionsPage.getPath(); |
1306 |
IFile file2; |
1307 |
try { |
1308 |
file2 = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(path)); |
1309 |
} catch(IllegalArgumentException e) { |
1310 |
final String title = CompareMessages.GenerateLocalDiff_3; |
1311 |
final String msg = CompareMessages.GenerateLocalDiff_4; |
1312 |
final MessageDialog dialog = new MessageDialog(getShell(), title, |
1313 |
null, msg, MessageDialog.ERROR, |
1314 |
new String[] { IDialogConstants.OK_LABEL }, 0); |
1315 |
dialog.open(); |
1316 |
return false; |
1317 |
} |
1318 |
if(!validateFile2(file2)) { |
1319 |
return false; |
1320 |
} |
1321 |
} |
1322 |
|
1323 |
// Create the patch |
1318 |
// Create the patch |
1324 |
generateDiffFile(file); |
1319 |
generateDiffFile(file); |
1325 |
|
1320 |
|