sysperfana/analyzetoolext/com.nokia.s60tools.analyzetool/src/com/nokia/s60tools/analyzetool/ui/MainView.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 MainView
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.ui;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    19
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    20
import java.io.FileInputStream;
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.Hashtable;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    25
import java.util.Iterator;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    26
import java.util.Locale;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    27
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    28
import org.eclipse.core.resources.IFile;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    29
import org.eclipse.core.resources.IMarker;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    30
import org.eclipse.core.resources.IProject;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    31
import org.eclipse.core.resources.IResource;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    32
import org.eclipse.core.resources.IWorkspaceRoot;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    33
import org.eclipse.core.resources.ResourcesPlugin;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    34
import org.eclipse.core.runtime.CoreException;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    35
import org.eclipse.core.runtime.IAdaptable;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    36
import org.eclipse.core.runtime.IProgressMonitor;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    37
import org.eclipse.core.runtime.IStatus;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    38
import org.eclipse.core.runtime.Path;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    39
import org.eclipse.core.runtime.Status;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    40
import org.eclipse.core.runtime.jobs.Job;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    41
import org.eclipse.jface.action.Action;
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
    42
import org.eclipse.jface.action.IAction;
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    43
import org.eclipse.jface.action.IMenuListener;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    44
import org.eclipse.jface.action.IMenuManager;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    45
import org.eclipse.jface.action.IToolBarManager;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    46
import org.eclipse.jface.action.MenuManager;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    47
import org.eclipse.jface.action.Separator;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    48
import org.eclipse.jface.preference.IPreferenceStore;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    49
import org.eclipse.jface.preference.PreferenceDialog;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    50
import org.eclipse.jface.viewers.DoubleClickEvent;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    51
import org.eclipse.jface.viewers.IDoubleClickListener;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    52
import org.eclipse.jface.viewers.ISelection;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    53
import org.eclipse.jface.viewers.ISelectionChangedListener;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    54
import org.eclipse.jface.viewers.IStructuredSelection;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    55
import org.eclipse.jface.viewers.ITreeContentProvider;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    56
import org.eclipse.jface.viewers.ITreeViewerListener;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    57
import org.eclipse.jface.viewers.LabelProvider;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    58
import org.eclipse.jface.viewers.SelectionChangedEvent;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    59
import org.eclipse.jface.viewers.StructuredSelection;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    60
import org.eclipse.jface.viewers.TreeExpansionEvent;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    61
import org.eclipse.jface.viewers.TreeViewer;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    62
import org.eclipse.jface.viewers.Viewer;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    63
import org.eclipse.jface.viewers.ViewerSorter;
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
    64
import org.eclipse.jface.window.Window;
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    65
import org.eclipse.swt.SWT;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    66
import org.eclipse.swt.custom.CTabFolder;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    67
import org.eclipse.swt.custom.CTabItem;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    68
import org.eclipse.swt.custom.SashForm;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    69
import org.eclipse.swt.dnd.Clipboard;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    70
import org.eclipse.swt.dnd.TextTransfer;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    71
import org.eclipse.swt.dnd.Transfer;
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
    72
import org.eclipse.swt.events.DisposeEvent;
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
    73
import org.eclipse.swt.events.DisposeListener;
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    74
import org.eclipse.swt.events.KeyEvent;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    75
import org.eclipse.swt.events.KeyListener;
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
    76
import org.eclipse.swt.events.SelectionEvent;
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
    77
import org.eclipse.swt.events.SelectionListener;
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    78
import org.eclipse.swt.graphics.Image;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    79
import org.eclipse.swt.layout.GridData;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    80
import org.eclipse.swt.widgets.Composite;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    81
import org.eclipse.swt.widgets.Label;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    82
import org.eclipse.swt.widgets.Menu;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    83
import org.eclipse.swt.widgets.Shell;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    84
import org.eclipse.ui.IActionBars;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    85
import org.eclipse.ui.ISelectionListener;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    86
import org.eclipse.ui.ISharedImages;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    87
import org.eclipse.ui.IWorkbenchActionConstants;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    88
import org.eclipse.ui.IWorkbenchPage;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    89
import org.eclipse.ui.IWorkbenchPart;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    90
import org.eclipse.ui.PlatformUI;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    91
import org.eclipse.ui.dialogs.PreferencesUtil;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    92
import org.eclipse.ui.ide.IDE;
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
    93
import org.eclipse.ui.navigator.CommonNavigator;
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    94
import org.eclipse.ui.part.ViewPart;
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
    95
import org.eclipse.ui.views.navigator.ResourceNavigator;
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
import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    98
import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    99
import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo;
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   100
import com.nokia.carbide.cpp.internal.project.ui.views.SymbianProjectNavigatorView;
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   101
import com.nokia.s60tools.analyzetool.Activator;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   102
import com.nokia.s60tools.analyzetool.AnalyzeToolHelpContextIDs;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   103
import com.nokia.s60tools.analyzetool.builder.BuilderUtil;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   104
import com.nokia.s60tools.analyzetool.engine.AnalysisItem;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   105
import com.nokia.s60tools.analyzetool.engine.AnalyzeFactory;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   106
import com.nokia.s60tools.analyzetool.engine.CallstackItem;
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   107
import com.nokia.s60tools.analyzetool.engine.DeferredCallstackManager;
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   108
import com.nokia.s60tools.analyzetool.engine.EpocReader;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   109
import com.nokia.s60tools.analyzetool.engine.IMemoryActivityModel;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   110
import com.nokia.s60tools.analyzetool.engine.MMPInfo;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   111
import com.nokia.s60tools.analyzetool.engine.ParseAnalyzeData;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   112
import com.nokia.s60tools.analyzetool.engine.ParseXMLFileSAX;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   113
import com.nokia.s60tools.analyzetool.engine.ProjectResults;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   114
import com.nokia.s60tools.analyzetool.engine.RunResults;
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   115
import com.nokia.s60tools.analyzetool.engine.SimpleCallstackManager;
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   116
import com.nokia.s60tools.analyzetool.engine.UseAtool;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   117
import com.nokia.s60tools.analyzetool.engine.statistic.ProcessInfo;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   118
import com.nokia.s60tools.analyzetool.engine.statistic.ReadFile;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   119
import com.nokia.s60tools.analyzetool.global.Constants;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   120
import com.nokia.s60tools.analyzetool.global.Util;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   121
import com.nokia.s60tools.analyzetool.internal.ui.graph.ChartContainer;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   122
import com.nokia.s60tools.analyzetool.ui.actions.DropDownMenu;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   123
import com.nokia.s60tools.analyzetool.ui.actions.FileActionHistory;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   124
import com.nokia.s60tools.analyzetool.ui.statistic.StatisticView;
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
/**
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   127
 * AnalyzeTool main view which displays memory analysis results and provides
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   128
 * interface for all the functionalities what AnalyzeTool has.
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   129
 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   130
 * @author kihe
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   131
 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   132
 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   133
public class MainView extends ViewPart implements ISelectionListener,
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   134
		ITreeViewerListener, IActionListener, ISelectionChangedListener,
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   135
		KeyListener {
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
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   138
	 * Sorts tree view objects.
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   139
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   140
	 * @author kihe
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   141
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   142
	public static class NameSorter extends ViewerSorter {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   143
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   144
		/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   145
		 * Compares view items.
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   146
		 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   147
		 * @see org.eclipse.jface.viewers.ViewerComparator#compare(org.eclipse.jface.viewers.Viewer,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   148
		 *      java.lang.Object, java.lang.Object)
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   149
		 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   150
		 * @param viewer
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   151
		 *            Viewer
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   152
		 * @param e1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   153
		 *            Object
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   154
		 * @param e2
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   155
		 *            Object
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   156
		 * @return int Always return 0
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   157
		 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   158
		@Override
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   159
		public int compare(final Viewer viewer, final Object e1, final Object e2) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   160
			return 0;
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
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   163
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   164
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   165
	 * The content provider class is responsible for providing objects to the
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   166
	 * view. It can wrap existing objects in adapters or simply return objects
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   167
	 * as-is. These objects may be sensitive to the current input of the view,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   168
	 * or ignore it and always show the same content (like Task List, for
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   169
	 * example).
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
	class ViewContentProvider implements ITreeContentProvider {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   172
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   173
		/**
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   174
		 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   175
		 * @see org.eclipse.jface.viewers.IContentProvider#dispose()
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   176
		 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   177
		public void dispose() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   178
			// MethodDeclaration/Block[count(BlockStatement) = 0 and
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   179
			// @containsComment = 'false']
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   180
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   181
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   182
		/**
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   183
		 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   184
		 * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   185
		 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   186
		public Object[] getChildren(Object parent) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   187
			if (parent instanceof TreeParent) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   188
				return ((TreeParent) parent).getChildren();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   189
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   190
			return new Object[0];
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   191
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   192
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   193
		/*
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   194
		 * (non-Javadoc)
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   195
		 * 
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   196
		 * @see
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   197
		 * org.eclipse.jface.viewers.IStructuredContentProvider#getElements(
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   198
		 * java.lang.Object)
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   199
		 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   200
		public Object[] getElements(Object parent) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   201
			if (parent.equals(getViewSite())) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   202
				if (invisibleRoot == null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   203
					getStartupContent();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   204
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   205
				return getChildren(invisibleRoot);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   206
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   207
			return getChildren(parent);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   208
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   209
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   210
		/*
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   211
		 * (non-Javadoc)
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   212
		 * 
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   213
		 * @see
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   214
		 * org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   215
		 * .Object)
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   216
		 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   217
		public Object getParent(Object child) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   218
			if (child instanceof TreeObject) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   219
				return ((TreeObject) child).getParent();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   220
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   221
			return null;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   222
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   223
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   224
		/*
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   225
		 * (non-Javadoc)
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   226
		 * 
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   227
		 * @see
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   228
		 * org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   229
		 * .Object)
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   230
		 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   231
		public boolean hasChildren(Object parent) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   232
			if (parent instanceof TreeParent) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   233
				return ((TreeParent) parent).hasChildren();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   234
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   235
			return false;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   236
		}
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
		/*
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   239
		 * (non-Javadoc)
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   240
		 * 
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   241
		 * @see
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   242
		 * org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   243
		 * .jface.viewers.Viewer, java.lang.Object, java.lang.Object)
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   244
		 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   245
		public void inputChanged(Viewer v, Object oldInput, Object newInput) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   246
			// MethodDeclaration/Block[count(BlockStatement) = 0 and
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   247
			// @containsComment = 'false']
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   248
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   249
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   250
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   251
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   252
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   253
	 * Provides elements of tree view.
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   254
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   255
	 * @author kihe
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   256
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   257
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   258
	public class ViewLabelProvider extends LabelProvider {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   259
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   260
		/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   261
		 * Used when tree model item is TreeParent.
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   262
		 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   263
		private final Image folder;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   264
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   265
		/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   266
		 * Default element only used to show error situations.
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   267
		 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   268
		private final Image element;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   269
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   270
		/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   271
		 * Used when tree model item is part of the module which is build with
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   272
		 * AnalyzeTool.
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   273
		 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   274
		private final Image build;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   275
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   276
		/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   277
		 * Used when tree model item is part of the project but not build with
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   278
		 * with AnalyzeTool.
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   279
		 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   280
		private final Image notBuild;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   281
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   282
		/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   283
		 * Used when tree model item is outside of the project modules.
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   284
		 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   285
		public Image outside;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   286
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   287
		/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   288
		 * Constructor. Created all the images which is used in the AnalyzeTool
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   289
		 * tree model.
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   290
		 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   291
		public ViewLabelProvider() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   292
			// create images
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   293
			folder = PlatformUI.getWorkbench().getSharedImages().getImage(
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   294
					ISharedImages.IMG_OBJ_FOLDER);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   295
			element = PlatformUI.getWorkbench().getSharedImages().getImage(
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   296
					ISharedImages.IMG_OBJ_ELEMENT);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   297
			build = Activator.getImageDescriptor(Constants.ICON_BUILD)
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   298
					.createImage();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   299
			notBuild = Activator.getImageDescriptor(Constants.ICON_NOT_BUILD)
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   300
					.createImage();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   301
			outside = Activator.getImageDescriptor(Constants.ICON_OUTSIDE)
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   302
					.createImage();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   303
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   304
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
		 * Gets current tree object image.
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   307
		 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   308
		 * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   309
		 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   310
		 * @param obj
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   311
		 *            Current tree model item
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   312
		 * @return Corresponding image of tree view object
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
		@Override
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   315
		public Image getImage(final Object obj) {
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
			// if object is TreeParent return "folder" icon
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   318
			if (obj instanceof TreeParent) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   319
				return folder;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   320
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   321
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   322
			// if object is TreeObject, need to change icon to match object
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   323
			// state
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   324
			else if (obj instanceof TreeObject) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   325
				// get TreeObject
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   326
				TreeObject tempObject = (TreeObject) obj;
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
				// change object icon if module belongs to selected project
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   329
				if (tempObject.isBelongs()) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   330
					// if module is built with AnalyzeTool
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   331
					if (tempObject.isBuild()) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   332
						return build;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   333
					}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   334
					// module not build with AnalyzeTool
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   335
					return notBuild;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   336
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   337
				// module not belong to selected project
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   338
				return outside;
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
			return element;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   341
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   342
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   343
		/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   344
		 * Gets current tree view object name.
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   345
		 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   346
		 * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   347
		 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   348
		 * @return Current tree view object name
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   349
		 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   350
		@Override
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   351
		public final String getText(final Object obj) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   352
			return obj.toString();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   353
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   354
	}
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
	/** Is trace actions enabled. */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   357
	public static boolean enableTrace;
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
	/** Title of the AnalyzeTool view */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   360
	private String viewTitle = Constants.ANALYZE_TOOL_TITLE;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   361
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   362
	/** Line feed character. */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   363
	private static String lineFeed = "\n";
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   364
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   365
	/** Contains information of test runs. */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   366
	public TreeViewer runView;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   367
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   368
	/** Contains one memory leak call stack addresses. */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   369
	private TreeViewer callstackView;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   370
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   371
	/** Tree parent object which not shown to user. */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   372
	private TreeParent invisibleRoot;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   373
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   374
	/** Double click action. */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   375
	private Action doubleClickAction;
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   376
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   377
	/** Click action. */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   378
	private Action clickAction;
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   379
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   380
	/** Change detail level action. */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   381
	public Action changeDetails;
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
	/** Select S60 log file action. */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   384
	private Action s60LogTargetAction;
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   385
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   386
	/** Select TraceViewer connection action. */
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   387
	// private Action externalLogTargetAction;
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   388
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   389
	/** Select fast data gathering mode */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   390
	private Action externalFastLogTargetAction;
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   391
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   392
	/** Select Ask always action. */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   393
	private Action askLogTargetAction;
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   394
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   395
	/** Save report file action. */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   396
	private Action saveReportAction;
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
	/** Save test run action. */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   399
	private Action saveDataFileAction;
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   400
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   401
	/** AnalyzeTool results action. */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   402
	private Action analyzeResults;
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   403
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   404
	/** Activate AnalyzeTool build action. */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   405
	public Action buildWithAtool;
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   406
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   407
	/** Clean AnalyzeTool changes action. */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   408
	private Action cleanAtoolChanges;
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   409
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   410
	/** Start/Stop trace action. */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   411
	public Action traceAction;
