Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Weinand2004-03-01 17:43:40 +0000
committerAndre Weinand2004-03-01 17:43:40 +0000
commit8902ba6111c1395583fd9b4bfd639c94bd6c2d88 (patch)
tree2e73d6bd920f136af1830be2c528d6c5e8818f50
parentc8baa99343deaf9e95cf9053a437e73955c6219b (diff)
downloadeclipse.platform.team-8902ba6111c1395583fd9b4bfd639c94bd6c2d88.tar.gz
eclipse.platform.team-8902ba6111c1395583fd9b4bfd639c94bd6c2d88.tar.xz
eclipse.platform.team-8902ba6111c1395583fd9b4bfd639c94bd6c2d88.zip
fixed #42731v20040301
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java19
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java19
2 files changed, 26 insertions, 12 deletions
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java
index afe0b5051..4a482c08b 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java
@@ -995,8 +995,9 @@ public class TextMergeViewer extends ContentMergeViewer {
fRight.getTextWidget().getVerticalBar().setVisible(!fSynchronizedScrolling);
fRight.addAction(MergeSourceViewer.SAVE_ID, fRightSaveAction);
- hsynchViewport(fLeft, fRight);
- hsynchViewport(fRight, fLeft);
+ hsynchViewport(fAncestor, fLeft, fRight);
+ hsynchViewport(fLeft, fAncestor, fRight);
+ hsynchViewport(fRight, fAncestor, fLeft);
if (fMarginWidth > 0) {
fRightCanvas= new BufferedCanvas(composite, SWT.NONE) {
@@ -1062,19 +1063,25 @@ public class TextMergeViewer extends ContentMergeViewer {
);
}
- private void hsynchViewport(final TextViewer tv1, final TextViewer tv2) {
+ private void hsynchViewport(final TextViewer tv1, final TextViewer tv2, final TextViewer tv3) {
final StyledText st1= tv1.getTextWidget();
final StyledText st2= tv2.getTextWidget();
+ final StyledText st3= tv3.getTextWidget();
final ScrollBar sb1= st1.getHorizontalBar();
- final ScrollBar sb2= st2.getHorizontalBar();
sb1.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
int max= sb1.getMaximum()-sb1.getThumb();
double v= 0.0;
if (max > 0)
v= (float)sb1.getSelection() / (float)max;
- max= sb2.getMaximum()-sb2.getThumb();
- st2.setHorizontalPixel((int)(max * v));
+ if (st2.isVisible()) {
+ ScrollBar sb2= st2.getHorizontalBar();
+ st2.setHorizontalPixel((int)((sb2.getMaximum()-sb2.getThumb()) * v));
+ }
+ if (st3.isVisible()) {
+ ScrollBar sb3= st3.getHorizontalBar();
+ st3.setHorizontalPixel((int)((sb3.getMaximum()-sb3.getThumb()) * v));
+ }
}
});
}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java
index afe0b5051..4a482c08b 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java
@@ -995,8 +995,9 @@ public class TextMergeViewer extends ContentMergeViewer {
fRight.getTextWidget().getVerticalBar().setVisible(!fSynchronizedScrolling);
fRight.addAction(MergeSourceViewer.SAVE_ID, fRightSaveAction);
- hsynchViewport(fLeft, fRight);
- hsynchViewport(fRight, fLeft);
+ hsynchViewport(fAncestor, fLeft, fRight);
+ hsynchViewport(fLeft, fAncestor, fRight);
+ hsynchViewport(fRight, fAncestor, fLeft);
if (fMarginWidth > 0) {
fRightCanvas= new BufferedCanvas(composite, SWT.NONE) {
@@ -1062,19 +1063,25 @@ public class TextMergeViewer extends ContentMergeViewer {
);
}
- private void hsynchViewport(final TextViewer tv1, final TextViewer tv2) {
+ private void hsynchViewport(final TextViewer tv1, final TextViewer tv2, final TextViewer tv3) {
final StyledText st1= tv1.getTextWidget();
final StyledText st2= tv2.getTextWidget();
+ final StyledText st3= tv3.getTextWidget();
final ScrollBar sb1= st1.getHorizontalBar();
- final ScrollBar sb2= st2.getHorizontalBar();
sb1.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
int max= sb1.getMaximum()-sb1.getThumb();
double v= 0.0;
if (max > 0)
v= (float)sb1.getSelection() / (float)max;
- max= sb2.getMaximum()-sb2.getThumb();
- st2.setHorizontalPixel((int)(max * v));
+ if (st2.isVisible()) {
+ ScrollBar sb2= st2.getHorizontalBar();
+ st2.setHorizontalPixel((int)((sb2.getMaximum()-sb2.getThumb()) * v));
+ }
+ if (st3.isVisible()) {
+ ScrollBar sb3= st3.getHorizontalBar();
+ st3.setHorizontalPixel((int)((sb3.getMaximum()-sb3.getThumb()) * v));
+ }
}
});
}

Back to the top