Skip to content

Commit 05cb6ef

Browse files
committed
Remove effectively dead code
The removed code is guarded by conditions that evaluate to a static value. The referenced fields are effectively final, thus making them explicitly final would lead to dead code warnings.
1 parent be45530 commit 05cb6ef

File tree

2 files changed

+21
-79
lines changed

2 files changed

+21
-79
lines changed

team/bundles/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,6 @@ public int hashCode() {
170170
// Configuration options
171171
private CompareConfiguration fCompareConfiguration;
172172
private ArrayList<Object> fArrayList= new ArrayList<>();
173-
/** use a side-by-side compare viewer */
174-
private boolean fCompare= true;
175173
/** show target on right hand side */
176174
private boolean fTargetIsRight= false;
177175
/** hide entries which have identical content */
@@ -1114,13 +1112,6 @@ private void handleMemberSelect(Widget w) {
11141112
}
11151113

11161114
private void setInput(Object input) {
1117-
if (!fCompare && input instanceof ICompareInput) {
1118-
ICompareInput ci= (ICompareInput) input;
1119-
if (fTargetIsRight)
1120-
input= ci.getLeft();
1121-
else
1122-
input= ci.getRight();
1123-
}
11241115
fContentPane.setInput(input);
11251116
if (fStructuredComparePane != null)
11261117
fStructuredComparePane.setInput(input);

team/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java

Lines changed: 21 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,6 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
331331
/** line width of change borders */
332332
private static final int LW= 1;
333333

334-
private boolean fShowCurrentOnly= false;
335-
private boolean fShowCurrentOnly2= false;
336334
private int fMarginWidth= MARGIN_WIDTH;
337335
private int fTopInset;
338336

@@ -408,7 +406,6 @@ private static RGB interpolate(RGB fg, RGB bg, double scale) {
408406

409407
private boolean fShowPseudoConflicts= false;
410408

411-
private boolean fUseSplines= true;
412409
private boolean fUseSingleLine= true;
413410
private boolean fHighlightTokenChanges = false;
414411

@@ -425,7 +422,6 @@ private static RGB interpolate(RGB fg, RGB bg, double scale) {
425422

426423
private MergeSourceViewer fFocusPart;
427424

428-
private boolean fSubDoc= true;
429425
private IPositionUpdater fPositionUpdater;
430426
private boolean fIsMac;
431427

@@ -784,14 +780,13 @@ private boolean internalSetDocument(MergeSourceViewer tp) {
784780
*/
785781
private void updateViewerDocumentRange(MergeSourceViewer tp, Position range) {
786782
tp.setRegion(range);
787-
if (this.fViewer.fSubDoc) {
788-
if (range != null) {
789-
IRegion r= this.fViewer.normalizeDocumentRegion(tp.getSourceViewer().getDocument(), TextMergeViewer.toRegion(range));
790-
tp.getSourceViewer().setVisibleRegion(r.getOffset(), r.getLength());
791-
} else
792-
tp.getSourceViewer().resetVisibleRegion();
793-
} else
783+
if (range != null) {
784+
IRegion r = this.fViewer.normalizeDocumentRegion(tp.getSourceViewer().getDocument(),
785+
TextMergeViewer.toRegion(range));
786+
tp.getSourceViewer().setVisibleRegion(r.getOffset(), r.getLength());
787+
} else {
794788
tp.getSourceViewer().resetVisibleRegion();
789+
}
795790
}
796791

797792
/*
@@ -809,7 +804,7 @@ private void updateViewerDocument(MergeSourceViewer tp, IDocument document, Posi
809804
SourceViewer sourceViewer = tp.getSourceViewer();
810805
sourceViewer.setRedraw(false);
811806
try {
812-
if (this.fViewer.fSubDoc && range != null) {
807+
if (range != null) {
813808
IRegion r= this.fViewer.normalizeDocumentRegion(document, TextMergeViewer.toRegion(range));
814809
sourceViewer.setDocument(document, r.getOffset(), r.getLength());
815810
} else {
@@ -1632,10 +1627,8 @@ else if ((style & SWT.RIGHT_TO_LEFT) != 0)
16321627

16331628
fSynchronizedScrolling= fPreferenceStore.getBoolean(ComparePreferencePage.SYNCHRONIZE_SCROLLING);
16341629
fShowPseudoConflicts= fPreferenceStore.getBoolean(ComparePreferencePage.SHOW_PSEUDO_CONFLICTS);
1635-
//fUseSplines= fPreferenceStore.getBoolean(ComparePreferencePage.USE_SPLINES);
16361630
fUseSingleLine= fPreferenceStore.getBoolean(ComparePreferencePage.USE_SINGLE_LINE);
16371631
fHighlightTokenChanges= fPreferenceStore.getBoolean(ComparePreferencePage.HIGHLIGHT_TOKEN_CHANGES);
1638-
//fUseResolveUI= fPreferenceStore.getBoolean(ComparePreferencePage.USE_RESOLVE_UI);
16391632
}
16401633

16411634
buildControl(parent);
@@ -2260,9 +2253,6 @@ private Diff handleMouseInSides(Canvas canvas, MergeSourceViewer tp, int my) {
22602253
if (diff.isDeleted())
22612254
continue;
22622255

2263-
if (fShowCurrentOnly2 && !isCurrentDiff(diff))
2264-
continue;
2265-
22662256
tp.getLineRange(diff.getPosition(leg), region);
22672257
region.x -= tp.getDocumentRegionOffset();
22682258
int y = getHeightBetweenLines(tp, 0, region.x) + shift;
@@ -2304,9 +2294,6 @@ private Diff getDiffUnderMouse(Canvas canvas, int mx, int my, Rectangle r) {
23042294
if (diff.isDeleted())
23052295
continue;
23062296

2307-
if (fShowCurrentOnly2 && !isCurrentDiff(diff))
2308-
continue;
2309-
23102297
fLeft.getLineRange(diff.getPosition(LEFT_CONTRIBUTOR), region);
23112298
region.x -= fLeft.getDocumentRegionOffset();
23122299
int ly = getHeightBetweenLines(fLeft, 0, region.x) + lshift;
@@ -3112,9 +3099,6 @@ private boolean updateDiffBackground(Diff diff) {
31123099
if (diff == null || diff.isToken())
31133100
return false;
31143101

3115-
if (fShowCurrentOnly && !isCurrentDiff(diff))
3116-
return false;
3117-
31183102
return true;
31193103
}
31203104

@@ -4036,13 +4020,8 @@ protected void handlePropertyChangeEvent(PropertyChangeEvent event) {
40364020
if (fFocusPart != null)
40374021
handleSelectionChanged(fFocusPart);
40384022

4039-
// } else if (key.equals(ComparePreferencePage.USE_SPLINES)) {
4040-
// fUseSplines= fPreferenceStore.getBoolean(ComparePreferencePage.USE_SPLINES);
4041-
// invalidateLines();
4042-
40434023
} else if (key.equals(ComparePreferencePage.USE_SINGLE_LINE)) {
40444024
fUseSingleLine= fPreferenceStore.getBoolean(ComparePreferencePage.USE_SINGLE_LINE);
4045-
// fUseResolveUI= fUseSingleLine;
40464025
fBasicCenterCurve= null;
40474026
updateControls();
40484027
invalidateLines();
@@ -4052,11 +4031,6 @@ protected void handlePropertyChangeEvent(PropertyChangeEvent event) {
40524031
updateControls();
40534032
updatePresentation();
40544033

4055-
// } else if (key.equals(ComparePreferencePage.USE_RESOLVE_UI)) {
4056-
// fUseResolveUI= fPreferenceStore.getBoolean(ComparePreferencePage.USE_RESOLVE_UI);
4057-
// updateResolveStatus();
4058-
// invalidateLines();
4059-
40604034
} else if (key.equals(fSymbolicFontName)) {
40614035
updateFont();
40624036
invalidateLines();
@@ -4343,9 +4317,6 @@ private void paintCenter(Canvas canvas, GC g) {
43434317
if (diff.isDeleted())
43444318
continue;
43454319

4346-
if (fShowCurrentOnly2 && !isCurrentDiff(diff))
4347-
continue;
4348-
43494320
fLeft.getLineRange(diff.getPosition(LEFT_CONTRIBUTOR), region);
43504321
region.x -= fLeft.getDocumentRegionOffset();
43514322
int ly = getHeightBetweenLines(fLeft, 0, region.x) + lshift;
@@ -4379,40 +4350,26 @@ private void paintCenter(Canvas canvas, GC g) {
43794350
g.drawRectangle(0-1, ly, w2, lh); // left
43804351
g.drawRectangle(w-w2, ry, w2, rh); // right
43814352

4382-
if (fUseSplines) {
4383-
int[] points= getCenterCurvePoints(w2, ly+lh/2, w-w2, ry+rh/2);
4384-
for (int i= 1; i < points.length; i++)
4385-
g.drawLine(w2+i-1, points[i-1], w2+i, points[i]);
4386-
} else {
4387-
g.drawLine(w2, ly+lh/2, w-w2, ry+rh/2);
4388-
}
4353+
int[] points = getCenterCurvePoints(w2, ly + lh / 2, w - w2, ry + rh / 2);
4354+
for (int i = 1; i < points.length; i++)
4355+
g.drawLine(w2 + i - 1, points[i - 1], w2 + i, points[i]);
43894356
} else {
43904357
// two lines
4391-
if (fUseSplines) {
4392-
g.setBackground(fillColor);
4358+
g.setBackground(fillColor);
43934359

4394-
g.setLineWidth(0 /* LW */);
4395-
g.setForeground(strokeColor);
4360+
g.setLineWidth(0 /* LW */);
4361+
g.setForeground(strokeColor);
43964362

4397-
int[] topPoints= getCenterCurvePoints(fPts[0], fPts[1], fPts[2], fPts[3]);
4398-
int[] bottomPoints= getCenterCurvePoints(fPts[6], fPts[7], fPts[4], fPts[5]);
4363+
int[] topPoints = getCenterCurvePoints(fPts[0], fPts[1], fPts[2], fPts[3]);
4364+
int[] bottomPoints = getCenterCurvePoints(fPts[6], fPts[7], fPts[4], fPts[5]);
4365+
g.setForeground(fillColor);
4366+
g.drawLine(0, bottomPoints[0], 0, topPoints[0]);
4367+
for (int i = 1; i < bottomPoints.length; i++) {
43994368
g.setForeground(fillColor);
4400-
g.drawLine(0, bottomPoints[0], 0, topPoints[0]);
4401-
for (int i= 1; i < bottomPoints.length; i++) {
4402-
g.setForeground(fillColor);
4403-
g.drawLine(i, bottomPoints[i], i, topPoints[i]);
4404-
g.setForeground(strokeColor);
4405-
g.drawLine(i-1, topPoints[i-1], i, topPoints[i]);
4406-
g.drawLine(i-1, bottomPoints[i-1], i, bottomPoints[i]);
4407-
}
4408-
} else {
4409-
g.setBackground(fillColor);
4410-
g.fillPolygon(fPts);
4411-
4412-
g.setLineWidth(0 /* LW */);
4369+
g.drawLine(i, bottomPoints[i], i, topPoints[i]);
44134370
g.setForeground(strokeColor);
4414-
g.drawLine(fPts[0], fPts[1], fPts[2], fPts[3]);
4415-
g.drawLine(fPts[6], fPts[7], fPts[4], fPts[5]);
4371+
g.drawLine(i - 1, topPoints[i - 1], i, topPoints[i]);
4372+
g.drawLine(i - 1, bottomPoints[i - 1], i, bottomPoints[i]);
44164373
}
44174374
}
44184375

@@ -4492,9 +4449,6 @@ private void paintSides(GC g, MergeSourceViewer tp, Canvas canvas, boolean right
44924449
if (diff.isDeleted())
44934450
continue;
44944451

4495-
if (fShowCurrentOnly2 && !isCurrentDiff(diff))
4496-
continue;
4497-
44984452
tp.getLineRange(diff.getPosition(leg), region);
44994453
region.x -= tp.getDocumentRegionOffset();
45004454
int y = getHeightBetweenLines(tp, 0, region.x) + shift;
@@ -4558,9 +4512,6 @@ private void paint(PaintEvent event, MergeSourceViewer tp) {
45584512
if (diff.isDeleted())
45594513
continue;
45604514

4561-
if (fShowCurrentOnly && !isCurrentDiff(diff))
4562-
continue;
4563-
45644515
tp.getLineRange(diff.getPosition(leg), range);
45654516
range.x -= tp.getDocumentRegionOffset();
45664517
int y = getHeightBetweenLines(tp, 0, range.x) + shift;

0 commit comments

Comments
 (0)