|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 package com.nokia.carbide.cpp.pi.util; |
|
19 |
|
20 import org.eclipse.swt.graphics.RGB; |
|
21 |
|
22 public class ThreadColorPalette extends TableColorPalette { |
|
23 |
|
24 @Override |
|
25 public RGB getConstantRGB(Object entry) { |
|
26 |
|
27 assert (entry instanceof String); |
|
28 //threadName = sample.thread.process.name + "::" + sample.thread.threadName + "_" + sample.thread.threadId; |
|
29 |
|
30 String string = (String)entry; |
|
31 |
|
32 int lastIndexOf = string.lastIndexOf("_"); |
|
33 |
|
34 |
|
35 String threadName[] = string.substring(0, lastIndexOf).split("::"); //$NON-NLS-1$ //$NON-NLS-2$ |
|
36 |
|
37 int length = threadName.length; |
|
38 |
|
39 if(length == 1){ |
|
40 String newArray[] = new String[2]; |
|
41 newArray[0] = threadName[0]; |
|
42 newArray[1] = string.substring(lastIndexOf); |
|
43 threadName = newArray; |
|
44 } |
|
45 |
|
46 assert (threadName.length == 2); |
|
47 |
|
48 String pro_string = threadName[0]; |
|
49 String thr_string = threadName[1]; |
|
50 int mark; |
|
51 if (pro_string.indexOf(".") != -1) //$NON-NLS-1$ |
|
52 mark = pro_string.indexOf("."); //EKA2 //$NON-NLS-1$ |
|
53 else if (pro_string.indexOf('[') != -1) |
|
54 mark = pro_string.indexOf('['); //EKA1 |
|
55 else |
|
56 return null; |
|
57 |
|
58 pro_string = pro_string.substring(0, mark); |
|
59 |
|
60 if (pro_string.equalsIgnoreCase("EKern") && thr_string.equalsIgnoreCase("NULL")) { //$NON-NLS-1$ //$NON-NLS-2$ |
|
61 return new RGB(192,192,192); // AWT Color.lightGray |
|
62 } |
|
63 if (pro_string.equalsIgnoreCase("CarbideProf") && thr_string.equalsIgnoreCase("Profiler")) { //$NON-NLS-1$ //$NON-NLS-2$ |
|
64 return new RGB(0, 255, 255); // AWT Color.cyan |
|
65 } |
|
66 if (pro_string.equalsIgnoreCase("C32exe") && thr_string.equalsIgnoreCase("EtelServer")) { //$NON-NLS-1$ //$NON-NLS-2$ |
|
67 return new RGB(255, 200, 0); // AWT Color.orange |
|
68 } |
|
69 if (pro_string.equalsIgnoreCase("C32exe") && thr_string.equalsIgnoreCase("SocketServer")) { //$NON-NLS-1$ //$NON-NLS-2$ |
|
70 return new RGB(255, 175, 175); // AWT Color.pink |
|
71 } |
|
72 if (pro_string.equalsIgnoreCase("DosServer") && thr_string.equalsIgnoreCase("DosServer")) { //$NON-NLS-1$ //$NON-NLS-2$ |
|
73 return new RGB(255, 0, 255); // AWT Color magenta |
|
74 } |
|
75 if (pro_string.equalsIgnoreCase("EFile") && thr_string.equalsIgnoreCase("FileServer")) { //$NON-NLS-1$ //$NON-NLS-2$ |
|
76 return new RGB(0, 0, 255); // AWT Color.blue |
|
77 } |
|
78 if (pro_string.equalsIgnoreCase("EKern") && thr_string.equalsIgnoreCase("Supervisor")) { //$NON-NLS-1$ //$NON-NLS-2$ |
|
79 return new RGB(0, 0, 0); // AWT Color.black |
|
80 } |
|
81 if (pro_string.equalsIgnoreCase("EikSrvs") && thr_string.equalsIgnoreCase("ViewServerThread")) { //$NON-NLS-1$ //$NON-NLS-2$ |
|
82 return new RGB(64, 64, 64); // AWT Color.darkGray |
|
83 } |
|
84 if (pro_string.equalsIgnoreCase("FbServ") && thr_string.equalsIgnoreCase("Fontbitmapserver")) { //$NON-NLS-1$ //$NON-NLS-2$ |
|
85 return new RGB(255, 0, 0); // AWT Color.red |
|
86 } |
|
87 if (pro_string.equalsIgnoreCase("Phone") && thr_string.equalsIgnoreCase("Phone")) { //$NON-NLS-1$ //$NON-NLS-2$ |
|
88 return new RGB(128, 128, 128); // AWT Color.gray |
|
89 } |
|
90 |
|
91 return null; |
|
92 } |
|
93 |
|
94 } |