|
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.internal.pi.analyser; |
|
19 |
|
20 import java.util.ArrayList; |
|
21 |
|
22 import com.nokia.carbide.cpp.pi.editors.PIPageEditor; |
|
23 |
|
24 public class PIChangeEvent { |
|
25 |
|
26 private PIChangeEvent() { |
|
27 /* this class can only have static method */ |
|
28 } |
|
29 |
|
30 public static void action(String actionString) { |
|
31 processEvent(actionString); |
|
32 } |
|
33 |
|
34 public static void processEvent(String actionString) { |
|
35 int uid = NpiInstanceRepository.getInstance().activeUid(); |
|
36 if ( actionString.equals("+") //$NON-NLS-1$ |
|
37 || actionString.equals("-") //$NON-NLS-1$ |
|
38 || actionString.equals("++") //$NON-NLS-1$ |
|
39 || actionString.equals("--")) //$NON-NLS-1$ |
|
40 { |
|
41 ArrayList<ProfileVisualiser> list = NpiInstanceRepository.getInstance().activeUidGetProfilePages(); |
|
42 |
|
43 // for zoom to selected time interval, there must be a selected time interval |
|
44 if ( actionString.equals("--") //$NON-NLS-1$ |
|
45 && !NpiInstanceRepository.getInstance().getProfilePage(uid, 0).getTopComposite().validInterval()) { |
|
46 // let the first page supply the error message |
|
47 NpiInstanceRepository.getInstance().getProfilePage(uid, 0).action(actionString); |
|
48 return; |
|
49 } |
|
50 |
|
51 for (int i = 0; i < list.size(); i++) |
|
52 NpiInstanceRepository.getInstance().getProfilePage(uid, i).action(actionString); |
|
53 } |
|
54 else if ( actionString.equals("changeInterval") //$NON-NLS-1$ |
|
55 || actionString.equals("changeSelection") //$NON-NLS-1$ |
|
56 || actionString.equals("changeThresholdThread") //$NON-NLS-1$ |
|
57 || actionString.equals("changeThresholdBinary") //$NON-NLS-1$ |
|
58 || actionString.equals("changeThresholdFunction")) //$NON-NLS-1$ |
|
59 { |
|
60 ArrayList<ProfileVisualiser> list = NpiInstanceRepository.getInstance().activeUidGetProfilePages(); |
|
61 |
|
62 for (int i = 0; i < list.size(); i++) |
|
63 NpiInstanceRepository.getInstance().getProfilePage(uid, i).action(actionString); |
|
64 } |
|
65 else |
|
66 { |
|
67 NpiInstanceRepository.getInstance().getProfilePage(uid, PIPageEditor.currentPageIndex()).action(actionString); |
|
68 } |
|
69 } |
|
70 } |