sysperfana/perfinvestigator/com.nokia.carbide.cpp.pi/src/com/nokia/carbide/cpp/internal/pi/analyser/PIChangeEvent.java
changeset 2 b9ab3b238396
child 12 ae255c9aa552
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysperfana/perfinvestigator/com.nokia.carbide.cpp.pi/src/com/nokia/carbide/cpp/internal/pi/analyser/PIChangeEvent.java	Thu Feb 11 15:32:31 2010 +0200
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Nokia Corporation - initial contribution.
+ *
+ * Contributors:
+ *
+ * Description: 
+ *
+ */
+
+package com.nokia.carbide.cpp.internal.pi.analyser;
+
+import java.util.ArrayList;
+
+import com.nokia.carbide.cpp.pi.editors.PIPageEditor;
+
+public class PIChangeEvent {
+
+	private PIChangeEvent() {
+		/* this class can only have static method */
+	}
+	
+	public static void action(String actionString) {
+		processEvent(actionString);
+	}
+	
+	public static void processEvent(String actionString) {
+		int uid = NpiInstanceRepository.getInstance().activeUid();
+		if (   actionString.equals("+") //$NON-NLS-1$
+			 || actionString.equals("-") //$NON-NLS-1$
+			 || actionString.equals("++") //$NON-NLS-1$
+			 || actionString.equals("--")) //$NON-NLS-1$
+		{
+			ArrayList<ProfileVisualiser> list = NpiInstanceRepository.getInstance().activeUidGetProfilePages();
+			
+			// for zoom to selected time interval, there must be a selected time interval
+			if (   actionString.equals("--") //$NON-NLS-1$
+				&& !NpiInstanceRepository.getInstance().getProfilePage(uid, 0).getTopComposite().validInterval()) {
+				// let the first page supply the error message
+				NpiInstanceRepository.getInstance().getProfilePage(uid, 0).action(actionString);
+				return;
+			}
+			
+			for (int i = 0; i < list.size(); i++)
+				NpiInstanceRepository.getInstance().getProfilePage(uid, i).action(actionString);
+		}
+		else if (   actionString.equals("changeInterval") //$NON-NLS-1$
+				 || actionString.equals("changeSelection") //$NON-NLS-1$
+				 || actionString.equals("changeThresholdThread") //$NON-NLS-1$
+				 || actionString.equals("changeThresholdBinary") //$NON-NLS-1$
+				 || actionString.equals("changeThresholdFunction")) //$NON-NLS-1$
+		{
+			ArrayList<ProfileVisualiser> list = NpiInstanceRepository.getInstance().activeUidGetProfilePages();
+			
+			for (int i = 0; i < list.size(); i++)
+				NpiInstanceRepository.getInstance().getProfilePage(uid, i).action(actionString);
+		}
+		else
+		{
+			NpiInstanceRepository.getInstance().getProfilePage(uid, PIPageEditor.currentPageIndex()).action(actionString);
+		}
+	}
+}