diff options
author | Darin Wright | 2009-04-08 15:40:05 +0000 |
---|---|---|
committer | Darin Wright | 2009-04-08 15:40:05 +0000 |
commit | f1255faf2500d4bd55c5954b9e531646c6332159 (patch) | |
tree | 8c5b5860a3a733ad2ef6409c31ca408c1030b132 | |
parent | ff8c8229444b4076467c911253a7ecbf2c836b65 (diff) | |
download | eclipse.platform.debug-f1255faf2500d4bd55c5954b9e531646c6332159.tar.gz eclipse.platform.debug-f1255faf2500d4bd55c5954b9e531646c6332159.tar.xz eclipse.platform.debug-f1255faf2500d4bd55c5954b9e531646c6332159.zip |
Remove dependency on org.eclipse.ui.forms bundle (which was introduced in 3.5 with bread crumb)
2 files changed, 37 insertions, 4 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItemDropDown.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItemDropDown.java index 808f51256..46e05c41f 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItemDropDown.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItemDropDown.java @@ -49,7 +49,6 @@ import org.eclipse.swt.widgets.Monitor; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.ToolBar; import org.eclipse.swt.widgets.Widget; -import org.eclipse.ui.forms.FormColors; /** @@ -146,7 +145,7 @@ class BreadcrumbItemDropDown implements IBreadcrumbDropDownSite { RGB rgb1= display.getSystemColor(color1).getRGB(); RGB rgb2= display.getSystemColor(color2).getRGB(); - RGB blend= FormColors.blend(rgb2, rgb1, ratio); + RGB blend= BreadcrumbViewer.blend(rgb2, rgb1, ratio); return new Color(display, blend); } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbViewer.java index 0233cdba9..52ec2db1c 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbViewer.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbViewer.java @@ -49,7 +49,6 @@ import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Widget; -import org.eclipse.ui.forms.FormColors; /** @@ -835,8 +834,43 @@ public abstract class BreadcrumbViewer extends StructuredViewer { RGB rgb1= display.getSystemColor(color1).getRGB(); RGB rgb2= display.getSystemColor(color2).getRGB(); - RGB blend= FormColors.blend(rgb2, rgb1, ratio); + RGB blend= blend(rgb2, rgb1, ratio); return new Color(display, blend); } + + /** + * Blends c1 and c2 based in the provided ratio. + * + * @param c1 + * first color + * @param c2 + * second color + * @param ratio + * percentage of the first color in the blend (0-100) + * @return the RGB value of the blended color + * @since 3.1 + */ + public static RGB blend(RGB c1, RGB c2, int ratio) { + int r = blend(c1.red, c2.red, ratio); + int g = blend(c1.green, c2.green, ratio); + int b = blend(c1.blue, c2.blue, ratio); + return new RGB(r, g, b); + } + + /** + * Blends two primary color components based on the provided ratio. + * + * @param v1 + * first component + * @param v2 + * second component + * @param ratio + * percentage of the first component in the blend + * @return + */ + private static int blend(int v1, int v2, int ratio) { + int b = (ratio * v1 + (100 - ratio) * v2) / 100; + return Math.min(255, b); + } } |