sysperfana/perfinvestigator/com.nokia.carbide.cpp.pi.button/src/com/nokia/carbide/cpp/pi/button/ButtonPlugin.java
author Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
Wed, 23 Jun 2010 15:05:09 +0300
changeset 12 ae255c9aa552
parent 5 844b047e260d
permissions -rw-r--r--
Performance Investigator Carbide extension 2.4.0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     1
/*
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     2
 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     3
 * All rights reserved.
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     4
 * This component and the accompanying materials are made available
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     5
 * under the terms of the License "Eclipse Public License v1.0"
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     6
 * which accompanies this distribution, and is available
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     8
 *
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     9
 * Initial Contributors:
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    10
 * Nokia Corporation - initial contribution.
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    11
 *
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    12
 * Contributors:
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    13
 *
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    14
 * Description: 
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    15
 *
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    16
 */
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    17
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    18
package com.nokia.carbide.cpp.pi.button;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    19
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    20
import java.io.File;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    21
import java.util.ArrayList;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    22
import java.util.Vector;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    23
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    24
import org.eclipse.jface.action.Action;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    25
import org.eclipse.jface.action.MenuManager;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    26
import org.eclipse.jface.preference.IPreferenceStore;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    27
import org.eclipse.jface.resource.ImageDescriptor;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    28
import org.eclipse.jface.window.Window;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    29
import org.eclipse.swt.widgets.Display;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    30
import org.eclipse.swt.widgets.Event;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    31
import org.osgi.framework.BundleContext;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    32
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    33
import com.nokia.carbide.cpp.internal.pi.analyser.NpiInstanceRepository;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    34
import com.nokia.carbide.cpp.internal.pi.analyser.ProfileVisualiser;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    35
import com.nokia.carbide.cpp.internal.pi.button.ui.SwitchBupMapDialog;
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    36
import com.nokia.carbide.cpp.internal.pi.model.GenericSample;
2
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    37
import com.nokia.carbide.cpp.internal.pi.model.GenericTrace;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    38
import com.nokia.carbide.cpp.internal.pi.model.ParsedTraceData;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    39
import com.nokia.carbide.cpp.internal.pi.plugin.model.AbstractPiPlugin;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    40
import com.nokia.carbide.cpp.internal.pi.plugin.model.IClassReplacer;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    41
import com.nokia.carbide.cpp.internal.pi.plugin.model.IEventListener;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    42
import com.nokia.carbide.cpp.internal.pi.plugin.model.IFinalizeTrace;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    43
import com.nokia.carbide.cpp.internal.pi.plugin.model.ITrace;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    44
import com.nokia.carbide.cpp.internal.pi.plugin.model.IViewMenu;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    45
import com.nokia.carbide.cpp.internal.pi.plugin.model.IVisualizable;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    46
import com.nokia.carbide.cpp.internal.pi.test.AnalysisInfoHandler;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    47
import com.nokia.carbide.cpp.internal.pi.test.IProvideTraceAdditionalInfo;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    48
import com.nokia.carbide.cpp.internal.pi.test.TraceAdditionalInfo;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    49
import com.nokia.carbide.cpp.internal.pi.visual.GenericTraceGraph;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    50
import com.nokia.carbide.cpp.internal.pi.visual.GraphDrawRequest;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    51
import com.nokia.carbide.cpp.pi.editors.PIPageEditor;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    52
import com.nokia.carbide.cpp.pi.importer.SampleImporter;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    53
import com.nokia.carbide.cpp.pi.util.GeneralMessages;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    54
import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    55
import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    56
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    57
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    58
/**
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    59
 * The main plugin class to be used in the desktop.
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    60
 */
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    61
public class ButtonPlugin extends AbstractPiPlugin
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    62
			implements ITrace, IViewMenu, IEventListener, IClassReplacer, IVisualizable, IFinalizeTrace, IProvideTraceAdditionalInfo
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    63
{
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    64
2
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    65
	public static final String PLUGIN_ID = PIPageEditor.PI_ID + ".button";  //$NON-NLS-1$
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    66
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    67
	// There will be three graphs - one each for editor pages 0, 1, 2
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    68
	// This code may assume that page 0 has the threads graph, 1 the binaries, and 2 the functions
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    69
	private final static int GRAPH_COUNT = 3;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    70
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    71
	//The shared instance.
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    72
	private static ButtonPlugin plugin;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    73
	
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    74
	private static IPreferenceStore prefsStore;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    75
	
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    76
	private static void setPlugin(ButtonPlugin newPlugin)
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    77
	{
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    78
		plugin = newPlugin;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    79
	}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    80
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    81
	/**
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    82
	 * The constructor.
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    83
	 */
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    84
	public ButtonPlugin() {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    85
		super();
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    86
		setPlugin(this);
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    87
	}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    88
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    89
	public Class getTraceClass() {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    90
		return BupTrace.class;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    91
	}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    92
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    93
	public Class getReplacedClass(String className)
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    94
	{
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    95
		if (   className.indexOf("com.nokia.carbide.cpp.pi.button.BupTrace") != -1 //$NON-NLS-1$
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    96
			|| className.indexOf("com.nokia.carbide.pi.button.BupTrace") != -1 //$NON-NLS-1$
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    97
			|| className.indexOf("fi.vtt.bappea.model.BupTrace") != -1 //$NON-NLS-1$
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    98
			|| className.indexOf("fi.vtt.bappea.bupTracePlugin.BupTrace") != -1) //$NON-NLS-1$
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    99
		{
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   100
			return BupTrace.class;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   101
		}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   102
		else if (   className.indexOf("com.nokia.carbide.cpp.pi.button.BupSample") != -1 //$NON-NLS-1$
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   103
				 || className.indexOf("com.nokia.carbide.pi.button.BupSample") != -1 )//$NON-NLS-1$
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   104
		{
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   105
			return BupSample.class;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   106
		}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   107
		else
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   108
			return null;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   109
	}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   110
	
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   111
	public void initialiseTrace(GenericTrace trace) 
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   112
	{
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   113
		if (!(trace instanceof BupTrace))
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   114
			return;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   115
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   116
		BupTrace bupTrace = (BupTrace)trace;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   117
		
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   118
		NpiInstanceRepository.getInstance().activeUidAddTrace("com.nokia.carbide.cpp.pi.button", trace); //$NON-NLS-1$
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   119
	}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   120
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   121
	public String getTraceName() {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   122
		return "Button"; //$NON-NLS-1$
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   123
	}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   124
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   125
	/* (non-Javadoc)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   126
	 * @see com.nokia.carbide.cpp.internal.pi.plugin.model.ITrace#getTraceTitle()
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   127
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   128
	public String getTraceTitle() {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   129
		return Messages.getString("ButtonPlugin.0"); //$NON-NLS-1$
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   130
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   131
2
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   132
	public int getTraceId() {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   133
		return 7;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   134
	}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   135
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   136
	/* (non-Javadoc)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   137
	 * @see com.nokia.carbide.cpp.internal.pi.plugin.model.ITrace#parseTraceFiles(java.io.File[])
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   138
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   139
	public ParsedTraceData parseTraceFiles(File[] files) throws Exception {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   140
		throw new UnsupportedOperationException();
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   141
	}
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   142
2
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   143
	public ParsedTraceData parseTraceFile(File file) throws Exception 
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   144
	{
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   145
		try
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   146
        {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   147
            BupTraceParser parser;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   148
            parser = new BupTraceParser();
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   149
            return parser.parse(file);
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   150
        } catch (Exception e)
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   151
        {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   152
            e.printStackTrace();
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   153
            throw e;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   154
        }
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   155
	}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   156
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   157
	public MenuManager getViewOptionManager() {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   158
		// current tab
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   159
		if (NpiInstanceRepository.getInstance().activeUidGetTrace("com.nokia.carbide.cpp.pi.button") == null) //$NON-NLS-1$
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   160
			return null;	// no trace, so no MenuManager
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   161
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   162
		Action action;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   163
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   164
		Boolean showEvents = Boolean.TRUE;		// by default, show button press events
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   165
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   166
		// if there is a value associated with the current Analyser tab, then use it
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   167
		Object obj = NpiInstanceRepository.getInstance().activeUidGetPersistState("com.nokia.carbide.cpp.pi.button.show"); //$NON-NLS-1$
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   168
		if ((obj != null) && (obj instanceof Boolean))
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   169
			// retrieve the current value
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   170
			showEvents = (Boolean)obj;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   171
		else
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   172
			// set the initial value
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   173
			NpiInstanceRepository.getInstance().activeUidSetPersistState("com.nokia.carbide.cpp.pi.button.show", showEvents); //$NON-NLS-1$
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   174
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   175
		action = new Action(Messages.getString("ButtonPlugin.showEventsAction"), Action.AS_CHECK_BOX) { //$NON-NLS-1$
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   176
			public void run() {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   177
				if (this.isChecked())
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   178
					receiveSelectionEvent("button_events_on"); //$NON-NLS-1$
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   179
				else
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   180
					receiveSelectionEvent("button_events_off"); //$NON-NLS-1$
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   181
			}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   182
		};
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   183
		action.setChecked(showEvents);
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   184
		action.setToolTipText(Messages.getString("ButtonPlugin.showEventsTooltip")); //$NON-NLS-1$
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   185
		PIPageEditor.currentMenuManager().add(action);
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   186
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   187
		action = new Action("Apply New Key Press Profile", Action.AS_PUSH_BUTTON) {	//$NON-NLS-1$
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   188
			public void run() {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   189
				switchMap();
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   190
			}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   191
		};
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   192
		action.setChecked(showEvents);
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   193
		action.setToolTipText(Messages.getString("ButtonPlugin.applyProfile")); //$NON-NLS-1$
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   194
		PIPageEditor.currentMenuManager().add(action);
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   195
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   196
		return PIPageEditor.currentMenuManager();
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   197
	}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   198
	
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   199
	public void receiveEvent(String actionString, Event event) 
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   200
	{
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   201
		if (   actionString.equals("button_events_on")  //$NON-NLS-1$
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   202
			|| actionString.equals("button_events_off")	//$NON-NLS-1$
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   203
			|| actionString.equals("button_map_switch")) //$NON-NLS-1$
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   204
	  	{
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   205
			BupTrace bupTrace = (BupTrace)NpiInstanceRepository.getInstance().activeUidGetTrace("com.nokia.carbide.cpp.pi.button"); //$NON-NLS-1$
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   206
			
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   207
			if (bupTrace == null)
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   208
				return;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   209
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   210
	  		((BupTraceGraph)bupTrace.getTraceGraph(PIPageEditor.THREADS_PAGE)).action(actionString);	
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   211
	  		((BupTraceGraph)bupTrace.getTraceGraph(PIPageEditor.BINARIES_PAGE)).action(actionString);	
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   212
	  		((BupTraceGraph)bupTrace.getTraceGraph(PIPageEditor.FUNCTIONS_PAGE)).action(actionString);	
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   213
	  	}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   214
	}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   215
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   216
	public void receiveSelectionEvent(String actionString) 
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   217
	{
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   218
		if (actionString == null)
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   219
			return;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   220
		
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   221
		int currentPage = PIPageEditor.currentPageIndex();
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   222
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   223
		if (   (currentPage != PIPageEditor.THREADS_PAGE)
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   224
			&& (currentPage != PIPageEditor.BINARIES_PAGE)
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   225
			&& (currentPage != PIPageEditor.FUNCTIONS_PAGE))
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   226
			  return;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   227
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   228
		if (actionString.equals("button_events_on")) { //$NON-NLS-1$
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   229
			NpiInstanceRepository.getInstance().activeUidSetPersistState("com.nokia.carbide.cpp.pi.button.show", true); //$NON-NLS-1$
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   230
	  	} else if (actionString.equals("button_events_off")) { //$NON-NLS-1$
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   231
	  		NpiInstanceRepository.getInstance().activeUidSetPersistState("com.nokia.carbide.cpp.pi.button.show", false); //$NON-NLS-1$
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   232
	  	} else {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   233
	  		return;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   234
	  	}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   235
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   236
		BupTrace bupTrace = (BupTrace)NpiInstanceRepository.getInstance().activeUidGetTrace("com.nokia.carbide.cpp.pi.button"); //$NON-NLS-1$
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   237
		
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   238
		if (bupTrace == null)
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   239
			return;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   240
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   241
  		((BupTraceGraph)bupTrace.getTraceGraph(PIPageEditor.THREADS_PAGE)).action(actionString);	
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   242
  		((BupTraceGraph)bupTrace.getTraceGraph(PIPageEditor.BINARIES_PAGE)).action(actionString);	
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   243
  		((BupTraceGraph)bupTrace.getTraceGraph(PIPageEditor.FUNCTIONS_PAGE)).action(actionString);	
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   244
	}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   245
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   246
	public Integer getLastSample(int graphIndex) {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   247
		return null;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   248
	}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   249
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   250
	public GraphDrawRequest getDrawRequest(int graphIndex) {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   251
		GraphDrawRequest request = new GraphDrawRequest();
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   252
		request.addParentGraph(
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   253
				graphIndex,
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   254
				"com.nokia.carbide.cpp.pi.address.AddressPlugin", //$NON-NLS-1$
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   255
				GraphDrawRequest.DRAW_TO_MOST_IMPORTANT_AVAILABLE,
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   256
				1);
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   257
		return request;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   258
	}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   259
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   260
//	public GenericTraceGraph getTraceGraph() 
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   261
//	{
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   262
//		return this.trace.getTraceGraph();
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   263
//	}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   264
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   265
	public GenericTraceGraph getTraceGraph(int graphIndex) 
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   266
	{
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   267
		BupTrace bupTrace = (BupTrace)NpiInstanceRepository.getInstance().activeUidGetTrace("com.nokia.carbide.cpp.pi.button"); //$NON-NLS-1$
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   268
		
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   269
		if (bupTrace == null)
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   270
			return null;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   271
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   272
		return bupTrace.getTraceGraph(graphIndex);
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   273
	}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   274
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   275
	/**
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   276
	 * This method is called upon plug-in activation
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   277
	 */
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   278
	public void start(BundleContext context) throws Exception {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   279
		super.start(context);
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   280
	}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   281
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   282
	/**
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   283
	 * This method is called when the plug-in is stopped
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   284
	 */
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   285
	public void stop(BundleContext context) throws Exception {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   286
		super.stop(context);
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   287
		setPlugin(null);
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   288
	}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   289
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   290
	/**
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   291
	 * Returns the shared instance.
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   292
	 */
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   293
	public static ButtonPlugin getDefault() {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   294
		return plugin;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   295
	}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   296
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   297
	/**
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   298
	 * Returns an image descriptor for the image file at the given
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   299
	 * plug-in relative path.
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   300
	 *
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   301
	 * @param path the path
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   302
	 * @return the image descriptor
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   303
	 */
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   304
	public static ImageDescriptor getImageDescriptor(String path) {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   305
		return AbstractPiPlugin.imageDescriptorFromPlugin("com.nokia.carbide.cpp.pi.button", path); //$NON-NLS-1$
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   306
	}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   307
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   308
	public int getGraphCount() {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   309
		return GRAPH_COUNT;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   310
	}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   311
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   312
	public int getPageNumber(int graphIndex) {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   313
		// Assumes page 0 has the threads graph, 1 has the binaries, and 2 has the functions
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   314
		return graphIndex;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   315
	}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   316
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   317
	// return whether this plugin's editor pages have been created
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   318
	public boolean arePagesCreated() {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   319
		return false;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   320
	}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   321
	
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   322
	public void setPagesCreated(boolean pagesCreated) {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   323
		return;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   324
	}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   325
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   326
	public int getCreatePageCount() {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   327
		return 0;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   328
	}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   329
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   330
	public int getCreatePageIndex(int index) {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   331
		return 0;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   332
	}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   333
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   334
	public ProfileVisualiser createPage(int index) {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   335
		return null;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   336
	}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   337
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   338
	public void setPageIndex(int index, int pageIndex) {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   339
		return;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   340
	}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   341
	
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   342
	/**
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   343
	 * Returns the shared preference store of this plugin
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   344
	 */
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   345
	public static IPreferenceStore getBupPrefsStore(){
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   346
		if (prefsStore == null){
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   347
			prefsStore = getDefault().getPreferenceStore();
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   348
		}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   349
		
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   350
		return prefsStore;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   351
	}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   352
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   353
	/* (non-Javadoc)
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   354
	 * @see com.nokia.carbide.cpp.internal.pi.plugin.model.IPIPageEditorDispose#runOnDispose()
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   355
	 */
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   356
	public void runOnDispose() {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   357
		BupTrace bupTrace = (BupTrace)NpiInstanceRepository.getInstance().activeUidGetTrace("com.nokia.carbide.cpp.pi.button"); //$NON-NLS-1$
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   358
		if (bupTrace != null) {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   359
			BupEventMapManager.getInstance().releaseMap(bupTrace.getCurrentBupMapInUse());
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   360
		}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   361
	}
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   362
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   363
	/* (non-Javadoc)
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   364
	 * @see com.nokia.carbide.cpp.internal.pi.plugin.model.IFinalizeTrace#runOnPartOpened()
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   365
	 */
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   366
	public void runOnPartOpened() {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   367
		//no-op
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   368
	}
2
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   369
	
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   370
	public void switchMap() {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   371
		BupTrace bupTrace = (BupTrace)NpiInstanceRepository.getInstance().activeUidGetTrace("com.nokia.carbide.cpp.pi.button"); //$NON-NLS-1$
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   372
		IBupEventMapProfile oldProfile = bupTrace.getCurrentBupMapInUse().getProfile();
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   373
		SwitchBupMapDialog dialog = new SwitchBupMapDialog(Display.getCurrent().getActiveShell(), oldProfile);
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   374
		if (dialog.open() == Window.OK) {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   375
			IBupEventMap oldMap = bupTrace.getCurrentBupMapInUse();
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   376
			IBupEventMap newMap = BupEventMapManager.getInstance().captureMap(dialog.getNewProfile());
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   377
			if (bupTrace != null) {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   378
				boolean resetAll = dialog.resetAll();
5
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   379
				Vector<GenericSample> samples = bupTrace.samples;
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   380
				for (GenericSample genericSample : samples) {
844b047e260d Performance Investigator Carbide extension 2.3.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
   381
					BupSample sample = (BupSample)genericSample;
2
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   382
					if (resetAll || !sample.isLabelModified()) {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   383
						sample.resetLabelToMapDefault(newMap);
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   384
					}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   385
				}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   386
				bupTrace.setCurrentBupMapInUse(newMap);
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   387
				AnalysisInfoHandler handler = NpiInstanceRepository.getInstance().activeUidGetAnalysisInfoHandler();
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   388
				// apply profile change to AnalysisInfoHandler that handling additional info in NPI file lifetime
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   389
				setBupMapProfileToInfoHandler(handler, dialog.getNewProfile());
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   390
				PIPageEditor.currentPageEditor().setDirty();
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   391
				// Use this for sending graph fresh
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   392
				receiveEvent("button_map_switch", new Event());	//$NON-NLS-1$
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   393
			}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   394
			BupEventMapManager.getInstance().releaseMap(oldMap);
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   395
		}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   396
	}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   397
	
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   398
	/*
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   399
	 * (non-javadoc)
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   400
	 * Only Bup Plugin should know about it's own additional info
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   401
	 * This class keep around a profile, and handle transfer in and out fo additional info
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   402
	 * in one place for consistence.
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   403
	 */
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   404
	private class BupInfoHandlerAdditionalInfo {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   405
		// index of additional info in NPI file
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   406
		private static final transient int BUP_MAP_PROFILE_ID = 0;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   407
		private static final transient int BUP_MAP_SYMBIAN_SDK_ID = 1;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   408
		private static final transient int BUP_MAP_IS_BUILTIN = 2;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   409
		private static final transient int BUP_MAP_IS_WORSPACE = 3;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   410
		
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   411
		IBupEventMapProfile profile;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   412
		
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   413
		Vector<Object> toAdditionalInfo() {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   414
			
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   415
			int maxSize = BUP_MAP_PROFILE_ID;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   416
			maxSize = Math.max(maxSize, BUP_MAP_SYMBIAN_SDK_ID);
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   417
			maxSize = Math.max(maxSize, BUP_MAP_IS_WORSPACE);
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   418
			maxSize = Math.max(maxSize, BUP_MAP_IS_BUILTIN);
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   419
			Vector<Object> result = new Vector<Object>(maxSize + 1);
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   420
			result.setSize(maxSize + 1);
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   421
			result.setElementAt(profile.getProfileId(), BUP_MAP_PROFILE_ID);
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   422
			result.setElementAt(profile.getSDK() != null ? profile.getSDK().getUniqueId() : "", BUP_MAP_SYMBIAN_SDK_ID); //$NON-NLS-1$
12
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
   423
			result.setElementAt(Boolean.valueOf(profile.getURI().equals(BupEventMapManager.WORKSPACE_PREF_KEY_MAP_URI)), BUP_MAP_IS_WORSPACE);
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
   424
			result.setElementAt(Boolean.valueOf(profile.getURI().equals(BupEventMapManager.DEFAULT_PROFILE_URI)), BUP_MAP_IS_BUILTIN);
2
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   425
			
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   426
			return result;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   427
		}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   428
		
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   429
		void fromAddtionalInfo(Vector<Object> additional_info) {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   430
			if (!(additional_info.get(BUP_MAP_PROFILE_ID) instanceof String) ||
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   431
					!(additional_info.get(BUP_MAP_SYMBIAN_SDK_ID) instanceof String) ||
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   432
					!(additional_info.get(BUP_MAP_IS_BUILTIN) instanceof Boolean) ||
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   433
					!(additional_info.get(BUP_MAP_IS_WORSPACE) instanceof Boolean))
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   434
			{
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   435
				// did you changed anything in analysisInfoHandlerToAdditonalInfo()?
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   436
				// did you changed the data format of addition info?
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   437
				GeneralMessages.showErrorMessage(Messages.getString("ButtonPlugin.InternalError")); //$NON-NLS-1$
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   438
			}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   439
			ArrayList<IBupEventMapProfile> profiles = new ArrayList<IBupEventMapProfile>();
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   440
			if (!additional_info.get(BUP_MAP_SYMBIAN_SDK_ID).equals("")) { //$NON-NLS-1$
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   441
				String sdkId = (String) additional_info.get(BUP_MAP_SYMBIAN_SDK_ID);
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   442
				ISymbianSDK sdk = SDKCorePlugin.getSDKManager().getSDK(sdkId, true);
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   443
				profiles.addAll(BupEventMapManager.getInstance().getProfilesFromSDK(sdk));
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   444
			} else if ((Boolean)additional_info.get(BUP_MAP_IS_WORSPACE)) {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   445
				profiles.addAll(BupEventMapManager.getInstance().getProfilesFromWorkspacePref());
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   446
			} else if ((Boolean)additional_info.get(BUP_MAP_IS_BUILTIN)) {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   447
				profiles.addAll(BupEventMapManager.getInstance().getProfilesFromBuiltin());
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   448
			}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   449
			
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   450
			profile = null;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   451
			for (IBupEventMapProfile tempProfile : profiles) {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   452
				if (tempProfile.getProfileId().equals(additional_info.get(BUP_MAP_PROFILE_ID))) {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   453
					profile = tempProfile;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   454
					break;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   455
				}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   456
			}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   457
			if (profile == null) {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   458
				if (additional_info.get(BUP_MAP_PROFILE_ID).equals("")) {	//$NON-NLS-1$
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   459
					profile = BupEventMapManager.getInstance().getLegacyProfile();
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   460
				} else {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   461
					GeneralMessages.showWarningMessage(Messages.getString("ButtonPlugin.keyMapRemoved")); //$NON-NLS-1$
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   462
					profile = BupEventMapManager.getInstance().getPrefSelectedProfile();					
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   463
				}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   464
			}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   465
		}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   466
	}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   467
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   468
	public void setupInfoHandler(AnalysisInfoHandler handler) {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   469
		ArrayList<IBupEventMapProfile> profiles = new ArrayList<IBupEventMapProfile>();
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   470
		if (SampleImporter.getInstance().getBupMapSymbianSDKId() != null &&
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   471
			!SampleImporter.getInstance().getBupMapSymbianSDKId().equals("")) { //$NON-NLS-1$
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   472
			ISymbianSDK sdk = SDKCorePlugin.getSDKManager().getSDK(SampleImporter.getInstance().getBupMapSymbianSDKId(), true);
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   473
			profiles.addAll(BupEventMapManager.getInstance().getProfilesFromSDK(sdk));
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   474
		} else if (SampleImporter.getInstance().isBupMapIsWorkspace()) {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   475
			profiles.addAll(BupEventMapManager.getInstance().getProfilesFromWorkspacePref());
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   476
		} else if (SampleImporter.getInstance().isBupMapIsBuiltIn()) {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   477
			profiles.addAll(BupEventMapManager.getInstance().getProfilesFromBuiltin());
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   478
		}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   479
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   480
		for (IBupEventMapProfile profile : profiles) {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   481
			if (profile.getProfileId().equals(SampleImporter.getInstance().getBupMapProfileId())) {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   482
				BupInfoHandlerAdditionalInfo info = (BupInfoHandlerAdditionalInfo) handler.getTraceDefinedInfo(getTraceId());
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   483
				if (info == null) {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   484
					info = new BupInfoHandlerAdditionalInfo();
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   485
				}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   486
				info.profile = profile;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   487
				handler.setTraceDefinedInfo(getTraceId(), info);
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   488
				break;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   489
			}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   490
		}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   491
	}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   492
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   493
	public void additionalInfoToAnalysisInfoHandler(Vector<Object> additional_info, AnalysisInfoHandler handler) { 
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   494
		BupInfoHandlerAdditionalInfo info = (BupInfoHandlerAdditionalInfo) handler.getTraceDefinedInfo(getTraceId());
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   495
		if (info == null) {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   496
			info = new BupInfoHandlerAdditionalInfo();
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   497
		}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   498
		info.fromAddtionalInfo(additional_info);
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   499
		handler.setTraceDefinedInfo(getTraceId(), info);
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   500
	}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   501
	
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   502
	public void analysisInfoHandlerToAdditonalInfo(TraceAdditionalInfo info, AnalysisInfoHandler handler) {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   503
		Vector<Object> additional_info = new Vector<Object>();
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   504
		Object handlerInfo = handler.getTraceDefinedInfo(getTraceId());
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   505
		if (handlerInfo instanceof BupInfoHandlerAdditionalInfo) {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   506
			additional_info = ((BupInfoHandlerAdditionalInfo)handlerInfo).toAdditionalInfo();
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   507
		}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   508
		info.addAdditionalInfo(getTraceId(), additional_info);
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   509
	}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   510
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   511
	/* (non-Javadoc)
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   512
	 * @see com.nokia.carbide.cpp.internal.pi.test.IProvideTraceAdditionalInfo#InfoHandlerToDisplayString(java.util.Vector)
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   513
	 */
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   514
	public String InfoHandlerToDisplayString(AnalysisInfoHandler handler) {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   515
		Object info = handler.getTraceDefinedInfo(getTraceId());
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   516
		if (info instanceof BupInfoHandlerAdditionalInfo) {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   517
			return Messages.getString("ButtonPlugin.keyPressProfile") +((BupInfoHandlerAdditionalInfo)info).profile.toString(); //$NON-NLS-1$
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   518
		}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   519
		return ""; //$NON-NLS-1$
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   520
	}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   521
	
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   522
	/*
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   523
	 * (non-Javadoc)
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   524
	 * Manipulate additional info among AnalysisInfoHandler during lifetime of loaded NPI file
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   525
	 */
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   526
	public void setBupMapProfileToInfoHandler(AnalysisInfoHandler handler, IBupEventMapProfile profile) {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   527
		BupInfoHandlerAdditionalInfo info = (BupInfoHandlerAdditionalInfo) handler.getTraceDefinedInfo(getTraceId());
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   528
		if (info == null) {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   529
			info = new BupInfoHandlerAdditionalInfo();
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   530
		}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   531
		info.profile = profile;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   532
		handler.setTraceDefinedInfo(getTraceId(), info);
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   533
	}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   534
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   535
	/*
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   536
	 * (non-Javadoc)
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   537
	 * Read additional info among AnalysisInfoHandler during lifetime of loaded NPI file
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   538
	 */
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   539
	public IBupEventMapProfile getBupMapProfileFromInfoHandler(AnalysisInfoHandler handler) {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   540
		Object info = handler.getTraceDefinedInfo(getTraceId());
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   541
		if (info != null && info instanceof BupInfoHandlerAdditionalInfo) {
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   542
			return ((BupInfoHandlerAdditionalInfo)info).profile;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   543
		}
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   544
		GeneralMessages.showWarningMessage(Messages.getString("ButtonPlugin.keyMapRemoved")); //$NON-NLS-1$
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   545
		return BupEventMapManager.getInstance().getPrefSelectedProfile();
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   546
	}
12
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
   547
	
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
   548
	/*
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
   549
	 * (non-Javadoc)
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
   550
	 * @see com.nokia.carbide.cpp.internal.pi.plugin.model.ITrace#isMandatory()
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
   551
	 */
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
   552
	public boolean isMandatory() {
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
   553
		return false;
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
   554
	}
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
   555
	
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
   556
	/*
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
   557
	 * (non-Javadoc)
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
   558
	 * @see com.nokia.carbide.cpp.internal.pi.plugin.model.ITrace#getTraceDescription()
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
   559
	 */
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
   560
	public String getTraceDescription() {
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
   561
		return getTraceTitle();
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 5
diff changeset
   562
	}
2
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   563
}