Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 71413 Details for
Bug 192779
[api] Push down CommitterColours to Team or Text
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
patch to org.eclipse.jface.text
192779.patch (text/plain), 4.11 KB, created by
Brock Janiczak
on 2007-06-15 00:34:24 EDT
(
hide
)
Description:
patch to org.eclipse.jface.text
Filename:
MIME Type:
Creator:
Brock Janiczak
Created:
2007-06-15 00:34:24 EDT
Size:
4.11 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jface.text >Index: src/org/eclipse/jface/text/revisions/Revision.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jface.text/src/org/eclipse/jface/text/revisions/Revision.java,v >retrieving revision 1.11 >diff -u -r1.11 Revision.java >--- src/org/eclipse/jface/text/revisions/Revision.java 9 May 2007 12:10:32 -0000 1.11 >+++ src/org/eclipse/jface/text/revisions/Revision.java 15 Jun 2007 04:29:32 -0000 >@@ -20,6 +20,7 @@ > > import org.eclipse.jface.text.source.ILineRange; > >+import org.eclipse.jface.internal.text.revisions.AuthorColors; > import org.eclipse.jface.internal.text.revisions.ChangeRegion; > import org.eclipse.jface.internal.text.revisions.Hunk; > >@@ -115,7 +116,9 @@ > * > * @return the RGB color description for this revision > */ >- public abstract RGB getColor(); >+ public RGB getColor() { >+ return AuthorColors.getDefault().getAuthorRGB(getAuthor()); >+ } > > /** > * Returns the unique (within the document) id of this revision. This may be the version string >Index: src/org/eclipse/jface/internal/text/revisions/AuthorColors.java >=================================================================== >RCS file: src/org/eclipse/jface/internal/text/revisions/AuthorColors.java >diff -N src/org/eclipse/jface/internal/text/revisions/AuthorColors.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jface/internal/text/revisions/AuthorColors.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,76 @@ >+/******************************************************************************* >+ * 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jface.internal.text.revisions; >+ >+import java.util.HashMap; >+import java.util.Map; >+ >+import org.eclipse.swt.graphics.RGB; >+ >+ >+/** >+ * Default implementation, assigns random colors to revisions based on author id. >+ * >+ * @since 3.4 >+ */ >+public final class AuthorColors { >+ >+ private static AuthorColors fInstance; >+ >+ // Fixed author color RGBs provided by the UI Designer >+ private static final RGB[] AUTHOR_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 author color singleton. >+ * >+ * @return the author color singleton >+ */ >+ public static AuthorColors getDefault() { >+ if (fInstance == null) >+ fInstance= new AuthorColors(); >+ return fInstance; >+ } >+ >+ /** The color map. */ >+ private Map fColors= new HashMap(); >+ >+ /** The number of colors that have been issued. */ >+ private int fCount= 0; >+ >+ private AuthorColors() { >+ } >+ >+ /** >+ * Returns a unique color description for each string passed in. Colors for new author are >+ * allocated to be as different as possible from the existing colors. >+ * >+ * @param author the author unique name >+ * @return the corresponding color >+ */ >+ public RGB getAuthorRGB(String author) { >+ RGB rgb= (RGB) fColors.get(author); >+ if (rgb == null) { >+ rgb= AUTHOR_RGBs[fCount++ % AUTHOR_RGBs.length]; >+ fColors.put(author, rgb); >+ } >+ return rgb; >+ } >+ >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
daniel_megert
:
review-
Actions:
View
|
Diff
Attachments on
bug 192779
:
71413