15
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
	/** Start subtest action. */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   414
	private Action startSubtest;
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   415
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   416
	/** Stop subtest action. */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   417
	private Action stopSubtest;
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   418
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   419
	/** Refresh(re-creates) project results */
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   420
	private Action refreshResults;
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   421
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   422
	/** Copies selected memory leak item info to the clipboard. */
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   423
	private Action copyAction;
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   424
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   425
	/** Action to open AnalyzeTool preference page. */
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   426
	private Action openPrefs;
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   427
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   428
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   429
	 * Clears selected project results without removing temporary files
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
	private Action clearProjectResults;
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
	/** Selected project reference. */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   434
	public IProject project;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   435
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   436
	/** Previously select project reference. */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   437
	public IProject lastProjectRef;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   438
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   439
	/** Project reference for active trace. */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   440
	private IProject traceStartedProjectRef;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   441
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   442
	/** Contains detailed information of selected run or memory leak. */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   443
	public Label informationLabel;
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
	/** Memory analysis parser. */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   446
	public ParseAnalyzeData parser;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   447
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   448
	/** Used data file. */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   449
	public String usedDataFileName = null;
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
	/** Is trace active. */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   452
	private boolean traceActive = false;
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
	/** Last active memory leak tree item. */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   455
	private TreeObject activeTreeItem;
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
	/** Contains workbench (all project) related cpp file info. */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   458
	private final AbstractList<String> cppFileNames;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   459
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   460
	/** Contains started subtest information. */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   461
	private final AbstractList<ActiveSubtests> startedSubtest;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   462
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   463
	/** Contains project related module results. */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   464
	private final ProjectResults projectResults;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   465
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   466
	/** Job for analyzing data files. */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   467
	private Job analyzeJob;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   468
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   469
	/** Job for reading the data files for the graph. */
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   470
	private GraphLoadJob graphLoadJob;
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   471
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   472
	/** Last selected tree item. */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   473
	private Object lastSelectedObject;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   474
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   475
	/** Contains information of which files were opened. */
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   476
	public FileActionHistory fileOpenHistory;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   477
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   478
	/** File open drop down menu. */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   479
	private DropDownMenu fileOpenMenu;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   480
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   481
	/** Log target action drop down menu. */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   482
	private DropDownMenu logTargetMenu;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   483
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   484
	/** Save file drop down menu. */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   485
	private DropDownMenu saveFileMenu;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   486
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   487
	/** Tab item for the "Top allocation locations" tab */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   488
	CTabItem memoryTab;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   489
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   490
	/** Tab item for the memory results tab */
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   491
	CTabItem mainTab;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   492
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   493
	/** StatisticView reference */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   494
	StatisticView statisticView;
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
	/** Contains project related modules */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   497
	private final Hashtable<IProject, AbstractList<MMPInfo>> projectModules;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   498
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   499
	/** Reads epocwind.out file */
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   500
	EpocReader listeningJob;
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   501
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   502
	/** The chart view composite */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   503
	protected ChartContainer chart;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   504
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
	 * The constructor.
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   507
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   508
	public MainView() {
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   509
		parser = new ParseAnalyzeData(true, false, true);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   510
		cppFileNames = new ArrayList<String>();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   511
		startedSubtest = new ArrayList<ActiveSubtests>();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   512
		projectResults = new ProjectResults();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   513
		fileOpenHistory = new FileActionHistory(Constants.HISTORY_LEVEL);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   514
		projectModules = new Hashtable<IProject, AbstractList<MMPInfo>>();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   515
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   516
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   517
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   518
	 * Activates AnalyzeTool custom build if it is not activated.
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   519
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   520
	public final void activateAnalysisBuild() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   521
		// check project validity
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   522
		if (checkProjectValidity()) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   523
			// add AnalyzeTool custom builder natures to project build nature
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   524
			BuilderUtil bUtil = new BuilderUtil();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   525
			if (bUtil.isNatureEnabled(project)) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   526
				bUtil.disableNatures(project);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   527
			} else {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   528
				bUtil.enableNatures(project);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   529
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   530
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   531
		// update build state
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   532
		updateBuildState(project);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   533
	}
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
	/*
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   536
	 * (non-Javadoc)
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   537
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   538
	 * @see com.nokia.s60tools.analyzetool.ui.IActionListener#allModulesBuilt()
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   539
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   540
	public final void buildStateChanged(final IProject projRef) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   541
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   542
		// check validity
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   543
		if (!project.equals(projRef) || projectResults == null) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   544
			return;
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
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   547
		final String datafile = projectResults.getDataFileName(projRef);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   548
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   549
		// if trace is captured or data file is opened
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   550
		if (datafile != null && runView != null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   551
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   552
			// need to check is data file available in the disk
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   553
			FileInputStream fis = null;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   554
			try {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   555
				// get existing file stream
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   556
				fis = new FileInputStream(datafile);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   557
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   558
				// if file is empty => do nothing
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   559
				if (fis.available() == 0) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   560
					return;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   561
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   562
			} catch (java.io.FileNotFoundException fnfe) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   563
				fnfe.printStackTrace();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   564
				return;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   565
			} catch (java.io.IOException ioe) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   566
				ioe.printStackTrace();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   567
				return;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   568
			} finally { // finally close input stream
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   569
				try {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   570
					if (fis != null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   571
						fis.close();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   572
						fis = null;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   573
					}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   574
				} catch (java.io.IOException ioe) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   575
					ioe.printStackTrace();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   576
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   577
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   578
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   579
			// data file is available
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   580
			int dataFileType = UseAtool.checkFileType(datafile);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   581
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   582
			if (dataFileType == Constants.DATAFILE_INVALID
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   583
					|| dataFileType == Constants.DATAFILE_XML
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   584
					|| dataFileType == Constants.DATAFILE_EMPTY) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   585
				return;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   586
			}
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   587
			boolean reGenerate = Util
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   588
					.openConfirmationDialog(Constants.BUILD_STATE_CHANGED);
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   589
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   590
			if (reGenerate) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   591
				// sync with UI thread
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   592
				runView.getControl().getDisplay().asyncExec(new Runnable() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   593
					public void run() {
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   594
						analyzeDataFile(Constants.ANALYZE_USE_DATA_FILE,
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   595
								datafile, false);
1
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
				});
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   598
			}
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
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   601
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   602
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   603
	 * Opens file dialog and analyzing data file for given location.
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   604
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   605
	 * @param type
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   606
	 *            Type to define is data file asked from the user or using the
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   607
	 *            give data file
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   608
	 * @param existingDataFile
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   609
	 *            Data file path
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   610
	 * @param showErrorInfo
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   611
	 *            Flag to determinate that displaying error info or not
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   612
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   613
	public final void analyzeDataFile(final int type,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   614
			final String existingDataFile, final boolean showErrorInfo) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   615
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   616
		// is project selected
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   617
		if (!checkProjectValidity()) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   618
			return;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   619
		}
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
		// user selected file
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   622
		final String selectedFile;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   623
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   624
		// ask for user data file
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   625
		if (type == Constants.ANALYZE_ASK_FOR_USER) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   626
			selectedFile = Util.openFileDialog(getSite().getShell(),
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   627
					Constants.DIALOG_SELECT_DATA_FILE, project.getLocation()
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   628
							.toOSString());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   629
		} else if (existingDataFile == null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   630
			selectedFile = parser.getDataFileName();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   631
		} else {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   632
			selectedFile = existingDataFile;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   633
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   634
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   635
		// if user select some file
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   636
		if (selectedFile != null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   637
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   638
			// clear previous data
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   639
			projectResults.clearProjectData(project);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   640
			activeTreeItem = null;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   641
			clearCallstackViewContent();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   642
			updateInformationLabel("");
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   643
			runView.setInput(getStartupContent());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   644
			changeViewTitle(viewTitle);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   645
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   646
			AbstractList<MMPInfo> modules = Util
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   647
					.loadProjectTargetsInfo(project);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   648
			projectModules.put(project, modules);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   649
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   650
			boolean xmlFile = Util.isFileXML(selectedFile);
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   651
			// if file is XML file
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   652
			// no need to analyze data file
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   653
			// => just create results from XML file
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   654
			if (xmlFile) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   655
				Job analyzingXMLJob = new Job(Constants.ANALYZE_TOOL_TITLE) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   656
					@Override
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   657
					protected IStatus run(IProgressMonitor monitor) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   658
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   659
						// update progress monitor state
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   660
						monitor.beginTask(Constants.PROGRESSDIALOG_TITLE,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   661
								IProgressMonitor.UNKNOWN);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   662
						// Parse the data file
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   663
						ParseXMLFileSAX dataFileParser = new ParseXMLFileSAX(
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   664
								project, selectedFile, projectResults);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   665
						boolean ret = dataFileParser.parse();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   666
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   667
						// set used datafile name
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   668
						usedDataFileName = selectedFile;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   669
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   670
						fileOpenHistory.setFileName(selectedFile);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   671
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   672
						// if parsing success
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   673
						// display memory leak results
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   674
						if (ret) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   675
							// update project results
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   676
							projectResults.setProjectModules(project,
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   677
									projectModules.get(project), dataFileParser
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   678
											.getModules());
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   679
						} else {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   680
							fileOpenHistory.removeFileName(selectedFile);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   681
							if (showErrorInfo) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   682
								showErrorMessage(Constants.INFO_FILE_INVALID);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   683
							}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   684
						}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   685
						updateChangeDetailState(project);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   686
						refreshView();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   687
						dataFileParser = null;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   688
						return new Status(IStatus.OK,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   689
								Constants.ANALYZE_CONSOLE_ID, IStatus.OK,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   690
								Constants.PROGRESSDIALOG_ANALYZE_COMPLETE, null);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   691
					}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   692
				};
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   693
				analyzingXMLJob.setUser(true);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   694
				analyzingXMLJob.schedule();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   695
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   696
			} else {
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   697
				try {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   698
					analyzeWithAtool(project, selectedFile, showErrorInfo);
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   699
				} catch (Exception e) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   700
					analyzeJob = null;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   701
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   702
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   703
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   704
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   705
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   706
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   707
	 * Analyzing memory analysis results using atool.exe.
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   708
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   709
	 * @param projectRef
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   710
	 *            Project reference
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   711
	 * @param usedFile
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   712
	 *            Data file which contains memory analyze data
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   713
	 * @param showErrorInfo
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   714
	 *            Flag to determinate that displaying error info or not
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   715
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   716
	public final void analyzeWithAtool(final IProject projectRef,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   717
			final String usedFile, final boolean showErrorInfo) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   718
		// check that no existing job running
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   719
		if (analyzeJob == null
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   720
				|| analyzeJob.getResult().getCode() == IStatus.CANCEL
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   721
				|| analyzeJob.getResult().getCode() == IStatus.ERROR) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   722
			analyzeJob = new Job(Constants.ANALYZE_TOOL_TITLE) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   723
				@Override
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   724
				protected IStatus run(IProgressMonitor monitor) {
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   725
					// inform progress dialog that task execution starts
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   726
					// this make progress dialog visible on the UI
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   727
					monitor.beginTask(Constants.PROGRESSDIALOG_ATOOL,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   728
							IProgressMonitor.UNKNOWN);
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   729
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   730
					fileOpenHistory.setFileName(usedFile);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   731
					// add2UserActionHistory( "File opened: " + usedFile );
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   732
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   733
					// set used datafile name
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   734
					usedDataFileName = usedFile;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   735
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   736
					if (chart != null) {
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   737
						resetGraphView();// clear out the graph view
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   738
					}
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   739
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   740
					// create atool object and execute atool
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   741
					UseAtool atool = new UseAtool();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   742
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   743
					// create XML file
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   744
					Constants.COMMAND_LINE_ERROR_CODE errorCode = atool
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   745
							.createXmlAndCleanDatFilesToCarbide(monitor,
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   746
									projectRef, usedFile, "-a");
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   747
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   748
					String xmlFileLocation = atool.getXmlFilePath();
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   749
					String cleanDatFileLocation = atool.getCleanDatFilePath();
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   750
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   751
					// if some error occurs display it to user.
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   752
					if (errorCode != Constants.COMMAND_LINE_ERROR_CODE.OK) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   753
						fileOpenHistory.removeFileName(usedFile);
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   754
						Util.displayCommandLineError(errorCode);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   755
					}
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   756
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   757
					// if XML file generation failed => info to the user
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   758
					else if (xmlFileLocation == null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   759
						fileOpenHistory.removeFileName(usedFile);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   760
						if (showErrorInfo) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   761
							showErrorMessage(Constants.INFO_FILE_INVALID);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   762
						}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   763
					} else {
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   764
						// Parse the XML file
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   765
						ParseXMLFileSAX dataFileParser = new ParseXMLFileSAX(
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   766
								project, xmlFileLocation, projectResults);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   767
						boolean error = dataFileParser.parse();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   768
						if (showErrorInfo && !error) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   769
							fileOpenHistory.removeFileName(usedFile);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   770
							showErrorMessage(Constants.INFO_FILE_INVALID);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   771
						}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   772
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   773
						projectResults.setProjectModules(project,
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   774
								projectModules.get(project), dataFileParser
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   775
										.getModules());
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   776
						projectResults.setDataFileName(projectRef,
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   777
								usedDataFileName);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   778
						// update display
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   779
						refreshView();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   780
					}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   781
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   782
					updateChangeDetailState(projectRef);
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   783
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   784
					if (!monitor.isCanceled()) {
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   785
						// create the job for loading the graph model
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   786
						// but only schedule it when the user gets to the graph
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   787
						// tab
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   788
						graphLoadJob = new GraphLoadJob(cleanDatFileLocation);
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   789
						graphLoadJob.setUser(true);// set progress bar
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   790
						graphLoadJob.setPriority(Job.LONG);
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   791
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   792
						// run the following in UI thread, since widgets get
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   793
						// accessed
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   794
						PlatformUI.getWorkbench().getDisplay().syncExec(
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   795
								new Runnable() {
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   796
									public void run() {
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   797
										if (((CTabFolder) chart.getParent())
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   798
												.getSelection() != null
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   799
												&& ((CTabFolder) chart
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   800
														.getParent())
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   801
														.getSelection()
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   802
														.getControl() == chart) {
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   803
											// chart tab is currently selected
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   804
											// so we can run the load job
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   805
											// straight away
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   806
											graphLoadJob.schedule();
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   807
										}
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   808
									}
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   809
								});
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   810
					}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   811
					analyzeJob = null;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   812
					return new Status(IStatus.OK, Constants.ANALYZE_CONSOLE_ID,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   813
							IStatus.OK,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   814
							Constants.PROGRESSDIALOG_ANALYZE_COMPLETE, null);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   815
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   816
			};
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   817
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   818
			if (graphLoadJob != null && graphLoadJob.getState() == Job.RUNNING) {
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   819
				graphLoadJob.cancel();
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   820
			}
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   821
			graphLoadJob = null;
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   822
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   823
			analyzeJob.setUser(true);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   824
			analyzeJob.setPriority(Job.LONG);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   825
			analyzeJob.schedule();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   826
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   827
		} else {
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   828
			// if existing job is running display info to user
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   829
			showMessage(Constants.INFO_ALLREADY_RUNNING);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   830
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   831
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   832
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   833
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   834
	 * Change report detail level.
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   835
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   836
	public final void changeDetailLevel() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   837
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   838
		// sync with UI thread
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   839
		PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   840
			public void run() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   841
				// get preference store
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   842
				IPreferenceStore store = Activator.getPreferences();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   843
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   844
				// get active report level
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   845
				String reportLevel = store.getString(Constants.REPORT_LEVEL);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   846
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   847
				boolean updateMemLeakAlso = false;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   848
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   849
				// set new report level
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   850
				if (Constants.REPORT_EVERY.equals(reportLevel)) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   851
					store.setValue(Constants.REPORT_LEVEL,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   852
							Constants.REPORT_KNOWN);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   853
					updateMemLeakAlso = true;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   854
				} else if (Constants.REPORT_KNOWN.equals(reportLevel)) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   855
					store.setValue(Constants.REPORT_LEVEL,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   856
							Constants.REPORT_TOPMOST);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   857
				} else if (Constants.REPORT_TOPMOST.equals(reportLevel)) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   858
					store.setValue(Constants.REPORT_LEVEL,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   859
							Constants.REPORT_EVERY);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   860
					updateMemLeakAlso = true;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   861
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   862
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   863
				if (updateMemLeakAlso && runView != null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   864
					activeTreeItem = null;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   865
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   866
					// set view content
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   867
					runView.setInput(getResults(false));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   868
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   869
					// refresh view
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   870
					runView.refresh();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   871
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   872
					// if last selected item not found current item list
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   873
					if (activeTreeItem == null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   874
						runView.setAutoExpandLevel(2);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   875
					} else {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   876
						// set selection to correct item
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   877
						runView.setSelection(new StructuredSelection(
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   878
								activeTreeItem), true);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   879
					}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   880
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   881
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   882
				if (callstackView != null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   883
					// update view callstack view content
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   884
					callstackView.setInput(getCallStack(activeTreeItem));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   885
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   886
					// expand all the trees on call stack view
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   887
					callstackView.expandAll();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   888
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   889
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   890
				// change tooltip
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   891
				changeReportActionTooltip();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   892
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   893
		});
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   894
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   895
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   896
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   897
	 * Change logging mode.
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   898
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   899
	 * @param loggingMode
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   900
	 *            Used logging mode
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   901
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   902
	public final void changeLogTarget(final String loggingMode) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   903
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   904
		if (logTargetMenu == null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   905
			return;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   906
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   907
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   908
		// get preference store
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   909
		IPreferenceStore store = Activator.getPreferences();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   910
		String usedLoggingMode = "";
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   911
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   912
		// if no logging mode given get it from the AnalyzeTool preferences
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   913
		if (loggingMode == null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   914
			usedLoggingMode = store.getString(Constants.LOGGING_MODE);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   915
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   916
		// logging mode is given => so start to use it
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   917
		else {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   918
			store.setValue(Constants.LOGGING_MODE, loggingMode);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   919
			usedLoggingMode = loggingMode;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   920
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   921
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   922
		if (Constants.LOGGING_S60.equals(usedLoggingMode)) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   923
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   924
			logTargetMenu.setImageDescriptor(Activator
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   925
					.getImageDescriptor(Constants.BUTTON_CELLURAR));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   926
			logTargetMenu
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   927
					.setToolTipText(Constants.ACTION_CHANGE_LOGGING_MODE_TOOLTIP_S60);
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   928
			if (loggingMode == null) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   929
				s60LogTargetAction.setChecked(true);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   930
				externalFastLogTargetAction.setChecked(false);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   931
				askLogTargetAction.setChecked(false);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   932
			}
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   933
		} else if (Constants.LOGGING_EXT_FAST.equals(usedLoggingMode)) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   934
			logTargetMenu.setImageDescriptor(Activator
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   935
					.getImageDescriptor(Constants.BUTTON_COMPUTER_FAST));
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   936
			logTargetMenu
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   937
					.setToolTipText(Constants.ACTION_CHANGE_LOGGING_MODE_TOOLTIP_FAST);
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   938
			if (loggingMode == null) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   939
				s60LogTargetAction.setChecked(false);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   940
				externalFastLogTargetAction.setChecked(true);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   941
				askLogTargetAction.setChecked(false);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   942
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   943
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   944
		// current logging mode is "ask_always"
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   945
		else {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   946
			logTargetMenu.setImageDescriptor(Activator
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   947
					.getImageDescriptor(Constants.BUTTON_ASK));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   948
			logTargetMenu
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   949
					.setToolTipText(Constants.ACTION_CHANGE_LOGGING_MODE_TOOLTIP_ASK);
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   950
			if (loggingMode == null) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   951
				s60LogTargetAction.setChecked(false);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   952
				externalFastLogTargetAction.setChecked(false);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   953
				askLogTargetAction.setChecked(true);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   954
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   955
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   956
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   957
		// if the fast data gathering mode is enabled by the preference page =>
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   958
		// enable also toolbar option
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   959
		// else disable fast data gathering mode
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   960
		externalFastLogTargetAction.setEnabled(store
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   961
				.getBoolean(Constants.LOGGING_FAST_ENABLED));
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   962
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   963
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   964
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   965
	 * Changes "Change report detail level" action tooltip.
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   966
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   967
	public final void changeReportActionTooltip() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   968
		if (changeDetails == null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   969
			return;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   970
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   971
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   972
		// get preference store
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   973
		IPreferenceStore store = Activator.getPreferences();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   974
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   975
		// get active report level
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   976
		String reportLevel = store.getString(Constants.REPORT_LEVEL);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   977
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   978
		// set new report level
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   979
		if (Constants.REPORT_EVERY.equals(reportLevel)) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   980
			changeDetails.setImageDescriptor(Activator
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   981
					.getImageDescriptor(Constants.BUTTON_DETAILS_ALL));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   982
			changeDetails
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   983
					.setToolTipText(Constants.ACTION_CHANGE_REPORT_LEVEL_ALL);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   984
		} else if (Constants.REPORT_KNOWN.equals(reportLevel)) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   985
			changeDetails.setImageDescriptor(Activator
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   986
					.getImageDescriptor(Constants.BUTTON_DETAILS_KNOWN));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   987
			changeDetails
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   988
					.setToolTipText(Constants.ACTION_CHANGE_REPORT_LEVEL_KNOWN);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   989
		} else if (Constants.REPORT_TOPMOST.equals(reportLevel)) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   990
			changeDetails.setImageDescriptor(Activator
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   991
					.getImageDescriptor(Constants.BUTTON_DETAILS_TOPMOST));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   992
			changeDetails
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   993
					.setToolTipText(Constants.ACTION_CHANGE_REPORT_LEVEL_TOPMOST);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   994
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   995
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   996
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   997
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   998
	 * Change view title.
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   999
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1000
	 * @param newTitle
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1001
	 *            New title text
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1002
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1003
	private void changeViewTitle(final String newTitle) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1004
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1005
		// if newTitle contains text
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1006
		if (newTitle != null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1007
			super.setContentDescription(newTitle);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1008
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1009
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1010
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1011
	/**
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1012
	 * Check that selected project is open and project information can be read.
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1013
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1014
	 * @return True if project is open and accessible otherwise False
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1015
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1016
	public final boolean checkProjectValidity() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1017
		// project is not selected show info to user
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1018
		if (project == null || !project.isOpen()) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1019
			Util.showMessage(Constants.NO_PROJ_SELECT);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1020
			return false;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1021
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1022
		return true;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1023
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1024
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1025
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1026
	 * Cleans atool.exe made changes.
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1027
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1028
	public final void clean() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1029
		if (!checkProjectValidity()) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1030
			return;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1031
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1032
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1033
		// check is atool.exe available
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1034
		if (!Util.isAtoolAvailable()) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1035
			showErrorMessage(Constants.INFO_ATOOL_NOT_AVAILABLE);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1036
			return;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1037
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1038
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1039
		// ask for user
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1040
		boolean ret = Util.openConfirmationDialog(Constants.CONFIRM_DELETE_ALL);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1041
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1042
		// if user confirms
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1043
		if (ret) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1044
			// clear AnalyzeTool made changes
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1045
			Util.clearAtoolChanges(project);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1046
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1047
			cleanAnalyzeData(null);
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1048
			resetGraphView();
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1049
			updateChangeDetailState(project);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1050
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1051
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1052
		if (statisticView != null) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1053
			statisticView.clean(null);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1054
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1055
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1056
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1057
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1058
	 * Cleans all the saved data.
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1059
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1060
	private void cleanAnalyzeData(final IProject projectRef) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1061
		// clean all data if project not specified
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1062
		if (projectRef == null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1063
			// clean all the project related info and data
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1064
			projectResults.clear();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1065
			projectModules.clear();
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1066
		} else {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1067
			// clear only one project results
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1068
			if (projectResults.contains(projectRef)) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1069
				projectResults.clearProjectData(projectRef);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1070
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1071
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1072
			if (projectModules.contains(projectRef)) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1073
				projectModules.remove(projectRef);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1074
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1075
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1076
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1077
		cppFileNames.clear();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1078
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1079
		// update variables
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1080
		activeTreeItem = null;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1081
		usedDataFileName = "";
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1082
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1083
		// set default view contents
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1084
		if (runView != null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1085
			runView.getControl().getDisplay().syncExec(new Runnable() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1086
				public void run() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1087
					runView.setInput(getStartupContent());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1088
					if (informationLabel != null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1089
						updateInformationLabel("");
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1090
					}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1091
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1092
					changeViewTitle(viewTitle);
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1093
					if (statisticView != null) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1094
						statisticView.clean(projectRef);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1095
					}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1096
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1097
			});
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1098
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1099
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1100
		clearCallstackViewContent();
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1101
		if (clearProjectResults != null && clearProjectResults != null) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1102
			clearProjectResults.setEnabled(false);
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1103
		} else if (clearProjectResults != null) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1104
			updateChangeDetailState(projectRef);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1105
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1106
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1107
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1108
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1109
	 * Clears callstack view contents.
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1110
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1111
	private void clearCallstackViewContent() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1112
		if (runView == null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1113
			return;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1114
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1115
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1116
		// if view exists
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1117
		runView.getControl().getDisplay().syncExec(new Runnable() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1118
			public void run() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1119
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1120
				if (callstackView != null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1121
					callstackView.setInput(null);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1122
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1123
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1124
		});
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1125
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1126
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1127
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1128
	 * Contributes action bar.
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1129
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1130
	private void contributeToActionBars() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1131
		if (getViewSite() == null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1132
			return;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1133
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1134
		IActionBars bars = getViewSite().getActionBars();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1135
		fillLocalPullDown(bars.getMenuManager());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1136
		fillLocalToolBar(bars.getToolBarManager());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1137
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1138
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1139
	/**
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1140
	 * This is a callback that will allow us to create the viewer and initialize
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1141
	 * it.
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1142
	 */
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1143
	@Override
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1144
	public void createPartControl(Composite parent) {
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1145
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
  1146
		// create a new Tab
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1147
		final CTabFolder mainFolder = new CTabFolder(parent, SWT.TOP);
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1148
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1149
		// create main view and add it tab
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1150
		createMainView(mainFolder);
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1151
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1152
		// create graph
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1153
		createGraphView(mainFolder);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1154
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1155
		// set initial selection
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1156
		mainFolder.setSelection(mainTab);
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1157
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1158
		mainFolder.addSelectionListener(new SelectionListener() {
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1159
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1160
			public void widgetDefaultSelected(SelectionEvent e) {
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1161
				widgetSelected(e);
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1162
			}
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1163
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1164
			public void widgetSelected(SelectionEvent e) {
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
  1165
				// if we changed to the graph tab and the graph load job isn't
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
  1166
				// already running
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1167
				// schedule it now
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1168
				if (graphLoadJob != null
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1169
						&& graphLoadJob.getState() != Job.RUNNING
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1170
						&& mainFolder.getSelection() != null
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1171
						&& mainFolder.getSelection().getControl() == chart) {
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1172
					graphLoadJob.schedule();
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1173
				}
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1174
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1175
				if (mainFolder.getSelectionIndex() == 1) {
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1176
					changeDetails.setEnabled(false);
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1177
				} else {
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1178
					changeDetails.setEnabled(true);
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1179
				}
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1180
			}
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1181
		});
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
  1182
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1183
		// stop any jobs that may be scheduled
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
  1184
		mainFolder.addDisposeListener(new DisposeListener() {
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1185
			public void widgetDisposed(DisposeEvent e) {
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
  1186
				if (graphLoadJob != null) {
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
  1187
					graphLoadJob.cancel();
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1188
					graphLoadJob = null;
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1189
				}
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
  1190
				if (analyzeJob != null) {
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1191
					analyzeJob.cancel();
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1192
					analyzeJob = null;
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1193
				}
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1194
			}
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1195
		});
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1196
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1197
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1198
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1199
	 * Creates graph view and add it to graph tab
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1200
	 * 
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1201
	 * @param mainFolder
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1202
	 *            CTabFolder parent of the view
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1203
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1204
	private void createGraphView(CTabFolder mainFolder) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1205
		final CTabItem chartTabItem = new CTabItem(mainFolder, SWT.NONE);
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1206
		chartTabItem.setText("Graph");
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1207
		chartTabItem.setToolTipText("AnalyzeTool graph per process");
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1208
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1209
		chart = new ChartContainer(mainFolder, SWT.NONE);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1210
		chartTabItem.setControl(chart);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1211
		IMemoryActivityModel model = AnalyzeFactory.getEmptyModel();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1212
		chart.setInput(project, model);
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1213
		model.addProcesses(model.getProcesses());// charts should get notified
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1214
		// via listeners on the
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1215
		// model
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1216
	}
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1217
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1218
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1219
	 * Clears the graph by setting an empty model and causing paint events
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1220
	 */
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1221
	private void resetGraphView() {
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1222
		if (chart != null) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1223
			chart.setInput(project, AnalyzeFactory.getEmptyModel());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1224
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1225
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1226
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1227
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1228
	 * Creates new statistic view and add it to memory tab
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1229
	 * 
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1230
	 * @param parent
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1231
	 *            Statistic view parent( CTabFolder )
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1232
	 */
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1233
	public void createMemoryView(CTabFolder parent) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1234
		statisticView = new StatisticView();
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1235
		memoryTab = statisticView.createView(parent);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1236
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1237
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1238
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1239
	 * Creates memory results view
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1240
	 * 
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1241
	 * @param parent
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1242
	 *            View parent ( CTabFolder )
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1243
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1244
	public void createMainView(CTabFolder parent) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1245
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1246
		// Create SashForm this form includes all the current view components
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1247
		SashForm sashForm = new SashForm(parent, SWT.HORIZONTAL);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1248
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1249
		mainTab = new CTabItem(parent, SWT.NONE);
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1250
		mainTab.setControl(sashForm);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1251
		mainTab.setText(Constants.MAIN_TAB_TITLE);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1252
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1253
		// create new treeviewer to shown memory analysis runs and leaks
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1254
		runView = new TreeViewer(sashForm, SWT.VIRTUAL);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1255
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1256
		// create SashForm to display call stack addresses and more detailed
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1257
		// information
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1258
		// of selected run or leak
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1259
		SashForm callstackForm = new SashForm(sashForm, SWT.VERTICAL);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1260
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1261
		// set content and label providers
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1262
		runView.setContentProvider(new ViewContentProvider());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1263
		runView.setLabelProvider(new ViewLabelProvider());
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
  1264
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1265
		// get init content
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1266
		runView.setInput(getStartupContent());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1267
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1268
		// add listener to provide selection change events
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1269
		runView.addTreeListener(this);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1270
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1271
		runView.setAutoExpandLevel(2);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1272
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1273
		// create new information label
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1274
		// this label contains more detailed information of selected item
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1275
		informationLabel = new Label(callstackForm, SWT.BORDER | SWT.CENTER);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1276
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1277
		// create grid data => this provides layout changes
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1278
		GridData data = new GridData();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1279
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1280
		// add grid data to label, this enables label ui modifications e.g. line
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1281
		// feed
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1282
		informationLabel.setLayoutData(data);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1283
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1284
		// set init text
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1285
		informationLabel.setText(Constants.INFO_NO_DATA);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1286
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1287
		// create new call stack view
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1288
		// this components contains information of one memory leak call stack
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1289
		// addresses
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1290
		callstackView = new TreeViewer(callstackForm, SWT.MULTI | SWT.H_SCROLL
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1291
				| SWT.V_SCROLL);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1292
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1293
		// modify UI components layouts
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1294
		// reserve more space for left side of UI
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1295
		sashForm.setWeights(new int[] { 5, 3 });
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1296
		callstackForm.setWeights(new int[] { 2, 8 });
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1297
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1298
		// add content and label providers
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1299
		callstackView.setContentProvider(new ViewContentProvider());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1300
		callstackView.setLabelProvider(new ViewLabelProvider());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1301
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1302
		// make actions and construct click listeners
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1303
		makeActions();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1304
		hookContextMenu();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1305
		hookDoubleClickAction();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1306
		hookClicks();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1307
		contributeToActionBars();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1308
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1309
		// set view title
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1310
		viewTitle = String.format(Constants.ANALYZE_TOOL_TITLE_WITH_VERSION,
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1311
				Util.getAToolFeatureVersionNumber());
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1312
		this.setContentDescription(viewTitle);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1313
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1314
		// add selection listener
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1315
		if (getSite() != null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1316
			getSite().getPage().addSelectionListener(this);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1317
			runView.getControl().addKeyListener(this);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1318
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1319
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1320
		// set actionlistener
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1321
		Activator.setActionListener(this);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1322
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1323
		// set help shortcuts
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1324
		PlatformUI.getWorkbench().getHelpSystem().setHelp(
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1325
				callstackView.getControl(),
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1326
				AnalyzeToolHelpContextIDs.ANALYZE_MAIN);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1327
		PlatformUI.getWorkbench().getHelpSystem().setHelp(runView.getControl(),
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1328
				AnalyzeToolHelpContextIDs.ANALYZE_MAIN);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1329
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1330
		ResourcesPlugin.getWorkspace().addResourceChangeListener(
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1331
				new ATResourceListener());
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1332
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1333
		IPreferenceStore store = Activator.getPreferences();
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
  1334
		store.setValue(Constants.LOGGING_FAST_ENABLED, true);
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1335
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1336
		// get default value for logging mode
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1337
		preferenceChanged();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1338
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1339
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1340
	/**
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1341
	 * When AnalyzeTool view is activated and TraceViewer plug-in is not
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1342
	 * available disable AnalyzeTool trace actions.
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1343
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1344
	 * @see com.nokia.s60tools.analyzetool.ui.IActionListener#disableTraceActions(boolean)
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1345
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1346
	 * @param disable
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1347
	 *            Boolean state of trace action
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1348
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1349
	public void disableTraceActions(final boolean disable) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1350
		if (traceAction != null && disable) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1351
			// enable trace action
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1352
			traceAction.setToolTipText(Constants.ACTION_START_TRACE);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1353
			traceAction.setEnabled(disable);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1354
		} else if (traceAction != null && !disable) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1355
			// disable trace action
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1356
			traceAction.setToolTipText(Constants.TRACE_NOT_FOUND);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1357
			traceAction.setEnabled(disable);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1358
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1359
		traceActive = false;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1360
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1361
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1362
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1363
	 * Fills context menu.
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1364
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1365
	 * @param manager
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1366
	 *            Menu manager
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1367
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1368
	private void fillContextMenu(IMenuManager manager) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1369
		manager.add(buildWithAtool);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1370
		manager.add(new Separator());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1371
		manager.add(traceAction);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1372
		manager.add(startSubtest);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1373
		manager.add(stopSubtest);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1374
		manager.add(new Separator());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1375
		manager.add(changeDetails);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1376
		manager.add(refreshResults);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1377
		manager.add(clearProjectResults);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1378
		manager.add(new Separator());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1379
		manager.add(cleanAtoolChanges);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1380
		manager.add(copyAction);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1381
		// Other plug-ins can contribute there actions here
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1382
		manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1383
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1384
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1385
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1386
	 * Fills local pull down menu.
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1387
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1388
	 * @param manager
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1389
	 *            Menu manager
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1390
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1391
	private void fillLocalPullDown(IMenuManager manager) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1392
		manager.add(buildWithAtool);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1393
		manager.add(new Separator());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1394
		manager.add(traceAction);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1395
		manager.add(startSubtest);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1396
		manager.add(stopSubtest);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1397
		manager.add(new Separator());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1398
		manager.add(changeDetails);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1399
		manager.add(refreshResults);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1400
		manager.add(new Separator());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1401
		manager.add(cleanAtoolChanges);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1402
		manager.add(new Separator());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1403
		manager.add(openPrefs);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1404
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1405
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1406
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1407
	 * Fills local toolbar.
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1408
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1409
	 * @param manager
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1410
	 *            Menu manager
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1411
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1412
	private void fillLocalToolBar(IToolBarManager manager) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1413
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1414
		logTargetMenu = new DropDownMenu(Constants.ACTION_SAVE, this, false,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1415
				false);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1416
		makeLogTargetActions();
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
  1417
		logTargetMenu.addAction(externalFastLogTargetAction);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1418
		logTargetMenu.addAction(s60LogTargetAction);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1419
		logTargetMenu.addAction(askLogTargetAction);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1420
		manager.add(logTargetMenu);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1421
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1422
		manager.add(buildWithAtool);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1423
		manager.add(new Separator());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1424
		manager.add(traceAction);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1425
		manager.add(startSubtest);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1426
		manager.add(stopSubtest);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1427
		manager.add(new Separator());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1428
		manager.add(changeDetails);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1429
		manager.add(new Separator());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1430
		fileOpenMenu = new DropDownMenu(Constants.ACTION_OPEN, this, false,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1431
				true);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1432
		makeFileOpenActions();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1433
		manager.add(fileOpenMenu);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1434
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1435
		// get drop down menu for save action
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1436
		saveFileMenu = new DropDownMenu(Constants.ACTION_SAVE, this, true,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1437
				false);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1438
		saveFileMenu.setImageDescriptor(Activator
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1439
				.getImageDescriptor(Constants.BUTTON_SAVE));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1440
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1441
		saveFileMenu.addAction(saveReportAction);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1442
		saveFileMenu.addAction(saveDataFileAction);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1443
		manager.add(saveFileMenu);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1444
		manager.add(new Separator());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1445
		manager.add(cleanAtoolChanges);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1446
		manager.add(new Separator());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1447
		manager.add(openPrefs);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1448
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1449
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1450
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1451
	 * Gets call stack information of current leak.
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1452
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1453
	 * @param treeObject
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1454
	 *            Tree object
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1455
	 * @return Object
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1456
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1457
	Object getCallStack(final TreeObject treeObject) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1458
		IPreferenceStore store = Activator.getPreferences();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1459
		// if project is not selected or treeobject is not created
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1460
		// => leave
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1461
		if (project == null || treeObject == null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1462
			return null;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1463
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1464
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1465
		// set active tree item
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1466
		activeTreeItem = treeObject;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1467
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1468
		AnalysisItem item = null;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1469
		if (treeObject.isSubTest()) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1470
			item = projectResults.getSubtestItem(project,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1471
					treeObject.getRunID(), treeObject.getMemLeakID(),
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1472
					treeObject.getSubtestID());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1473
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1474
		// get AnalysisItem
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1475
		else {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1476
			item = projectResults.getSpecific(project, treeObject.getRunID(),
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1477
					treeObject.getMemLeakID());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1478
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1479
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1480
		if (item == null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1481
			return null;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1482
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1483
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1484
		if (store == null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1485
			return null;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1486
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1487
		AbstractList<MMPInfo> modules = projectModules.get(project);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1488
		TreeHelper helper = new TreeHelper(null, store);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1489
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1490
		TreeParent parent = helper.getCallstack(item, modules);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1491
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1492
		return parent;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1493
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1494
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1495
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1496
	 * Gets callstack item name.
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1497
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1498
	 * @param callstackItem
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1499
	 *            One callstack item
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1500
	 * @return Callstack name if found otherwise null
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1501
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1502
	public final String getCallstackItemName(final CallstackItem callstackItem) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1503
		// if call stack item not set => return
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1504
		if (callstackItem == null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1505
			return null;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1506
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1507
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1508
		String cppFileName = "";
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1509
		String fileName = callstackItem.getFileName().toLowerCase(Locale.US);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1510
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1511
		if (fileName.indexOf(".cpp") == -1) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1512
			return null;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1513
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1514
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1515
		// check that project contains cpp file which is parsed from call stack
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1516
		// list
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1517
		Iterator<String> iterCppFiles = cppFileNames.iterator();
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1518
		while (iterCppFiles.hasNext()) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1519
			String cppFileLocation = iterCppFiles.next();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1520
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1521
			// parse file name from the source path
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1522
			int slash = Util.getLastSlashIndex(cppFileLocation);
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1523
			if (slash != -1) {
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1524
				String cppFile = cppFileLocation.substring(slash + 1,
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1525
						cppFileLocation.length());
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1526
				if (cppFile.equalsIgnoreCase(fileName)) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1527
					cppFileName = cppFileLocation;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1528
					break;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1529
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1530
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1531
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1532
		return cppFileName;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1533
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1534
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1535
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1536
	 * Gets file info for current project.
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1537
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1538
	 * @param projectRef
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1539
	 *            Project reference
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1540
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1541
	private void getFileInfos(final IProject projectRef) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1542
		ResourceVisitor visitor = new ResourceVisitor(this);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1543
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1544
		// go thru all open projects
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1545
		// this enables to display one memory address corresponding source code
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1546
		// line
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1547
		// for outside of active project
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1548
		try {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1549
			if (projectRef == null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1550
				IWorkspaceRoot myWorkspaceRoot = ResourcesPlugin.getWorkspace()
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1551
						.getRoot();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1552
				IProject[] projects = myWorkspaceRoot.getProjects();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1553
				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
  1554
					IProject tempProject = projects[i];
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1555
					if (tempProject.isOpen()) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1556
						tempProject.accept(visitor);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1557
					}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1558
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1559
			} else { // project is selected
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1560
				// if project is open => accept resource visitor
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1561
				if (projectRef.isOpen()) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1562
					projectRef.accept(visitor);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1563
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1564
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1565
		} catch (CoreException e) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1566
			e.printStackTrace();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1567
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1568
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1569
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1570
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1571
	 * Gets project results.
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1572
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1573
	 * @param projectRef
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1574
	 *            Project reference
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1575
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1576
	public void getProjectResults(final IProject projectRef) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1577
		// if project reference is null => leave
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1578
		if (projectRef == null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1579
			return;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1580
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1581
		// if project is selected and it is open
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1582
		else if (projectRef.isOpen()) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1583
			// if this is the first time to get project results
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1584
			if (lastProjectRef == null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1585
				lastProjectRef = projectRef;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1586
				updateBuildState(lastProjectRef);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1587
				updateChangeDetailState(lastProjectRef);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1588
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1589
			// project selection changed
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1590
			// need to get selected project results and mmp file info
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1591
			else if (!lastProjectRef.equals(projectRef)) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1592
				activeTreeItem = null;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1593
				lastProjectRef = projectRef;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1594
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1595
				runView.setInput(getResults(false));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1596
				callstackView.setInput(getCallStack(null));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1597
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1598
				updateInformationLabel("");
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1599
				updateBuildState(lastProjectRef);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1600
				updateChangeDetailState(lastProjectRef);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1601
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1602
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1603
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1604
		// update clear project results action state
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1605
		if (projectResults.contains(projectRef)) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1606
			clearProjectResults.setEnabled(true);
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1607
		} else {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1608
			clearProjectResults.setEnabled(false);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1609
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1610
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1611
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1612
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1613
	 * Gets memory leak analysis results.
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1614
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1615
	 * @param showErrorInfo
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1616
	 *            Display error info or not
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1617
	 * @return Object memory leak analysis results
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1618
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1619
	private Object getResults(final boolean showErrorInfo) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1620
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1621
		try {
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
  1622
			// create a new tree parent
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1623
			TreeParent testRuns = new TreeParent(Constants.TEST_RUNS_TREE_TITLE);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1624
			invisibleRoot = null;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1625
			invisibleRoot = new TreeParent(Constants.TREE_TITLE);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1626
			invisibleRoot.addChild(testRuns);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1627
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1628
			// if current project does not contain results => just update
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1629
			// default view values
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1630
			if (!projectResults.contains(project)) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1631
				changeViewTitle(viewTitle);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1632
				updateInformationLabel(Constants.INFO_NO_DATA);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1633
				return getStartupContent();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1634
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1635
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1636
			if (!projectModules.containsKey(project)) {
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1637
				AbstractList<MMPInfo> modules = Util
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1638
						.loadProjectTargetsInfo(project);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1639
				projectModules.put(project, modules);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1640
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1641
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1642
			// get run results
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1643
			AbstractList<RunResults> runs = projectResults.getResults(project);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1644
			AbstractList<MMPInfo> modules = projectModules.get(project);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1645
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1646
			// if no results available => show default view content
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1647
			if (runs == null || runs.isEmpty()) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1648
				changeViewTitle(viewTitle);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1649
				updateInformationLabel(Constants.INFO_NO_DATA);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1650
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1651
				// because no results created => delete project empty results
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1652
				projectResults.clearProjectData(project);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1653
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1654
				fileOpenHistory.removeFileName(projectResults
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1655
						.getDataFileName(project));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1656
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1657
				// display info to user
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1658
				if (showErrorInfo) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1659
					showErrorMessage(Constants.INFO_FILE_INVALID);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1660
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1661
				return getStartupContent();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1662
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1663
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1664
			IPreferenceStore store = Activator.getPreferences();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1665
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1666
			// create TreeHelper object
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1667
			// TreeHelper class creates tree model to this view.
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1668
			TreeHelper helper = new TreeHelper(lastSelectedObject, store);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1669
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1670
			// clear active item
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1671
			activeTreeItem = null;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1672
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1673
			// update used data file name
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1674
			usedDataFileName = projectResults.getDataFileName(project);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1675
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1676
			// change view title
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1677
			changeViewTitle(viewTitle + " results from file: "
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1678
					+ usedDataFileName);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1679
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1680
			// thru runs
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1681
			Iterator<RunResults> runIterator = runs.iterator();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1682
			while (runIterator.hasNext()) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1683
				// get one run info
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1684
				RunResults oneRunResults = runIterator.next();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1685
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1686
				// creates one run information at the time
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1687
				TreeParent oneRunTree = helper.createRunResults(oneRunResults,
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1688
						modules);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1689
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1690
				// get active item
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1691
				// active must ask from the TreeHelper class
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1692
				// because it can be filtered out when creating new tree model
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1693
				activeTreeItem = helper.getActiveItem();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1694
				testRuns.addChild(oneRunTree);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1695
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1696
		} catch (java.lang.NullPointerException npe) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1697
			npe.printStackTrace();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1698
			return null;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1699
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1700
		// expand to runs level
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1701
		runView.setAutoExpandLevel(2);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1702
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1703
		return invisibleRoot;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1704
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1705
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1706
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1707
	 * Sets startup contents for view.
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1708
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1709
	 * @return Object which can be displayd
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1710
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1711
	public TreeParent getStartupContent() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1712
		// create default treeviewer content
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1713
		invisibleRoot = new TreeParent(Constants.ANALYZE_TOOL_TITLE);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1714
		TreeParent child = new TreeParent(Constants.INFO_NO_DATA_FILE_AVAILABLE);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1715
		invisibleRoot.addChild(child);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1716
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1717
		return invisibleRoot;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1718
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1719
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1720
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1721
	 * Adds selection changed listener to view.
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1722
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1723
	private void hookClicks() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1724
		runView.addSelectionChangedListener(this);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1725
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1726
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1727
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1728
	 * Hooks context menu.
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1729
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1730
	private void hookContextMenu() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1731
		MenuManager menuMgr = new MenuManager("#PopupMenu");
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1732
		menuMgr.setRemoveAllWhenShown(true);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1733
		menuMgr.addMenuListener(new IMenuListener() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1734
			@SuppressWarnings("synthetic-access")
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1735
			public void menuAboutToShow(IMenuManager manager) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1736
				MainView.this.fillContextMenu(manager);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1737
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1738
		});
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1739
		Menu menu = menuMgr.createContextMenu(runView.getControl());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1740
		runView.getControl().setMenu(menu);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1741
		if (getSite() != null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1742
			getSite().registerContextMenu(menuMgr, runView);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1743
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1744
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1745
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1746
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1747
	 * Hook double click actions.
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1748
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1749
	private void hookDoubleClickAction() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1750
		callstackView.addDoubleClickListener(new IDoubleClickListener() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1751
			public void doubleClick(DoubleClickEvent event) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1752
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1753
				doubleClickAction.run();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1754
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1755
		});
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1756
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1757
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1758
	/**
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1759
	 * Check that if subtest by given name already exists.
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1760
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1761
	 * @param subTestName
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1762
	 *            Subtest name
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1763
	 * @param target
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1764
	 *            Testing target
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1765
	 * @return True if already exists otherwise False
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1766
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1767
	public final boolean isSubtestExists(final String subTestName,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1768
			final String target) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1769
		Iterator<ActiveSubtests> subTestIter = startedSubtest.iterator();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1770
		while (subTestIter.hasNext()) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1771
			ActiveSubtests oneSubtest = subTestIter.next();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1772
			if (oneSubtest.getName().equals(subTestName)
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1773
					&& oneSubtest.getTargetName().equals(target)) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1774
				return true;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1775
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1776
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1777
		return false;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1778
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1779
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1780
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1781
	 * Go thru the project files and stores mmp files.
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1782
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1783
	 * @param resource
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1784
	 *            One resource file of project
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1785
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1786
	public final void loadFileInfo(IResource resource) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1787
		// get all the cpp file info which are imported to workspace
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1788
		// this enable pinpointing the code line for outside active project cpp
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1789
		// file than
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1790
		// the memory analysis is made
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1791
		// get cpp file info
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1792
		String cppFileName = Util.getCPPFileNameAndPath(resource);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1793
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1794
		// if cpp file found, save it
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1795
		if (cppFileName != null && !cppFileNames.contains(cppFileName)) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1796
			this.cppFileNames.add(cppFileName);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1797
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1798
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1799
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1800
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1801
	 * Construct all the actions.
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1802
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1803
	private void makeActions() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1804
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1805
		// listens click actions
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1806
		clickAction = new Action() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1807
			@Override
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1808
			public void run() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1809
				// get selection
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1810
				ISelection selection = runView.getSelection();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1811
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1812
				// get selection object
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1813
				Object obj = ((IStructuredSelection) selection)
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1814
						.getFirstElement();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1815
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1816
				// if object exists
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1817
				if (obj == null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1818
					copyAction.setEnabled(false);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1819
					return;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1820
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1821
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1822
				// get call stack addresses to view
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1823
				if (obj instanceof TreeObject) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1824
					lastSelectedObject = obj;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1825
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1826
					// get callstack items
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1827
					Object resultObject = getCallStack((TreeObject) obj);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1828
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1829
					// if results not found
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1830
					if (resultObject == null) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1831
						copyAction.setEnabled(false);
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1832
					} else {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1833
						callstackView.setInput(resultObject);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1834
						copyAction.setEnabled(true);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1835
					}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1836
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1837
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1838
				// expand all the trees on call stack view
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1839
				callstackView.expandAll();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1840
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1841
				setTextToInformationLabel();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1842
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1843
		};
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1844
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1845
		// listens double click actions
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1846
		doubleClickAction = new Action() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1847
			@Override
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1848
			public void run() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1849
				// get selection
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1850
				ISelection selection = callstackView.getSelection();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1851
				Object obj = ((IStructuredSelection) selection)
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1852
						.getFirstElement();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1853
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1854
				// open file in editor
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1855
				if (obj instanceof TreeObject) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1856
					openEditor((TreeObject) obj);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1857
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1858
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1859
		};
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1860
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1861
		// data capture
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1862
		traceAction = new Action() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1863
			@Override
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1864
			public void run() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1865
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1866
				// if trace is active => stop the trace
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1867
				if (traceActive) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1868
					stop(true);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1869
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1870
				// if trace is not active => start the trace
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1871
				else {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1872
					start();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1873
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1874
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1875
		};
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1876
		traceAction.setText(Constants.ACTION_START_TRACE);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1877
		traceAction.setToolTipText(Constants.ACTION_START_TRACE);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1878
		traceAction.setImageDescriptor(Activator
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1879
				.getImageDescriptor((Constants.BUTTON_RUN)));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1880
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1881
		// if trace actions are disabled
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1882
		if (!enableTrace) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1883
			traceAction.setEnabled(false);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1884
			traceAction.setToolTipText(Constants.TRACE_NOT_FOUND);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1885
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1886
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1887
		// build with atool
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1888
		buildWithAtool = new Action() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1889
			@Override
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1890
			public void run() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1891
				activateAnalysisBuild();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1892
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1893
		};
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1894
		buildWithAtool.setText(Constants.ACTION_AT_BUILD_ACTIVE);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1895
		buildWithAtool.setToolTipText(Constants.ACTION_AT_BUILD_ACTIVE);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1896
		buildWithAtool.setImageDescriptor(Activator
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1897
				.getImageDescriptor(Constants.BUTTON_BUILD));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1898
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1899
		// clean atool changes
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1900
		cleanAtoolChanges = new Action() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1901
			@Override
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1902
			public void run() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1903
				clean();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1904
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1905
		};
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1906
		cleanAtoolChanges.setText(Constants.ACTION_CLEAR_CHANGES);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1907
		cleanAtoolChanges
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1908
				.setToolTipText(Constants.ACTION_CLEAR_CHANGES_TOOLTIP);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1909
		cleanAtoolChanges.setImageDescriptor(Activator
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1910
				.getImageDescriptor(Constants.BUTTON_CLEAN));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1911
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1912
		// change detail level
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1913
		changeDetails = new Action() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1914
			@Override
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1915
			public void run() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1916
				changeDetailLevel();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1917
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1918
		};
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1919
		changeDetails.setText(Constants.ACTION_CHANGE_REPORT_LEVEL);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1920
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1921
		// save report( xml ) file
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1922
		saveReportAction = new Action() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1923
			@Override
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1924
			public void run() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1925
				saveReportFile(Constants.SAVE_REPORT_FILE_XML);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1926
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1927
		};
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1928
		saveReportAction.setText(Constants.ACTION_SAVE_REPORT);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1929
		saveReportAction.setToolTipText(Constants.ACTION_SAVE_REPORT);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1930
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1931
		// save data file
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1932
		saveDataFileAction = new Action() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1933
			@Override
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1934
			public void run() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1935
				saveReportFile(Constants.SAVE_REPORT_FILE_DATA);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1936
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1937
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1938
		};
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1939
		saveDataFileAction.setText(Constants.ACTION_SAVE_DATA);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1940
		saveDataFileAction.setToolTipText(Constants.ACTION_SAVE_DATA);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1941
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1942
		// start subtest
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1943
		startSubtest = new Action() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1944
			@Override
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1945
			public void run() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1946
				startSubTest();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1947
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1948
		};
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1949
		startSubtest.setText(Constants.ACTION_START_SUBTEST);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1950
		startSubtest.setToolTipText(Constants.ACTION_START_SUBTEST);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1951
		startSubtest.setImageDescriptor(Activator
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1952
				.getImageDescriptor(Constants.BUTTON_START_SUBTEST));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1953
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1954
		// stop subtest
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1955
		stopSubtest = new Action() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1956
			@Override
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1957
			public void run() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1958
				stopSubTest();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1959
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1960
		};
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1961
		stopSubtest.setText(Constants.ACTION_STOP_SUBTEST);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1962
		stopSubtest.setToolTipText(Constants.ACTION_STOP_SUBTEST);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1963
		stopSubtest.setImageDescriptor(Activator
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1964
				.getImageDescriptor(Constants.BUTTON_STOP_SUBTEST));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1965
		stopSubtest.setDescription(Constants.ACTION_STOP_SUBTEST);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1966
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1967
		// set start and stop subtest not visible at the beginning
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1968
		startSubtest.setEnabled(false);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1969
		stopSubtest.setEnabled(false);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1970
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1971
		analyzeResults = new Action() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1972
			@Override
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1973
			public void run() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1974
				analyzeDataFile(Constants.ANALYZE_ASK_FOR_USER, null, true);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1975
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1976
		};
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1977
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1978
		analyzeResults.setText(Constants.ACTION_OPEN);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1979
		analyzeResults.setToolTipText(Constants.ACTION_OPEN);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1980
		analyzeResults.setImageDescriptor(Activator
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1981
				.getImageDescriptor(Constants.BUTTON_OPEN));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1982
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1983
		clearProjectResults = new Action() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1984
			@Override
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1985
			public void run() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1986
				cleanAnalyzeData(project);
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1987
				if (statisticView != null) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1988
					statisticView.clean(project);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1989
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1990
				updateChangeDetailState(project);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1991
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1992
		};
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1993
		clearProjectResults.setText(Constants.ACTION_CLEAR_RESULTS);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1994
		clearProjectResults.setToolTipText(Constants.ACTION_CLEAR_RESULTS);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1995
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1996
		refreshResults = new Action() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1997
			@Override
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  1998
			public void run() {
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  1999
				if (project != null && project.isOpen()
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2000
						&& projectResults != null) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2001
					String dataFile = projectResults.getDataFileName(project);
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2002
					if (dataFile != null || !("").equals(dataFile)) {
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2003
						analyzeDataFile(Constants.ANALYZE_USE_DATA_FILE,
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2004
								dataFile, true);
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2005
					} else {
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2006
						// some internal error occurred => disable this action
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2007
						refreshResults.setEnabled(false);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2008
					}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2009
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2010
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2011
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2012
		};
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2013
		refreshResults.setText(Constants.ACTION_RE_ANALYZE);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2014
		refreshResults.setToolTipText(Constants.ACTION_RE_ANALYZE_TOOLTIP);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2015
		refreshResults.setEnabled(false);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2016
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2017
		// copy active item contents to clipboard
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2018
		copyAction = new Action() {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2019
			@Override
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2020
			public void run() {
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2021
				// copy active item contents to clipboard
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2022
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2023
				// Create new clipboard object
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2024
				Clipboard cp = new Clipboard(runView.getControl().getDisplay());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2025
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2026
				// Create new TextTransfer object
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2027
				// TextTransfer converts plain text represented as a java String
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2028
				// to a platform specific representation of the data and vice
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2029
				// versa
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2030
				TextTransfer tt = TextTransfer.getInstance();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2031
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2032
				// new StringBuffer which contains the copied text
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2033
				StringBuffer sb = new StringBuffer(64);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2034
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2035
				// chech that project contains results
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2036
				if (projectResults == null || !projectResults.contains(project)
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2037
						|| activeTreeItem == null) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2038
					return;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2039
				}
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2040
				// get active item info (also callstack info)
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2041
				AnalysisItem item = null;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2042
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2043
				// if selected item is subtest
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2044
				if (activeTreeItem.isSubTest()) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2045
					item = projectResults.getSubtestItem(project,
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2046
							activeTreeItem.getRunID(), activeTreeItem
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2047
									.getMemLeakID(), activeTreeItem
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2048
									.getSubtestID());
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2049
				} else {
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2050
					item = projectResults.getSpecific(project, activeTreeItem
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2051
							.getRunID(), activeTreeItem.getMemLeakID());
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2052
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2053
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2054
				// check that item found
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2055
				if (item == null) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2056
					return;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2057
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2058
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2059
				sb.append(activeTreeItem.getName());
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2060
				String separator = System.getProperty("line.separator");
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2061
				sb.append(separator);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2062
				char space = ' ';
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2063
				AbstractList<CallstackItem> callstackItems = item
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2064
						.getCallstackItems();
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2065
				Iterator<CallstackItem> iterCallstack = callstackItems
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2066
						.iterator();
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2067
				while (iterCallstack.hasNext()) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2068
					CallstackItem oneItem = iterCallstack.next();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2069
					sb.append("      ");
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2070
					sb.append(oneItem.getMemoryAddress());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2071
					sb.append(space);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2072
					sb.append(oneItem.getModuleName());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2073
					sb.append(space);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2074
					sb.append(oneItem.getFunctionName());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2075
					sb.append(space);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2076
					sb.append(oneItem.getFileName());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2077
					sb.append(space);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2078
					int lineNbr = oneItem.getLeakLineNumber();
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2079
					if (lineNbr > 0) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2080
						sb.append(lineNbr);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2081
					}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2082
					sb.append(separator);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2083
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2084
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2085
				// info is ready => now copy info to clipboard
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2086
				cp.setContents(new Object[] { sb.toString() },
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2087
						new Transfer[] { tt });
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2088
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2089
		};
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2090
		copyAction.setText(Constants.ACTION_COPY);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2091
		copyAction.setEnabled(false);
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2092
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2093
		// open preferences action
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2094
		openPrefs = new Action() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2095
			@Override
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2096
			public void run() {
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2097
				PreferenceDialog dialog = PreferencesUtil
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2098
						.createPreferenceDialogOn(PlatformUI.getWorkbench()
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2099
								.getActiveWorkbenchWindow().getShell(),
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2100
								Constants.ANALYZE_TOOL_PREFS_ID, null, null);
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2101
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2102
				if (dialog != null) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2103
					dialog.open();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2104
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2105
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2106
		};
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2107
		openPrefs.setText(Constants.ACTION_OPEN_PREFS);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2108
		openPrefs.setToolTipText(Constants.ACTION_OPEN_PREFS_TOOLTIP);
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2109
		openPrefs.setImageDescriptor(Activator
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2110
				.getImageDescriptor(Constants.BUTTON_OPEN_PREFS));
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2111
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2112
		changeReportActionTooltip();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2113
		updateChangeDetailState(project);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2114
		updateBuildState(project);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2115
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2116
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2117
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2118
	 * Creates file open actions.
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2119
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2120
	private void makeFileOpenActions() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2121
		fileOpenMenu.setText(Constants.ACTION_OPEN);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2122
		fileOpenMenu.setToolTipText(Constants.ACTION_OPEN);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2123
		fileOpenMenu.setImageDescriptor(Activator
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2124
				.getImageDescriptor(Constants.BUTTON_OPEN));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2125
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2126
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2127
	/**
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2128
	 * Creates data gathering actions.
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2129
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2130
	private void makeLogTargetActions() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2131
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2132
		s60LogTargetAction = new Action(Constants.LOGGING_S60,
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2133
				IAction.AS_RADIO_BUTTON) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2134
			@Override
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2135
			public void run() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2136
				changeLogTarget(Constants.LOGGING_S60);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2137
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2138
		};
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2139
		s60LogTargetAction.setText(Constants.PREFS_S60);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2140
		s60LogTargetAction
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2141
				.setToolTipText(Constants.ACTION_CHANGE_LOGGING_MODE_TOOLTIP_S60);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2142
		s60LogTargetAction.setImageDescriptor(Activator
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2143
				.getImageDescriptor(Constants.BUTTON_CELLURAR));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2144
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2145
		externalFastLogTargetAction = new Action(Constants.LOGGING_EXT_FAST,
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2146
				IAction.AS_RADIO_BUTTON) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2147
			@Override
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2148
			public void run() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2149
				changeLogTarget(Constants.LOGGING_EXT_FAST);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2150
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2151
		};
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2152
		externalFastLogTargetAction.setText(Constants.PREFS_EXT_FAST);
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2153
		externalFastLogTargetAction
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2154
				.setToolTipText(Constants.PREFS_EXT_FAST_TOOLTIP);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2155
		externalFastLogTargetAction.setImageDescriptor(Activator
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2156
				.getImageDescriptor(Constants.BUTTON_COMPUTER_FAST));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2157
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2158
		askLogTargetAction = new Action(Constants.LOGGING_ASK_ALLWAYS,
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2159
				IAction.AS_RADIO_BUTTON) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2160
			@Override
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2161
			public void run() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2162
				changeLogTarget(Constants.LOGGING_ASK_ALLWAYS);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2163
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2164
		};
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2165
		askLogTargetAction.setText(Constants.PREFS_ASK_ALWAYS);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2166
		askLogTargetAction
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2167
				.setToolTipText(Constants.ACTION_CHANGE_LOGGING_MODE_TOOLTIP_ASK);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2168
		askLogTargetAction.setImageDescriptor(Activator
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2169
				.getImageDescriptor(Constants.BUTTON_ASK));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2170
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2171
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2172
	/**
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2173
	 * Displays selected callstack item location on default file editor.
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2174
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2175
	 * @param treeObject
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2176
	 *            Tree object
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2177
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2178
	public final void openEditor(final TreeObject treeObject) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2179
		// get file info for all projects
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2180
		getFileInfos(project);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2181
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2182
		try {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2183
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2184
			// if no project selected
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2185
			if (project == null || !project.isOpen()) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2186
				Util.showMessage(Constants.NO_PROJ_SELECT);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2187
				return;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2188
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2189
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2190
			// get selected call stack item
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2191
			CallstackItem callstackItem = treeObject.getCallstackItem();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2192
			if (callstackItem == null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2193
				return;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2194
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2195
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2196
			String cppFileName = getCallstackItemName(callstackItem);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2197
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2198
			if (cppFileName == null || ("").equals(cppFileName)) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2199
				cppFileName = callstackItem.getFileName();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2200
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2201
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2202
			// if leak number is invalid => leave
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2203
			if (callstackItem.getLeakLineNumber() < 1) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2204
				return;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2205
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2206
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2207
			String line = Integer.toString(callstackItem.getLeakLineNumber());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2208
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2209
			IFile file = null;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2210
			if (project.isOpen()) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2211
				file = ResourcesPlugin.getWorkspace().getRoot().getFile(
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2212
						new Path(project.getName() + "\\" + cppFileName));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2213
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2214
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2215
			// if file not found in active project
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2216
			// go thru all open projects in current workbench
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2217
			if (file == null || !file.exists()) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2218
				IWorkspaceRoot myWorkspaceRoot = ResourcesPlugin.getWorkspace()
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2219
						.getRoot();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2220
				IProject[] projects = myWorkspaceRoot.getProjects();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2221
				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
  2222
					file = ResourcesPlugin.getWorkspace().getRoot()
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2223
							.getFile(
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2224
									new Path(projects[i].getName() + "\\"
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2225
											+ cppFileName));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2226
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2227
					// 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
  2228
					if (file != null && file.exists()) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2229
						break;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2230
					}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2231
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2232
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2233
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2234
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2235
			// if file still not found
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2236
			// display info to user and leave
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2237
			if (file == null || !file.exists()) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2238
				Util.showMessage(Constants.SOURCE_NOT_FOUND);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2239
				return;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2240
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2241
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2242
			IWorkbenchPage page = PlatformUI.getWorkbench()
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2243
					.getActiveWorkbenchWindow().getActivePage();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2244
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2245
			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
  2246
			map.put(IMarker.LINE_NUMBER, Integer.parseInt(line));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2247
			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
  2248
			IMarker marker = file.createMarker(IMarker.TEXT);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2249
			marker.setAttributes(map);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2250
			IDE.openEditor(page, marker);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2251
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2252
		} catch (NullPointerException npe) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2253
			npe.printStackTrace();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2254
		} catch (CoreException ce) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2255
			ce.printStackTrace();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2256
		} catch (Exception e) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2257
			e.printStackTrace();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2258
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2259
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2260
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2261
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2262
	 * Updates log target action and report action tooltips.
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2263
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2264
	 * @see com.nokia.s60tools.analyzetool.ui.IActionListener#preferenceChanged()
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2265
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2266
	public void preferenceChanged() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2267
		// get active logging mode
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2268
		changeLogTarget(null);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2269
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2270
		changeReportActionTooltip();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2271
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2272
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2273
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2274
	 * Refresh AnalyzeTool view.
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2275
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2276
	public final void refreshView() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2277
		// update display content
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2278
		runView.getControl().getDisplay().syncExec(new Runnable() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2279
			public void run() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2280
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2281
				updateInformationLabel("");
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2282
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2283
				// refresh view
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2284
				runView.setInput(getResults(false));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2285
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2286
				// refresh callstack view
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2287
				getCallStack(activeTreeItem);
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2288
				if (project != null && project.isOpen()
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2289
						&& projectResults.contains(project)) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2290
					clearProjectResults.setEnabled(true);
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2291
				} else {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2292
					clearProjectResults.setEnabled(false);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2293
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2294
				updateChangeDetailState(project);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2295
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2296
		});
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2297
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2298
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2299
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2300
	 * Runs user selected AnalyzeTool action.
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2301
	 * 
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2302
	 * @see com.nokia.s60tools.analyzetool.ui.IActionListener#runAction(IProject,
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2303
	 *      com.nokia.s60tools.analyzetool.global.Constants.ACTIONS)
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2304
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2305
	 * @param projectRef
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2306
	 *            Project reference
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2307
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2308
	 * @param action
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2309
	 *            Which action to execute
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2310
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2311
	public void runAction(IProject projectRef, Constants.ACTIONS action) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2312
		project = projectRef;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2313
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2314
		switch (action) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2315
		case RUN_VIEW_MEM_LEAKS:
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2316
			analyzeResults.run();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2317
			break;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2318
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2319
		case RUN_BUILD:
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2320
			buildWithAtool.run();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2321
			break;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2322
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2323
		case RUN_CLEAN:
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2324
			cleanAtoolChanges.run();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2325
			break;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2326
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2327
		default: // by design default statement is empty
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2328
			break;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2329
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2330
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2331
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2332
	/**
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2333
	 * Copies existing report or data file to the new location. Asks from user
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2334
	 * new location where to copy the file.
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2335
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2336
	 * @param type
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
  2337
	 *            Which kind of type the file is. Possible types XML or data
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2338
	 *            file
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2339
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2340
	 * @return True if saving successfully otherwise false
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2341
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2342
	public final boolean saveReportFile(final int type) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2343
		// copy success?
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2344
		boolean success = false;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2345
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2346
		// check if project is selected
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2347
		if (project == null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2348
			showMessage(Constants.NO_PROJ_SELECT);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2349
			return success;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2350
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2351
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2352
		// folder location
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2353
		String folder = null;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2354
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2355
		// file path and name to use
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2356
		String usedFile = null;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2357
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2358
		// save xml file
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2359
		if (type == Constants.SAVE_REPORT_FILE_XML) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2360
			String targetPath = Util.getBldInfFolder(project, true)
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2361
					+ Constants.FILENAME_CARBIDE;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2362
			java.io.File file = new java.io.File(targetPath);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2363
			if (file.exists()) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2364
				String[] names = new String[2];
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2365
				names[0] = "*.xml";
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2366
				names[1] = "*.*";
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2367
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2368
				Shell shell = null;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2369
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2370
				// get shell from teh active view
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2371
				if (runView != null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2372
					shell = runView.getControl().getShell();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2373
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2374
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2375
				// if for some reason shell is null => leave
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2376
				if (shell == null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2377
					return success;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2378
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2379
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2380
				// ask user where to save xml report file
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2381
				folder = Util.fileSaveDialog(Constants.DIALOG_SAVE_REPORT,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2382
						names, shell);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2383
				usedFile = targetPath;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2384
			} else {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2385
				Util.showMessage(Constants.INFO_NO_RESULTS_FILE);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2386
				return success;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2387
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2388
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2389
		// save data file
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2390
		else {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2391
			String dataFile = Util.isDataFileAvailable(project);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2392
			// check is there data file which can be used
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2393
			if ((dataFile == null || dataFile.equals(""))
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2394
					&& (usedDataFileName == null || usedDataFileName.equals(""))) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2395
				Util.showMessage(Constants.INFO_NO_DATA_FILE);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2396
				return success;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2397
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2398
			// if no existing data file opened
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2399
			else if (usedDataFileName == null || usedDataFileName.equals("")) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2400
				usedFile = dataFile;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2401
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2402
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2403
			// user is already opened data file => save it
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2404
			else {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2405
				usedFile = usedDataFileName;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2406
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2407
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2408
			String[] names = new String[2];
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2409
			names[0] = "*.dat";
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2410
			names[1] = "*.*";
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2411
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2412
			Shell shell = null;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2413
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
  2414
			// get shell from the active view
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2415
			if (runView != null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2416
				shell = runView.getControl().getShell();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2417
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2418
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2419
			// if for some reason shell is null => leave
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2420
			if (shell == null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2421
				return success;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2422
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2423
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
  2424
			// ask user where to save XML report file
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2425
			folder = Util.fileSaveDialog(Constants.DIALOG_SAVE_TRACE, names,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2426
					shell);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2427
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2428
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2429
		// no folder selected
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2430
		// user press "cancel" button;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2431
		if (folder == null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2432
			return success;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2433
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2434
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2435
		// copy file to folder
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2436
		success = Util.copyFileToFolder(usedFile, folder);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2437
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2438
		// report to user
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2439
		if (success) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2440
			Util.showMessage(Constants.INFO_SAVE_SUCCESS + folder);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2441
		} else {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2442
			Util.showMessage(Constants.MAIN_CAN_NOT_COPY + usedFile);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2443
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2444
		return success;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2445
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2446
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2447
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2448
	 * Notifies this action delegate that the selection in the workbench has
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2449
	 * changed.
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2450
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2451
	 * @param part
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2452
	 *            Workbench part
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2453
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2454
	 * @param selection
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2455
	 *            User selection
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2456
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2457
	@SuppressWarnings("restriction")
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2458
	public void selectionChanged(IWorkbenchPart part, ISelection selection) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2459
		// project reference
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2460
		IProject selectedProject = null;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2461
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2462
		// Check where the selection comes from
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2463
		// Supported views: CommonNavigator, SymbianProjectNavigatorView and
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2464
		// ResourceNavigator
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2465
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2466
		if (!(part instanceof CommonNavigator
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2467
				|| part instanceof SymbianProjectNavigatorView || part instanceof ResourceNavigator)) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2468
			return;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2469
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2470
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2471
		// get selection
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2472
		IStructuredSelection structuredSelection = (IStructuredSelection) selection;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2473
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2474
		// get first element of selection
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2475
		Object element = structuredSelection.getFirstElement();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2476
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2477
		// check selection
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2478
		if (element instanceof IAdaptable) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2479
			IAdaptable adaptable = (IAdaptable) element;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2480
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2481
			IResource resource = null;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2482
			if (adaptable instanceof IResource) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2483
				resource = (IResource) adaptable;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2484
			} else if (adaptable instanceof org.eclipse.cdt.internal.ui.cview.IncludeRefContainer) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2485
				selectedProject = ((org.eclipse.cdt.internal.ui.cview.IncludeRefContainer) adaptable)
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2486
						.getCProject().getProject();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2487
			} else if (adaptable instanceof org.eclipse.cdt.core.model.ICProject) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2488
				selectedProject = ((org.eclipse.cdt.core.model.ICProject) adaptable)
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2489
						.getProject();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2490
			} else {
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2491
				resource = (IResource) adaptable.getAdapter(IResource.class);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2492
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2493
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2494
			// resource found => get resource project
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2495
			if (resource != null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2496
				selectedProject = resource.getProject();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2497
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2498
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2499
		// first item is null => update build state
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2500
		else if (element == null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2501
			updateBuildState(null);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2502
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2503
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2504
		// if project found and it is open => get project results
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2505
		if (selectedProject != null && selectedProject.isOpen()) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2506
			project = selectedProject;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2507
			getProjectResults(selectedProject);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2508
			updateBuildState(project);
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2509
			if (statisticView != null) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2510
				statisticView.handleProjectChange(project);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2511
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2512
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2513
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2514
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2515
	/**
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2516
	 * Executes clickAction when user selects item in the AnalyzeTool view.
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2517
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2518
	 * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2519
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2520
	 * @param event
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2521
	 *            Selection changed event
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2522
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2523
	public void selectionChanged(SelectionChangedEvent event) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2524
		clickAction.run();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2525
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2526
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2527
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2528
	 * Passing the focus request to the viewer's control.
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2529
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2530
	@Override
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2531
	public void setFocus() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2532
		runView.getControl().setFocus();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2533
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2534
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2535
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2536
	 * Sets text to information label.
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2537
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2538
	public final void setTextToInformationLabel() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2539
		if (activeTreeItem == null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2540
			return;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2541
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2542
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2543
		// run information
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2544
		RunResults oneRunResults = projectResults.getRun(project,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2545
				activeTreeItem.getRunID());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2546
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2547
		// no results found => update label
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2548
		if (oneRunResults == null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2549
			updateInformationLabel("");
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2550
		} else {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2551
			StringBuffer buffer = new StringBuffer(32);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2552
			buffer.append("Run: ");
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2553
			buffer.append(oneRunResults.getItemID());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2554
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2555
			buffer.append(" Memory leaks: ");
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2556
			buffer.append(oneRunResults.getAnalysisItems().size());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2557
			buffer.append(" Handle leaks: ");
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2558
			buffer.append(oneRunResults.getHandleLeaks().size());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2559
			if (("").equals(oneRunResults.getEndTime())) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2560
				buffer.append("\nStart time: " + oneRunResults.getStartTime()
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2561
						+ " \nEnd time: FAILED");
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2562
			} else {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2563
				buffer.append("\nStart time: " + oneRunResults.getStartTime()
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2564
						+ " \nEnd time: " + oneRunResults.getEndTime());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2565
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2566
			updateInformationLabel(buffer.toString());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2567
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2568
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2569
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2570
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2571
	 * Shows error message.
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2572
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2573
	 * @param message
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2574
	 *            Error message to show
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2575
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2576
	public final void showErrorMessage(final String message) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2577
		runView.getControl().getDisplay().syncExec(new Runnable() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2578
			public void run() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2579
				Util.showErrorMessage(message);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2580
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2581
		});
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2582
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2583
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2584
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2585
	 * Shows message.
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2586
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2587
	 * @param message
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2588
	 *            Message to show
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2589
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2590
	public final void showMessage(final String message) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2591
		runView.getControl().getDisplay().syncExec(new Runnable() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2592
			public void run() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2593
				Util.showMessage(message);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2594
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2595
		});
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2596
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2597
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2598
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2599
	 * Starts traceviewer connection.
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2600
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2601
	private void start() {
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
  2602
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
  2603
		// check if the project is selected and open
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2604
		if (!checkProjectValidity()) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2605
			return;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2606
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2607
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2608
		// get project file infos
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2609
		getFileInfos(project);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2610
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2611
		String dataFile = Util.isDataFileAvailable(project);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2612
		// if data file already exists, ask for overwrite
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2613
		if (dataFile != null && !dataFile.equalsIgnoreCase("")) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2614
			int saveDataFiles = Util
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2615
					.openConfirmationDialogWithCancel(Constants.CONFIRM_OVERWRITE_FILE);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2616
			if (saveDataFiles == Constants.SAVE_DATA_FILE) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2617
				if (!saveReportFile(Constants.SAVE_REPORT_FILE_DATA)) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2618
					return;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2619
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2620
			} else if (saveDataFiles == Constants.SAVE_DATA_FILE_CANCEL) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2621
				// user press "Cancel" so return and do nothing
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2622
				return;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2623
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2624
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2625
			// delete existing data file
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2626
			Util.deleteDataFile(project);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2627
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2628
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2629
		ICarbideProjectInfo info = CarbideBuilderPlugin.getBuildManager()
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2630
				.getProjectInfo(project);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2631
		ICarbideBuildConfiguration config = info.getDefaultConfiguration();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2632
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2633
		// start listening emulator output
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2634
		if (config.getPlatformString().equals(Constants.BUILD_TARGET_WINSCW)) {
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2635
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2636
			String dbghelpDllVersionInfo = Util.getDbghelpDllVersionInfo(Util
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2637
					.getAtoolInstallFolder());
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2638
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2639
			if (dbghelpDllVersionInfo != Constants.DBGHELPDLL_IS_UP_TO_DATE) {
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2640
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2641
				DbghelpDllVersionInfoDialog dialog = new DbghelpDllVersionInfoDialog(
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2642
						getSite().getShell(), dbghelpDllVersionInfo);
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2643
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2644
				if (dialog.open() == Window.CANCEL)
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2645
					return;
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2646
			}
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2647
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2648
			listeningJob = new EpocReader(project, this);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2649
			listeningJob.start();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2650
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2651
			traceStarted();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2652
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2653
			return;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2654
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2655
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2656
		// else start trace capturing using TraceViewer connection
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2657
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2658
		// main view class instance
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2659
		// this instance if passed to the TraceWrapper class
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2660
		final MainView selfInstance = this;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2661
		Job activateTrace = new Job(Constants.STARTING_TRACE) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2662
			@Override
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2663
			protected IStatus run(IProgressMonitor monitor) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2664
				try {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2665
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2666
					// update progress monitor state
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2667
					monitor.beginTask(Constants.STARTING_TRACE,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2668
							IProgressMonitor.UNKNOWN);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2669
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2670
					// load TraceWrapper class
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2671
					Class<?> buildManagerClass = Class
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2672
							.forName("com.nokia.s60tools.analyzetool.trace.TraceWrapper");
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2673
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2674
					// get TraceWrapper class available methods
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2675
					java.lang.reflect.Method[] methods = buildManagerClass
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2676
							.getMethods();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2677
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2678
					// thru methods
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2679
					for (int i = 0; i < methods.length; i++) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2680
						// get one method
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2681
						java.lang.reflect.Method oneMethod = methods[i];
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2682
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2683
						// if method name is "connect"
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2684
						if (oneMethod.getName().equalsIgnoreCase("connect")) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2685
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2686
							// parameters for the connect method
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2687
							Object[] objs = new Object[1];
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2688
							objs[0] = selfInstance;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2689
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2690
							// call connect method
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2691
							String returnValue = (String) oneMethod.invoke(
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2692
									buildManagerClass.newInstance(), objs);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2693
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2694
							// if there was no errors while connection
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2695
							if (("").equals(returnValue)) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2696
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2697
								// invoke parser to open needed streams
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2698
								parser.openStreams(Util.getBldInfFolder(
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2699
										project, true));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2700
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2701
								traceStarted();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2702
							} else {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2703
								traceAction
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2704
										.setImageDescriptor(Activator
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2705
												.getImageDescriptor((Constants.BUTTON_RUN)));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2706
								traceActive = false;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2707
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2708
								showErrorMessage(returnValue);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2709
							}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2710
						}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2711
					}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2712
				} catch (ClassNotFoundException cnfe) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2713
					cnfe.printStackTrace();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2714
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2715
				} catch (SecurityException se) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2716
					se.printStackTrace();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2717
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2718
				} catch (IllegalAccessException iae) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2719
					iae.printStackTrace();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2720
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2721
				} catch (IllegalArgumentException iare) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2722
					iare.printStackTrace();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2723
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2724
				} catch (java.lang.reflect.InvocationTargetException ite) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2725
					ite.printStackTrace();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2726
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2727
				} catch (InstantiationException iv) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2728
					iv.printStackTrace();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2729
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2730
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2731
				return new Status(IStatus.OK, Constants.ANALYZE_CONSOLE_ID,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2732
						IStatus.OK, "Trace started", null);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2733
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2734
		};
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2735
		activateTrace.setUser(true);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2736
		activateTrace.schedule();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2737
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2738
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2739
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2740
	 * Starts subtests.
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2741
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2742
	public final void startSubTest() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2743
		// get started processes
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2744
		Hashtable<String, Integer> startedPros = null;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2745
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2746
		// if parser exists => means that the tracing is started and processes
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2747
		// info is available
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2748
		if (parser != null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2749
			startedPros = parser.getStartedProcesses();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2750
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2751
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2752
		// no processes = >show info and leave
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2753
		if (startedPros == null || startedPros.isEmpty()) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2754
			Util.showMessage(Constants.SUBTEST_NO_PROCESSES);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2755
			return;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2756
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2757
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2758
		// get started target info
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2759
		AbstractList<String> targets = new ArrayList<String>();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2760
		for (java.util.Enumeration<String> e = startedPros.keys(); e
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2761
				.hasMoreElements();) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2762
			String processName = e.nextElement();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2763
			targets.add(processName);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2764
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2765
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2766
		// used target
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2767
		String target = null;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2768
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2769
		// processes found, print info to user
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2770
		if (targets.size() == 1) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2771
			target = targets.get(0);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2772
		} else {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2773
			target = Util.openSelectionDialog(Constants.SUBTEST_SELECT_TARGET,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2774
					Constants.SUBTEST_RUNNING_PROCESSES_INFO, targets);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2775
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2776
		}
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2777
		if (target == null || ("").equals(target)) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2778
			return;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2779
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2780
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2781
		// ask for subtest name
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2782
		CustomInputDialog dialog = new CustomInputDialog(
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2783
				Constants.ANALYZE_TOOL_TITLE, Constants.SUBTEST_INPUT_NAME, "");
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2784
		dialog.open();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2785
		String subTestName = dialog.getUserInput();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2786
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2787
		if (subTestName == null || subTestName.length() == 0) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2788
			return;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2789
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2790
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2791
		// get process id for selected target
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2792
		int processID = startedPros.get(target);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2793
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2794
		// if subtest already exists
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2795
		if (isSubtestExists(subTestName, target)) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2796
			Util.showMessage(Constants.SUBTEST_ALLREADY_RUNNING);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2797
			return;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2798
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2799
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2800
		// create new subtes object and add it to AbstractList
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2801
		ActiveSubtests subtes = new ActiveSubtests(subTestName, target,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2802
				processID);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2803
		startedSubtest.add(subtes);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2804
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2805
		// start subtest
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2806
		parser.parse(Constants.PREFIX + " " + subtes.getProcessID()
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
  2807
				+ " TSS 0000 " + subTestName);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2808
		updateSubtestInfoText(Constants.SUBTEST_STARTED + target
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2809
				+ Constants.ENRULE + subTestName);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2810
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2811
		stopSubtest.setEnabled(true);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2812
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2813
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2814
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2815
	 * Stop external message tracing.
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2816
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2817
	public final void stop(boolean analyze) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2818
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2819
		ICarbideProjectInfo info = CarbideBuilderPlugin.getBuildManager()
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2820
				.getProjectInfo(project);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2821
		ICarbideBuildConfiguration config = info.getDefaultConfiguration();
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2822
		if (config.getPlatformString().equalsIgnoreCase(
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2823
				Constants.BUILD_TARGET_WINSCW)) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2824
			listeningJob.stop();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2825
			traceStopped(analyze);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2826
			return;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2827
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2828
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2829
		// else stop TraceViewer connection
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2830
		try {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2831
			Class<?> buildManagerClass = Class
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2832
					.forName("com.nokia.s60tools.analyzetool.trace.TraceWrapper");
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2833
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2834
			java.lang.reflect.Method[] methods = buildManagerClass.getMethods();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2835
			for (int i = 0; i < methods.length; i++) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2836
				java.lang.reflect.Method oneMethod = methods[i];
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2837
				if (oneMethod.getName().equalsIgnoreCase("disconnect")) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2838
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2839
					Object[] objs = new Object[1];
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2840
					objs[0] = this;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2841
					String returnValue = (String) oneMethod.invoke(
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2842
							buildManagerClass.newInstance(), new Object[] {});
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2843
					if (("").equals(returnValue)) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2844
						traceStopped(analyze);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2845
					} else {
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2846
						showErrorMessage("Error while disconnecting TraceViewer");
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2847
						traceAction.setImageDescriptor(Activator
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2848
								.getImageDescriptor((Constants.BUTTON_STOP)));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2849
						traceActive = true;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2850
					}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2851
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2852
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2853
		} catch (ClassNotFoundException cnfe) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2854
			cnfe.printStackTrace();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2855
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2856
		} catch (SecurityException se) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2857
			se.printStackTrace();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2858
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2859
		} catch (IllegalAccessException iae) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2860
			iae.printStackTrace();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2861
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2862
		} catch (IllegalArgumentException iare) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2863
			iare.printStackTrace();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2864
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2865
		} catch (java.lang.reflect.InvocationTargetException ite) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2866
			ite.printStackTrace();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2867
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2868
		} catch (InstantiationException iv) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2869
			iv.printStackTrace();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2870
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2871
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2872
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2873
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2874
	 * Updates button states and creates results for project.
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2875
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2876
	private void traceStopped(boolean analyze) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2877
		// update icon and information text
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2878
		traceAction.setImageDescriptor(Activator
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2879
				.getImageDescriptor((Constants.BUTTON_RUN)));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2880
		traceAction.setText(Constants.ACTION_START_TRACE);
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2881
		traceAction.setToolTipText(Constants.ACTION_START_TRACE);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2882
		traceActive = false;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2883
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2884
		// close any active subtests
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2885
		if (!startedSubtest.isEmpty()) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2886
			for (int j = 0; j < startedSubtest.size(); j++) {
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2887
				ActiveSubtests oneSubtest = startedSubtest.get(j);
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2888
				parser.parse(Constants.PREFIX + " " + oneSubtest.getProcessID()
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
  2889
						+ " TSE 0000 " + oneSubtest.getName());
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2890
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2891
			startedSubtest.clear();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2892
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2893
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2894
		// tell parser to finish => write data to file
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2895
		parser.finish();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2896
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2897
		// inform user
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2898
		updateLabel(Constants.INFO_TRACE_STOP);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2899
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2900
		// set start and stop trace not visible
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2901
		startSubtest.setEnabled(false);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2902
		stopSubtest.setEnabled(false);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2903
		fileOpenMenu.setEnabled(true);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2904
		saveFileMenu.setEnabled(true);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2905
		cleanAtoolChanges.setEnabled(true);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2906
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2907
		project = traceStartedProjectRef;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2908
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2909
		// parse and analyze saved data file
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2910
		if (analyze) {
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2911
			analyzeDataFile(Constants.ANALYZE_USE_DATA_FILE, null, true);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2912
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2913
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2914
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2915
	/**
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2916
	 * Stop one subtest. If there is multiple subtests running ask for user to
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2917
	 * which one to stop.
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2918
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2919
	public final void stopSubTest() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2920
		// no processes show info
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2921
		if (startedSubtest.isEmpty()) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2922
			Util.showMessage(Constants.SUBTEST_NO_SUBTESTS);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2923
		} else {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2924
			// only one subtest no need to ask for users
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2925
			if (startedSubtest.size() == 1) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2926
				ActiveSubtests oneSubtest = startedSubtest.get(0);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2927
				parser.parse(Constants.PREFIX + " " + oneSubtest.getProcessID()
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
  2928
						+ " TSE 0000 " + oneSubtest.getName());
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2929
				updateSubtestInfoText(Constants.SUBTEST_ENDED
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2930
						+ oneSubtest.getTargetName() + Constants.ENRULE
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2931
						+ oneSubtest.getName());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2932
				startedSubtest.remove(0);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2933
				stopSubtest.setEnabled(false);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2934
			} else { // multiple subtest found ask for the user which to stop
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2935
				// multiple subtest found ask for user which to be ended
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2936
				AbstractList<String> tmpSubtest = new ArrayList<String>();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2937
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2938
				// get list of active subtests
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2939
				for (int i = 0; i < startedSubtest.size(); i++) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2940
					ActiveSubtests oneSubtest = startedSubtest.get(i);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2941
					String tmpStr = oneSubtest.getTargetName()
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2942
							+ Constants.ENRULE + oneSubtest.getName();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2943
					tmpSubtest.add(tmpStr);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2944
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2945
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2946
				String selection = Util.openSelectionDialog(
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2947
						Constants.SUBTEST_SELECT_SUBTEST_TO_STOP, null,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2948
						tmpSubtest);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2949
				// thru active subtests
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2950
				for (int k = 0; k < startedSubtest.size(); k++) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2951
					// get one subtest
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2952
					ActiveSubtests oneSubtest = startedSubtest.get(k);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2953
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2954
					// split user selected subtest information to get subtest
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2955
					// name
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2956
					String[] splittedText = selection.split(" ");
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2957
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2958
					// if user selected subtest name and current subtest equals
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2959
					if (splittedText[2].equals(oneSubtest.getName())) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2960
						// write subtest end tag to data file
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2961
						parser.parse(Constants.PREFIX + " "
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
  2962
								+ oneSubtest.getProcessID() + " TSE 0000 "
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
  2963
								+ oneSubtest.getName());
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2964
						updateSubtestInfoText(Constants.SUBTEST_ENDED
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2965
								+ oneSubtest.getTargetName() + Constants.ENRULE
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2966
								+ oneSubtest.getName());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2967
						// remove current subtest from active subtest
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2968
						// AbstractList
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2969
						startedSubtest.remove(k);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2970
						break;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2971
					}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2972
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2973
				if (startedSubtest.isEmpty()) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2974
					stopSubtest.setEnabled(false);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2975
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2976
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2977
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2978
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2979
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2980
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2981
	 * When AnalyzeTool view tree model is collapsed.
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2982
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2983
	 * @see org.eclipse.jface.viewers.ITreeViewerListener#treeCollapsed(org.eclipse.jface.viewers.TreeExpansionEvent)
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2984
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2985
	 * @param event
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2986
	 *            Tree expansion event
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2987
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2988
	public void treeCollapsed(TreeExpansionEvent event) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2989
		// MethodDeclaration/Block[count(BlockStatement) = 0 and
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2990
		// @containsComment = 'false']
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2991
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2992
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2993
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2994
	 * When AnalyzeTool view tree model is expanded.
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2995
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2996
	 * @see org.eclipse.jface.viewers.ITreeViewerListener#treeExpanded(org.eclipse.jface.viewers.TreeExpansionEvent)
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  2997
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2998
	 * @param event
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  2999
	 *            Tree expansion event
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3000
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3001
	public void treeExpanded(TreeExpansionEvent event) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3002
		// MethodDeclaration/Block[count(BlockStatement) = 0 and
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3003
		// @containsComment = 'false']
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3004
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3005
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3006
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3007
	 * Updates allocation count in the information label.
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3008
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3009
	 * The information layout is hard to modify so we need to manage information
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3010
	 * label text
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3011
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3012
	public final void updateAllocNumber() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3013
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3014
		runView.getControl().getDisplay().syncExec(new Runnable() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3015
			public void run() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3016
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
  3017
				// if label is created
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3018
				if (informationLabel != null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3019
					// get existing label text
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3020
					String tmpText = informationLabel.getText();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3021
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3022
					// split existing text
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3023
					String[] strArray = tmpText.split(lineFeed);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3024
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3025
					// if text contains more than 3 lines
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3026
					if (strArray.length >= 2) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3027
						// create new buffer
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3028
						StringBuffer tmpBuffer = new StringBuffer(
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3029
								strArray.length);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3030
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3031
						// set memory allocation size
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3032
						strArray[1] = Constants.INFO_ALLOCATED_MEM
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3033
								+ parser.getAllocationsSize();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3034
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3035
						// get updated text to buffer
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3036
						for (int i = 0; i < strArray.length; i++) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3037
							tmpBuffer.append(strArray[i]);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3038
							tmpBuffer.append(lineFeed);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3039
						}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3040
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3041
						// set new text to information label
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3042
						informationLabel.setText(tmpBuffer.toString());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3043
					} else {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3044
						informationLabel.setText(tmpText + lineFeed
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3045
								+ Constants.INFO_ALLOCATED_MEM
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3046
								+ parser.getAllocationsSize());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3047
					}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3048
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3049
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3050
		});
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3051
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3052
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3053
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3054
	 * Update build action icon and tooltip text.
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3055
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3056
	 * @param projectRef
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3057
	 *            Project reference
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3058
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3059
	public final void updateBuildState(final IProject projectRef) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3060
		if (buildWithAtool == null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3061
			return;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3062
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3063
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3064
		BuilderUtil util = new BuilderUtil();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3065
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3066
		// if project is not selected
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3067
		if (projectRef == null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3068
			buildWithAtool.setText(Constants.ACTION_AT_BUILD_DEACTIVE);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3069
			buildWithAtool.setToolTipText(Constants.ACTION_AT_BUILD_DEACTIVE);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3070
			buildWithAtool.setChecked(false);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3071
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3072
		// if AnalyzeTool build is enabled
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3073
		else if (util.isNatureEnabled(projectRef)) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3074
			buildWithAtool.setText(Constants.ACTION_AT_BUILD_ACTIVE);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3075
			buildWithAtool.setToolTipText(Constants.ACTION_AT_BUILD_ACTIVE);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3076
			buildWithAtool.setChecked(true);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3077
		} else {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3078
			buildWithAtool.setText(Constants.ACTION_AT_BUILD_DEACTIVE);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3079
			buildWithAtool.setToolTipText(Constants.ACTION_AT_BUILD_DEACTIVE);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3080
			buildWithAtool.setChecked(false);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3081
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3082
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3083
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3084
	/**
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3085
	 * Indicates the target (emulator/device) by inspecting the given projects
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3086
	 * build configuration.
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3087
	 * 
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3088
	 * @param selectedProject
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3089
	 *            the currently active project
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3090
	 * @return "emulator" if the build configuration is WINSCW, "device"
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3091
	 *         otherwise
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3092
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3093
	private static String getTraceTarget(final IProject selectedProject) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3094
		String target = "";
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3095
		if (selectedProject != null && selectedProject.isOpen()) {
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3096
			ICarbideProjectInfo info = CarbideBuilderPlugin.getBuildManager()
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3097
					.getProjectInfo(selectedProject);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3098
			if (info != null) {
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3099
				ICarbideBuildConfiguration config = info
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3100
						.getDefaultConfiguration();
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3101
				target = config.getPlatformString().equals(
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3102
						Constants.BUILD_TARGET_WINSCW) ? Constants.INFO_TRACE_FROM_EMULATOR
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3103
						: Constants.INFO_TRACE_FROM_DEVICE;
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3104
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3105
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3106
		return target;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3107
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3108
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3109
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3110
	 * Update change detail action state.
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3111
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3112
	 * @param projectRef
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3113
	 *            Current project
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3114
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3115
	public final void updateChangeDetailState(final IProject projectRef) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3116
		if (changeDetails == null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3117
			return;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3118
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3119
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3120
		if (projectRef == null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3121
			changeDetails.setEnabled(false);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3122
			refreshResults.setEnabled(false);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3123
			return;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3124
		} else if (projectResults.contains(projectRef)) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3125
			changeDetails.setEnabled(true);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3126
		} else {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3127
			changeDetails.setEnabled(false);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3128
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3129
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3130
		String dataFile = projectResults.getDataFileName(projectRef);
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3131
		if (dataFile != null) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3132
			int fileType = UseAtool.checkFileType(dataFile);
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3133
			if (fileType == Constants.DATAFILE_TRACE
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
  3134
					|| fileType == Constants.DATAFILE_LOG
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
  3135
					|| fileType == Constants.DATAFILE_BINARY) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3136
				refreshResults.setEnabled(true);
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3137
			} else {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3138
				refreshResults.setEnabled(false);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3139
			}
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3140
		} else {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3141
			refreshResults.setEnabled(false);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3142
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3143
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3144
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3145
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3146
	 * Sets information to the information label.
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3147
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3148
	 * @param infoText
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3149
	 *            Info text
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3150
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3151
	private void updateInformationLabel(final String infoText) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3152
		// trace is active => do not update information label
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3153
		if (traceActive) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3154
			return;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3155
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3156
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3157
		// sync with the UI thread
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3158
		runView.getControl().getDisplay().syncExec(new Runnable() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3159
			public void run() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3160
				// if informationlabel exists set text
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3161
				if (informationLabel != null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3162
					informationLabel.setText(infoText);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3163
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3164
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3165
		});
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3166
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3167
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3168
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3169
	 * Updates label by given string.
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3170
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3171
	 * @param line
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3172
	 *            String to display
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3173
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3174
	public final void updateLabel(final String line) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3175
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3176
		final String oneLine = line;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3177
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3178
		runView.getControl().getDisplay().syncExec(new Runnable() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3179
			public void run() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3180
				// if informationlabel exists set text
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3181
				if (informationLabel != null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3182
					informationLabel.setText(oneLine);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3183
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3184
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3185
		});
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3186
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3187
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3188
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3189
	 * Updates Subtest info to the information label.
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3190
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3191
	 * The information layout is hard to modify so we need to manage information
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3192
	 * label text
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3193
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3194
	 * @param text
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3195
	 *            New label text
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3196
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3197
	private void updateSubtestInfoText(final String text) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3198
		final String newText = text;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3199
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3200
		runView.getControl().getDisplay().syncExec(new Runnable() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3201
			public void run() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3202
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3203
				// if label exists
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3204
				if (informationLabel != null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3205
					// get existing label text
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3206
					String origText = informationLabel.getText();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3207
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3208
					// split existing text
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3209
					String[] strArray = origText.split(lineFeed);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3210
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3211
					// create new buffer
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3212
					StringBuffer tmpBuffer = new StringBuffer(strArray.length);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3213
					if (strArray.length >= 3) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3214
						// update text
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3215
						strArray[2] = newText;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3216
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3217
						// get updated text to buffer
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3218
						for (int i = 0; i < strArray.length; i++) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3219
							tmpBuffer.append(strArray[i]);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3220
							tmpBuffer.append(lineFeed);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3221
						}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3222
						// set new text to information label
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3223
						informationLabel.setText(tmpBuffer.toString());
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3224
					} else {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3225
						informationLabel.setText(origText + newText);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3226
					}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3227
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3228
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3229
		});
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3230
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3231
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3232
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3233
	 * Updates button states, clears existing project data and updating view.
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3234
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3235
	private void traceStarted() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3236
		// clear view contents
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3237
		cleanAnalyzeData(project);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3238
		clearCallstackViewContent();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3239
		traceStartedProjectRef = project;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3240
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3241
		// change icon and information text
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3242
		traceAction.setImageDescriptor(Activator
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3243
				.getImageDescriptor((Constants.BUTTON_STOP)));
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3244
		traceAction.setText(Constants.ACTION_STOP_TRACE);
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3245
		traceAction.setToolTipText(Constants.ACTION_STOP_TRACE);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3246
		traceActive = true;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3247
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3248
		String fromTarget = getTraceTarget(traceStartedProjectRef);
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3249
		updateLabel(fromTarget.length() == 0 ? Constants.INFO_TRACE_START
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3250
				: String.format(Constants.INFO_TRACE_FROM_TARGET_START,
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3251
						fromTarget));
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3252
		// add2UserActionHistory( "Trace started for
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3253
		// project: "
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3254
		// +project.getName() +" at "+ Util.getTime() );
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3255
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3256
		// set start and stop subtest visible
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3257
		startSubtest.setEnabled(true);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3258
		stopSubtest.setEnabled(false);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3259
		fileOpenMenu.setEnabled(false);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3260
		saveFileMenu.setEnabled(false);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3261
		cleanAtoolChanges.setEnabled(false);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3262
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3263
		updateAllocNumber();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3264
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3265
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3266
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3267
	 * Overrided method to capture keyevents.
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3268
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3269
	 * @see org.eclipse.swt.events.KeyListener#keyPressed(org.eclipse.swt.events.KeyEvent)
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3270
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3271
	public void keyPressed(KeyEvent e) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3272
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3273
		// C key address(hex)
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3274
		final int CTRL_C = 0x3;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3275
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3276
		// key event character
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3277
		int charValue = e.character;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3278
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3279
		// c key pressed
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3280
		boolean cPressed = (charValue == CTRL_C); // This should be enough
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3281
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3282
		// ctrl key pressed
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3283
		boolean ctrlPressed = (e.stateMask & SWT.CTRL) != 0;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3284
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3285
		// if ctrl and c key pressed => run copy action
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3286
		if (ctrlPressed & cPressed) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3287
			// Triggering copy action
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3288
			copyAction.run();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3289
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3290
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3291
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3292
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3293
	 * (non-Javadoc)
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3294
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3295
	 * @see org.eclipse.swt.events.KeyListener#keyReleased(org.eclipse.swt.events.KeyEvent)
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3296
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3297
	public void keyReleased(KeyEvent e) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3298
		// This method is overrided
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3299
	}
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3300
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3301
	/**
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3302
	 * This job parses the .dat file and loads the graph
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3303
	 * 
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3304
	 */
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3305
	class GraphLoadJob extends Job {
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3306
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3307
		/** Location of file to parse for graph model */
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3308
		private String datFileLocation;
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3309
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3310
		/**
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3311
		 * Constructor
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3312
		 * 
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3313
		 * @param aDatFileLocation
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3314
		 *            Location of file to parse for graph model
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3315
		 */
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3316
		public GraphLoadJob(String aDatFileLocation) {
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3317
			super(Constants.GRAPH_LOAD_JOB_TITLE);
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3318
			this.datFileLocation = aDatFileLocation;
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3319
		}
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3320
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3321
		@Override
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3322
		protected IStatus run(IProgressMonitor monitor) {
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3323
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3324
			monitor.beginTask(Constants.GRAPH_GENERATING_PROG_TITLE,
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3325
					IProgressMonitor.UNKNOWN);
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3326
			try {
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3327
				ReadFile fileReader = new ReadFile();
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3328
				boolean success = fileReader.readFile(datFileLocation);
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3329
				if (success) {
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3330
					AbstractList<ProcessInfo> processes = fileReader
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3331
							.getStatistic();
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3332
					IMemoryActivityModel model = new AnalyzeFactory()
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3333
							.createModel(processes.size() == 0);
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3334
					if (processes.size() > 0) {
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3335
						model.setDeferredCallstackReading(fileReader
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3336
								.hasDeferredCallstacks());
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3337
						if (model.isDeferredCallstackReading()) {
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3338
							DeferredCallstackManager callstackManager = new DeferredCallstackManager(
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3339
									datFileLocation);
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3340
							callstackManager.setProcesses(processes);
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3341
							model.setCallstackManager(callstackManager);
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3342
						} else {
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
  3343
							model
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
  3344
									.setCallstackManager(new SimpleCallstackManager());
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3345
						}
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3346
					}
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3347
					if (!monitor.isCanceled()) {
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3348
						chart.setInput(project, model);
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3349
						model.addProcesses(processes);
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3350
					}
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3351
					fileReader.finish();
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3352
				}
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3353
			} catch (OutOfMemoryError oome) {
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3354
				Activator
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3355
						.getDefault()
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3356
						.logInfo(IStatus.ERROR, IStatus.ERROR,
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3357
								"Can not allocate enough memory for the memory usage graph model.");
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3358
			} catch (Exception e) {
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3359
				Activator.getDefault().log(IStatus.ERROR,
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3360
						"Error while generating graph model", e);
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3361
			}
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3362
			graphLoadJob = null;
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3363
			return Status.OK_STATUS;
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3364
		}
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
  3365
	}
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
  3366
}