sysperfana/analyzetoolext/com.nokia.s60tools.analyzetool/src/com/nokia/s60tools/analyzetool/internal/ui/graph/MemOpDescriptor.java
author Matti Laitinen <matti.t.laitinen@nokia.com>
Tue, 24 Aug 2010 12:16:27 +0300
changeset 15 0367d2db2c06
parent 6 f65f740e69f9
permissions -rw-r--r--
AnalyzeTool Carbide extension 1.10.0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     1
/*
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
     2
 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     3
 * All rights reserved.
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     4
 * This component and the accompanying materials are made available
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     5
 * under the terms of "Eclipse Public License v1.0"
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     6
 * which accompanies this distribution, and is available
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     8
 *
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     9
 * Initial Contributors:
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    10
 * Nokia Corporation - initial contribution.
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    11
 *
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    12
 * Contributors:
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    13
 *
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    14
 * Description:  Definitions for the class MemOpDescriptor
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    15
 *
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    16
 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    17
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    18
package com.nokia.s60tools.analyzetool.internal.ui.graph;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    19
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
    20
import java.io.IOException;
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    21
import java.util.AbstractList;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    22
import java.util.ArrayList;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    23
import java.util.HashMap;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    24
import java.util.List;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    25
import java.util.Locale;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    26
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    27
import org.eclipse.core.resources.IFile;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    28
import org.eclipse.core.resources.IMarker;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    29
import org.eclipse.core.resources.IProject;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    30
import org.eclipse.core.resources.IWorkspaceRoot;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    31
import org.eclipse.core.resources.ResourcesPlugin;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    32
import org.eclipse.core.runtime.CoreException;
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
    33
import org.eclipse.core.runtime.IStatus;
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    34
import org.eclipse.core.runtime.Path;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    35
import org.eclipse.jface.viewers.CellEditor;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    36
import org.eclipse.jface.viewers.TextCellEditor;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    37
import org.eclipse.swt.SWT;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    38
import org.eclipse.swt.events.KeyListener;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    39
import org.eclipse.swt.events.MouseEvent;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    40
import org.eclipse.swt.events.MouseListener;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    41
import org.eclipse.swt.widgets.Composite;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    42
import org.eclipse.swt.widgets.Text;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    43
import org.eclipse.ui.IWorkbenchPage;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    44
import org.eclipse.ui.PartInitException;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    45
import org.eclipse.ui.PlatformUI;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    46
import org.eclipse.ui.ide.IDE;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    47
import org.eclipse.ui.views.properties.IPropertyDescriptor;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    48
import org.eclipse.ui.views.properties.IPropertySource;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    49
import org.eclipse.ui.views.properties.TextPropertyDescriptor;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    50
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    51
import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    52
import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    53
import com.nokia.cdt.debug.cw.symbian.symbolreader.IFunction;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    54
import com.nokia.cdt.debug.cw.symbian.symbolreader.ISourceLocation;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    55
import com.nokia.cdt.debug.cw.symbian.symbolreader.ISymbolFile;
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
    56
import com.nokia.s60tools.analyzetool.Activator;
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
    57
import com.nokia.s60tools.analyzetool.engine.ICallstackManager;
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    58
import com.nokia.s60tools.analyzetool.engine.statistic.AllocCallstack;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    59
import com.nokia.s60tools.analyzetool.engine.statistic.AllocInfo;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    60
import com.nokia.s60tools.analyzetool.engine.statistic.BaseInfo;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    61
import com.nokia.s60tools.analyzetool.engine.statistic.DllLoad;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    62
import com.nokia.s60tools.analyzetool.engine.statistic.SourceFile;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    63
import com.nokia.s60tools.analyzetool.engine.statistic.SymReader;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    64
import com.nokia.s60tools.analyzetool.global.Constants;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    65
import com.nokia.s60tools.analyzetool.global.Util;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    66
import com.nokia.s60tools.analyzetool.internal.ui.util.GraphUtils;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    67
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    68
/**
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
    69
 * MemOpDescriptor provides properties of any Alloc/Leak/Free suitable to be
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
    70
 * displayed in eclipse Properties View.
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    71
 * 
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    72
 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    73
@SuppressWarnings("restriction")
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    74
class MemOpDescriptor implements IPropertySource {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    75
	BaseInfo memInfo;
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
    76
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    77
	/** process Id descriptor */
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
    78
	private static final String PID_ID = "pid"; //$NON-NLS-1$
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
    79
	private final DotTextPropertyDescriptor PID_DESCRIPTOR = new DotTextPropertyDescriptor(
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
    80
			PID_ID, Messages.MemOpDescriptor_1);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    81
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    82
	/** Memory operation type Allocation/Leak/Free descriptor */
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
    83
	private static final String TYPE_ID = "type"; //$NON-NLS-1$
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
    84
	private final DotTextPropertyDescriptor TYPE_DESCRIPTOR = new DotTextPropertyDescriptor(
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
    85
			TYPE_ID, Messages.MemOpDescriptor_3);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    86
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    87
	/** Time descriptor */
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
    88
	private static final String TIME_ID = "time"; //$NON-NLS-1$
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
    89
	private final DotTextPropertyDescriptor TIME_DESCRIPTOR = new DotTextPropertyDescriptor(
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
    90
			TIME_ID, Messages.MemOpDescriptor_5);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    91
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    92
	/** size descriptor */
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
    93
	private static final String SIZE_ID = "size"; //$NON-NLS-1$
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
    94
	private final DotTextPropertyDescriptor SIZE_DESCRIPTOR = new DotTextPropertyDescriptor(
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
    95
			SIZE_ID, Messages.MemOpDescriptor_7);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    96
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    97
	/** memory address descriptor */
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
    98
	private static final String ADDR_ID = "address"; //$NON-NLS-1$
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
    99
	private final DotTextPropertyDescriptor ADDR_DESCRIPTOR = new DotTextPropertyDescriptor(
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   100
			ADDR_ID, Messages.MemOpDescriptor_9);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   101
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   102
	/** total memory size consumed by the process descriptor */
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   103
	private static final String TSIZE_ID = "total"; //$NON-NLS-1$
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   104
	private final DotTextPropertyDescriptor TSIZE_DESCRIPTOR = new DotTextPropertyDescriptor(
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   105
			TSIZE_ID, Messages.MemOpDescriptor_11);
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   106
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   107
	/** thread id descriptor */
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   108
	private static final String THREAD_ID = "thread"; //$NON-NLS-1$
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   109
	private final DotTextPropertyDescriptor THREAD_DESCRIPTOR = new DotTextPropertyDescriptor(
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   110
			THREAD_ID, Messages.MemOpDescriptor_10);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   111
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   112
	/**
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   113
	 * life time of an allocation descriptor. This applies only to non Leaked
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   114
	 * allocations
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   115
	 */
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   116
	private static final String LIFETIME_ID = "lifetime"; //$NON-NLS-1$
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   117
	private final DotTextPropertyDescriptor LIFETIME_DESCRIPTOR = new DotTextPropertyDescriptor(
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   118
			LIFETIME_ID, Messages.MemOpDescriptor_13);
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   119
	private static final String ATTRIBUTES_GROUP = "Attributes"; //$NON-NLS-1$
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   120
	/** used for making absolute time values relative */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   121
	private long baseTime;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   122
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   123
	/** callstack item descriptor id */
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   124
	private static final String CALL_STACK_ID = "callstack"; //$NON-NLS-1$
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   125
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   126
	/** current project */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   127
	IProject iCurrentProject = null;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   128
	/** Symbol Reader */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   129
	SymReader iSymReader = null;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   130
	/** c++ files from the current project */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   131
	AbstractList<String> cppFileNames;
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   132
	static final String LINE_SEPARATOR = " :: "; //$NON-NLS-1$
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   133
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   134
	private ICallstackManager callstackManager;
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   135
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   136
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   137
	 * Constructor
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   138
	 * 
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   139
	 * @param newBaseTime
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   140
	 *            usually process start time, used for making absolute time
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   141
	 *            values relative
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   142
	 * @param info
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   143
	 *            the alloc or free info
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   144
	 * @param project
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   145
	 *            IProject to use for locating source file
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   146
	 * @param symReader
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   147
	 *            the SymReader to use for pinpointing
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   148
	 * @param cppFiles
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   149
	 * @param callstackManager
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   150
	 *            CallstackManager for reading callstacks from BaseInfo
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   151
	 */
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   152
	public MemOpDescriptor(Long newBaseTime, BaseInfo info, IProject project,
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   153
			SymReader symReader, AbstractList<String> cppFiles,
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   154
			ICallstackManager callstackManager) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   155
		memInfo = info;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   156
		iCurrentProject = project;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   157
		iSymReader = symReader;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   158
		cppFileNames = cppFiles;
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   159
		this.baseTime = newBaseTime;
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   160
		this.callstackManager = callstackManager;
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   161
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   162
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   163
	/*
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   164
	 * (non-Javadoc)
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   165
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   166
	 * @see org.eclipse.ui.views.properties.IPropertySource#getEditableValue()
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   167
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   168
	public Object getEditableValue() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   169
		return null; // no edit
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   170
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   171
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   172
	/*
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   173
	 * (non-Javadoc)
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   174
	 * 
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   175
	 * @see
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   176
	 * org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   177
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   178
	public IPropertyDescriptor[] getPropertyDescriptors() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   179
		final List<IPropertyDescriptor> completeList = new ArrayList<IPropertyDescriptor>();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   180
		PID_DESCRIPTOR.setCategory(ATTRIBUTES_GROUP);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   181
		completeList.add(PID_DESCRIPTOR);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   182
		TYPE_DESCRIPTOR.setCategory(ATTRIBUTES_GROUP);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   183
		completeList.add(TYPE_DESCRIPTOR);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   184
		TIME_DESCRIPTOR.setCategory(ATTRIBUTES_GROUP);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   185
		completeList.add(TIME_DESCRIPTOR);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   186
		SIZE_DESCRIPTOR.setCategory(ATTRIBUTES_GROUP);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   187
		completeList.add(SIZE_DESCRIPTOR);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   188
		ADDR_DESCRIPTOR.setCategory(ATTRIBUTES_GROUP);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   189
		completeList.add(ADDR_DESCRIPTOR);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   190
		TSIZE_DESCRIPTOR.setCategory(ATTRIBUTES_GROUP);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   191
		completeList.add(TSIZE_DESCRIPTOR);
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   192
		THREAD_DESCRIPTOR.setCategory(ATTRIBUTES_GROUP);
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   193
		completeList.add(THREAD_DESCRIPTOR);
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   194
		if (memInfo instanceof AllocInfo && ((AllocInfo) memInfo).isFreed()) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   195
			LIFETIME_DESCRIPTOR.setCategory(ATTRIBUTES_GROUP);
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   196
			completeList.add(LIFETIME_DESCRIPTOR); // only non leaks
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   197
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   198
		// add callstack descriptors
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   199
		if (callstackManager != null && callstackManager.hasCallstack(memInfo)) {
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   200
			try {
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   201
				List<AllocCallstack> callstack = callstackManager
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   202
						.readCallstack(memInfo);
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   203
				if (callstack != null) {
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   204
					for (int i = 0; i < callstack.size(); i++) {
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   205
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   206
						final DotTextPropertyDescriptor propDesc = new DotTextPropertyDescriptor(
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   207
								i, CALL_STACK_ID);
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   208
						propDesc.setCategory("CallStack"); //$NON-NLS-1$
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   209
						completeList.add(propDesc);
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   210
					}
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   211
				}
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   212
			} catch (IOException e) {
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   213
				// since callstacks aren't fatal and we can't handle it usefully
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   214
				// here, log this to the error log
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   215
				Activator.getDefault().log(IStatus.ERROR,
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   216
						Messages.MemOpDescriptor_18, e);
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   217
			}
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   218
		}
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   219
		return completeList.toArray(new TextPropertyDescriptor[completeList
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   220
				.size()]);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   221
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   222
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   223
	/*
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   224
	 * (non-Javadoc)
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   225
	 * 
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   226
	 * @see
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   227
	 * org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   228
	 * .lang.Object)
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   229
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   230
	public Object getPropertyValue(Object id) {
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   231
		// Note, this method must return String values for the CellEditor to
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   232
		// work
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   233
		if (PID_ID.equals(id)) {
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   234
			return String.valueOf(memInfo.getProcessID());// process ids are
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   235
			// usually decimal
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   236
			// values
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   237
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   238
		if (TYPE_ID.equals(id))
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   239
			return memInfo instanceof AllocInfo ? ((AllocInfo) memInfo)
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   240
					.isFreed() ? Messages.MemOpDescriptor_19
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   241
					: Messages.MemOpDescriptor_20 : Messages.MemOpDescriptor_21;
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   242
		if (TIME_ID.equals(id))
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   243
			return GraphUtils.renderTime(memInfo.getTime() - baseTime);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   244
		if (SIZE_ID.equals(id))
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   245
			return String.format(Messages.MemOpDescriptor_22, memInfo
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   246
					.getSizeInt());
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   247
		if (ADDR_ID.equals(id))
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   248
			return Long.toString(memInfo.getMemoryAddress(), 16);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   249
		if (TSIZE_ID.equals(id))
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   250
			return String.format(Messages.MemOpDescriptor_23, memInfo
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   251
					.getTotalMem());
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   252
		if (THREAD_ID.equals(id))
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   253
			return String.valueOf(memInfo.getThreadId());
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   254
		if (LIFETIME_ID.equals(id)) {
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   255
			if (memInfo instanceof AllocInfo && ((AllocInfo) memInfo).isFreed()) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   256
				AllocInfo info = (AllocInfo) memInfo;
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   257
				return GraphUtils.renderTime(info.getFreedBy().getTime()
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   258
						- info.getTime());
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   259
			}
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   260
			throw new IllegalStateException(
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   261
					"Should not happen because we did not provide a lifetime descriptor for leak and free."); //$NON-NLS-1$
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   262
		}
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   263
		if (id instanceof Integer && callstackManager.hasCallstack(memInfo)) {
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   264
			int callstackId = (Integer) id;
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   265
			try {
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   266
				List<AllocCallstack> callstackList = callstackManager
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   267
						.readCallstack(memInfo);
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   268
				if (callstackId < callstackList.size()) {
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   269
					AllocCallstack callstackItem = callstackList
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   270
							.get(callstackId);
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   271
					DllLoad tempLoad = callstackItem.getDllLoad();
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   272
					long addr = callstackItem.getMemoryAddress();
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   273
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   274
					String name = String.format(Messages.MemOpDescriptor_25,
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   275
							addr);
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   276
					if (tempLoad != null
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   277
							&& callstackItem.getMemoryAddress() != tempLoad
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   278
									.getStartAddress()) {
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   279
						SourceFile aSourcefile = pinpoint(callstackItem
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   280
								.getMemoryAddress(), callstackItem.getDllLoad());
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   281
						if (aSourcefile != null) { // callstack resolved to a
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   282
							// file-function-line
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   283
							return name + LINE_SEPARATOR
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   284
									+ callstackItem.getDllLoad().getName()
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   285
									+ LINE_SEPARATOR
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   286
									+ aSourcefile.getFileName()
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   287
									+ LINE_SEPARATOR
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   288
									+ aSourcefile.getFunctionName()
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   289
									+ LINE_SEPARATOR
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   290
									+ aSourcefile.getLineNumber();
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   291
						}
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   292
					}
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   293
					return name
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   294
							+ (tempLoad != null ? LINE_SEPARATOR
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   295
									+ tempLoad.getName() : ""); //$NON-NLS-1$
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   296
				}
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   297
			} catch (IOException e) {
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   298
				// since callstacks aren't fatal and we can't handle it usefully
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   299
				// here, log this to the error log
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   300
				Activator.getDefault().log(IStatus.ERROR,
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   301
						Messages.MemOpDescriptor_27, e);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   302
			}
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   303
		}
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   304
		return null;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   305
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   306
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   307
	/*
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   308
	 * (non-Javadoc)
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   309
	 * 
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   310
	 * @see
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   311
	 * org.eclipse.ui.views.properties.IPropertySource#isPropertySet(java.lang
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   312
	 * .Object)
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   313
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   314
	public boolean isPropertySet(Object id) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   315
		return false;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   316
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   317
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   318
	/*
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   319
	 * (non-Javadoc)
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   320
	 * 
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   321
	 * @see
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   322
	 * org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   323
	 * .lang.Object)
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   324
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   325
	public void resetPropertyValue(Object id) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   326
		// do nothing
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   327
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   328
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   329
	/*
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   330
	 * (non-Javadoc)
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   331
	 * 
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   332
	 * @see
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   333
	 * org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   334
	 * .lang.Object, java.lang.Object)
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   335
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   336
	public void setPropertyValue(Object id, Object value) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   337
		// do nothing
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   338
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   339
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   340
	/**
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   341
	 * DotTextPropertyDescriptor defines a read only TextPropertyDescriptor It
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   342
	 * also add a customised key/mouse listener. This listener will be useful
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   343
	 * for pinpointing the source.
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   344
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   345
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   346
	private class DotTextPropertyDescriptor extends TextPropertyDescriptor {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   347
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   348
		/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   349
		 * Constructor
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   350
		 * 
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   351
		 * @param id
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   352
		 *            Descriptor Id
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   353
		 * @param displayName
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   354
		 *            Descriptor display name
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   355
		 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   356
		public DotTextPropertyDescriptor(Object id, String displayName) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   357
			super(id, displayName);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   358
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   359
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   360
		/**
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   361
		 * create a Read Only TextCellEditor and add the defined listener to its
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   362
		 * Control.
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   363
		 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   364
		 * @see org.eclipse.ui.views.properties.TextPropertyDescriptor#createPropertyEditor(org.eclipse.swt.widgets.Composite)
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   365
		 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   366
		@Override
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   367
		public CellEditor createPropertyEditor(Composite parent) {
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   368
			TextCellEditor editor = new SimpleTextCellEditor(parent,
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   369
					SWT.READ_ONLY);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   370
			Text control = (Text) editor.getControl();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   371
			control.setEditable(false);
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   372
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   373
			DotPropKeyMouseListener listener = new DotPropKeyMouseListener();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   374
			control.addKeyListener(listener);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   375
			control.addMouseListener(listener);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   376
			if (getValidator() != null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   377
				editor.setValidator(getValidator());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   378
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   379
			return editor;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   380
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   381
	}
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   382
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   383
	private class SimpleTextCellEditor extends TextCellEditor {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   384
		public SimpleTextCellEditor(Composite parent, int readOnly) {
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   385
			super(parent, readOnly);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   386
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   387
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   388
		@Override
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   389
		public boolean isCopyEnabled() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   390
			return false;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   391
		}
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   392
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   393
		@Override
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   394
		public boolean isCutEnabled() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   395
			return false;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   396
		}
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   397
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   398
		@Override
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   399
		public boolean isPasteEnabled() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   400
			return false;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   401
		}
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   402
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   403
		@Override
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   404
		public boolean isFindEnabled() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   405
			return false;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   406
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   407
	}
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   408
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   409
	/**
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   410
	 * This class is only for convenience for the moment. It's very likely that
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   411
	 * the listener will be provided by AnalyzeToolGraph
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   412
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   413
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   414
	private class DotPropKeyMouseListener implements KeyListener, MouseListener {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   415
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   416
		// Key
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   417
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   418
		public void keyPressed(org.eclipse.swt.events.KeyEvent e) {
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   419
			// do nothing by design
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   420
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   421
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   422
		public void keyReleased(org.eclipse.swt.events.KeyEvent keyEvent) {
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   423
			// System.out.println("key released.");
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   424
			if (keyEvent.character == '\r') {
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   425
				String text = ((Text) keyEvent.getSource()).getText();
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   426
				if (text != null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   427
					String[] segs = text.split(LINE_SEPARATOR);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   428
					if (segs.length == 5) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   429
						openEditor(segs[2], segs[4]);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   430
					}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   431
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   432
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   433
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   434
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   435
		// Mouse
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   436
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   437
		public void mouseDoubleClick(MouseEvent e) {
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   438
			String text = ((Text) e.getSource()).getText();
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   439
			if (text != null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   440
				String[] segs = text.split(LINE_SEPARATOR);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   441
				if (segs.length == 5) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   442
					openEditor(segs[2], segs[4]);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   443
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   444
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   445
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   446
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   447
		public void mouseDown(MouseEvent e) {
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   448
			// do nothing by design
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   449
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   450
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   451
		public void mouseUp(MouseEvent e) {
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   452
			// do nothing by design
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   453
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   454
	}
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   455
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   456
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   457
	 * Pinpoints one memory address to source code line.
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   458
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   459
	 * @param memoryAddress
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   460
	 *            Memory address
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   461
	 * @param dllLoad
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   462
	 *            DllLoad item
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   463
	 * @return SourceFile if found otherwise null
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   464
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   465
	private SourceFile pinpoint(Long memoryAddress, DllLoad dllLoad) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   466
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   467
		if (dllLoad != null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   468
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   469
			ISymbolFile symbolFile = iSymReader.getSymbolFile(
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   470
					dllLoad.getName(), false);
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   471
			if (symbolFile != null) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   472
				return pinpointToSrcLine(symbolFile, memoryAddress, dllLoad);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   473
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   474
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   475
		return null;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   476
	}
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   477
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   478
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   479
	 * Pinpoints memory address to source code line
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   480
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   481
	 * @param symbolFile
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   482
	 *            Opened symbol file
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   483
	 * @param memoryAddress
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   484
	 *            Used memory address
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   485
	 * @param dllLoad
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   486
	 *            DllLoad object where to memory address belongs
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   487
	 * @return SourceFile
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   488
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   489
	private SourceFile pinpointToSrcLine(ISymbolFile symbolFile,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   490
			Long memoryAddress, DllLoad dllLoad) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   491
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   492
		ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager()
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   493
				.getProjectInfo(iCurrentProject);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   494
		String platform = cpi.getDefaultConfiguration().getPlatformString();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   495
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   496
		try {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   497
			// this is the start address of each symbol file
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   498
			long defaultLinkAddress = 0;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   499
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   500
			// if the platform is other than winscw => adjust the memory address
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   501
			if (!(Constants.BUILD_TARGET_WINSCW).equalsIgnoreCase(platform)) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   502
				defaultLinkAddress = 32768L;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   503
			} else {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   504
				defaultLinkAddress = -4096L;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   505
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   506
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   507
			// calculate memory address in symbol file
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   508
			long calculated = (memoryAddress - dllLoad.getStartAddress())
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   509
					+ defaultLinkAddress;
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   510
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   511
			java.math.BigInteger bigAddress = new java.math.BigInteger(Long
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   512
					.toHexString(calculated), 16);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   513
			IFunction func = symbolFile.findFunctionByAddress(bigAddress);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   514
			ISourceLocation loc = symbolFile.findSourceLocation(bigAddress);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   515
			if (func != null && loc != null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   516
				String sourceFile = loc.getSourceFile();
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   517
				if (sourceFile == null || sourceFile.equalsIgnoreCase("")) //$NON-NLS-1$
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   518
					return null;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   519
				int lineNumber = loc.getLineNumber();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   520
				if (lineNumber == 0)
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   521
					return null;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   522
				String name = func.getName();
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   523
				if (name == null || name.equalsIgnoreCase("")) //$NON-NLS-1$
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   524
					return null;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   525
				/*
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   526
				 * if( onlyForProjectFiles &&
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   527
				 * !isFilePartOfTheProject(loc.getSourceFile()) ) return null;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   528
				 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   529
				SourceFile file = new SourceFile();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   530
				file.setFileName(sourceFile);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   531
				file.setLineNumber(lineNumber);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   532
				file.setFunctionName(name);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   533
				return file;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   534
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   535
		} catch (java.lang.NumberFormatException nfe) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   536
			// do nothing by design
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   537
			nfe.printStackTrace();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   538
		} catch (Exception e) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   539
			// do nothing by design
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   540
			e.printStackTrace();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   541
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   542
		return null;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   543
	}
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   544
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   545
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   546
	 * Opens current callstack item on default editor and pinpoints memory leak
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   547
	 * line
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   548
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   549
	 * @param cppFileName
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   550
	 *            Cpp file name
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   551
	 * @param lineNumber
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   552
	 *            Cpp file line number
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   553
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   554
	private void openEditor(String cppFileName, String lineNumber) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   555
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   556
		// check that used information is given
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   557
		// we need to know file name and file line number
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   558
		// that we could open the right line in editor
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   559
		if (cppFileName == null || ("").equals(cppFileName) //$NON-NLS-1$
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   560
				|| lineNumber == null || ("").equals(lineNumber)) { //$NON-NLS-1$
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   561
			return;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   562
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   563
		try {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   564
			IFile file = null;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   565
			String usedFileName = null;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   566
			usedFileName = getFileNames(cppFileName);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   567
			if (iCurrentProject.isOpen()) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   568
				file = ResourcesPlugin.getWorkspace().getRoot().getFile(
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   569
						new Path(iCurrentProject.getName()
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   570
								+ usedFileName.toLowerCase(Locale.US)));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   571
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   572
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   573
			// if file not found in active project
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   574
			if (file == null || !file.exists()) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   575
				IWorkspaceRoot myWorkspaceRoot = ResourcesPlugin.getWorkspace()
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   576
						.getRoot();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   577
				IProject[] projects = myWorkspaceRoot.getProjects();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   578
				for (int i = 0; i < projects.length; i++) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   579
					file = ResourcesPlugin.getWorkspace().getRoot().getFile(
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   580
							new Path(projects[i].getName() + "\\" //$NON-NLS-1$
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   581
									+ usedFileName));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   582
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   583
					// file found => skip the rest of the projects
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   584
					if (file != null && file.exists()) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   585
						break;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   586
					}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   587
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   588
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   589
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   590
			// if file still not found
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   591
			// display info to user and leave
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   592
			if (file == null || !file.exists()) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   593
				Util.showMessage(Constants.SOURCE_NOT_FOUND);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   594
				return;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   595
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   596
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   597
			IWorkbenchPage page = PlatformUI.getWorkbench()
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   598
					.getActiveWorkbenchWindow().getActivePage();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   599
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   600
			HashMap<String, Object> map = new HashMap<String, Object>();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   601
			map.put(IMarker.LINE_NUMBER, Integer.parseInt(lineNumber));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   602
			// map.put(IDE.EDITOR_ID_ATTR,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   603
			// "org.eclipse.jdt.ui.ClassFileEditor");
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   604
			map.put(IDE.EDITOR_ID_ATTR, Constants.SOURCE_FILE_EDITOR_ID);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   605
			IMarker marker = file.createMarker(IMarker.TEXT);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   606
			marker.setAttributes(map);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   607
			IDE.openEditor(page, marker, true);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   608
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   609
		} catch (PartInitException pie) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   610
			pie.printStackTrace();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   611
		} catch (NullPointerException npe) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   612
			npe.printStackTrace();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   613
		} catch (CoreException ce) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   614
			ce.printStackTrace();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   615
		} catch (Exception e) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   616
			e.printStackTrace();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   617
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   618
	}
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   619
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   620
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   621
	 * Find symbol reader api pinpointed class file for project class files.
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   622
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   623
	 * @param fileName
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   624
	 *            cpp file name
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   625
	 * @return found cpp file location
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   626
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   627
	private String getFileNames(String fileName) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   628
		int slash = Util.getLastSlashIndex(fileName);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   629
		String tempFile = fileName.substring(slash + 1, fileName.length());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   630
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   631
		String realFileName = fileName;
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   632
		for (String tempFileName : cppFileNames) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   633
			int slashTemp = Util.getLastSlashIndex(tempFileName);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   634
			String tempFileWithoutExt = tempFileName.substring(slashTemp + 1,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   635
					tempFileName.length());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   636
			if (tempFileWithoutExt.equalsIgnoreCase(tempFile)) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   637
				realFileName = tempFileName;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   638
				break;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   639
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   640
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   641
		return realFileName;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   642
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   643
}