diff options
author | Michael Valenta | 2007-05-15 18:12:38 +0000 |
---|---|---|
committer | Michael Valenta | 2007-05-15 18:12:38 +0000 |
commit | 7cea1dce191ef5bd547ab0cfe60a785a8b056488 (patch) | |
tree | 8f9c832ceda5385a7ff6e16ffe73f4dafef8807f /bundles/org.eclipse.team.cvs.ui | |
parent | e41bf9b7f20904c9c8ef8fc1d1490e0f257e4f4f (diff) | |
download | eclipse.platform.team-7cea1dce191ef5bd547ab0cfe60a785a8b056488.tar.gz eclipse.platform.team-7cea1dce191ef5bd547ab0cfe60a785a8b056488.tar.xz eclipse.platform.team-7cea1dce191ef5bd547ab0cfe60a785a8b056488.zip |
Bug 180993 [quick diff] Improve colors for Show Annotation
Diffstat (limited to 'bundles/org.eclipse.team.cvs.ui')
-rw-r--r-- | bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CommitterColors.java | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CommitterColors.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CommitterColors.java index c3cbf0e2f..457ce6744 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CommitterColors.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/CommitterColors.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. + * Copyright (c) 2005, 2007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -15,16 +15,27 @@ import java.util.Map; import org.eclipse.swt.graphics.RGB; + /** * Default implementation, assigns random colors to revisions based on committer id. - * <p> - * XXX This API is provisional and may change any time during the development of eclipse 3.2. - * </p> * * @since 3.2 */ final class CommitterColors { + private static CommitterColors fInstance; + + // Fixed committer color RGBs provided by the UI Designer + private static final RGB[] COMMITTER_RGBs= new RGB[] { + new RGB(131, 150, 98), new RGB(132, 164, 118), new RGB(221, 205, 93), new RGB(199, 134, 57), new RGB(197, 123, 127), + new RGB(133, 166, 214), new RGB(143, 163, 54), new RGB(180, 148, 74), new RGB(139, 136, 140), new RGB(48, 135, 144), + new RGB(190, 93, 66), new RGB(101, 101, 217), new RGB(23, 101, 160), new RGB(72, 153, 119), + + new RGB(136, 176, 70), new RGB(123, 187, 95), new RGB(255, 230, 59), new RGB(255, 138, 1), new RGB(233, 88, 98), + new RGB(93, 158, 254), new RGB(175, 215, 0), new RGB(232, 168, 21), new RGB(140, 134, 142), new RGB(0, 172, 191), + new RGB(251, 58, 4), new RGB(63, 64, 255), new RGB(0, 104, 183), new RGB(27, 194, 130) + }; + /** * Returns the committer color singleton. @@ -56,26 +67,10 @@ final class CommitterColors { public RGB getCommitterRGB(String committer) { RGB rgb= (RGB) fColors.get(committer); if (rgb == null) { - rgb= computeRGB(fCount++); + rgb= COMMITTER_RGBs[fCount++ % COMMITTER_RGBs.length]; fColors.put(committer, rgb); } return rgb; } - private RGB computeRGB(int ordinal) { - float hue= computeHue(ordinal); - RGB rgb= new RGB(hue, 1.0f, 1.0f); - return rgb; - } - - private float computeHue(int ordinal) { - int base= 3; - int l= ordinal < base ? 0 : (int) Math.floor(Math.log(ordinal / base) / Math.log(2)); - int m= ((int) Math.pow(2, l)) * base; - int j= ordinal < base ? ordinal : ordinal - m; - float offset= ordinal < base ? 0.0f : (float) (180.0f / base / Math.pow(2, l)); - float delta= ordinal < base ? 120.0f : 2 * offset; - float hue= (offset + j * delta) % 360; - return hue; - } } |