Lines 1-5
Link Here
|
1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
2 |
* Copyright (c) 2000, 2007 IBM Corporation and others. |
2 |
* Copyright (c) 2000, 2008 IBM Corporation and others. |
3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
Lines 10-39
Link Here
|
10 |
*******************************************************************************/ |
10 |
*******************************************************************************/ |
11 |
package org.eclipse.compare.internal; |
11 |
package org.eclipse.compare.internal; |
12 |
|
12 |
|
13 |
import java.io.*; |
13 |
import java.io.ByteArrayInputStream; |
|
|
14 |
import java.io.InputStream; |
14 |
import java.util.HashMap; |
15 |
import java.util.HashMap; |
15 |
import java.util.Iterator; |
16 |
import java.util.Iterator; |
16 |
import java.util.Map; |
17 |
import java.util.Map; |
17 |
|
18 |
|
18 |
import org.eclipse.ui.*; |
19 |
import org.eclipse.compare.CompareConfiguration; |
|
|
20 |
import org.eclipse.compare.IEncodedStreamContentAccessor; |
21 |
import org.eclipse.compare.ITypedElement; |
22 |
import org.eclipse.compare.contentmergeviewer.TextMergeViewer; |
23 |
import org.eclipse.compare.structuremergeviewer.DiffNode; |
24 |
import org.eclipse.compare.structuremergeviewer.Differencer; |
25 |
import org.eclipse.jface.dialogs.Dialog; |
26 |
import org.eclipse.jface.preference.IPreferenceStore; |
27 |
import org.eclipse.jface.preference.PreferencePage; |
28 |
import org.eclipse.jface.preference.RadioGroupFieldEditor; |
29 |
import org.eclipse.jface.util.IPropertyChangeListener; |
30 |
import org.eclipse.jface.util.PropertyChangeEvent; |
31 |
import org.eclipse.swt.SWT; |
32 |
import org.eclipse.swt.events.DisposeEvent; |
33 |
import org.eclipse.swt.events.DisposeListener; |
34 |
import org.eclipse.swt.events.ModifyEvent; |
35 |
import org.eclipse.swt.events.ModifyListener; |
36 |
import org.eclipse.swt.events.SelectionAdapter; |
37 |
import org.eclipse.swt.events.SelectionEvent; |
38 |
import org.eclipse.swt.events.SelectionListener; |
39 |
import org.eclipse.swt.graphics.Image; |
40 |
import org.eclipse.swt.layout.GridData; |
41 |
import org.eclipse.swt.layout.GridLayout; |
42 |
import org.eclipse.swt.widgets.Button; |
43 |
import org.eclipse.swt.widgets.Composite; |
44 |
import org.eclipse.swt.widgets.Control; |
45 |
import org.eclipse.swt.widgets.Label; |
46 |
import org.eclipse.swt.widgets.TabFolder; |
47 |
import org.eclipse.swt.widgets.TabItem; |
48 |
import org.eclipse.swt.widgets.Text; |
49 |
import org.eclipse.ui.IWorkbench; |
50 |
import org.eclipse.ui.IWorkbenchPreferencePage; |
51 |
import org.eclipse.ui.PlatformUI; |
19 |
import org.eclipse.ui.dialogs.PreferenceLinkArea; |
52 |
import org.eclipse.ui.dialogs.PreferenceLinkArea; |
20 |
import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer; |
53 |
import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer; |
21 |
import org.eclipse.ui.texteditor.AbstractTextEditor; |
54 |
import org.eclipse.ui.texteditor.AbstractTextEditor; |
22 |
|
55 |
|
23 |
import org.eclipse.swt.SWT; |
|
|
24 |
import org.eclipse.swt.events.*; |
25 |
import org.eclipse.swt.graphics.Image; |
26 |
import org.eclipse.swt.layout.*; |
27 |
import org.eclipse.swt.widgets.*; |
28 |
|
29 |
import org.eclipse.jface.dialogs.Dialog; |
30 |
import org.eclipse.jface.preference.*; |
31 |
import org.eclipse.jface.util.*; |
32 |
|
33 |
import org.eclipse.compare.*; |
34 |
import org.eclipse.compare.contentmergeviewer.TextMergeViewer; |
35 |
import org.eclipse.compare.structuremergeviewer.*; |
36 |
|
37 |
|
56 |
|
38 |
public class ComparePreferencePage extends PreferencePage implements IWorkbenchPreferencePage { |
57 |
public class ComparePreferencePage extends PreferencePage implements IWorkbenchPreferencePage { |
39 |
|
58 |
|
Lines 76-81
Link Here
|
76 |
public static final String HIGHLIGHT_TOKEN_CHANGES= PREFIX + "HighlightTokenChanges"; //$NON-NLS-1$ |
95 |
public static final String HIGHLIGHT_TOKEN_CHANGES= PREFIX + "HighlightTokenChanges"; //$NON-NLS-1$ |
77 |
//public static final String USE_RESOLVE_UI= PREFIX + "UseResolveUI"; //$NON-NLS-1$ |
96 |
//public static final String USE_RESOLVE_UI= PREFIX + "UseResolveUI"; //$NON-NLS-1$ |
78 |
public static final String PATH_FILTER= PREFIX + "PathFilter"; //$NON-NLS-1$ |
97 |
public static final String PATH_FILTER= PREFIX + "PathFilter"; //$NON-NLS-1$ |
|
|
98 |
public static final String ADDED_LINES_REGEX= PREFIX + "AddedLinesRegex"; //$NON-NLS-1$ |
99 |
public static final String REMOVED_LINES_REGEX= PREFIX + "RemovedLinesRegex"; //$NON-NLS-1$ |
79 |
|
100 |
|
80 |
|
101 |
|
81 |
private TextMergeViewer fPreviewViewer; |
102 |
private TextMergeViewer fPreviewViewer; |
Lines 84-89
Link Here
|
84 |
private OverlayPreferenceStore fOverlayStore; |
105 |
private OverlayPreferenceStore fOverlayStore; |
85 |
private Map fCheckBoxes= new HashMap(); |
106 |
private Map fCheckBoxes= new HashMap(); |
86 |
private Text fFilters; |
107 |
private Text fFilters; |
|
|
108 |
private Text addedLinesRegex; |
109 |
private Text removedLinesRegex; |
87 |
private SelectionListener fCheckBoxListener; |
110 |
private SelectionListener fCheckBoxListener; |
88 |
|
111 |
|
89 |
|
112 |
|
Lines 96-101
Link Here
|
96 |
new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, SHOW_MORE_INFO), |
119 |
new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, SHOW_MORE_INFO), |
97 |
new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IGNORE_WHITESPACE), |
120 |
new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IGNORE_WHITESPACE), |
98 |
new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PREF_SAVE_ALL_EDITORS), |
121 |
new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PREF_SAVE_ALL_EDITORS), |
|
|
122 |
new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, ADDED_LINES_REGEX), |
123 |
new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, REMOVED_LINES_REGEX), |
99 |
|
124 |
|
100 |
new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND), |
125 |
new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND), |
101 |
new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT), |
126 |
new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT), |
Lines 118-123
Link Here
|
118 |
store.setDefault(SHOW_MORE_INFO, false); |
143 |
store.setDefault(SHOW_MORE_INFO, false); |
119 |
store.setDefault(IGNORE_WHITESPACE, false); |
144 |
store.setDefault(IGNORE_WHITESPACE, false); |
120 |
store.setDefault(PREF_SAVE_ALL_EDITORS, false); |
145 |
store.setDefault(PREF_SAVE_ALL_EDITORS, false); |
|
|
146 |
store.setDefault(ADDED_LINES_REGEX, ""); //$NON-NLS-1$ |
147 |
store.setDefault(REMOVED_LINES_REGEX, ""); //$NON-NLS-1$ |
121 |
//store.setDefault(USE_SPLINES, false); |
148 |
//store.setDefault(USE_SPLINES, false); |
122 |
store.setDefault(USE_SINGLE_LINE, true); |
149 |
store.setDefault(USE_SINGLE_LINE, true); |
123 |
store.setDefault(HIGHLIGHT_TOKEN_CHANGES, true); |
150 |
store.setDefault(HIGHLIGHT_TOKEN_CHANGES, true); |
Lines 158-163
Link Here
|
158 |
* @see PreferencePage#performOk() |
185 |
* @see PreferencePage#performOk() |
159 |
*/ |
186 |
*/ |
160 |
public boolean performOk() { |
187 |
public boolean performOk() { |
|
|
188 |
fOverlayStore.setValue(ADDED_LINES_REGEX, addedLinesRegex.getText()); |
189 |
fOverlayStore.setValue(REMOVED_LINES_REGEX, removedLinesRegex.getText()); |
190 |
|
161 |
fOverlayStore.propagate(); |
191 |
fOverlayStore.propagate(); |
162 |
editor.store(); |
192 |
editor.store(); |
163 |
return true; |
193 |
return true; |
Lines 250-256
Link Here
|
250 |
new Label(composite, SWT.NONE); |
280 |
new Label(composite, SWT.NONE); |
251 |
|
281 |
|
252 |
Label l= new Label(composite, SWT.WRAP); |
282 |
Label l= new Label(composite, SWT.WRAP); |
253 |
l.setText(Utilities.getString("ComparePreferencePage.filter.description")); //$NON-NLS-1$ |
283 |
l.setText(Utilities.getString("ComparePreferencePage.regex.description")); //$NON-NLS-1$ |
254 |
|
284 |
|
255 |
Composite c2= new Composite(composite, SWT.NONE); |
285 |
Composite c2= new Composite(composite, SWT.NONE); |
256 |
c2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); |
286 |
c2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); |
Lines 259-267
Link Here
|
259 |
c2.setLayout(layout); |
289 |
c2.setLayout(layout); |
260 |
|
290 |
|
261 |
l= new Label(c2, SWT.NONE); |
291 |
l= new Label(c2, SWT.NONE); |
|
|
292 |
l.setText(Utilities.getString("ComparePreferencePage.regexAdded.label")); //$NON-NLS-1$ |
293 |
addedLinesRegex = new Text(c2, SWT.BORDER); |
294 |
addedLinesRegex.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); |
295 |
addedLinesRegex.setText(fOverlayStore.getString(ADDED_LINES_REGEX)); |
296 |
|
297 |
l= new Label(c2, SWT.NONE); |
298 |
l.setText(Utilities.getString("ComparePreferencePage.regexRemoved.label")); //$NON-NLS-1$ |
299 |
removedLinesRegex = new Text(c2, SWT.BORDER); |
300 |
removedLinesRegex.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); |
301 |
removedLinesRegex.setText(fOverlayStore.getString(REMOVED_LINES_REGEX)); |
302 |
|
303 |
// a spacer |
304 |
new Label(composite, SWT.NONE); |
305 |
|
306 |
l= new Label(composite, SWT.WRAP); |
307 |
l.setText(Utilities.getString("ComparePreferencePage.filter.description")); //$NON-NLS-1$ |
308 |
|
309 |
Composite c3= new Composite(composite, SWT.NONE); |
310 |
c3.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); |
311 |
layout= new GridLayout(2, false); |
312 |
layout.marginWidth= 0; |
313 |
c3.setLayout(layout); |
314 |
|
315 |
l= new Label(c3, SWT.NONE); |
262 |
l.setText(Utilities.getString("ComparePreferencePage.filter.label")); //$NON-NLS-1$ |
316 |
l.setText(Utilities.getString("ComparePreferencePage.filter.label")); //$NON-NLS-1$ |
263 |
|
317 |
|
264 |
fFilters= new Text(c2, SWT.BORDER); |
318 |
fFilters= new Text(c3, SWT.BORDER); |
265 |
fFilters.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); |
319 |
fFilters.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); |
266 |
fFilters.setText(fOverlayStore.getString(PATH_FILTER)); |
320 |
fFilters.setText(fOverlayStore.getString(PATH_FILTER)); |
267 |
fFilters.addModifyListener( |
321 |
fFilters.addModifyListener( |
Lines 374-379
Link Here
|
374 |
|
428 |
|
375 |
if (fFilters != null) |
429 |
if (fFilters != null) |
376 |
fFilters.setText(fOverlayStore.getString(PATH_FILTER)); |
430 |
fFilters.setText(fOverlayStore.getString(PATH_FILTER)); |
|
|
431 |
if (addedLinesRegex != null) |
432 |
addedLinesRegex.setText(fOverlayStore.getString(ADDED_LINES_REGEX)); |
433 |
if (removedLinesRegex != null) |
434 |
removedLinesRegex.setText(fOverlayStore.getString(REMOVED_LINES_REGEX)); |
377 |
|
435 |
|
378 |
editor.load(); |
436 |
editor.load(); |
379 |
} |
437 |
} |