Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMickael Istria2019-07-30 18:37:13 -0400
committerMickael Istria2019-07-31 09:50:50 -0400
commita36a62d0c3fb05a9f9eed61f1d127566b83b8479 (patch)
treecb18335b063356e4a73bd24b2980b129e5acb62d
parent417b6047c1ee012024e9fe086d073afcbc9c3611 (diff)
downloadeclipse.platform.team-a36a62d0c3fb05a9f9eed61f1d127566b83b8479.tar.gz
eclipse.platform.team-a36a62d0c3fb05a9f9eed61f1d127566b83b8479.tar.xz
eclipse.platform.team-a36a62d0c3fb05a9f9eed61f1d127566b83b8479.zip
Change-Id: I7910a963e0b050602eb70a6b06f69a55c5bbc494 Signed-off-by: Mickael Istria <mistria@redhat.com>
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ComparePreferencePage.java94
-rw-r--r--bundles/org.eclipse.compare/plugin.properties7
2 files changed, 72 insertions, 29 deletions
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ComparePreferencePage.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ComparePreferencePage.java
index ac215b261..133adb208 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ComparePreferencePage.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ComparePreferencePage.java
@@ -124,7 +124,7 @@ public class ComparePreferencePage extends PreferencePage implements IWorkbenchP
private IPropertyChangeListener fPreferenceChangeListener;
- private CompareConfiguration fCompareConfiguration;
+ private List<CompareConfiguration> fCompareConfigurations = new ArrayList<>();
private OverlayPreferenceStore fOverlayStore;
private Map<Button, String> fCheckBoxes = new HashMap<>();
private Text fFilters;
@@ -186,8 +186,8 @@ public class ComparePreferencePage extends PreferencePage implements IWorkbenchP
String key= event.getProperty();
if (key.equals(INITIALLY_SHOW_ANCESTOR_PANE)) {
boolean b= fOverlayStore.getBoolean(INITIALLY_SHOW_ANCESTOR_PANE);
- if (fCompareConfiguration != null) {
- fCompareConfiguration.setProperty(INITIALLY_SHOW_ANCESTOR_PANE, Boolean.valueOf(b));
+ for (CompareConfiguration compareConfiguration : fCompareConfigurations) {
+ compareConfiguration.setProperty(INITIALLY_SHOW_ANCESTOR_PANE, Boolean.valueOf(b));
}
}
};
@@ -378,43 +378,57 @@ public class ComparePreferencePage extends PreferencePage implements IWorkbenchP
editor.fillIntoGrid(radioGroup, 1);
editors.add(editor);
+ PreferenceLinkArea area = new PreferenceLinkArea(composite, SWT.NONE,
+ "org.eclipse.ui.preferencePages.ColorsAndFonts", //$NON-NLS-1$
+ Utilities.getString("ComparePreferencePage.colorAndFontLink"), //$NON-NLS-1$
+ (IWorkbenchPreferenceContainer) getContainer(),
+ "selectCategory:org.eclipse.compare.contentmergeviewer.TextMergeViewer"); //$NON-NLS-1$
+
+ GridData data = new GridData(SWT.FILL, SWT.CENTER, false, false);
+ area.getControl().setLayoutData(data);
+
// a spacer
Label separator= new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
separator.setVisible(false);
- Label previewLabel= new Label(composite, SWT.NULL);
- previewLabel.setText(Utilities.getString("ComparePreferencePage.preview.label")); //$NON-NLS-1$
+ {
+ Label previewLabel = new Label(composite, SWT.NULL);
+ previewLabel.setText(Utilities.getString("ComparePreferencePage.preview-2way.label")); //$NON-NLS-1$
- Control previewer= createPreviewer(composite);
- GridData gd= new GridData(GridData.FILL_BOTH);
- gd.widthHint= convertWidthInCharsToPixels(60);
- gd.heightHint= convertHeightInCharsToPixels(13);
- previewer.setLayoutData(gd);
+ Control previewer = create2WayPreviewer(composite);
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ gd.widthHint = convertWidthInCharsToPixels(60);
+ gd.heightHint = convertHeightInCharsToPixels(12);
+ previewer.setLayoutData(gd);
+ }
- PreferenceLinkArea area = new PreferenceLinkArea(composite, SWT.NONE,
- "org.eclipse.ui.preferencePages.ColorsAndFonts", Utilities.getString("ComparePreferencePage.colorAndFontLink"), //$NON-NLS-1$ //$NON-NLS-2$
- (IWorkbenchPreferenceContainer)getContainer(), "selectCategory:org.eclipse.compare.contentmergeviewer.TextMergeViewer"); //$NON-NLS-1$
+ {
+ Label previewLabel = new Label(composite, SWT.NULL);
+ previewLabel.setText(Utilities.getString("ComparePreferencePage.preview.label")); //$NON-NLS-1$
- GridData data= new GridData(SWT.FILL, SWT.CENTER, false, false);
- area.getControl().setLayoutData(data);
+ Control previewer = create3WayPreviewer(composite);
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ gd.widthHint = convertWidthInCharsToPixels(60);
+ gd.heightHint = convertHeightInCharsToPixels(9);
+ previewer.setLayoutData(gd);
+ }
return composite;
}
- private Control createPreviewer(Composite parent) {
-
- fCompareConfiguration= new CompareConfiguration(fOverlayStore);
- fCompareConfiguration.setAncestorLabel(Utilities.getString("ComparePreferencePage.ancestor.label")); //$NON-NLS-1$
+ private Control create3WayPreviewer(Composite parent) {
+ CompareConfiguration compareConfiguration = new CompareConfiguration(fOverlayStore);
+ compareConfiguration.setAncestorLabel(Utilities.getString("ComparePreferencePage.ancestor.label")); //$NON-NLS-1$
- fCompareConfiguration.setLeftLabel(Utilities.getString("ComparePreferencePage.left.label")); //$NON-NLS-1$
- fCompareConfiguration.setLeftEditable(false);
+ compareConfiguration.setLeftLabel(Utilities.getString("ComparePreferencePage.left.label")); //$NON-NLS-1$
+ compareConfiguration.setLeftEditable(false);
- fCompareConfiguration.setRightLabel(Utilities.getString("ComparePreferencePage.right.label")); //$NON-NLS-1$
- fCompareConfiguration.setRightEditable(false);
+ compareConfiguration.setRightLabel(Utilities.getString("ComparePreferencePage.right.label")); //$NON-NLS-1$
+ compareConfiguration.setRightEditable(false);
- TextMergeViewer fPreviewViewer= new TextMergeViewer(parent, SWT.BORDER, fCompareConfiguration);
+ TextMergeViewer previewViewer = new TextMergeViewer(parent, SWT.BORDER, compareConfiguration);
- fPreviewViewer.setInput(
+ previewViewer.setInput(
new DiffNode(Differencer.CONFLICTING,
new FakeInput("ComparePreferencePage.previewAncestor"), //$NON-NLS-1$
new FakeInput("ComparePreferencePage.previewLeft"), //$NON-NLS-1$
@@ -422,15 +436,39 @@ public class ComparePreferencePage extends PreferencePage implements IWorkbenchP
)
);
- Control c= fPreviewViewer.getControl();
+ Control c = previewViewer.getControl();
c.addDisposeListener(e -> {
- if (fCompareConfiguration != null)
- fCompareConfiguration.dispose();
+ if (compareConfiguration != null)
+ compareConfiguration.dispose();
});
+ fCompareConfigurations.add(compareConfiguration);
return c;
}
+ private Control create2WayPreviewer(Composite parent) {
+ CompareConfiguration compareConfiguration = new CompareConfiguration(fOverlayStore);
+ compareConfiguration.setLeftLabel(Utilities.getString("ComparePreferencePage.workingCopy.label")); //$NON-NLS-1$
+ compareConfiguration.setRightLabel(Utilities.getString("ComparePreferencePage.baseline.label")); //$NON-NLS-1$
+ compareConfiguration.setRightEditable(false);
+
+ TextMergeViewer previewViewer = new TextMergeViewer(parent, SWT.BORDER, compareConfiguration);
+
+ previewViewer.setInput(new DiffNode(
+ new FakeInput("ComparePreferencePage.workingCopy"), //$NON-NLS-1$
+ new FakeInput("ComparePreferencePage.baseline") //$NON-NLS-1$
+ ));
+
+ Control c = previewViewer.getControl();
+ c.addDisposeListener(e -> {
+ if (compareConfiguration != null)
+ compareConfiguration.dispose();
+ });
+
+ fCompareConfigurations.add(compareConfiguration);
+ return c;
+ }
+
private void initializeFields() {
Iterator<Button> e = fCheckBoxes.keySet().iterator();
diff --git a/bundles/org.eclipse.compare/plugin.properties b/bundles/org.eclipse.compare/plugin.properties
index 041d5208a..8bb9f8039 100644
--- a/bundles/org.eclipse.compare/plugin.properties
+++ b/bundles/org.eclipse.compare/plugin.properties
@@ -137,18 +137,23 @@ ComparePreferencePage.highlightTokenChanges.label=&Highlight individual changes
ComparePreferencePage.disableCapping.label=Disable &capping when comparing large documents
ComparePreferencePage.swapped.label=S&wap left and right
-ComparePreferencePage.preview.label= Pre&view:
+ComparePreferencePage.preview.label= Pre&view 3-way compare:
+ComparePreferencePage.preview-2way.label= Preview 2-w&ay compare:
ComparePreferencePage.ancestor.label= Common Ancestor
ComparePreferencePage.left.label= Local
ComparePreferencePage.right.label= Remote
ComparePreferencePage.backgroundColor1.label= Bac&kground Color:
ComparePreferencePage.backgroundColor2.label= S&ystem Default
ComparePreferencePage.backgroundColor3.label= C&ustom
+ComparePreferencePage.workingCopy.label= Working Copy
+ComparePreferencePage.baseline.label= Baseline
# Compare editor contents for Compare preview page
ComparePreferencePage.previewAncestor= 1\n2\n3\nconflicting change\n4\n5
ComparePreferencePage.previewLeft= 1\n2\noutgoing addition\n3\noutgoing change\n4\npseudo conflict\n5
ComparePreferencePage.previewRight= 1\nincoming addition\nincoming addition\n2\n3\nincoming change\n4\npseudo conflict\n5
+ComparePreferencePage.baseline= \nline 1\nline 2\nremoved line 2a\nremoved line 2b\nline 3\nline 4\nline 5\nline 6\nline to modify 7\nline 8\nremoved words in line 9\n
+ComparePreferencePage.workingCopy= line 1\nline 2\nline 3\nadded words in line 4\nline 5\nadded line 5a\nadded line 6b\nline 6\nmodified line 7\nline 8\nline 9
ComparePreferencePage.colorAndFontLink=See <a>''{0}''</a> preferences for text compare colors and fonts.

Back to the top