View | Details | Raw Unified | Return to bug 164678 | Differences between
and this patch

Collapse All | Expand All

(-)Eclipse UI/org/eclipse/ui/internal/keys/KeysPreferencePage.java (-2 / +17 lines)
Lines 1384-1391 Link Here
1384
					for (int i = 0; i < items.length; i++) {
1384
					for (int i = 0; i < items.length; i++) {
1385
						final TableItem item = items[i];
1385
						final TableItem item = items[i];
1386
						for (int j = 0; j < numColumns; j++) {
1386
						for (int j = 0; j < numColumns; j++) {
1387
							fileWriter.write('"' + item.getText(j).replaceAll(
1387
							String buf = replaceQuotes(item.getText(j));
1388
									"\"", "\"\"") + '"');  //$NON-NLS-1$//$NON-NLS-2$
1388
							fileWriter.write(buf);
1389
							if (j < numColumns - 1) {
1389
							if (j < numColumns - 1) {
1390
								fileWriter.write(',');
1390
								fileWriter.write(',');
1391
							}
1391
							}
Lines 1407-1412 Link Here
1407
		};
1407
		};
1408
		SafeRunner.run(runnable);
1408
		SafeRunner.run(runnable);
1409
	}
1409
	}
1410
	
1411
	private String replaceQuotes(String s) {
1412
		StringBuffer buf = new StringBuffer(s);
1413
		int len = buf.length();
1414
		int idx = buf.indexOf("\""); //$NON-NLS-1$
1415
		while (idx != -1 && idx < len) {
1416
			buf.insert(idx, '"');
1417
			if (idx + 1 < len) {
1418
				idx = buf.indexOf("\"", idx + 1); //$NON-NLS-1$
1419
			} else {
1420
				idx = -1;
1421
			}
1422
		}
1423
		return '"' + buf.toString() + '"';
1424
	}
1410
1425
1411
	/**
1426
	/**
1412
	 * Handles the selection event on the remove button. This removes all
1427
	 * Handles the selection event on the remove button. This removes all

Return to bug 164678