|
1 /* |
|
2 * Copyright (c) 2010 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 package com.nokia.carbide.cpp.pi.internal.perfcounters; |
|
18 |
|
19 import org.eclipse.core.runtime.IAdapterFactory; |
|
20 |
|
21 import com.nokia.carbide.cpp.internal.pi.analyser.NpiInstanceRepository; |
|
22 import com.nokia.carbide.cpp.internal.pi.model.ICPUScale; |
|
23 import com.nokia.carbide.cpp.internal.pi.model.ParsedTraceData; |
|
24 import com.nokia.carbide.cpp.internal.pi.model.TraceDataRepository; |
|
25 import com.nokia.carbide.cpp.pi.peccommon.PecCommonTrace; |
|
26 |
|
27 public class PecTraceAdapterFactory implements IAdapterFactory { |
|
28 |
|
29 /* |
|
30 * (non-Javadoc) |
|
31 * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class) |
|
32 */ |
|
33 @SuppressWarnings("unchecked") |
|
34 public Object getAdapter(Object adaptableObject, Class adapterType) { |
|
35 int uid = NpiInstanceRepository.getInstance().activeUid(); |
|
36 ParsedTraceData ptd = TraceDataRepository.getInstance().getTrace(uid, PecTrace.class); //$NON-NLS-1$ |
|
37 if(ptd != null){ |
|
38 PecCommonTrace pecTrace = (PecCommonTrace) ptd.traceData; |
|
39 return pecTrace; |
|
40 } |
|
41 return null; |
|
42 } |
|
43 |
|
44 /* |
|
45 * (non-Javadoc) |
|
46 * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList() |
|
47 */ |
|
48 @SuppressWarnings("unchecked") |
|
49 public Class[] getAdapterList() { |
|
50 return new Class[] {ICPUScale.class}; |
|
51 } |
|
52 |
|
53 } |