Skip to content

Commit 591fa7f

Browse files
author
Ernesto Posse
committed
Issue #443: Incorporated fix into CompareColotImpl
Signed-off-by: Ernesto Posse <eposse.gmail.com>
1 parent 0ef598f commit 591fa7f

File tree

1 file changed

+20
-9
lines changed
  • papyrus-patch/v4.8.0/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/mergeviewer

1 file changed

+20
-9
lines changed

papyrus-patch/v4.8.0/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/mergeviewer/CompareColorImpl.java

+20-9
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ public class CompareColorImpl implements RemovalListener<RGB, Color>, ICompareCo
4949

5050
/** Scale factor */
5151
private static final double INTERPOLATION_SCALE_2 = 0.97;
52+
53+
/** Scale factor for filling of a selected element */
54+
private static final double INTERPOLATION_SCALE_SELECTED_FILL = 0.3;
5255

5356
/** Scale factor to compute the color of border. */
5457
private static final double DARKER_BORDER_SCALE_FACTOR = -0.5;
@@ -82,26 +85,32 @@ public class CompareColorImpl implements RemovalListener<RGB, Color>, ICompareCo
8285

8386
private RGB incomingFill;
8487

88+
private RGB incommingSelectedFill;
89+
8590
private RGB conflictSelected;
8691

8792
private RGB conflict;
8893

8994
private RGB conflictFill;
9095

96+
private RGB conflictSelectedFill;
97+
9198
private RGB outgoingSelected;
9299

93100
private RGB outgoing;
94101

95102
private RGB outgoingFill;
96103

104+
private RGB outgoingSelectedFill;
105+
97106
private RGB requiredColor;
98107

99108
private RGB requiredBorderColor;
100109

101110
private RGB unmergeableColor;
102111

103112
private RGB unmergeableBorderColor;
104-
113+
105114
/**
106115
* Constructor. With this constructor the colors will disposed at the same as the control.
107116
*
@@ -153,29 +162,28 @@ public Color getFillColor(Diff diff, boolean isThreeWay, boolean isIgnoreAncesto
153162
}
154163

155164
private RGB getFillRGB(Diff diff, boolean isThreeWay, boolean isIgnoreAncestor, boolean selected) {
156-
RGB selectedFill = getBackground();
157165
if (isThreeWay && !isIgnoreAncestor) {
158166
boolean requiredConflictForWayOfMerge = false;
159167

160168
if (diff.getConflict() == null && !requiredConflictForWayOfMerge) {
161169
switch (diff.getSource()) {
162170
case RIGHT:
163171
if (fLeftIsLocal) {
164-
return selected ? selectedFill : incomingFill;
172+
return selected ? incommingSelectedFill : incomingFill;
165173
}
166-
return selected ? selectedFill : outgoingFill;
174+
return selected ? outgoingSelectedFill : outgoingFill;
167175
case LEFT:
168176
if (fLeftIsLocal) {
169-
return selected ? selectedFill : outgoingFill;
177+
return selected ? outgoingSelectedFill : outgoingFill;
170178
}
171-
return selected ? selectedFill : incomingFill;
179+
return selected ? incommingSelectedFill : incomingFill;
172180
}
173181
} else {
174-
return selected ? selectedFill : conflictFill;
182+
return selected ? conflictSelectedFill : conflictFill;
175183
}
176-
return selected ? selectedFill : conflictFill;
184+
return selected ? conflictSelectedFill : conflictFill;
177185
}
178-
return selected ? selectedFill : outgoingFill;
186+
return selected ? outgoingSelectedFill : outgoingFill;
179187
}
180188

181189
/**
@@ -234,20 +242,23 @@ protected final void updateColors() {
234242
}
235243
conflict = interpolate(conflictSelected, background, INTERPOLATION_SCALE_1);
236244
conflictFill = interpolate(conflictSelected, background, INTERPOLATION_SCALE_2);
245+
conflictSelectedFill = interpolate(conflictSelected, background, INTERPOLATION_SCALE_SELECTED_FILL);
237246

238247
outgoingSelected = fColorRegistry.getRGB(OUTGOING_CHANGE_COLOR_THEME_KEY);
239248
if (outgoingSelected == null) {
240249
outgoingSelected = new RGB(0, 0, 0); // BLACK
241250
}
242251
outgoing = interpolate(outgoingSelected, background, INTERPOLATION_SCALE_1);
243252
outgoingFill = interpolate(outgoingSelected, background, INTERPOLATION_SCALE_2);
253+
outgoingSelectedFill = interpolate(outgoingSelected, background, INTERPOLATION_SCALE_SELECTED_FILL);
244254

245255
incomingSelected = fColorRegistry.getRGB(INCOMING_CHANGE_COLOR_THEME_KEY);
246256
if (incomingSelected == null) {
247257
incomingSelected = new RGB(0, 0, MAX_RGB_COMPONENT); // BLUE
248258
}
249259
incoming = interpolate(incomingSelected, background, INTERPOLATION_SCALE_1);
250260
incomingFill = interpolate(incomingSelected, background, INTERPOLATION_SCALE_2);
261+
incommingSelectedFill = interpolate(incomingSelected, background, INTERPOLATION_SCALE_SELECTED_FILL);
251262
}
252263

253264
/**

0 commit comments

Comments
 (0)