--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.carbide.extensions.traceanalyser/build.properties Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,3 @@
+bin.includes = feature.xml,\
+ license.txt,\
+ license.htm
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.carbide.extensions.traceanalyser/feature.xml Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="com.nokia.carbide.extensions.traceanalyser"
+ label="Carbide.c++ Extensions - Trace Analyser"
+ version="1.0.5"
+ provider-name="Nokia"
+ plugin="com.nokia.s60tools.traceanalyser">
+
+ <description>
+ Trace Analyser tool is used for analysing OST trace data that is received from a device.
+ </description>
+
+ <copyright>
+ Nokia Corporation and/or its subsidiary(-ies). All rights reserved. License: http://www.eclipse.org/legal/epl-v10.html.
+ </copyright>
+
+ <license url="license.htm">
+ Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).All rights reserved.
+ This component and the accompanying materials are made available under the
+ terms of "Eclipse Public License v1.0" which accompanies this
+ distribution, and is available at the URL "http://www.eclipse.org/legal/epl-v10.html".
+
+ Part of the graphics of the program are from Eclipse 3.1 platform
+ and CDT project in Eclipse community, which are made available under
+ the terms of the Eclipse Public License v1.0.
+ A copy of the EPL is provided at
+ http://www.eclipse.org/legal/epl-v10.html
+ </license>
+
+ <url>
+ <update label="Carbide.c++ Extensions Nokia Update Server" url="http://trwwwaps.nmp.nokia.com/programs/carbide"/>
+ </url>
+
+ <plugin
+ id="com.nokia.s60tools.traceanalyser"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="com.nokia.s60tools.traceanalyser.timingrule"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="com.nokia.s60tools.traceanalyser.parameterrule"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="com.nokia.s60tools.traceanalyser.help"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.carbide.extensions.traceanalyser/license.htm Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,14 @@
+<h2>Carbide.c++ Extensions - TraceViewer plug-in</h2>
+
+<h3>License Information</h3>
+COPYRIGHTS<br/>
+Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).All rights reserved.<br/>
+This component and the accompanying materials are made available under the <br/>
+terms of "Eclipse Public License v1.0" which accompanies this <br/>
+distribution, and is available at the URL "http://www.eclipse.org/legal/epl-v10.html".<br/>
+
+Part of the graphics of the program are from Eclipse 3.1 platform
+and CDT project in Eclipse community, which are made available under
+the terms of the Eclipse Public License v1.0.
+A copy of the EPL is provided at
+http://www.eclipse.org/legal/epl-v10.html
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser.help/META-INF/MANIFEST.MF Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 1
+Bundle-Name: External Tool Help Template Plug-in
+Bundle-SymbolicName: com.nokia.s60tools.traceanalyser.help;singleton=true
+Bundle-Version: 1.0.3
+Bundle-Vendor: Nokia
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser.help/about.html Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,25 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<html>
+<head>
+ <title>About</title>
+ <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June, 2010</p>
+
+<h3>Copyright</h3>
+
+<p>Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights
+reserved.<br>
+License: <a
+href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.</p>
+
+<p><br>
+</p>
+
+<p></p>
+</body>
+</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser.help/book.css Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,183 @@
+/*
+ Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
+ License: http://www.eclipse.org/legal/epl-v10.html
+*/
+
+/* Add whitespace around entire display to avoid crowding edges of view */
+/* 20070523-Removed top margin size to close gap between location breadcrumbs and page title */
+html {
+ margin: 2px 10px 10px 10px;
+ }
+
+/* Set default font to serif style, 12-pt and plain */
+body, p, table {
+ font-family: Verdana, Helvetica, Arial, sans-serif;
+ font-size: 13px;
+ font-weight: normal;
+}
+
+/* Use sans-serif fonts for all title styles */
+h1, h2, h3, h4, h5, h6, strong, em {
+ font-family: Verdana, Helvetica, Arial, sans-serif;
+ color: #000000;
+ }
+
+h1 { font-size:20px }
+h2 { font-size:18px }
+h3 { font-size:16px }
+h4 { font-size:14px }
+h5 { font-size:13px }
+h6 { font-size:12px }
+
+/* For headlines at the top of a view, add space */
+/* 20090224-changed green fade to gold header image */
+h1, h2, h3 {
+ background-image: url(html/images/gold_header.png);
+ background-repeat: no-repeat;
+ padding:10px 0px 10px 12px;
+ }
+
+li {
+ margin-bottom:8px;
+ margin-top:8px;
+ }
+
+/* Footer includes space and a gray line above the company logo */
+#footer {
+ padding-top:10px;
+ margin-top:20px;
+ border-top:1px solid #999;
+ font-family: Helvetica, sans-serif;
+ font-size: 11px;
+ color:#333;
+ }
+
+.listing {
+ font-family: "Courier New", Courier, mono;
+ color: #000000;
+ background-color: #FFFFCC;
+ margin: 5px 0px;
+ }
+
+.code, pre {
+ font-family: "Courier New", Courier, mono;
+ font-size: 13px;
+ color: #000000;
+ }
+
+.step {
+ /* background-color: #EEE; */
+ /* margin: 10px 0px; */
+ /* color: #111; */
+ /* border-bottom:2px solid #EEE; */
+ }
+
+.substep {
+ background-color: #EEE;
+ }
+
+
+/* Figure/Listing/Table titles are centered and gray */
+p.table {
+ color: #999;
+ font-weight: bold;
+ padding-top: 5px;
+ }
+
+table {
+ border: solid #999 1px;
+ table-layout: auto;
+ font-size: 13px;
+ }
+
+td, th {
+ border: solid #999 1px;
+ padding: 5px;
+ vertical-align:top;
+ }
+
+/* 20070522-replaced gray with green background to match gradiant color for title */
+th {
+ background-color:#FFC550; /* background-color:#acd79b;
+ background-color:#999;
+ color:#FFF; */
+ }
+
+div.ol.p {
+ margin-left: 3em;
+ }
+
+/* Make all ordered/unordered list items appear in bold gray */
+div ol > li, div ul > li {
+ font-weight:bold;
+ color: #333;
+ }
+
+div ol > p, div ul > p, div li > p {
+ font-weight:normal;
+ }
+
+/* Make all H4 and H5 items appear in bold gray against a light green background */
+div h5, div h4 {
+ padding:5px 0px 5px 12px;
+ background-color:#FDCB2F;
+ /* background-color: #EEE; */
+ font-weight:bold;
+ color: #000000;
+ }
+
+
+/* Notes stand out using a light top & bottom borders with dark gray text */
+p.note {
+ /* color: #03C; */
+ /* background-color: #FFFF99; */
+ color: #333;
+ padding: 5px;
+ margin-left: 1em;
+ margin-right: 1em;
+ border-top: solid #BBB thin;
+ border-bottom: solid #BBB thin;
+ }
+
+
+/* Figure/Listing/Table titles are centered and gray */
+p.figure {
+ color: #333;
+ text-align: center;
+ font-weight: bold;
+ }
+
+/* highly visible red background and white text for things that need fixing before release */
+/* SHOULD NOT BE PRESENT IN RELEASED PRODUCTS */
+.fix {
+ background-color: red;
+ font-weight: bold;
+ color: white;
+ }
+
+.question {
+ font-style:italic;
+ font-weight:bold;
+ color: #555;
+ }
+
+.titleSmall {
+ font-family: Helvetica, sans-serif;
+ font-size: 11px;
+ }
+
+
+.plain {
+ font-family: Helvetica, sans-serif;
+ font-size: 12px;
+ font-style: normal;
+ line-height: normal;
+ font-weight: normal;
+ font-variant: normal;
+ color: #000000;
+ text-decoration: none;
+ }
+
+a:link { color: #0033CC }
+a:visited { color: #555555 }
+a:hover { color: #0033CC }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser.help/build.properties Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,8 @@
+bin.includes = META-INF/,\
+ html/,\
+ plugin.xml,\
+ book.css
+src.includes = html/,\
+ META-INF/,\
+ plugin.xml,\
+ book.css
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser.help/html/cheatsheet/getStarted_ta_cs.xml Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,140 @@
+<?xml version="1.0" encoding="utf-8"?>
+<?APT Element gi="cheatsheet" attrs="title"?>
+<?APT Element gi="intro"?>
+<?APT Element gi="description"?>
+<?APT Element gi="item" attrs="title href skip"?>
+<?APT Element gi="b"?>
+<cheatsheet title="Configuring tracing rules to analyse application's performance">
+<intro>
+<description>This tutorial shows you the steps for creating tracing rules in the TraceAnalyser tool.
+<br/><br/>
+<b>Prerequisites</b>
+<br/><br/>
+* TraceViewer and TraceBuilder applications are present in your Carbide.c++ environment.
+<br/><br/>
+* (Optional) TraceSwitch SIS is installed on your device.
+<br/><br/>
+You can obtain TraceSwitch from the S60 RnD SDK, under the <b>RnD Tools</b> folder. TraceSwitch, together with the ToolsStarter SIS, support the USB connection method by default. You only need to plug in the device to start receiving traces.
+</description>
+</intro>
+
+<item title="Create or open a project." href="" skip="false">
+<description>Open or create a new project in Carbide.c++.
+</description>
+</item>
+
+<item
+ href="/com.nokia.tracebuilder.help/html/tasks/addingtraces.htm"
+ skip="false"
+ title="Add OST traces to the source code.">
+<description>Adding Open System Traces (OST) means adding "tags" to your application's source code, to those places that you want to monitor.
+<br/>
+<br/>
+The easiest way to do this is by using the TraceBuilder application: <b>Carbide > TraceBuilder</b>.
+<br/>
+<br/>
+For example, to monitor timings in a camera application, you could add the first trace to capture the key press for taking a picture, and another where the taken picture is shown to the user.
+<br/>
+<br/>
+The corresponding rule to be created in TraceAnalyser might then state that these actions must occur within 5 seconds.
+</description>
+</item>
+ <item
+ href="/com.nokia.tracebuilder.help/html/tasks/setprojectandcompile.htm"
+ title="Set your project's include paths and compile your application.">
+ <description>
+ To use Open System Trace (OST) traces, you must include the "OpenSystemTrace.h" header file from the development environment.
+<br/><br/>
+ </description>
+ </item>
+ <item
+ title="Obtain the files generated in the compilation.">
+ <description>
+ After compiling your project, you should have two files:
+<br/><br/>
+1: A SIS file of your application that you can install into the device by using USB.
+<br/><br/>
+2: An XML format dictionary file that is needed for activating and decoding traces in TraceViewer.
+<br/><br/>
+The file is generated into the following directory:
+<br/><br/>
+[SDK root]\epoc32\include\internal\symbiantraces\dictionary.
+
+ </description>
+ </item>
+ <item
+ href="/com.nokia.traceviewer.help/html/reference/preferencesconnection.htm"
+ title="Define connection settings.">
+ <description>
+ To start receiving traces on the TraceViewer application, define connection settings between the device and your PC.
+<br/><br/>
+Start the TraceViewer tool from <b>Carbide > TraceViewer</b>.
+<br/><br/>
+On the toolbar, click the small arrow and from the drop-down list, select <b>Connection Settings</b>.
+<br/><br/>
+ </description>
+ </item>
+ <item
+ href="/com.nokia.traceviewer.help/html/tasks/traceactivation.htm"
+ title="Activate and decode traces.">
+ <description>
+ Trace activation is a way of generating specific trace data that is relevant for your components. This reduces the amount of traces listed on the TraceViewer user interface.
+<br/><br/>
+Start the TraceViewer tool from <b>Carbide > TraceViewer</b>.
+<br/><br/>
+Load the dictionary file (.xml) that contains the necessary component and group information.
+<br/><br/>
+Activate the components and groups you want to use.
+<br/><br/>
+For more information, see TraceViewer Help.
+ </description>
+ </item>
+ <item
+ href="/com.nokia.traceanalyser.help/html/tasks/creating_rules.htm"
+ title="Create rules for the traces you want to monitor.">
+ <description>
+ Start TraceAnalyser from <b>Carbide > TraceAnalyser</b>.
+<br/><br/>
+Create either <b>Timing</b> or <b>Parameter</b> rule type for the events you want to monitor.
+<br/><br/>
+An example of the rule could be a statement like this: "Taking a picture should not take longer than 5 seconds."
+ </description>
+ </item>
+ <item
+ href="/com.nokia.traceviewer.help/html/tasks/connect.htm"
+ title="Connect to trace source and run your application.">
+ <description>
+ In TraceViewer, start receiving traces.
+<br/><br/>
+Run the SIS file of your application on the device.
+ </description>
+ </item>
+ <item
+ href="/com.nokia.traceanalyser.help/html/tasks/viewing_failed_cases.htm"
+ title="Analyse the rules in TraceAnalyser and TraceViewer.">
+ <description>
+ All executed trace rules (both passed and failed ones) are listed on the TraceAnalyser main view.
+<br/><br/>
+If some of them fail during execution (for example, an operation execution takes longer than defined in the rule), the TraceAnalyser icon will quickly flash to indicate that a rule violation has occurred.
+<br/><br/>
+To view the failed cases, select the <b>Fail Log</b> tab.
+<br/><br/>
+To view the traces that caused the failure, double-click a rule on the view. TraceViewer opens and scrolls to the traces.
+<br/><br/>
+Double-click the trace to jump to the codeline that caused the failure.
+ </description>
+ </item>
+
+<item title="Analyse the code and correct errors as needed." href="" skip="false">
+<description>
+ To view the traces that caused the failure, double-click a rule on the TraceAnalyser <b>Fail Log</b>.
+<br/><br/>
+TraceViewer opens and scrolls to the trace.
+<br/><br/>
+In TraceViewer, double-click the trace to jump to the codeline that caused the failure.
+<br/><br/>
+Once you have identified the problem in the source code, try to fix it and run the rule again.
+</description>
+</item>
+
+</cheatsheet>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser.help/html/contexts.xml Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?NLS TYPE="org.eclipse.help.contexts"?>
+<contexts>
+
+
+<!-- An example context definition in contexts.xml file:
+
+ <context id="TOOL_NAME_MAIN_VIEW">
+ <description>TOOL NAME's Main View</description>
+ <topic label="Task 1" href="html/tasks/tasks1.htm" />
+ <topic label="Task 2" href="html/tasks/tasks2.htm" />
+ </context>
+
+-->
+
+
+
+<!-- The context's id can be accessed from the source code
+ in the following way.
+
+ Define a class storing the context ID constants at
+ source code level:
+
+ public class AppDepHelpContextIDs {
+ ...
+ public static final String APPDEP_COMPONENT_LIST_VIEW =
+ APPDEP_HELP_PROJECT_PLUGIN_ID
+ +".APPDEP_COMPONENT_LIST_VIEW";
+ ...
+ }
+
+ // Somewhere in the code there is a UI item
+ // the context help will be bound to.
+ private TableViewer listItemsViewer;
+ ...
+ // Binding context help ID into the control happens with SetHelp-method.
+ // The first parameter must be a sub class of org.eclipse.swt.widgets.Control.
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(listItemsViewer.getControl(),
+ AppDepHelpContextIDs.APPDEP_COMPONENT_LIST_VIEW);
+
+ -->
+
+
+ <context id="TRACE_ANALYSER_MAIN_VIEW">
+ <description>In TraceAnalyser, you can create rules to supervise the time consumption of an application and detect timing violations. The main view shows both passed and failed rules. </description>
+ <topic label="TraceAnalyser overview" href="html/gettingstarted/traceanalyser_overview.htm" />
+ <topic label="Creating tracing rules" href="html/tasks/creating_rules.htm" />
+ </context>
+
+ <context id="TRACE_ANALYSER_FAIL_LOG">
+ <description>If a tracing rule fails (for example, the interval between operations is longer than defined), you can view more information about the violation on the Fail Log tab.</description>
+ <topic label="Viewing the log of failed rules" href="html/tasks/viewing_failed_cases.htm" />
+ </context>
+
+ <context id="TRACE_ANALYSER_RULE_EDITOR">
+ <description>TraceAnalyser's Rule Editor dialog contains general fields for all rule types, and some specific fields for timing and parameter rules separately. </description>
+ <topic label="Creating tracing rules" href="html/tasks/creating_rules.htm" />
+ <topic label="Modifying rules" href="html/tasks/modifying_rules.htm" />
+ </context>
+
+ <context id="TRACE_ANALYSER_TRACE_SELECTION_DIALOG">
+ <description>In the Trace Selection dialog, you can view the trace dictionaries that are loaded in TraceViewer application, and select the traces you want to use. </description>
+ <topic label="Creating tracing rules" href="html/tasks/creating_rules.htm" />
+ </context>
+
+ <context id="TRACE_ANALYSER_HISTORY_VIEW">
+ <description>TraceAnalyser history view shows you information on the rule's performance over time. </description>
+ <topic label="Viewing the rule history" href="html/tasks/viewing_the_history.htm" />
+ </context>
+
+</contexts>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser.help/html/gettingstarted/gs_index.htm Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,19 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 1.0 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+<meta http-equiv="content-style-type" content="text/css">
+<title>Getting started</title>
+<link href="../../book.css" type="text/css" rel="StyleSheet"></head>
+<body>
+
+<h2>Getting started</h2>
+<p>The following topics give you information on how to get started with this tool: </p>
+<ul>
+ <li><a href="traceanalyser_overview.htm">TraceAnalyser overview</a></li>
+ <li><a href="traceanalyser_basic_walkthrough.htm">TraceAnalyser basic walk-through</a></li>
+</ul>
+
+<div id="footer">Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
+License: <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.</div></body></html>
+
Binary file trace/traceanalyser/com.nokia.s60tools.traceanalyser.help/html/gettingstarted/images/dg_mainview.png has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser.help/html/gettingstarted/traceanalyser_basic_walkthrough.htm Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,48 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
+<title>TraceAnalyser basic walk-through</title>
+<link href="../../book.css" type="text/css" rel="stylesheet"></head>
+<body><h2>TraceAnalyser basic walk-through</h2> <h5>Before you start</h5><p>
+Setting up TraceAnalyser requires the following tracing tools: </p><ul>
+<li><b>In Carbide.c++:</b> TraceBuilder and TraceViewer tools, accessible
+from the <b>Carbide</b> menu. </li>
+<li><b>In the device:</b> (Optional) The TraceSwitch tool that listens to
+the incoming traces. For more information on how to obtain it, see the <a
+href="../release_notes.htm#requirements">Release Note</a><?Pub Caret1>. </li>
+</ul><p>The following steps are needed for using this tool: </p><ol>
+<li>Open or create a project in Carbide.c++. </li>
+<li>To add OST traces to the source code, start the TraceBuilder tool from <b>
+Carbide > TraceBuilder</b>. <p> For more instructions, see the topic <i>Adding
+traces to the source code</i> in TraceBuilder Help. </p></li>
+<li>Set your project's include paths and compile the application. For instructions,
+see <i>Setting project include paths and compiling</i> in TraceBuilder Help. <p><b>
+Note:</b> Compilation uses TraceCompiler that generates the needed headers.
+After compilation, you should have two files: </p><ul>
+<li>a SIS file of your tool that you can now install into the device. </li>
+<li>an XML format dictionary file that is needed for activating and decoding
+traces in TraceViewer. It is generated into the following directory: <i>[SDK
+root]\epoc32\include\internal\symbiantraces\dictionary</i>. </li>
+</ul></li>
+<li>In TraceViewer, also define the settings for connecting your PC to the
+device. The options are USB or eXtended Trace Interface (XTI). <p>See <i>
+Setting TraceViewer preferences</i> in TraceViewer Help. </p><p><b>Tip:</b> If
+you have TraceSwitch enabled in the device, the USB connection is supported
+by default and you only need to plug in the device to start receiving traces.
+</p></li>
+<li>To activate and decode traces, start the TraceViewer tool from <b>Carbide
+> TraceViewer</b>, and activate the dictionary file there. <p>For instructions,
+see <i>Trace activation </i> in TraceViewer Help. </p></li>
+<li>In TraceAnalyser, create the rules for issues you want to monitor: timings
+or parameters. <p>See example scenarios in <i>TraceAnalyser overview</i> and
+step-by-step instructions in <a href="../tasks/creating_rules.htm">Creating
+tracing rules</a>. </p></li>
+<li>Transfer your application's SIS file to the device and run it. <p>If some
+tracing rules fail during execution, they are listed on the TraceAnalyser's <b>
+Fail Log</b> tab.</p></li>
+<li>To analyse the failed rule in more detail, double-click it to view it
+in the TraceViewer application. TraceViewer will show the codeline that caused
+the failure.</li>
+</ol><div id="footer">Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
+License: <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.</div> </body></html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser.help/html/gettingstarted/traceanalyser_overview.htm Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,36 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
+<title>TraceAnalyser overview</title>
+<link href="../../book.css" type="text/css" rel="stylesheet"></head>
+<body><h2>TraceAnalyser overview</h2> <p>TraceAnalyser is a tool that enables
+you to supervise the target application's time consumption during an operation,
+or supervise parameters in Open System Trace (OST) traces. </p><p>With this
+tool, you can create a set of rules that define: </p><ul>
+<li>the order and maximum delay between two operations that are traced (see
+example scenario below). </li>
+<li>a desired range for parameter values (for example, <i>"The first parameter
+of Trace A should be at least 150"</i>). </li>
+</ul><p>TraceAnalyser lists both passed and failed events to the main view,
+along with other information such as the pass rate. See the following example:
+</p><p><img src="images\dg_mainview.png" alt="Sample view of data filled in on the tabbed view."></p><p>
+If a rule fails (for example, the interval between operations is longer than
+defined), you can view more information about the violation on the <b>Fail
+Log</b> tab.</p><p>You can also view history graphs of the defined rules,
+to see how the performance of your application has changed over time. </p><h3><a
+name="case1"></a>Example: Analysing timings in a camera application</h3><p>
+When developing a camera application, you might want to define the following
+kind of rule: </p><p><i>“Taking a picture should not take longer than
+5 seconds.”</i></p><p>To monitor this programmatically, you can instrument
+your code so that OST trace is placed to capture the key press for taking
+a picture, and another where the taken picture is shown to the user. The corresponding
+rule would then state that these actions must occur within 5 seconds. </p><h5>
+Related Tasks</h5><ul>
+<li><a href="../tasks/creating_rules.htm">Creating tracing rules</a></li>
+<li><a href="../tasks/modifying_rules.htm">Modifying rules</a></li>
+<li><a href="../tasks/viewing_failed_cases.htm">Viewing the log of failed rules
+<li><a href="../tasks/viewing_the_history.htm">Viewing the rule history</a></li>
+</a></li>
+</ul><div id="footer">Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
+License: <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.</div> </body></html>
Binary file trace/traceanalyser/com.nokia.s60tools.traceanalyser.help/html/images/about_cpp.png has changed
Binary file trace/traceanalyser/com.nokia.s60tools.traceanalyser.help/html/images/background_carbide.jpg has changed
Binary file trace/traceanalyser/com.nokia.s60tools.traceanalyser.help/html/images/brandmark_cpp.gif has changed
Binary file trace/traceanalyser/com.nokia.s60tools.traceanalyser.help/html/images/gold_header.png has changed
Binary file trace/traceanalyser/com.nokia.s60tools.traceanalyser.help/html/images/green_fade_left_68_165_28.png has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser.help/html/index.xml Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?NLS TYPE="org.eclipse.help.index"?>
+
+ <!-- INDEX INSTRUCTIONS
+
+ Use the index.xml file to define the index entries for the plugin's
+ help contents. In Eclipse 3.2 and beyond an Index tab appears in the Help
+ viewer making it possible for user to more easily locate subjects of
+ interest to them.
+
+ In brief, every file used in the help documentation should have at least one
+ associated index entry for it. Ideally, it's simple to make two entries per
+ page by simply re-wording the subject slightly. For example, a view could
+ be indexed twice like this, 1) Breakpoint view, and 2) Views/Breakpoint.
+
+ See ??? for details on creating indexes.
+
+ -->
+
+<index>
+
+ <!-- AAAAAAAA -->
+
+ <!-- BBBBBBBB -->
+
+ <!-- CCCCCCCC -->
+
+ <!-- DDDDDDDD -->
+
+ <!-- EEEEEEEE -->
+
+ <!-- FFFFFFFF -->
+
+ <!-- GGGGGGGG -->
+
+ <!-- HHHHHHHH -->
+
+ <!-- IIIIIIII -->
+
+ <!-- JJJJJJJJ -->
+
+ <!-- KKKKKKKK -->
+
+ <!-- LLLLLLLL -->
+
+
+ <!-- MMMMMMMM -->
+
+ <!-- NNNNNNNN -->
+
+ <!-- OOOOOOOO -->
+
+ <entry keyword="TraceAnalyser overview" >
+ <topic href="html/gettingstarted/traceanalyser_overview.htm" />
+ </entry>
+
+ <!-- PPPPPPPP -->
+
+ <entry keyword="parameter rules" >
+ <topic href="html/tasks/creating_rules.htm" />
+ </entry>
+
+ <!-- QQQQQQQQ -->
+
+ <!-- RRRRRRRR -->
+
+ <!-- SSSSSSSS -->
+
+ <!-- TTTTTTTT -->
+
+ <entry keyword="tracing rules" >
+ <topic href="html/gettingstarted/traceanalyser_overview.htm" />
+ </entry>
+
+ <entry keyword="timing rules" >
+ <topic href="html/tasks/creating_rules.htm" />
+ </entry>
+
+ <entry keyword="Tracing rule walk-through" >
+ <topic href="html/Getting_Started/walk_through.htm" />
+ </entry>
+
+ <!-- UUUUUUUU -->
+
+ <!-- VVVVVVVV -->
+
+ <!-- WWWWWWWW -->
+
+ <!-- XXXXXXXX -->
+
+ <!-- YYYYYYYY -->
+
+ <!-- ZZZZZZZZ -->
+
+</index>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser.help/html/intro/overviewTraceAnalyserExtContent.xml Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<introContent>
+<!-- Extension to the Overview page. -->
+
+ <extensionContent
+ id="com.nokia.s60tools.traceanalyser.help-overview"
+ alt-style="traceanalyser.properties"
+ style="traceanalyser.css"
+ path="overview/@">
+
+ <group
+ id="content-group"
+ style-id="content-group">
+
+ <link
+ label="Trace Analyser Overview"
+ url="http://org.eclipse.ui.intro/showHelpTopic?id=/com.nokia.s60tools.traceanalyser.help/html/gettingstarted/traceanalyser_overview.htm"
+ id="traceanalyser"
+ style-id="content-link">
+ <text>Learn about Trace Analyser and what it can do to improve your development efforts.</text>
+ </link>
+
+ </group>
+
+ </extensionContent>
+
+</introContent>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser.help/html/intro/traceanalyser.css Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,2 @@
+a#traceanalyser img { background-image : url(traceanalyser.gif); }
+a#traceanalyser:hover img { background-image : url(traceanalyser_hov.gif); }
Binary file trace/traceanalyser/com.nokia.s60tools.traceanalyser.help/html/intro/traceanalyser.gif has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser.help/html/intro/traceanalyser.properties Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,9 @@
+
+overview.traceanalyser = html/intro/traceanalyser.gif
+overview.traceanalyser:hover = html/intro/traceanalyser_hov.gif
+
+whatsnew.traceanalyser = html/intro/traceanalyser.gif
+whatsnew.traceanalyser:hover = html/intro/traceanalyser_hov.gif
+
+tutorials.traceanalyser = html/intro/traceanalyser.gif
+tutorials.traceanalyser:hover = html/intro/traceanalyser_hov.gif
Binary file trace/traceanalyser/com.nokia.s60tools.traceanalyser.help/html/intro/traceanalyser_hov.gif has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser.help/html/intro/tutorialsTraceAnalyserExtContent.xml Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<introContent>
+<!-- Extension to the Tutorials page. -->
+
+ <extensionContent
+ id="com.nokia.s60tools.traceanalyser.help-tutorials"
+ alt-style="traceanalyser.properties"
+ style="traceanalyser.css"
+ path="tutorials/@">
+
+ <group
+ id="content-group"
+ style-id="content-group">
+
+ <link
+ label="Trace Analyser tutorial"
+ url="http://org.eclipse.ui.intro/showStandby?partId=org.eclipse.platform.cheatsheet&input=com.nokia.s60tools.traceanalyser.quickstart"
+ id="traceanalyser"
+ style-id="content-link">
+ <text>Start analysing traces by following step-by-step instructions.</text>
+ </link>
+ </group>
+
+ </extensionContent>
+
+</introContent>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser.help/html/intro/whatsnewTraceAnalyserExtContent.xml Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<introContent>
+<!-- Extension to the Whats New page. -->
+
+ <extensionContent
+ id="com.nokia.s60tools.traceanalyser.help-whatsnew"
+ alt-style="traceanalyser.properties"
+ style="traceanalyser.css"
+ path="whatsnew/@">
+
+ <group
+ id="content-group"
+ style-id="content-group">
+
+ <link
+ label="Trace Analyser Release Notes"
+ url="http://org.eclipse.ui.intro/showHelpTopic?id=/com.nokia.s60tools.traceanalyser.help/html/release_notes.htm"
+ id="traceanalyser"
+ style-id="content-link">
+ <text>Learn about what's new in Trace Analyser for this release.</text>
+ </link>
+
+ </group>
+
+ </extensionContent>
+
+</introContent>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser.help/html/legal.htm Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,38 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
+ <title>License Information</title>
+ <link href="../book.css" type="text/css" rel="stylesheet">
+</head>
+
+<body>
+<h3>License Information</h3>
+
+<h5>COPYRIGHTS</h5>
+
+<p>Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights
+reserved. This component and the accompanying materials are made available
+under the terms of "Eclipse Public License v1.0" which accompanies this
+distribution and is available at the URL <a
+href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.</p>
+
+<p>Initial Contributors:<br>
+Nokia Corporation - initial contribution</p>
+
+<h5>NOTICES</h5>
+
+<p>Part of the graphics of the program are from Eclipse 3.1 platform and CDT
+project in Eclipse community, which are made available under the terms of the
+Eclipse Public License v1.0.</p>
+
+<p>A copy of the EPL is provided at <a
+href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html
+</a></p>
+
+<div id="footer">
+Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights
+reserved. License: <a
+href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.</div>
+</body>
+</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser.help/html/release_notes.htm Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,134 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
+ <title>Release Notes</title>
+ <link href="../book.css" type="text/css" rel="stylesheet">
+</head>
+
+<body>
+<h2>Release Notes</h2>
+
+<h4>TraceAnalyser – Version 1.0.5</h4>
+
+<p>Released June 20, 2010</p>
+<ul>
+ <li><a href="#description">Product description</a></li>
+ <li><a href="#features">Main features</a></li>
+ <li><a href="#newfeatures">What's new</a></li>
+ <li><a href="#installation">Installation notes</a></li>
+ <li><a href="#requirements">System requirements</a></li>
+ <li><a href="#compissues">Compatibility issues</a></li>
+ <li><a href="#issues">Known issues</a></li>
+</ul>
+
+<h3><a name="description"></a>Product description</h3>
+
+<p>TraceAnalyser is a tool that enables you to supervise the target
+application's time consumption during an operation, or supervise parameters in
+Open System Trace (OST) traces.</p>
+
+<p>The tool can be started by selecting the <b>Carbide > TraceAnalyser</b>
+menu item.</p>
+
+<h3><a name="features"></a>Main features</h3>
+
+<p>With this tool, you can create a set of rules that define: </p>
+<ul>
+ <li>the order and maximum delay between two operations that are traced, </li>
+ <li>the desired range for parameter values. </li>
+</ul>
+
+<p>TraceAnalyser lists both passed and failed events to the main view, along
+with other information such as the pass rate.</p>
+
+<h3><a name="newfeatures"></a>What's new</h3>
+<ul>
+ <li>TraceAnalyser is now released under EPL license.</li>
+</ul>
+
+<h3><a name="installation"></a>Installation notes</h3>
+<ul>
+ <li>N/A</li>
+</ul>
+
+<h3><a name="requirements"></a>System requirements</h3>
+
+<p>Basic requirements:</p>
+<ul>
+ <li>Windows 2000, Windows XP</li>
+ <li>Minimum SDK build PC.</li>
+ <li>Normal SDK build PC.</li>
+</ul>
+
+<p>Additional requirements:</p>
+<ul>
+ <li>USB connection for connecting your PC to the device. </li>
+ <li>Nokia PC Suite for transferring files from your PC to the device. </li>
+ <li>TraceViewer for activating and viewing the received traces. Available in
+ the Carbide.c++ IDE. </li>
+ <li>(Optional) TraceBuilder for adding OST traces to your application code.
+ Available in the Carbide.c++ IDE. </li>
+ <li>(Optional) TraceSwitch SIS file installed on the device. Available in S60
+ RnD platform releases, under the <b>RnD Tools</b> folder (source directory:
+ <i>\ppd_sw\rd_sw\traceswitch</i>).
+ <p>Together with the ToolsStarter SIS file, TraceSwitch enables an easy
+ plug-and-play tracing solution. For more information, see the
+ <i>TraceSwitch User's Guide</i>, available in the source directory.</p>
+ </li>
+</ul>
+
+<h3><a name="compissues"></a>Compatibility issues</h3>
+<ul>
+ <li>N/A</li>
+</ul>
+
+<h3><a name="issues"></a>Known issues</h3>
+<ul>
+ <li>N/A</li>
+</ul>
+
+<h3>Version history</h3>
+
+<h5>Version 1.0.4 – 8th December 2009</h5>
+
+<p>Bug fixes related to Help</p>
+
+<h5>Version 1.0.3 – 8th December 2009</h5>
+
+<p>Bug fixes related to usage of TraceViewer API. Scrolled traces are now
+filtered out from analysed traces.</p>
+
+<h5>Version 1.0.2 – 6th October 2009</h5>
+
+<p>Bug fixes related tousage of TraceViewer API. Traces received from
+TraceViewer are not anymore cloned.</p>
+
+<h5>Version 1.0.1 – 19th August 2009</h5>
+
+<p>Bug fixes in help links.</p>
+
+<h5>Version 1.0.0 – 25th June 2009</h5>
+
+<p>The first version.</p>
+
+<div id="footer">
+<p>Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies).<br>
+All rights reserved. <br>
+This component and the accompanying materials are made available <br>
+under the terms of "Eclipse Public License v1.0" <br>
+which accompanies this distribution and is available <br>
+at the URL <a
+href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+<br>
+<br>
+Initial Contributors:<br>
+Nokia Corporation - initial contribution <br>
+<br>
+Contributors:<br>
+Description:</p>
+
+<p></p>
+</div>
+</body>
+</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser.help/html/tasks/creating_rules.htm Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,85 @@
+<!--Arbortext, Inc., 1988-2004, v.4002-->
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
+<title>Creating tracing rules</title>
+<link href="../../book.css" type="text/css" rel="stylesheet"></head>
+<body><h2>Creating tracing rules</h2> <h5>Before you start</h5><p>Before you
+can create tracing rules, check that you have: </p><ul>
+<li>compiled your code, </li>
+<li>and loaded the generated dictionary file to TraceViewer. </li>
+</ul><p>See <a href="../gettingstarted/traceanalyser_basic_walkthrough.htm">
+TraceAnalyser basic walk-through</a> for the complete steps. </p><p>To create
+tracing rules, do the following: </p><ol>
+<li>Start TraceAnalyser from the <b>Carbide > TraceAnalyser</b> menu item.
+</li>
+<li>Click <b>Create new rule</b>. <p>The <b>Edit Rule</b> dialog is displayed.
+</p></li>
+<li>From the <b>Rule Type</b> list box, select which kind of rule you are
+creating: <ul>
+<li><b>Timing rule</b> for detecting if an operation can be executed within
+a specified time limit. </li>
+<li><b>Trace parameter rule</b> for detecting if parameters are beyond a desireable
+value range. </li>
+</ul></li>
+<li>In the <b>Rule Name</b> field, type in a name for the rule. <p>For example: <i>
+Camera Test</i>. </p></li>
+<li>(Optional) In the <b>Description</b> field, type in a free-form description
+of what the rule is about. <p> For example, for a timing rule: <i>Test that
+the Camera application is able to capture a picture within 1000ms time limit.
+</i></p></li>
+<li>Configure the rule-specific settings. <p>For instructions, see either <a
+href="#timing">To define timing rules</a> or <a href="#parameter">To define
+parameter rules</a> below. </p></li>
+<li>Connect your PC to the device by using the connection settings defined
+in TraceViewer (USB or XTI). </li>
+<li>In TraceViewer, activate the traces you want to receive. </li>
+<li>Run your application on the device. <p>During execution, TraceAnalyser
+lists both passed and failed events to the main view, along with other information
+such as the pass rate. See the following example: </p><p><img src="images\dg_mainview.png"
+alt="Sample of the main view, showing rules and activated/deactivated cases."></p></li>
+</ol><p>After the rules have been executed, you can do either of the following:
+</p><ul>
+<li><a href="viewing_failed_cases.htm">View the log of failed rules</a>, and
+together with TraceViewer determine which codeline caused the rule violation.
+</li>
+<li><a href="viewing_the_history.htm">View the rule history graph</a> to see
+how the performance of the application has changed over time. </li>
+</ul><p></p><h3><a name="timing"></a>To define timing rules:</h3><ol>
+<li>To select which trace should be monitored as the first part of this rule
+(Trace A), click <b>Select Trace</b>. <p>The <b>Select Trace for Rule</b> dialog
+is opened, showing the trace dictionaries that you loaded in TraceViewer earlier.
+</p></li>
+<li>Select the traces you want to use and click <b>OK. </b> </li>
+<li>Repeat the above steps for Trace B. </li>
+<li>In the <b>Time Limit</b> fields, enter the range the values in milliseconds
+for Trace A and Trace B. <ul>
+<li>For <b>Time Limit A</b>, the value means that Trace B must arrive after
+this. </li>
+<li>For <b>Time Limit B</b>, the value means that Trace B must arrive before
+this. </li>
+</ul><p>The following figure shows an example of how a tracing rule could
+look like: </p><p><img src="images\dg_timingRule.png" alt="Sample of the Edit Rule dialog with the sample values filled in."></p></li>
+<li>To finish, click <b>OK</b>. </li>
+</ol><h3><a name="parameter"></a>To define parameter rules:</h3><ol>
+<li>To select which trace should be monitored as the first part of this rule,
+click <b>Select Trace</b>. <p>The <b>Select Trace for Rule</b> dialog is opened,
+showing the trace dictionaries that you loaded in TraceViewer earlier. </p></li>
+<li>Select the traces you want to use and click <b>OK. </b> </li>
+<li>From the <b>Trace parameter should be</b> list box, select the behavior
+what you want the parameter and values to be: <?Pub Caret><ul>
+<li><b>Greater than/Equal to</b> </li>
+<li><b>Less than/Equal to</b> </li>
+<li><b>Between</b> </li>
+<li><b>Equal to</b> </li>
+</ul><p>The following figure shows an example of how a tracing rule could
+look like: </p><p><img src="images\ParameterRuleDialog.png" alt="Sample of the UI showing values for parameter rule type"></p></li>
+<li>To finish, click <b>OK</b>. </li>
+</ol><h5>Related tasks</h5><ul>
+<li><a href="modifying_rules.htm">Modifying rules</a></li>
+<li><a href="viewing_failed_cases.htm">Viewing the log of failed rules</a></li>
+<li><a href="viewing_the_history.htm">Viewing the rule history</a></li>
+</ul> <div id="footer">Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
+License: <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.</div> </body></html>
+<?Pub *0000004916>
Binary file trace/traceanalyser/com.nokia.s60tools.traceanalyser.help/html/tasks/images/ParameterRuleDialog.png has changed
Binary file trace/traceanalyser/com.nokia.s60tools.traceanalyser.help/html/tasks/images/Thumbs.db has changed
Binary file trace/traceanalyser/com.nokia.s60tools.traceanalyser.help/html/tasks/images/cb_activate.png has changed
Binary file trace/traceanalyser/com.nokia.s60tools.traceanalyser.help/html/tasks/images/default_mainview.png has changed
Binary file trace/traceanalyser/com.nokia.s60tools.traceanalyser.help/html/tasks/images/dg_EditRule.png has changed
Binary file trace/traceanalyser/com.nokia.s60tools.traceanalyser.help/html/tasks/images/dg_FailLog.png has changed
Binary file trace/traceanalyser/com.nokia.s60tools.traceanalyser.help/html/tasks/images/dg_mainview.png has changed
Binary file trace/traceanalyser/com.nokia.s60tools.traceanalyser.help/html/tasks/images/dg_timingRule.png has changed
Binary file trace/traceanalyser/com.nokia.s60tools.traceanalyser.help/html/tasks/images/tab_Graph.png has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser.help/html/tasks/modifying_rules.htm Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,31 @@
+<!--Arbortext, Inc., 1988-2004, v.4002-->
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<?Pub Inc>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
+<title>Modifying rules</title>
+<link href="../../book.css" type="text/css" rel="stylesheet"></head>
+<body><h2>Modifying rules</h2><p>To modify the tracing rules or counters,
+do any of the following: </p><ul>
+<li>To edit rule content, select it and click <b>Edit rule</b>. <p>The <b>
+Edit Rule</b> dialog is displayed, where you can change the range of values
+as needed. To finish, click <b>OK</b>. </p></li>
+<li>To copy a rule as the basis for a new rule, right-click it and select <b>
+Copy Selected Rule</b> from the context menu. The <b>Edit Rule</b> dialog
+is displayed, showing the values of the original rule filled in. Change the
+values as needed and click <b>OK</b>. </li>
+<li>To deactivate a rule from being executed, clear its check box on the main
+view: <p><img src="images\cb_activate.png"></p></li>
+<li>To reset the counters on the main view, select either <b>Reset All Counters
+</b> from the toolbar, or right-click a rule and select <b>Reset Selected
+Rule's Counters</b> from the context menu. </li>
+<li>To remove a rule completely, select it and click <b>Delete Selected Rule
+</b>. </li>
+</ul><h5>Related tasks</h5><ul>
+<li><a href="creating_rules.htm">Creating tracing <?Pub Caret>rules</a></li>
+<li><a href="viewing_failed_cases.htm">Viewing the log of failed rules</a></li>
+<li><a href="viewing_the_history.htm">Viewing the rule history</a></li>
+</ul> <div id="footer">Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
+License: <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.</div></body></html>
+<?Pub *0000001723>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser.help/html/tasks/tasks.htm Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,26 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+<meta http-equiv="content-style-type" content="text/css">
+<title>Configuring tracing rules with TraceAnalyser</title>
+<link href="../../book.css" type="text/css" rel="StyleSheet"></head>
+<body><h2>Configuring tracing rules with TraceAnalyser</h2> <p>TraceAnalyser
+is a tool that enables you to supervise and analyse the target application's
+time consumption during an operation, or supervise parameters in Open System
+Trace (OST) traces. </p><p>With this tool, you can create a set of rules that
+define the order and maximum delay between two traces, or a value range that
+must be met. Whenever some rule fails (for example, an operation takes longer
+than what was required in the rule), a failure log is written to TraceAnalyser's
+interface. You can also view history graphs of the defined rules. </p><p>
+To see an overview of all the steps, start by reading <a href="../gettingstarted/traceanalyser_basic_walkthrough.htm">
+TraceAnalyser basic walk-through</a>. </p><h5>Related tasks</h5><ul>
+<li><a href="../tasks/creating_rules.htm">Creating tracing rules</a></li>
+<li><a href="modifying_rules.htm">Modifying rules</a></li>
+<li><a href="viewing_failed_cases.htm">Viewing the log of failed rules</a></li>
+<li><a href="viewing_the_history.htm">Viewing the rule history</a></li>
+</ul> <div id="footer">Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
+License: <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.</div>
+</body>
+</html>
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser.help/html/tasks/viewing_failed_cases.htm Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,25 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
+<title>Viewing the log of failed rules</title>
+<link href="../../book.css" type="text/css" rel="stylesheet"></head>
+<body><h2>Viewing the log of failed rules</h2> <p>If some of the rules fail
+during execution, the TraceAnalyser icon will quickly flash to indicate that
+a rule violation has occurred. </p><p>To view the failed cases: </p><ol>
+<li>Select the <b>Fail Log</b> tab. <p>The failed rules are listed on the
+view, with a timestamp of the operation, the name of the rule, scope of the
+violation and the limit. </p><p>See the following example: </p><p><img src="images\dg_FailLog.png"
+alt="Sample UI of the Fail Log"></p></li>
+<li>To view the traces that caused the failure, double-click a rule on the
+view. <p>The TraceViewer application opens, and scrolls to the traces. </p></li>
+<li>In TraceViewer, double-click the trace to jump directly to the codeline
+that caused the failure. </li>
+<li>Check the code, fix it as applicable and run the rule again. </li>
+</ol><p>At any time, you can reset the view by clicking <b>Clear Fail Log
+</b>. </p><h5>Related tasks</h5><ul>
+<li><a href="viewing_the_history.htm">Viewing the rule history
+</a></li>
+</ul>.<div id="footer">Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
+License: <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.</div></body></html>
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser.help/html/tasks/viewing_the_history.htm Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,27 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
+<title>Viewing the rule history</title>
+<link href="../../book.css" type="text/css" rel="stylesheet"></head>
+<body><h2>Viewing the rule history</h2> <p>The rule <b>Graph</b> tab shows all detected
+rule events for one rule. In this view, you can inspect how the
+performance of your application has evolved over time. </p>
+<p>To view the graph: </p><ul>
+<li>On the main view, right-click a rule and select <b>Draw History</b> from the context menu. <p>
+A graphical illustration of the performance of the rule is shown at different
+times. </p></li>
+<li><p>You can see the exact timestamp and values at any time by placing the
+cursor on the line. See the example below: </p><p><img src="images\tab_Graph.png"
+alt="Sample of the history graph showing the timestamp and values."></p></li>
+</ul>
+<p>This view helps you track down reasons for your application's performance problems.
+From the graph, you can see when the performance of the application
+has deteriorated significantly. The graph is updated in real time, meaning
+that if it is open while the corresponding rule event is received, the graph is
+updated immediately.</p> <h5>Related tasks</h5><ul>
+<li><a href="modifying_rules.htm">Modifying rules</a></li>
+<li><a href="viewing_failed_cases.htm">Viewing the log of failed rules</a></li>
+</ul>
+<div id="footer">Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
+License: <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.</div><?Pub Caret1> </body></html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser.help/html/tool.htm Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,49 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
+ <title>Carbide.c++ User Guide</title>
+ <link href="../book.css" rel="stylesheet" type="text/css">
+ <style>
+ table, td, th { border: 0px none #FFF; }
+ </style>
+</head>
+
+<body background="images/background_carbide.jpg">
+<p> </p>
+
+<table width="530" border="0" align="center" cellpadding="0" cellspacing="5"
+bgcolor="#FFFFFF">
+ <tbody>
+ <tr>
+ <td width="215"><img src="images/about_cpp.png" width="225"
+ height="200"></td>
+ <td width="294" valign="bottom"><p align="right"><b><img
+ src="images/brandmark_cpp.gif" width="106" height="52"></b></p>
+
+ <p> </p>
+
+ <p> </p>
+
+ <p> </p>
+
+ <p class="titleSmall"></p>
+
+ <p>Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies). All
+ rights reserved.<br>
+ License: <a
+ href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.</p>
+
+ <p></p>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2"><h1 align="center">TraceAnalyser User Guide </h1>
+
+ <p align="center" class="titleSmall">Version 1.0.5; June, 2010</p>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</body>
+</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser.help/html/toolTOC.xml Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?NLS TYPE="org.eclipse.help.toc"?>
+
+<!--
+ Links tool docs to main TOC for Carbide help in the defined location.
+ NOTE: Tool name seems to be ignored here for display purposes but needed to
+ make the link_to section work.
+-->
+
+<!-- Current link_to attribute works on top of Carbide 1.3 -->
+<toc label="TraceAnalyser" link_to="../com.nokia.carbide.help.common/carbideHelpTOC.xml#anchorCarbideFeature">
+
+ <topic label="TraceAnalyser" href="html/tool.htm">
+
+ <topic label="Release notes" href="html/release_notes.htm" />
+
+ <topic label="Getting started" href="html/gettingstarted/gs_index.htm">
+ <topic label="TraceAnalyser overview" href="html/gettingstarted/traceanalyser_overview.htm" />
+ <topic label="TraceAnalyser basic walk-through" href="html/gettingstarted/traceanalyser_basic_walkthrough.htm" />
+ </topic>
+
+ <topic label="Configuring tracing rules with TraceAnalyser" href="html/tasks/tasks.htm">
+ <topic label="Creating rules" href="html/tasks/creating_rules.htm" />
+ <topic label="Modifying rules" href="html/tasks/modifying_rules.htm" />
+ <topic label="Viewing the failed rules" href="html/tasks/viewing_failed_cases.htm" />
+ <topic label="Viewing the rule history" href="html/tasks/viewing_the_history.htm" />
+ </topic>
+
+ <topic label="Legal" href="html/legal.htm" />
+
+ </topic>
+
+
+</toc>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser.help/plugin.xml Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+
+<plugin>
+ <extension point="org.eclipse.help.toc">
+ <toc
+ file="html/toolTOC.xml"
+ primary="true" />
+ <toc
+ file="html/tocTasks.xml"
+ primary="false" />
+ <toc
+ file="html/tocGettingStarted.xml"
+ primary="false" />
+ </extension>
+
+<!-- Carbide.c++ cheatsheets extension -->
+ <extension point="org.eclipse.ui.cheatsheets.cheatSheetContent">
+ <category
+ id="com.nokia.carbide.cpp.tools.cheatsheets"
+ name="Carbide.c++ Tools" />
+ <cheatsheet
+ category="com.nokia.carbide.cpp.tools.cheatsheets"
+ composite="false"
+ contentFile="html/cheatsheet/getStarted_ta_cs.xml"
+ id="com.nokia.s60tools.traceanalyser.quickstart"
+ name="Trace Analyser Quick Start Guide" />
+ </extension>
+
+<!-- CONTEXT IDs for CONTEXTUAL HELP in windows, dialogs, and views -->
+ <extension point="org.eclipse.help.contexts">
+ <contexts
+ file="html/contexts.xml"
+ plugin="com.nokia.s60tools.traceanalyser.help" />
+ </extension>
+
+<!-- CONTEXT IDs for INDEX in windows, dialogs, and views -->
+ <extension point="org.eclipse.help.index">
+ <index file="html/index.xml" />
+ </extension>
+
+<!-- Universal Intro support for welcome pages -->
+ <extension point="org.eclipse.ui.intro.configExtension">
+ <configExtension
+ configId="org.eclipse.ui.intro.universalConfig"
+ content="html/intro/overviewTraceAnalyserExtContent.xml" />
+ <configExtension
+ configId="org.eclipse.ui.intro.universalConfig"
+ content="html/intro/whatsnewTraceAnalyserExtContent.xml" />
+ <configExtension
+ configId="org.eclipse.ui.intro.universalConfig"
+ content="html/intro/tutorialsTraceAnalyserExtContent.xml" />
+ </extension>
+
+</plugin>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser.parameterrule/.classpath Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser.parameterrule/.settings/org.eclipse.jdt.core.prefs Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,7 @@
+#Thu Apr 23 12:23:21 EEST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser.parameterrule/META-INF/MANIFEST.MF Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Parameter Rule Type for Trace Analyser Plug-In
+Bundle-SymbolicName: com.nokia.s60tools.traceanalyser.parameterrule;singleton:=true
+Bundle-Version: 1.0.5
+Bundle-Vendor: Nokia
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Require-Bundle: com.nokia.s60tools.traceanalyser;bundle-version="1.0.0",
+ org.eclipse.core.runtime;bundle-version="3.4.0",
+ org.eclipse.ui;bundle-version="3.4.1",
+ com.nokia.traceviewer;bundle-version="2.0.27"
+Bundle-ActivationPolicy: lazy
+Bundle-Activator: com.nokia.s60tools.traceanalyser.parameterrule.plugin.TraceAnalyserParameterRulePlugin
+Export-Package: com.nokia.s60tools.traceanalyser.parameterrule.rule;x-friends:="com.nokia.s60tools.traceanalyser.tests"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser.parameterrule/build.properties Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser.parameterrule/plugin.xml Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ point="com.nokia.s60tools.traceanalyser.traceanalyserrule"
+ id="com.nokia.s60tools.traceanalyser.parameterrule"
+ name="Paremeter Rule for Trace Analyser">
+ <parameterrule
+ providerName="Parameter Rule"
+ class="com.nokia.s60tools.traceanalyser.parameterrule.rule.ParameterRuleType" />
+ </extension>
+
+</plugin>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser.parameterrule/src/com/nokia/s60tools/traceanalyser/parameterrule/plugin/TraceAnalyserParameterRulePlugin.java Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,69 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.s60tools.traceanalyser.parameterrule.plugin;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class TraceAnalyserParameterRulePlugin extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "com.nokia.s60tools.traceanalyser.parameterrule";
+
+ // The shared instance
+ private static TraceAnalyserParameterRulePlugin plugin;
+
+ /**
+ * TraceAnalyserParameterRulePlugin.
+ * The constructor
+ */
+ public TraceAnalyserParameterRulePlugin() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * getDefault.
+ * Returns the shared instance
+ * @return the shared instance
+ */
+ public static TraceAnalyserParameterRulePlugin getDefault() {
+ return plugin;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser.parameterrule/src/com/nokia/s60tools/traceanalyser/parameterrule/rule/ParameterRule.java Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,470 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.s60tools.traceanalyser.parameterrule.rule;
+
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Date;
+
+import com.nokia.s60tools.traceanalyser.export.GeneralMethods;
+import com.nokia.s60tools.traceanalyser.export.RuleEvent;
+import com.nokia.s60tools.traceanalyser.export.TraceAnalyserRule;
+import com.nokia.s60tools.traceanalyser.export.TraceInfo;
+import com.nokia.s60tools.traceanalyser.export.RuleEvent.RuleStatus;
+import com.nokia.s60tools.traceanalyser.parameterrule.rule.ParameterRuleType.ParameterType;
+import com.nokia.traceviewer.engine.TraceProperties;
+
+public class ParameterRule extends TraceAnalyserRule {
+
+ /* Strings that are searched from xml-file */
+
+ public static final String XML_TRACE = "ParameterTrace";
+ public static final String XML_TYPE = "Type";
+ public static final String XML_LIMITA = "LimitA";
+ public static final String XML_LIMITB = "LimitB";
+
+ private ParameterType parameterType;
+
+ private TraceInfo traceItem;
+
+ private int LimitA;
+ private int LimitB;
+
+ private String workingDirectory;
+
+ /**
+ * ParameterRule.
+ * Constructor
+ */
+ public ParameterRule() {
+ super("Parameter Rule");
+ traceItem = new TraceInfo();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.nokia.s60tools.traceanalyser.export.TraceAnalyserRule#writeXML()
+ */
+ public boolean writeXML(){
+
+ if(rulePath == null){
+ // get directory for rule.
+
+ String path = getNextFreeDirectory(workingDirectory);
+ if(path != null){
+ rulePath = path;
+ }
+ else{
+ return false;
+ }
+ }
+ rulePath = addSlashToEnd(rulePath);
+ if(super.writeBasicInfoIntoFile()){
+ String fileName = rulePath + FILENAME_ADDITIONAL_INFO;
+ try {
+ // Create file
+ FileWriter fstream = new FileWriter(fileName);
+ BufferedWriter output = new BufferedWriter(fstream);
+ output.write(this.getAdditionalInfoXmlString());
+ // Close the output stream
+ output.close();
+ return true;
+ } catch (Exception e) {// Catch exception if any
+ return false;
+ }
+ }
+ return false;
+
+ }
+
+ /**
+ * readXML.
+ * Reads xml-file and formats this rule's definitions. NOTE rulePath needs to be defined before calling this function.
+ */
+ public boolean readXML(){
+ if(super.readXML()){
+
+ if(rulePath != null){
+ String additionalInfoPath = TraceAnalyserRule.addSlashToEnd(rulePath) + FILENAME_ADDITIONAL_INFO;
+ File additionalInfoFile = new File(additionalInfoPath);
+ boolean errorOccured = false;
+ if (additionalInfoFile.exists()) {
+ try {
+ // Create buffered reader.
+ BufferedReader input = new BufferedReader(new FileReader(additionalInfoFile));
+ try {
+ if(!readFile(input)){
+ errorOccured = true;
+ }
+ }
+ catch(Exception e){
+ errorOccured = true;
+ }
+ finally {
+ input.close();
+ }
+ } catch (Exception e) {
+ errorOccured = true;
+ }
+ }
+ if(errorOccured){
+ return false;
+ }
+ else{
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+
+ /**
+ * readFile
+ * Reads xml file given as parameter.
+ * @param input bufferedReader opened to inputFile.
+ * @throws IOException if file operations fails.
+ * @return true if file was read successfully
+ */
+ private boolean readFile(BufferedReader input) throws IOException{
+ String line = null;
+
+ // This while loop searches xml tags from file. When tag is found information is saved and
+ // new searchPhrase is updated. Tags are searched in order where they should be.
+
+ if(!traceItem.readXMLBuffer(input, XML_TRACE)){
+ return false;
+ }
+
+
+ String searchPhrase = XML_TYPE;
+ while ((line = input.readLine()) != null) {
+ if (line.contains(searchPhrase)) {
+ if(searchPhrase.equals(XML_TYPE)){
+ String type = GeneralMethods.getTextBetweenQuotes(line);
+ if(!setParameterString(type)){
+ return false;
+ }
+ searchPhrase = XML_LIMITA;
+
+ }
+
+ else if(searchPhrase.equals(XML_LIMITA)){
+ LimitA = Integer.parseInt(GeneralMethods.getTextBetweenQuotes(line));
+ searchPhrase = XML_LIMITB;
+
+ }
+ else if(searchPhrase.equals(XML_LIMITB)){
+ LimitB = Integer.parseInt(GeneralMethods.getTextBetweenQuotes(line));
+ return true;
+ }
+
+ }
+
+ }
+ return false;
+ }
+
+ /**
+ * getAdditionalInfoXmlString.
+ * @return XML string that can be written to file.
+ */
+ private String getAdditionalInfoXmlString(){
+ String xml = "";
+ xml += "<AdditionalInfo>\n";
+ xml += " <Traces>\n";
+ xml += traceItem.getXMLString(XML_TRACE,8);
+ xml += " </Traces>\n";
+ xml += " <Limitations>\n";
+ xml += getLimitationInfoXmlString(8);
+ xml += " </Limitations>\n";
+ xml += "</AdditionalInfo>\n";
+ return xml;
+ }
+
+
+ /**
+ * getTimingInfoXmlString.
+ * @param indent indent that is used.
+ * @return xml-string that can be written to file.
+ */
+ private String getLimitationInfoXmlString(int indent){
+ String xml = "";
+ String indentString = this.getIndentString(indent);
+
+ xml += indentString + "<ParameterType=\"";
+ xml += getParameterString();
+ xml += "\">\n";
+
+ xml += indentString + "<" + XML_LIMITA + "=\"";
+ xml += Integer.toString(LimitA);
+ xml += "\">\n";
+
+ xml += indentString + "<" + XML_LIMITB+ "=\"";
+ xml += Integer.toString(LimitB);
+ xml += "\">\n";
+
+
+ return xml;
+ }
+
+
+ /**
+ * getParameterString.
+ * Returns parameter String
+ * @return Parameter type.
+ */
+ public String getParameterString(){
+ if(parameterType == ParameterType.BETWEEN){
+ return ParameterRuleType.TYPE_COMBO_TEXTS_BETWEEN;
+ }
+ else if(parameterType == ParameterType.EQUAL){
+ return ParameterRuleType.TYPE_COMBO_TEXTS_EQUAL_TO;
+ }
+ else if(parameterType == ParameterType.GREATER){
+ return ParameterRuleType.TYPE_COMBO_TEXTS_GREATER_THAN;
+ }
+ else if(parameterType == ParameterType.LESS){
+ return ParameterRuleType.TYPE_COMBO_TEXTS_LESS_THAN;
+ }
+ else{
+ return null;
+ }
+ }
+
+ /**
+ * setParameterString.
+ * @param type Sets parameter string
+ * @return true if string was equal to some rule type.
+ */
+ public boolean setParameterString(String type){
+ if(type.equals(ParameterRuleType.TYPE_COMBO_TEXTS_BETWEEN)){
+ this.parameterType = ParameterType.BETWEEN;
+ return true;
+ }
+ else if(type.equals(ParameterRuleType.TYPE_COMBO_TEXTS_EQUAL_TO)){
+ this.parameterType = ParameterType.EQUAL;
+ return true;
+ }
+ else if(type.equals(ParameterRuleType.TYPE_COMBO_TEXTS_GREATER_THAN)){
+ this.parameterType = ParameterType.GREATER;
+ return true;
+ }
+ else if(type.equals(ParameterRuleType.TYPE_COMBO_TEXTS_LESS_THAN)){
+ this.parameterType = ParameterType.LESS;
+ return true;
+ }
+ else{
+ return false;
+ }
+ }
+
+
+ /*
+ * (non-Javadoc)
+ * @see com.nokia.s60tools.traceanalyser.export.TraceAnalyserRule#checkIfRuleFails(com.nokia.traceviewer.engine.TraceProperties)
+ */
+ public RuleEvent checkRuleStatus(TraceProperties traceProperties) {
+
+
+
+ //get properties of trace:
+ ArrayList<String> properties = traceProperties.parameters;
+ if(properties.size() == 0){
+ return new RuleEvent(RuleStatus.NONE);
+ }
+
+ if(TraceInfo.compareTraces(traceProperties.information, traceItem.getIdNumbers())){
+ //TODO trycatch
+ int parameter = Integer.parseInt(properties.get(0));
+
+ int violation = 0;
+ RuleStatus status = RuleStatus.PASS;
+ int limit = 0;
+
+ if(parameterType == ParameterType.LESS){
+ if( !(parameter <= LimitA) ){
+ status = RuleStatus.FAIL;
+ violation = parameter - LimitA;
+ limit = LimitA;
+ }
+ else{
+ status = RuleStatus.PASS;
+ }
+
+
+ }
+ else if(parameterType == ParameterType.EQUAL){
+ if(parameter != LimitA ){
+ status = RuleStatus.FAIL;
+ violation = parameter - LimitA;
+ limit = LimitA;
+ }
+ else{
+ status = RuleStatus.PASS;
+ }
+ }
+ else if(parameterType == ParameterType.GREATER){
+ if( !(parameter >= LimitA) ){
+ status = RuleStatus.FAIL;
+ violation = parameter - LimitA;
+ limit = LimitA;
+ }
+ else{
+ status = RuleStatus.PASS;
+ }
+
+ }
+
+ else if(parameterType == ParameterType.BETWEEN){
+ if(parameter < LimitA){
+ status = RuleStatus.FAIL;
+ violation = parameter - LimitA;
+ limit = LimitA;
+
+ }
+ else if(parameter > LimitB){
+ status = RuleStatus.FAIL;
+ violation = parameter - LimitB;
+ limit = LimitB;
+ }
+ else{
+ status = RuleStatus.PASS;
+
+ }
+
+ }
+ return new RuleEvent( status, parameter, limit, violation, name, "",
+ new Date(), new int[]{traceProperties.traceNumber} );
+
+
+ }
+ return new RuleEvent(RuleStatus.NONE);
+
+
+
+ }
+
+
+
+
+
+
+ /*
+ * (non-Javadoc)
+ * @see com.nokia.s60tools.traceanalyser.export.TraceAnalyserRule#getUnit()
+ */
+ public String getUnit(){
+ return "";
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.nokia.s60tools.traceanalyser.export.TraceAnalyserRule#equals(com.nokia.s60tools.traceanalyser.export.TraceAnalyserRule)
+ */
+ public boolean equals(TraceAnalyserRule rule) {
+ ParameterRule parameterRule = (ParameterRule) rule;
+ if (parameterRule.getName().equals(this.name)
+ && parameterRule.getDescription().equals(this.description)
+ && parameterRule.getLimitA() == this.LimitA
+ && parameterRule.getTraceItem().equals(this.traceItem)) {
+ if (parameterRule.getParameterType() == ParameterType.BETWEEN &&
+ parameterRule.getLimitB() != this.LimitB ){
+ return false;
+ }
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.nokia.s60tools.traceanalyser.export.TraceAnalyserRule#getLimits()
+ */
+ public int[] getLimits() {
+ if(parameterType == ParameterType.BETWEEN){
+ return new int[]{LimitA, LimitB};
+ }
+ else{
+ return new int[]{LimitA};
+
+ }
+ }
+
+ /* Getters and setters for member variables. */
+
+
+ public String getWorkingDirectory() {
+ return workingDirectory;
+ }
+
+ public void setWorkingDirectory(String workingDirectory) {
+ this.workingDirectory = workingDirectory;
+ }
+
+ public TraceInfo getTraceItem() {
+ return traceItem;
+ }
+
+ public void setTraceItem(TraceInfo traceItem) {
+ this.traceItem = traceItem;
+ }
+
+
+
+ public int getLimitA() {
+ return LimitA;
+ }
+
+ public void setLimitA(int limitA) {
+ LimitA = limitA;
+ }
+
+ public int getLimitB() {
+ return LimitB;
+ }
+
+ public void setLimitB(int limitB) {
+ LimitB = limitB;
+ }
+
+ public ParameterType getParameterType() {
+ return parameterType;
+ }
+
+ public void setParameterType(ParameterType parameterType) {
+ this.parameterType = parameterType;
+ }
+
+
+
+
+
+
+
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser.parameterrule/src/com/nokia/s60tools/traceanalyser/parameterrule/rule/ParameterRuleType.java Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,466 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.s60tools.traceanalyser.parameterrule.rule;
+
+import java.io.File;
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+
+import com.nokia.s60tools.traceanalyser.export.ITraceAnalyserRuleType;
+import com.nokia.s60tools.traceanalyser.export.ITraceAnalyserRuleTypeListener;
+import com.nokia.s60tools.traceanalyser.export.ITraceSelectionCompositeListener;
+import com.nokia.s60tools.traceanalyser.export.TraceAnalyserRule;
+import com.nokia.s60tools.traceanalyser.export.TraceInfo;
+import com.nokia.s60tools.traceanalyser.export.TraceSelectionComposite;
+import com.nokia.s60tools.traceanalyser.parameterrule.plugin.TraceAnalyserParameterRulePlugin;
+import com.nokia.traceviewer.engine.TraceInformation;
+
+/**
+ * class Parameter Rule.
+ * "Parameter Rule"-rule type for Trace Analyser
+ */
+
+public class ParameterRuleType implements ITraceAnalyserRuleType, ITraceSelectionCompositeListener, SelectionListener, ModifyListener{
+
+ public static enum ParameterType{GREATER, LESS, BETWEEN, EQUAL};
+
+ public static final String TYPE_COMBO_TEXTS_GREATER_THAN = "Greater than/Equal to";
+ public static final String TYPE_COMBO_TEXTS_LESS_THAN = "Less than/Equal to";
+ public static final String TYPE_COMBO_TEXTS_BETWEEN = "Between";
+ public static final String TYPE_COMBO_TEXTS_EQUAL_TO = "Equal to";
+
+ /* UI components */
+ private GridData gridDataComposite;
+ private Composite compositeParameterRule;
+ private Combo comboParameterType;
+ private Text textParameterValue1;
+ private Text textParameterValue2;
+ private GridData gridDataTextRuleName2;
+ private GridData gridDataLabelAndText;
+ private Label labelAndText;
+
+ /* Trace Selection composites */
+ TraceSelectionComposite traceSelectionComposite;
+
+ /* Edit rule-window */
+ ITraceAnalyserRuleTypeListener listener;
+
+
+ /**
+ * TimingRule.
+ * constructor
+ */
+ public ParameterRuleType(){
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.nokia.s60tools.traceanalyser.export.ITraceAnalyserRule#createUIComponents(org.eclipse.swt.widgets.Composite)
+ */
+ public void createUIComponents(Composite composite, ITraceAnalyserRuleTypeListener listener) {
+
+ this.listener = listener;
+
+ // Create composite for rule
+ compositeParameterRule = new Composite(composite, SWT.NONE);
+ GridLayout layoutcompositeParameterRule = new GridLayout();
+ layoutcompositeParameterRule.numColumns = 1;
+ compositeParameterRule.setLayout(layoutcompositeParameterRule);
+ gridDataComposite = new GridData(GridData.FILL_HORIZONTAL);
+ compositeParameterRule.setLayoutData(gridDataComposite);
+
+ // create trace selection components.
+ traceSelectionComposite = new TraceSelectionComposite(compositeParameterRule, "Trace:", this);
+
+ // create composite for parameters
+ Composite compositeParameters = new Composite(compositeParameterRule, SWT.NONE);
+ GridLayout layoutcompositeParameters = new GridLayout();
+ layoutcompositeParameters.numColumns = 4;
+ compositeParameters.setLayout(layoutcompositeParameters);
+ GridData gridDataCompositeParameters = new GridData(GridData.FILL_HORIZONTAL);
+ compositeParameters.setLayoutData(gridDataCompositeParameters);
+
+ createParameterComponents(compositeParameters);
+
+
+ }
+
+ private void createParameterComponents(Composite composite){
+
+ // create label
+ Label labelParameterText = new Label(composite, SWT.NONE);
+ labelParameterText.setText("Trace parameter(integer) should be:");
+ GridData gridDataLabelParameterText = new GridData(GridData.BEGINNING);
+ gridDataLabelParameterText.horizontalSpan = 4;
+ labelParameterText.setLayoutData(gridDataLabelParameterText);
+
+
+ // Parameter type
+ comboParameterType = new Combo(composite, SWT.READ_ONLY);
+ GridData dataGridComboparameterTypeCombo = new GridData(GridData.BEGINNING);
+ comboParameterType.setLayoutData(dataGridComboparameterTypeCombo);
+
+ String[] parameterTypes = new String[]{ TYPE_COMBO_TEXTS_GREATER_THAN, TYPE_COMBO_TEXTS_LESS_THAN,
+ TYPE_COMBO_TEXTS_BETWEEN, TYPE_COMBO_TEXTS_EQUAL_TO };
+ comboParameterType.setItems(parameterTypes);
+ comboParameterType.select(0);
+
+ // Create rule name text field
+ textParameterValue1 = new Text(composite, SWT.BORDER);
+ GridData gridDataTextRuleName = new GridData(GridData.BEGINNING);
+ gridDataTextRuleName.widthHint = 30;
+
+ textParameterValue1.setToolTipText("Define Parameter");
+ textParameterValue1.setLayoutData(gridDataTextRuleName);
+
+ // create label
+ labelAndText = new Label(composite, SWT.NONE);
+ labelAndText.setText(" and ");
+ gridDataLabelAndText = new GridData(GridData.BEGINNING);
+ labelAndText.setLayoutData(gridDataLabelAndText);
+
+ textParameterValue2 = new Text(composite, SWT.BORDER);
+ gridDataTextRuleName2 = new GridData(GridData.BEGINNING);
+ gridDataTextRuleName2.widthHint = 30;
+ textParameterValue2.setToolTipText("Define Parameter");
+ textParameterValue2.setLayoutData(gridDataTextRuleName2);
+
+
+ Listener inputListener = new Listener() {
+ public void handleEvent(Event event) {
+ String string = event.text;
+ char[] chars = new char[string.length()];
+ string.getChars(0, chars.length, chars, 0);
+ for (int i = 0; i < chars.length; i++) {
+ if (!('0' <= chars[i] && chars[i] <= '9')) {
+ event.doit = false;
+ return;
+ }
+ }
+
+ }
+
+ };
+ // Set text box to accept only numbers.
+ textParameterValue1.addListener(SWT.Verify, inputListener);
+ textParameterValue2.addListener(SWT.Verify, inputListener);
+
+ comboParameterType.addSelectionListener(this);
+ textParameterValue1.addModifyListener(this);
+ textParameterValue2.addModifyListener(this);
+
+/* comboParameterType.addSelectionListener(new SelectionListener(){
+
+ public void widgetDefaultSelected(SelectionEvent event) {
+ // Nothing to be done
+
+ }
+
+ public void widgetSelected(SelectionEvent arg0) {
+
+
+ hideAndRevealParameter2();
+ listener.canFinish();
+ }
+
+ });
+ */
+ }
+
+ private void hideAndRevealParameter2(){
+ boolean value = false;
+ if(comboParameterType.getText().equals("Between")){
+ value = true;
+ }
+ textParameterValue2.setVisible(value);
+ labelAndText.setVisible(value);
+
+ gridDataLabelAndText.exclude = !value;
+ gridDataTextRuleName2.exclude = !value;
+
+ textParameterValue2.getParent().layout();
+ textParameterValue2.getParent().redraw();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.nokia.s60tools.traceanalyser.export.ITraceAnalyserRule#setVisible(boolean)
+ */
+ public void setVisible(boolean value){
+ compositeParameterRule.setVisible(value);
+ gridDataComposite.exclude = !value;
+ hideAndRevealParameter2();
+
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.nokia.s60tools.traceanalyser.export.ITraceAnalyserRuleType#saveRule(java.lang.String, java.lang.String)
+ */
+ public TraceAnalyserRule getRule(String name, String description){
+
+ // Create new parameter rule.
+ ParameterRule newRule = new ParameterRule();
+
+ // set basic info.
+ newRule.setName(name);
+ newRule.setDescription(description);
+
+
+ // set directory for rule.
+ newRule.setWorkingDirectory(getPluginWorkingLocation());
+
+ // set trace item for rule.
+ newRule.setTraceItem(traceSelectionComposite.getTraceInformation());
+
+
+
+ // set parameter type for rule.
+
+ if(comboParameterType.getText().equals(TYPE_COMBO_TEXTS_GREATER_THAN)){
+ newRule.setParameterType(ParameterType.GREATER);
+ }
+ else if(comboParameterType.getText().equals(TYPE_COMBO_TEXTS_EQUAL_TO)){
+ newRule.setParameterType(ParameterType.EQUAL);
+
+ }
+ else if(comboParameterType.getText().equals(TYPE_COMBO_TEXTS_BETWEEN)){
+ newRule.setParameterType(ParameterType.BETWEEN);
+
+ }
+ else if(comboParameterType.getText().equals(TYPE_COMBO_TEXTS_LESS_THAN)){
+ newRule.setParameterType(ParameterType.LESS);
+
+ }
+
+ // if empty, set to zero.
+ if(textParameterValue1.getText() == ""){
+ textParameterValue1.setText("0");
+ }
+
+ if(newRule.getParameterType() != ParameterType.BETWEEN || textParameterValue2.getText() == ""){
+ textParameterValue2.setText("0");
+
+ }
+ int limitA = 0;
+ int limitB = 0;
+ try{
+ limitA = Integer.parseInt(textParameterValue1.getText());
+ limitB = Integer.parseInt(textParameterValue2.getText());
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ newRule.setLimitA(limitA);
+ newRule.setLimitB(limitB);
+
+ // write rule into xml-file.
+ // if(newRule.writeXML()){
+ return newRule;
+ //}
+ //else{
+ //return null;
+ // }
+ //return null;
+ }
+
+
+ /**
+ * getPluginWorkingLocation.
+ * Returns a path where Rule plugin can do various tasks (located under workspace).
+ */
+ public static String getPluginWorkingLocation() {
+ IPath location = Platform.getStateLocation( TraceAnalyserParameterRulePlugin.getDefault().getBundle());
+ return location.toOSString();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.nokia.s60tools.traceanalyser.export.ITraceAnalyserRuleType#getRules()
+ */
+ public ArrayList<TraceAnalyserRule> getRules(){
+
+ ArrayList<TraceAnalyserRule> rules = new ArrayList<TraceAnalyserRule>();
+ File rootFolder = new File(getPluginWorkingLocation());
+ File[] rootFiles = rootFolder.listFiles();
+ int i = 0;
+
+ while( i < rootFiles.length ){
+ if(rootFiles[i].isDirectory()){
+ // Create new rule.
+ ParameterRule rule = new ParameterRule();
+ rule.setRulePath(rootFiles[i].toString());
+
+ // read XML, if successful add object to arraylist.
+ if( rule.readXML() ){
+ rules.add(rule);
+ }
+ }
+ i++;
+
+ }
+
+ return rules;
+
+ }
+
+ /**
+ * getRuleType.
+ * @param this rule types name.
+ */
+ public String getRuleType() {
+ return "Parameter Rule";
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.nokia.s60tools.traceanalyser.export.ITraceAnalyserRuleType#formatRuleDefinitions(com.nokia.s60tools.traceanalyser.export.TraceAnalyserRule)
+ */
+ public boolean formatRuleDefinitions(TraceAnalyserRule rule) {
+
+ if(ParameterRule.class == rule.getClass()){
+ ParameterRule parameterRule = (ParameterRule) rule;
+
+ traceSelectionComposite.setTraceItem(parameterRule.getTraceItem());
+
+ comboParameterType.select(parameterRule.getParameterType().ordinal());
+
+ textParameterValue1.setText(Integer.toString(parameterRule.getLimitA()));
+ textParameterValue2.setText(Integer.toString(parameterRule.getLimitB()));
+
+ return true;
+ }
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.nokia.s60tools.traceanalyser.export.ITraceAnalyserRuleType#canFinish()
+ */
+ public String canFinish() {
+ if(traceSelectionComposite.getTraceInformation() == null ){
+ return "Trace must be defined.";
+ }
+ if(textParameterValue1.getText().equals("")){
+ return "Limit must be defined.";
+ }
+
+ if(textParameterValue2.isVisible() && textParameterValue2.getText().equals("")){
+ return "Both Limits must be defined";
+ }
+
+ if(comboParameterType.getText().equals(TYPE_COMBO_TEXTS_BETWEEN)){
+ int limit1 = Integer.parseInt(textParameterValue1.getText());
+ int limit2 = Integer.parseInt(textParameterValue2.getText());
+ if(limit1 >= limit2 ){
+ return "Second limitation parameter must be greater that first.";
+ }
+ }
+
+
+ return null;
+
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.nokia.s60tools.traceanalyser.export.ITraceSelectionCompositeListener#traceInfoUpdated()
+ */
+ public void traceInfoUpdated() {
+ listener.canFinish();
+ }
+
+ public void widgetDefaultSelected(SelectionEvent arg0) {
+ // Nothing to be done
+
+ }
+
+ public void widgetSelected(SelectionEvent event) {
+
+ if(event.widget == comboParameterType){
+ hideAndRevealParameter2();
+ listener.canFinish();
+ }
+ }
+
+ public void modifyText(ModifyEvent arg0) {
+ listener.canFinish();
+
+ }
+
+ static public ParameterRule createDummyRule(String ruleName, ParameterType type){
+ // Create new timing rule.
+
+ ParameterRule newRule = new ParameterRule();
+
+ // set basic info.
+ newRule.setName(ruleName);
+ newRule.setDescription("testDescription");
+
+ // set directory for rule.
+ newRule.setWorkingDirectory(getPluginWorkingLocation());
+
+ // set trace items for rule.
+ TraceInfo info1 = new TraceInfo();
+ TraceInformation information = new TraceInformation();
+ information.setTraceId(1);
+ info1.setIdNumbers(information);
+ info1.setIdNumbers(information);
+
+ newRule.setTraceItem(info1);
+
+ newRule.setParameterType(type);
+
+
+ int limitA = 0;
+ int limitB = 0;
+ try{
+ limitA = Integer.parseInt("10");
+ limitB = Integer.parseInt("100");
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ newRule.setLimitA(limitA);
+ if(type == ParameterType.BETWEEN){
+ newRule.setLimitB(limitB);
+ }
+ // write rule into xml-file.
+ return newRule;
+
+ }
+
+
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser.timingrule/.classpath Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser.timingrule/.settings/org.eclipse.jdt.core.prefs Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,7 @@
+#Tue Mar 17 13:09:19 EET 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser.timingrule/META-INF/MANIFEST.MF Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Timing Rule Type for Trace Analyser Plug-In
+Bundle-SymbolicName: com.nokia.s60tools.traceanalyser.timingrule;singleton:=true
+Bundle-Version: 1.0.5
+Bundle-Vendor: Nokia
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Require-Bundle: com.nokia.s60tools.traceanalyser;bundle-version="1.0.0",
+ org.eclipse.core.runtime;bundle-version="3.4.0",
+ org.eclipse.ui;bundle-version="3.4.1",
+ com.nokia.traceviewer;bundle-version="2.0.27"
+Bundle-ActivationPolicy: lazy
+Bundle-Activator: com.nokia.s60tools.traceanalyser.timingrule.plugin.TraceAnalyserTimingRulePlugin
+Export-Package: com.nokia.s60tools.traceanalyser.timingrule.rule;x-friends:="com.nokia.s60tools.traceanalyser.tests"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser.timingrule/build.properties Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser.timingrule/plugin.xml Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ point="com.nokia.s60tools.traceanalyser.traceanalyserrule"
+ id="com.nokia.s60tools.traceanalyser.timingrule"
+ name="Timing Rule for Trace Analyser">
+ <timingrule
+ providerName="Timing Rule"
+ class="com.nokia.s60tools.traceanalyser.timingrule.rule.TimingRuleType" />
+ </extension>
+
+</plugin>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser.timingrule/src/com/nokia/s60tools/traceanalyser/timingrule/plugin/TraceAnalyserTimingRulePlugin.java Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,69 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.s60tools.traceanalyser.timingrule.plugin;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class TraceAnalyserTimingRulePlugin extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "com.nokia.s60tools.traceanalyser.timingrule";
+
+ // The shared instance
+ private static TraceAnalyserTimingRulePlugin plugin;
+
+ /**
+ * TraceAnalyserTimingRulePlugin.
+ * The constructor
+ */
+ public TraceAnalyserTimingRulePlugin() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * getDefault.
+ * Returns the shared instance
+ * @return the shared instance
+ */
+ public static TraceAnalyserTimingRulePlugin getDefault() {
+ return plugin;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser.timingrule/src/com/nokia/s60tools/traceanalyser/timingrule/rule/TimingRule.java Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,365 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.s60tools.traceanalyser.timingrule.rule;
+
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.Date;
+
+import com.nokia.s60tools.traceanalyser.export.GeneralMethods;
+import com.nokia.s60tools.traceanalyser.export.RuleEvent;
+import com.nokia.s60tools.traceanalyser.export.TraceAnalyserRule;
+import com.nokia.s60tools.traceanalyser.export.TraceInfo;
+import com.nokia.s60tools.traceanalyser.export.RuleEvent.RuleStatus;
+import com.nokia.traceviewer.engine.TraceInformation;
+import com.nokia.traceviewer.engine.TraceProperties;
+
+public class TimingRule extends TraceAnalyserRule {
+
+ /* Strings that are searched from xml-file */
+ public static final String XML_COMPONENT_ID = "ComponentID";
+ public static final String XML_GROUP_ID = "GroupID";
+ public static final String XML_TRACE_ID = "TraceID";
+ public static final String XML_TRACE_NAME = "TraceName";
+ public static final String XML_TIME_LIMIT_A = "TimeLimitA";
+ public static final String XML_TIME_LIMIT_B = "TimeLimitB";
+
+
+
+
+ /* Trace items assigned for this rule */
+ private TraceInfo traceItemA;
+ private TraceInfo traceItemB;
+
+ /* Time limits assigned for this rule */
+ private int timeLimitA;
+ private int timeLimitB;
+
+ /* previous trace event that has something to do with this rule */
+ //private TraceProperties previousEvent;
+
+ private int previousTraceNumber;
+ private long previousTraceTimeStamp;
+
+ private String workingDirectory;
+
+ /**
+ * TimingRule.
+ * Constructor
+ */
+ public TimingRule() {
+ super("Timing Rule");
+ traceItemA = new TraceInfo();
+ traceItemB = new TraceInfo();
+ previousTraceNumber = -1;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.nokia.s60tools.traceanalyser.export.TraceAnalyserRule#writeXML()
+ */
+ public boolean writeXML(){
+
+ if(rulePath == null){
+ // get directory for rule.
+
+ String path = getNextFreeDirectory(workingDirectory);
+ if(path != null){
+ rulePath = path;
+ }
+ else{
+ return false;
+ }
+ }
+ rulePath = addSlashToEnd(rulePath);
+ if(super.writeBasicInfoIntoFile()){
+ String fileName = rulePath + FILENAME_ADDITIONAL_INFO;
+ try {
+ // Create file
+ FileWriter fstream = new FileWriter(fileName);
+ BufferedWriter output = new BufferedWriter(fstream);
+ output.write(this.getAdditionalInfoXmlString());
+ // Close the output stream
+ output.close();
+ return true;
+ } catch (Exception e) {// Catch exception if any
+ return false;
+ }
+ }
+ return false;
+
+ }
+
+ /**
+ * readXML.
+ * Reads xml-file and formats this rule's definitions. NOTE rulePath needs to be defined before calling this function.
+ */
+ public boolean readXML(){
+ if(super.readXML()){
+
+ if(rulePath != null){
+ String additionalInfoPath = TraceAnalyserRule.addSlashToEnd(rulePath) + FILENAME_ADDITIONAL_INFO;
+ File additionalInfoFile = new File(additionalInfoPath);
+ boolean errorOccured = false;
+ if (additionalInfoFile.exists()) {
+ try {
+ // Create buffered reader.
+ BufferedReader input = new BufferedReader(new FileReader(additionalInfoFile));
+ try {
+ if(!readFile(input)){
+ errorOccured = true;
+ }
+ }
+ catch(Exception e){
+ errorOccured = true;
+ }
+ finally {
+ input.close();
+ }
+ } catch (Exception e) {
+ errorOccured = true;
+ }
+ }
+ if(errorOccured){
+ return false;
+ }
+ else{
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+
+ /**
+ * readFile.
+ * Reads xml file given as parameter.
+ * @param input bufferedReader opened to inputFile.
+ * @throws IOException if file operations fails.
+ * @return true if rule was read successfully
+ */
+ private boolean readFile(BufferedReader input) throws IOException{
+ String line = null;
+
+ // This while loop searches xml tags from file. When tag is found information is saved and
+ // new searchPhrase is updated. Tags are searched in order where they should be.
+
+ if(!traceItemA.readXMLBuffer(input, "TraceA")){
+ return false;
+ }
+
+ if(!traceItemB.readXMLBuffer(input, "TraceB")){
+ return false;
+ }
+
+ String searchPhrase = XML_TIME_LIMIT_A;
+ while ((line = input.readLine()) != null) {
+ if (line.contains(searchPhrase)) {
+ if(searchPhrase.equals(XML_TIME_LIMIT_A)){
+ timeLimitA = Integer.parseInt(GeneralMethods.getTextBetweenQuotes(line));
+ searchPhrase = XML_TIME_LIMIT_B;
+
+ }
+ else if(searchPhrase.equals(XML_TIME_LIMIT_B)){
+ timeLimitB = Integer.parseInt(GeneralMethods.getTextBetweenQuotes(line));
+ return true;
+ }
+
+ }
+
+ }
+ return false;
+ }
+
+ /**
+ * getAdditionalInfoXmlString.
+ * @return XML string that can be written to file.
+ */
+ private String getAdditionalInfoXmlString(){
+ String xml = "";
+ xml += "<AdditionalInfo>\n";
+ xml += " <Traces>\n";
+ xml += traceItemA.getXMLString("TraceA",8);
+ xml += traceItemB.getXMLString("TraceB",8);
+ xml += " </Traces>\n";
+ xml += " <TimingInfo>\n";
+ xml += getTimingInfoXmlString(8);
+ xml += " </TimingInfo>\n";
+ xml += "</AdditionalInfo>\n";
+ return xml;
+ }
+
+ /**
+ * getTimingInfoXmlString.
+ * @param indent indent that is used.
+ * @return xml-string that can be written to file.
+ */
+ private String getTimingInfoXmlString(int indent){
+ String xml = "";
+ String indentString = this.getIndentString(indent);
+ xml += indentString + "<" + XML_TIME_LIMIT_A +"=\"";
+ xml += Integer.toString(timeLimitA);
+ xml += "\">\n";
+ xml += indentString + "<" + XML_TIME_LIMIT_B +"=\"";
+ xml += Integer.toString(timeLimitB);
+ xml += "\">\n";
+
+ return xml;
+ }
+
+
+
+ /*
+ * (non-Javadoc)
+ * @see com.nokia.s60tools.traceanalyser.export.TraceAnalyserRule#checkIfRuleFails(com.nokia.traceviewer.engine.TraceProperties)
+ */
+ public RuleEvent checkRuleStatus(TraceProperties traceProperties) {
+
+
+ // check if received trace is trace A
+ if(TraceInfo.compareTraces(traceProperties.information, traceItemA.getIdNumbers())){
+ previousTraceNumber = traceProperties.traceNumber;
+ previousTraceTimeStamp = traceProperties.timestamp;
+
+ //previousEvent = traceProperties.clone();
+ /*previousEvent = new TraceProperties(null);
+ previousEvent.timestamp = traceProperties.timestamp;
+ previousEvent.traceNumber = traceProperties.traceNumber;*/
+
+ }
+
+ // Check if received trace is trace B
+ else if(TraceInfo.compareTraces(traceProperties.information, traceItemB.getIdNumbers()) && previousTraceNumber != -1){
+
+
+ long difference = traceProperties.timestamp - previousTraceTimeStamp;
+ double doubleDiff = difference/1000000.0000;
+ difference = Math.round(doubleDiff);
+
+ int[] traceNumbers = new int[]{previousTraceNumber, traceProperties.traceNumber};
+ previousTraceNumber = -1;
+
+ if(timeLimitA > difference){
+ int violation = (int)difference - timeLimitA;
+ return new RuleEvent(RuleStatus.FAIL, (int)difference, timeLimitA, violation, name, "ms",
+ new Date(), traceNumbers );
+ }
+ if(timeLimitB < difference){
+ int violation = (int)difference - timeLimitB;
+ return new RuleEvent(RuleStatus.FAIL, (int)difference, timeLimitB, violation, name, "ms",
+ new Date(), traceNumbers );
+ }
+ return new RuleEvent(RuleStatus.PASS, (int)difference, new Date(), "ms");
+
+ }
+ return new RuleEvent(RuleStatus.NONE);
+
+ }
+
+
+
+
+
+
+ /*
+ * (non-Javadoc)
+ * @see com.nokia.s60tools.traceanalyser.export.TraceAnalyserRule#getUnit()
+ */
+ public String getUnit(){
+ return "ms";
+ }
+
+
+ /*
+ * (non-Javadoc)
+ * @see com.nokia.s60tools.traceanalyser.export.TraceAnalyserRule#equals(com.nokia.s60tools.traceanalyser.export.TraceAnalyserRule)
+ */
+ public boolean equals(TraceAnalyserRule rule) {
+ TimingRule timingRule = (TimingRule) rule;
+ if (timingRule.getName().equals(this.name)
+ && timingRule.getDescription().equals(this.description)
+ && timingRule.getTimeLimitA() == this.timeLimitA
+ && timingRule.getTimeLimitB() == this.timeLimitB
+ && true
+ && timingRule.getTraceItemA().equals(this.traceItemA)
+ && timingRule.getTraceItemB().equals(this.traceItemB)) {
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
+
+ /*
+ * (non-Javadoc)
+ * @see com.nokia.s60tools.traceanalyser.export.TraceAnalyserRule#getLimits()
+ */
+ public int[] getLimits() {
+ return new int[]{timeLimitA, timeLimitB};
+ }
+
+
+ /* Getters and setters for member variables. */
+ public TraceInfo getTraceItemA() {
+ return traceItemA;
+ }
+ public void setTraceItemA(TraceInfo traceItemA) {
+ this.traceItemA = traceItemA;
+ }
+ public TraceInfo getTraceItemB() {
+ return traceItemB;
+ }
+ public void setTraceItemB(TraceInfo traceItemB) {
+ this.traceItemB = traceItemB;
+ }
+ public int getTimeLimitA() {
+ return timeLimitA;
+ }
+ public void setTimeLimitA(int timeLimitA) {
+ this.timeLimitA = timeLimitA;
+ }
+ public int getTimeLimitB() {
+ return timeLimitB;
+ }
+ public void setTimeLimitB(int timeLimitB) {
+ this.timeLimitB = timeLimitB;
+ }
+
+ public String getWorkingDirectory() {
+ return workingDirectory;
+ }
+
+ public void setWorkingDirectory(String workingDirectory) {
+ this.workingDirectory = workingDirectory;
+ }
+
+
+
+
+
+
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser.timingrule/src/com/nokia/s60tools/traceanalyser/timingrule/rule/TimingRuleType.java Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,382 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.s60tools.traceanalyser.timingrule.rule;
+
+import java.io.File;
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+
+import com.nokia.s60tools.traceanalyser.export.ITraceAnalyserRuleType;
+import com.nokia.s60tools.traceanalyser.export.ITraceAnalyserRuleTypeListener;
+import com.nokia.s60tools.traceanalyser.export.ITraceSelectionCompositeListener;
+import com.nokia.s60tools.traceanalyser.export.TraceAnalyserRule;
+import com.nokia.s60tools.traceanalyser.export.TraceInfo;
+import com.nokia.s60tools.traceanalyser.export.TraceSelectionComposite;
+import com.nokia.s60tools.traceanalyser.timingrule.plugin.TraceAnalyserTimingRulePlugin;
+import com.nokia.traceviewer.engine.TraceInformation;
+
+/**
+ * class Timing Rule.
+ * "Parameter Rule"-rule type for Trace Analyser
+ */
+
+public class TimingRuleType implements ITraceAnalyserRuleType, ITraceSelectionCompositeListener, ModifyListener{
+
+ /* UI components */
+ private GridData gridDataComposite;
+ private Composite compositeTimingRule;
+ private Text textLimitTraceA;
+ private Text textLimitTraceB;
+
+ /* Trace Selection composites */
+ TraceSelectionComposite traceSelectionCompositeA;
+ TraceSelectionComposite traceSelectionCompositeB;
+
+ /* Edit rule-window */
+ ITraceAnalyserRuleTypeListener listener;
+
+
+
+ /**
+ * TimingRule.
+ * constructor
+ */
+ public TimingRuleType(){
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.nokia.s60tools.traceanalyser.export.ITraceAnalyserRule#createUIComponents(org.eclipse.swt.widgets.Composite)
+ */
+ public void createUIComponents(Composite composite, ITraceAnalyserRuleTypeListener listener) {
+
+ this.listener = listener;
+
+ // Create composite for rule
+ compositeTimingRule = new Composite(composite, SWT.NONE);
+ GridLayout layoutTraceA = new GridLayout();
+ layoutTraceA.numColumns = 1;
+ compositeTimingRule.setLayout(layoutTraceA);
+ gridDataComposite = new GridData(GridData.FILL_HORIZONTAL);
+ compositeTimingRule.setLayoutData(gridDataComposite);
+
+ // create trace selection components.
+ traceSelectionCompositeA = new TraceSelectionComposite(compositeTimingRule, "Trace A:", this);
+ traceSelectionCompositeB = new TraceSelectionComposite(compositeTimingRule, "Trace B:", this);
+
+ // create composite for time limits
+ Composite compositeTimeLimits = new Composite(compositeTimingRule, SWT.NONE);
+ GridLayout layoutTimeLimitA = new GridLayout();
+ layoutTimeLimitA.numColumns = 2;
+ compositeTimeLimits.setLayout(layoutTimeLimitA);
+ GridData gridDataTimeLimits = new GridData(GridData.FILL_HORIZONTAL);
+ compositeTimeLimits.setLayoutData(gridDataTimeLimits);
+
+ // create time limit components.
+ textLimitTraceA = this.createTimeLimitControls(compositeTimeLimits, "Time Limit A(Trace B must arrive after this):");
+ textLimitTraceB = this.createTimeLimitControls(compositeTimeLimits, "Time Limit B(Trace B must arrive before this):");
+
+
+ }
+
+ /**
+ * createTimeLimitControls.
+ * Method that creates time limit related ui-components.
+ * @param composite composite where components are placed
+ * @param labelText text of the label
+ * @return textBox where time limit is written.
+ */
+ private Text createTimeLimitControls(Composite composite, String labelText){
+
+ // create composite for trace limit components
+ Composite compositeTimeLimits = new Composite(composite, SWT.NONE);
+ GridLayout layoutTimeLimitA = new GridLayout();
+ layoutTimeLimitA.numColumns = 2;
+ compositeTimeLimits.setLayout(layoutTimeLimitA);
+ GridData gridDataTimeLimits = new GridData(GridData.FILL_HORIZONTAL);
+ compositeTimeLimits.setLayoutData(gridDataTimeLimits);
+
+ // Create time limit label
+ Label labelTimeLimit = new Label(compositeTimeLimits, SWT.NONE);
+ labelTimeLimit.setText(labelText);
+ GridData gridDataLabelTimeLimit = new GridData(GridData.BEGINNING);
+ gridDataLabelTimeLimit.horizontalSpan = 2;
+ labelTimeLimit.setLayoutData(gridDataLabelTimeLimit);
+
+ // Create time limit text box.
+ Text textBox = new Text(compositeTimeLimits, SWT.BORDER);
+ GridData gridDataTextBox = new GridData(GridData.BEGINNING);
+ gridDataTextBox.widthHint = 30;
+ textBox.setTextLimit(5);
+ textBox.setToolTipText("Define time limit for trace.");
+ textBox.setLayoutData(gridDataTextBox);
+ textBox.setText("0");
+
+ // Create ms-label
+ Label labelMS = new Label(compositeTimeLimits, SWT.NONE);
+ labelMS.setText("ms");
+
+ // Set text box to accept only numbers.
+ textBox.addListener(SWT.Verify, new Listener() {
+ public void handleEvent(Event event) {
+ String string = event.text;
+ char[] chars = new char[string.length()];
+ string.getChars(0, chars.length, chars, 0);
+ for (int i = 0; i < chars.length; i++) {
+ if (!('0' <= chars[i] && chars[i] <= '9')) {
+ event.doit = false;
+ return;
+ }
+ }
+ }
+
+ });
+
+ textBox.addModifyListener(this);
+
+ return textBox;
+
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.nokia.s60tools.traceanalyser.export.ITraceAnalyserRule#setVisible(boolean)
+ */
+ public void setVisible(boolean value){
+ compositeTimingRule.setVisible(value);
+ gridDataComposite.exclude = !value;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.nokia.s60tools.traceanalyser.export.ITraceAnalyserRuleType#saveRule(java.lang.String, java.lang.String)
+ */
+ public TraceAnalyserRule getRule(String name, String description){
+
+ // Create new timing rule.
+ TimingRule newRule = new TimingRule();
+
+ // set basic info.
+ newRule.setName(name);
+ newRule.setDescription(description);
+
+
+ // set directory for rule.
+ newRule.setWorkingDirectory(getPluginWorkingLocation());
+
+ // set trace items for rule.
+ newRule.setTraceItemA(traceSelectionCompositeA.getTraceInformation());
+ newRule.setTraceItemB(traceSelectionCompositeB.getTraceInformation());
+
+
+ // set time limits for rule.
+
+ // if empty, set to zero.
+ if(textLimitTraceA.getText() == ""){
+ textLimitTraceA.setText("0");
+ }
+ if(textLimitTraceB.getText() == ""){
+ textLimitTraceB.setText("0");
+ }
+
+ int limitA = 0;
+ int limitB = 0;
+ try{
+ limitA = Integer.parseInt(textLimitTraceA.getText());
+ limitB = Integer.parseInt(textLimitTraceB.getText());
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ newRule.setTimeLimitA(limitA);
+ newRule.setTimeLimitB(limitB);
+
+ // write rule into xml-file.
+ // if(newRule.writeXML()){
+ return newRule;
+ //}
+ //else{
+ //return null;
+ // }
+ }
+
+
+ /**
+ * getPluginWorkingLocation.
+ * Returns a path where Rule plugin can do various tasks (located under workspace).
+ */
+ public static String getPluginWorkingLocation() {
+ IPath location = Platform.getStateLocation( TraceAnalyserTimingRulePlugin.getDefault().getBundle());
+ return location.toOSString();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.nokia.s60tools.traceanalyser.export.ITraceAnalyserRuleType#getRules()
+ */
+ public ArrayList<TraceAnalyserRule> getRules(){
+
+ ArrayList<TraceAnalyserRule> rules = new ArrayList<TraceAnalyserRule>();
+ File rootFolder = new File(getPluginWorkingLocation());
+ File[] rootFiles = rootFolder.listFiles();
+ int i = 0;
+
+ while( i < rootFiles.length ){
+ if(rootFiles[i].isDirectory()){
+ // Create new rule.
+ TimingRule rule = new TimingRule();
+ rule.setRulePath(rootFiles[i].toString());
+
+ // read XML, if successful add object to arraylist.
+ if( rule.readXML() ){
+ rules.add(rule);
+ }
+ }
+ i++;
+
+ }
+
+ return rules;
+
+ }
+
+ /**
+ * getRuleType.
+ * @param this rule types name.
+ */
+ public String getRuleType() {
+ return "Timing Rule";
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.nokia.s60tools.traceanalyser.export.ITraceAnalyserRuleType#formatRuleDefinitions(com.nokia.s60tools.traceanalyser.export.TraceAnalyserRule)
+ */
+ public boolean formatRuleDefinitions(TraceAnalyserRule rule) {
+
+ if(TimingRule.class == rule.getClass()){
+ TimingRule timingRule = (TimingRule) rule;
+
+ traceSelectionCompositeA.setTraceItem(timingRule.getTraceItemA());
+ traceSelectionCompositeB.setTraceItem(timingRule.getTraceItemB());
+
+ textLimitTraceA.setText(Integer.toString( timingRule.getTimeLimitA()));
+ textLimitTraceB.setText(Integer.toString( timingRule.getTimeLimitB()));
+ return true;
+ }
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.nokia.s60tools.traceanalyser.export.ITraceAnalyserRuleType#canFinish()
+ */
+ public String canFinish() {
+ if(traceSelectionCompositeA.getTraceInformation() == null ){
+ return "Trace A must be defined";
+ }
+ if(traceSelectionCompositeB.getTraceInformation() == null){
+ return "Trace B must be defined";
+ }
+
+ int limit1 = Integer.parseInt(textLimitTraceA.getText());
+ int limit2 = Integer.parseInt(textLimitTraceB.getText());
+
+ if(limit1 >= limit2 && !(limit1 == 0 && limit2 == 0) ){
+ return "Limit B must be greater that limit A";
+ }
+
+ return null;
+
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.nokia.s60tools.traceanalyser.export.ITraceSelectionCompositeListener#traceInfoUpdated()
+ */
+ public void traceInfoUpdated() {
+ listener.canFinish();
+ }
+
+ static public TimingRule createDummyRule(String ruleName){
+ // Create new timing rule.
+
+ TimingRule newRule = new TimingRule();
+
+ // set basic info.
+ newRule.setName(ruleName);
+ newRule.setDescription("testDescription");
+
+ // set directory for rule.
+ newRule.setWorkingDirectory(getPluginWorkingLocation());
+
+ // set trace items for rule.
+ TraceInfo info1 = new TraceInfo();
+ TraceInformation information = new TraceInformation();
+ information.setTraceId(1);
+ info1.setIdNumbers(information);
+ info1.setIdNumbers(information);
+
+
+ TraceInfo info2 = new TraceInfo();
+ TraceInformation information2 = new TraceInformation();
+ information2.setTraceId(2);
+ info2.setIdNumbers(information2);
+
+ newRule.setTraceItemA(info1);
+ newRule.setTraceItemB(info2);
+
+
+
+ int limitA = 0;
+ int limitB = 0;
+ try{
+ limitA = Integer.parseInt("10");
+ limitB = Integer.parseInt("100");
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ newRule.setTimeLimitA(limitA);
+ newRule.setTimeLimitB(limitB);
+
+ // write rule into xml-file.
+ return newRule;
+
+ }
+
+ public void modifyText(ModifyEvent arg0) {
+ listener.canFinish();
+ }
+
+
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/.classpath Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/META-INF/MANIFEST.MF Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,59 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Carbide.c++ Extensions - Trace Analyser
+Bundle-SymbolicName: com.nokia.s60tools.traceanalyser; singleton:=true
+Bundle-Version: 1.0.5
+Bundle-Activator: com.nokia.s60tools.traceanalyser.plugin.TraceAnalyserPlugin
+Bundle-Vendor: Nokia
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ com.nokia.s60tools.ui;bundle-version="1.2.1",
+ com.nokia.traceviewer;bundle-version="2.0.27",
+ org.eclipse.ui.ide;bundle-version="3.4.1",
+ org.eclipse.draw2d;bundle-version="3.4.1"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Export-Package: com.nokia.s60tools.traceanalyser.containers;x-friends:="com.nokia.s60tools.traceanalyser.tests";
+ uses:="com.nokia.s60tools.traceanalyser.export,
+ com.nokia.traceviewer.engine",
+ com.nokia.s60tools.traceanalyser.export;uses:="com.nokia.traceviewer.engine,org.eclipse.swt.events,org.eclipse.swt.widgets",
+ com.nokia.s60tools.traceanalyser.interfaces;x-friends:="com.nokia.s60tools.traceanalyser.tests",
+ com.nokia.s60tools.traceanalyser.model;x-friends:="com.nokia.s60tools.traceanalyser.tests";
+ uses:="org.eclipse.core.runtime,
+ com.nokia.s60tools.traceanalyser.ui.views,
+ org.eclipse.core.runtime.jobs,
+ com.nokia.s60tools.traceanalyser.containers,
+ com.nokia.traceviewer.engine,
+ org.eclipse.ui,
+ com.nokia.s60tools.traceanalyser.interfaces,
+ com.nokia.traceviewer.engine.dataprocessor,
+ org.eclipse.jface.dialogs",
+ com.nokia.s60tools.traceanalyser.plugin;x-friends:="com.nokia.s60tools.traceanalyser.tests";
+ uses:="org.eclipse.jface.resource,
+ com.nokia.s60tools.traceanalyser.ui.views,
+ org.eclipse.ui.plugin,
+ org.osgi.framework,
+ com.nokia.s60tools.traceanalyser.model",
+ com.nokia.s60tools.traceanalyser.resources;x-friends:="com.nokia.s60tools.traceanalyser.tests";
+ uses:="org.eclipse.jface.resource,
+ org.eclipse.swt.graphics",
+ com.nokia.s60tools.traceanalyser.ui.actions;x-friends:="com.nokia.s60tools.traceanalyser.tests";
+ uses:="org.eclipse.jface.action,
+ org.eclipse.ui,
+ org.eclipse.jface.viewers",
+ com.nokia.s60tools.traceanalyser.ui.dialogs;x-friends:="com.nokia.s60tools.traceanalyser.tests";
+ uses:="com.nokia.s60tools.traceanalyser.export,
+ org.eclipse.swt.events,
+ org.eclipse.swt.widgets,
+ com.nokia.traceviewer.engine.activation,
+ org.eclipse.jface.dialogs",
+ com.nokia.s60tools.traceanalyser.ui.views;x-friends:="com.nokia.s60tools.traceanalyser.tests";
+ uses:="org.eclipse.swt.events,
+ com.nokia.s60tools.ui,
+ com.nokia.s60tools.traceanalyser.interfaces,
+ org.eclipse.ui.part,
+ javax.swing,
+ org.eclipse.jface.viewers,
+ org.eclipse.swt.graphics,
+ org.eclipse.swt.widgets,
+ com.nokia.s60tools.traceanalyser.model"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/about.html Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,20 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<html>
+<head>
+<title>About</title>
+<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
+</head>
+<body>
+
+<h2>About This Content</h2>
+
+<p>June 4, 2010</p>
+
+<h3>Copyright</h3>
+<p>Copyright © 2007-2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.<br>
+This component and the accompanying materials are made available under the <br/>
+terms of "Eclipse Public License v1.0" which accompanies this <br/>
+distribution, and is available at the URL: <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.<p>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/about.ini Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,43 @@
+#
+# Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+#
+# about.ini
+# contains information about a feature
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# "%key" are externalized strings defined in about.properties
+# This file does not need to be translated.
+
+# Property "aboutText" contains blurb for "About" dialog (translated)
+# This text is shown in Feature Details -dialog when feature is selected.
+aboutText=%productBlurb
+
+# Property "windowImage" contains path to window icon (16x16)
+# needed for primary features only
+
+# Property "featureImage" contains path to feature image (32x32)
+# Not using this in here because we do not want the icon to
+# show on about dialog. Only using aboutText above.
+#featureImage=icons/appdep.png
+
+# Property "aboutImage" contains path to product image (500x330 or 115x164)
+# needed for primary features only
+
+# Property "appName" contains name of the application (translated)
+# needed for primary features only
+
+# Property "welcomePerspective" contains the id of the perspective in which the
+# welcome page is to be opened.
+# optional
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/about.mappings Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,24 @@
+#
+# Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+#
+# about.mappings
+# contains fill-ins for about.properties
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file does not need to be translated.
+
+# The following should contain the build version.
+# e.g. "0=20020612"
+0=1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/about.properties Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,33 @@
+#
+# Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+#
+# about.properties
+# contains externalized strings for about.ini
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# fill-ins are supplied by about.mappings
+# This file should be translated.
+
+productBlurb=Carbide.c++ Extensions - TraceAnalyser \n\
+\n\
+Version: 1.0\n\
+Build id: {0}\n\
+\n\
+\n\
+Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).\n\
+All rights reserved. License: http://www.eclipse.org/legal/epl-v10.html.\n\
+\n\
+This product includes software developed by Eclipse Project\n\
+(http://www.eclipse.org/).
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/build.properties Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,14 @@
+source.. = src/
+output.. = bin/
+bin.includes = plugin.xml,\
+ META-INF/,\
+ .,\
+ icons/,\
+ contexts.xml,\
+ about.html,\
+ about.ini,\
+ about.mappings,\
+ about.properties
+bin.excludes = icons/Thumbs.db,\
+ icons/ClearOneCounter.png,\
+ icons/PNG_04/
Binary file trace/traceanalyser/com.nokia.s60tools.traceanalyser/icons/ClearAllCounters.png has changed
Binary file trace/traceanalyser/com.nokia.s60tools.traceanalyser/icons/ClearFailLog.png has changed
Binary file trace/traceanalyser/com.nokia.s60tools.traceanalyser/icons/CreateNewRule.png has changed
Binary file trace/traceanalyser/com.nokia.s60tools.traceanalyser/icons/FailReceived.png has changed
Binary file trace/traceanalyser/com.nokia.s60tools.traceanalyser/icons/TraceAnalyser.png has changed
Binary file trace/traceanalyser/com.nokia.s60tools.traceanalyser/icons/TraceAnalyser_banner.png has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/plugin.xml Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension-point id="traceanalyserrule" name="Trace Analyser's Rule Type" schema="schema/traceanalyserrule.exsd"/>
+
+ <extension
+ point="org.eclipse.ui.actionSets">
+ <actionSet
+ description="Trace Analyser"
+ id="com.nokia.s60tools.traceanalyser.ui.actions.ToolbarShortcutAction"
+ label="Trace Analyser"
+ visible="true">
+ <menu
+ id="com.nokia.carbide.cpp.ui.CarbideMenu"
+ label="&Carbide">
+ <separator
+ name="com.nokia.s60tools.ToolsMenuGroup">
+ </separator>
+ </menu>
+ <action
+ class="com.nokia.s60tools.traceanalyser.ui.actions.ToolbarShortcutAction"
+ icon="icons/TraceAnalyser.png"
+ id="com.nokia.s60tools.traceanalyser.ui.actions.ToolbarShortcutAction"
+ label="Trace Analyser"
+ menubarPath="com.nokia.carbide.cpp.ui.CarbideMenu/CarbideExtensions"
+ tooltip="Trace Analyser">
+ </action>
+
+ </actionSet>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.views">
+ <category
+ name="Carbide Extensions"
+ id="com.nokia.s60tools">
+ </category>
+ <view
+ name="Trace Analyser"
+ icon="icons/TraceAnalyser.png"
+ category="com.nokia.s60tools"
+ class="com.nokia.s60tools.traceanalyser.ui.views.MainView"
+ id="com.nokia.s60tools.traceanalyser.ui.views.MainView">
+ </view>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.editors">
+ <editor
+ class="com.nokia.s60tools.traceanalyser.ui.editors.HistoryEditor"
+ default="false"
+ icon="icons/TraceAnalyser.png"
+ id="com.nokia.s60tools.traceanalyser.ui.editors.HistoryEditor"
+ name="History View"/>
+ </extension>
+
+
+
+
+ <extension point="org.eclipse.ui.startup">
+ <startup class="com.nokia.s60tools.traceanalyser.model.StartupHandler"/>
+ </extension>
+
+</plugin>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/schema/com.nokia.s60tools.traceanalyser.rule.exsd Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,84 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="com.nokia.s60tools.traceanalyser" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="com.nokia.s60tools.traceanalyser" id="com.nokia.s60tools.traceanalyser.rule" name="Rule for Trace Analyser"/>
+ </appinfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/schema/traceanalyserrule.exsd Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,107 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="com.nokia.s60tools.traceanalyser" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="com.nokia.s60tools.traceanalyser" id="traceanalyserrule" name="Trace Analyser's Rule Type"/>
+ </appinfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="traceanalyserrule">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="com.nokia.s60tools.traceanalyser.export.ITraceAnalyserRule"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="providerName" type="string" use="required">
+ <annotation>
+ <documentation>
+ Name of the trace provider
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/src/com/nokia/s60tools/traceanalyser/containers/DummyRule.java Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,107 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.s60tools.traceanalyser.containers;
+
+import java.util.ArrayList;
+import com.nokia.s60tools.traceanalyser.export.RuleEvent;
+import com.nokia.s60tools.traceanalyser.export.TraceAnalyserRule;
+import com.nokia.traceviewer.engine.TraceProperties;
+
+
+/**
+ * class DummyRule.
+ * DummyRule that is used for sending messages from rule manager to main view.
+ */
+public class DummyRule extends TraceAnalyserRule {
+
+ /**
+ * DummyRule
+ * @param type Type of the rule.
+ */
+ public DummyRule(String type) {
+ super(type);
+ name = type;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.nokia.s60tools.traceanalyser.export.TraceAnalyserRule#checkRuleStatus(com.nokia.traceviewer.engine.TraceProperties)
+ */
+ @Override
+ public RuleEvent checkRuleStatus(TraceProperties traceProperties) {
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.nokia.s60tools.traceanalyser.export.TraceAnalyserRule#getLimitUnit()
+ */
+ @Override
+ public String getUnit() {
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.nokia.s60tools.traceanalyser.export.TraceAnalyserRule#readHistory()
+ */
+ @Override
+ public ArrayList<RuleEvent> readHistory() {
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.nokia.s60tools.traceanalyser.export.TraceAnalyserRule#saveHistory(java.util.ArrayList)
+ */
+ @Override
+ public boolean saveHistory(ArrayList<RuleEvent> history) {
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.nokia.s60tools.traceanalyser.export.TraceAnalyserRule#writeXML()
+ */
+ @Override
+ public boolean writeXML() {
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.nokia.s60tools.traceanalyser.export.TraceAnalyserRule#equals(com.nokia.s60tools.traceanalyser.export.TraceAnalyserRule)
+ */
+ @Override
+ public boolean equals(TraceAnalyserRule rule) {
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.nokia.s60tools.traceanalyser.export.TraceAnalyserRule#getLimits()
+ */
+ @Override
+ public int[] getLimits() {
+ return null;
+ }
+
+
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/src/com/nokia/s60tools/traceanalyser/containers/RuleInformation.java Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,225 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.s60tools.traceanalyser.containers;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+
+import com.nokia.s60tools.traceanalyser.export.RuleEvent;
+import com.nokia.s60tools.traceanalyser.export.TraceAnalyserRule;
+
+
+/**
+ * class RuleInformation.
+ * Class that contains information about one rule that is shown on main view of Trace Analyser.
+ */
+public class RuleInformation implements Serializable {
+
+
+ /**
+ * UID for serialization.
+ */
+ private static final long serialVersionUID = 1L;
+
+
+ /* indexes for TableViewer */
+ public static final int INDEX_CHECK_BOX = 0;
+ public static final int INDEX_NAME = 1;
+ public static final int INDEX_PASS = 2;
+ public static final int INDEX_FAIL = 3;
+ public static final int INDEX_PASS_FAIL_RATIO = 4;
+ public static final int INDEX_MIN = 5;
+ public static final int INDEX_MAX = 6;
+ public static final int INDEX_AVG = 7;
+ public static final int INDEX_MED = 8;
+
+ /* Trace Analyser Rule object */
+ private TraceAnalyserRule rule;
+
+ /* amount of passes */
+ private int pass;
+
+ /* amount of fails */
+ private int fail;
+
+ /* min value */
+ private int min;
+
+ /* max value */
+ private int max;
+
+ /* average value */
+ private int avg;
+
+ /* median value */
+ private int med;
+
+ /* all history events */
+ private ArrayList<RuleEvent> events;
+
+ /**
+ * RuleInformation
+ * Constructor
+ * @param rule rule for this information.
+ */
+ public RuleInformation(TraceAnalyserRule rule){
+ this.rule = rule;
+ this.events = new ArrayList<RuleEvent>();
+ }
+
+
+ /**
+ * getText.
+ * MainView can use this to get description for each column in the grid
+ * @param index index of the column
+ * @return value for asked column
+ */
+ public String getText(int index) {
+ String retval = "";
+ switch (index) {
+ case INDEX_CHECK_BOX:
+ retval = "";
+ break;
+ case INDEX_NAME:
+ retval = rule.getName();
+ break;
+ case INDEX_PASS:
+ retval = Integer.toString(pass);
+ break;
+ case INDEX_FAIL:
+ retval = Integer.toString(fail);
+ break;
+ case INDEX_PASS_FAIL_RATIO:
+
+ double value = getPassPercent();
+ if(value == -1){
+ return "-";
+ }
+ else{
+ retval = Double.toString(value);
+ }
+
+ break;
+ case INDEX_MAX:
+ retval = Integer.toString(max) + rule.getUnit();
+ break;
+ case INDEX_MIN:
+ retval = Integer.toString(min) + rule.getUnit();
+ break;
+ case INDEX_AVG:
+ if(pass > 0 || fail > 0){
+ retval = Integer.toString(avg) + rule.getUnit();
+ }
+ else{
+ retval = "-";
+ }
+ break;
+ case INDEX_MED:
+ if(pass > 0 || fail > 0){
+ retval = Integer.toString(med) + rule.getUnit();
+ }
+ else{
+ retval = "-";
+ }
+ break;
+ default:
+ break;
+ }
+ return retval;
+ }
+
+ /**
+ * delete.
+ * Deletes rule and all information relating to it.
+ * @return true if file operations were successful
+ */
+ public boolean delete(){
+ return rule.delete();
+ }
+
+ /* Getters and setters for member variables */
+
+ public TraceAnalyserRule getRule() {
+ return rule;
+ }
+ public void setRule(TraceAnalyserRule rule) {
+ this.rule = rule;
+ }
+ public int getPass() {
+ return pass;
+ }
+ public void setPass(int pass) {
+ this.pass = pass;
+ }
+ public int getFail() {
+ return fail;
+ }
+ public void setFail(int fail) {
+ this.fail = fail;
+ }
+ public int getMin() {
+ return min;
+ }
+ public void setMin(int min) {
+ this.min = min;
+ }
+ public int getMax() {
+ return max;
+ }
+ public void setMax(int max) {
+ this.max = max;
+ }
+ public int getAvg() {
+ return avg;
+ }
+ public void setAvg(int avg) {
+ this.avg = avg;
+ }
+ public int getMed() {
+ return med;
+ }
+ public void setMed(int med) {
+ this.med = med;
+ }
+
+ public ArrayList<RuleEvent> getEvents() {
+ return events;
+ }
+ public void setEvents(ArrayList<RuleEvent> events) {
+ this.events = events;
+ }
+
+ /**
+ * getPassPercent.
+ * @return returns current pass percent for rule.
+ */
+ public double getPassPercent(){
+ if(pass == 0 && fail == 0){
+ return -1;
+ }
+ else{
+ double passDouble = pass;
+ double allEvents = fail + pass;
+ double value = passDouble / allEvents;
+ double roundedValue = (int)(value * 1000 + 0.5)/10.0;
+ return roundedValue;
+ }
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/src/com/nokia/s60tools/traceanalyser/export/GeneralMethods.java Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+
+package com.nokia.s60tools.traceanalyser.export;
+
+public class GeneralMethods {
+ /**
+ * getTextBetweenQuotes.
+ * Returns text between two first quotation marks on line that is give as parameter
+ * @param line where quotations are searched.
+ * @return text between quotation marks
+ */
+ public static String getTextBetweenQuotes(String line){
+ int index = 0;
+ if((index =line.indexOf("\"")) > -1){
+ line = line.substring(index+1);
+ if((index =line.indexOf("\"")) > -1){
+ return line.substring(0,index);
+ }
+ }
+ return null;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/src/com/nokia/s60tools/traceanalyser/export/ITraceAnalyserRuleType.java Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.s60tools.traceanalyser.export;
+import java.util.ArrayList;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * interface ITraceAnalyserRuleType.
+ * Interface that all Trace Analyser rule type Plug
+ * -Ins must implement
+ *
+ */
+public interface ITraceAnalyserRuleType {
+
+ /**
+ * createUIComponents.
+ * Method that places all UI components related
+ * to rule into give composite-parameter.
+ * @param composite composite where all UI
+ * components all placed
+ * @param listener listener for UI-changes.
+ */
+ public void createUIComponents(
+ Composite composite,
+ ITraceAnalyserRuleTypeListener listener);
+
+ /**
+ * formatRuleDefinitions.
+ * Inserts settings from given rule to UI
+ * components if rule's type is same.
+ * @param rule rule which values are formatted
+ * to UI.
+ * @return true if parameter rule was from
+ * this type.
+ */
+ public boolean formatRuleDefinitions(
+ TraceAnalyserRule rule);
+
+ /**
+ * getRuleName.
+ * @return Name of the rule
+ */
+ public String getRuleType();
+
+ /**
+ * setVisible.
+ * Excludes & hides rule's ui components.
+ * @param value true if rule needs to be hidden.
+ */
+ public void setVisible(boolean value);
+
+ /**
+ * getRule.
+ * Gets rule from values that are inserted into
+ * user interface.
+ * @param name rule name.
+ * @param description rule description.
+ * @return Trace Analyser Rule
+ */
+ public TraceAnalyserRule getRule(String name,
+ String description);
+
+ /**
+ * getRules.
+ * Loads list of rules from file system.
+ * @return Rule list.
+ */
+ public ArrayList<TraceAnalyserRule> getRules();
+
+ /**
+ * canFinish.
+ * @return implementation of this rule type method
+ * returns null if this page is complete.
+ * If page is not complete, error message is returned.
+ */
+ public String canFinish();
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/src/com/nokia/s60tools/traceanalyser/export/ITraceAnalyserRuleTypeListener.java Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.s60tools.traceanalyser.export;
+
+public interface ITraceAnalyserRuleTypeListener {
+
+ /**
+ * canFinish.
+ * this method is called when some values of ui components have changed
+ * and UI needs to check if finishing is possible
+ */
+ public void canFinish();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/src/com/nokia/s60tools/traceanalyser/export/ITraceSelectionCompositeListener.java Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.s60tools.traceanalyser.export;
+
+public interface ITraceSelectionCompositeListener {
+
+ /**
+ * traceInfoUpdated.
+ * This method is called when trace item information is changed.
+ */
+ public void traceInfoUpdated();
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/src/com/nokia/s60tools/traceanalyser/export/RuleEvent.java Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,303 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.s60tools.traceanalyser.export;
+
+import java.io.Serializable;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+/**
+ * class RuleEvent.
+ * Class that represents one rule event, either passed or failed. Rule event also contains
+ * trace value that was measured and limit that was violated.
+ */
+public class RuleEvent implements Serializable {
+ /**
+ * serialization UID number
+ */
+ private static final long serialVersionUID = 1L;
+
+
+ /* indexes for fail log tableviewer */
+ public static final int INDEX_FAIL_LOG_TIME = 0;
+ public static final int INDEX_FAIL_LOG_RULE_NAME = 1;
+ public static final int INDEX_FAIL_LOG_VIOLATION = 2;
+ public static final int INDEX_FAIL_LOG_LIMIT = 3;
+
+ /* indexes for History views tableviewer */
+ public static final int INDEX_HISTORY_STATUS = 0;
+ public static final int INDEX_HISTORY_TIME = 1;
+ public static final int INDEX_HISTORY_VALUE = 2;
+ public static final int INDEX_HISTORY_VIOLATION = 3;
+
+ /* Status stating if rule was failed or passed. */
+ public enum RuleStatus{ PASS, NONE, FAIL};
+ private RuleStatus status;
+
+ /* value that was measured */
+ private int value;
+
+ /* measured violation */
+ private int violation;
+
+ /* limit that was broken */
+ private int limit;
+
+ /* time when violation occured */
+ private Date time;
+
+ /* Numbers of traces */
+ private int[] traceNumbers;
+
+ /* unit of value */
+ private String unit = "";
+
+ /* Name of the rule */
+ private String ruleName;
+
+ /**
+ * RuleEvent.
+ * constructor
+ * @param status Status stating if rule was failed or passed.
+ * @param value value that was measured
+ * @param limit limit that was broken
+ * @param ruleName Name of the rule
+ * @param unit unit of value
+ * @param time time when violation occured
+ * @param traceNumbers Numbers of traces
+ */
+ public RuleEvent(RuleStatus status, int value, int limit, int violation, String ruleName,
+ String unit, Date time, int[] traceNumbers){
+ this.status = status;
+ this.value = value;
+ this.limit = limit;
+ this.ruleName = ruleName;
+ this.unit = unit;
+ this.time = time;
+ this.traceNumbers = traceNumbers;
+ this.violation = violation;
+ }
+
+ /**
+ * RuleEvent.
+ * constructor
+ * @param status Status stating if rule was failed or passed.
+ */
+ public RuleEvent(RuleStatus status){
+ this.status = status;
+ this.value = 0;
+ this.limit = 0;
+ this.ruleName = "";
+ this.unit = "";
+ this.time = null;
+ this.traceNumbers = null;
+ }
+
+ /**
+ * RuleEvent.
+ * constructor
+ * @param status Status stating if rule was failed or passed.
+ * @param value value that was measured
+ * @param limit limit that was broken
+ * @param ruleName Name of the rule
+ * @param unit unit of value
+ */
+ public RuleEvent(RuleStatus status, int value, Date time, String unit) {
+ this.status = status;
+ this.value = value;
+ this.time = time;
+ this.unit = unit;
+ }
+
+ /**
+ * RuleEvent.
+ * constructor
+ */
+ public RuleEvent(){
+ this.status = RuleStatus.NONE;
+ this.value = 0;
+ this.limit = 0;
+ this.ruleName = "";
+ this.unit = "";
+ this.time = null;
+ this.traceNumbers = null;
+
+ }
+
+ /**
+ * equals
+ * Comparator.
+ * @param event event that is compared to this object.
+ * @return true if events are equal.
+ */
+ public boolean equals(RuleEvent event){
+ if( limit == event.getLimit() &&
+ status == event.getStatus() &&
+ value == event.getValue() ){
+ return true;
+ }
+ else{
+ return false;
+ }
+ }
+
+ /**
+ * getFailLogText.
+ * Fail log can use this to get description for each column in the grid
+ * @param index index of the column
+ * @return value for asked column
+ */
+
+ public String getFailLogText(int index) {
+ String retval = "";
+ switch (index) {
+ case INDEX_FAIL_LOG_TIME:
+ if(time != null){
+ SimpleDateFormat formatter = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss:SSS");
+ retval = formatter.format(time);
+ }
+ else{
+ return "";
+ }
+ break;
+ case INDEX_FAIL_LOG_RULE_NAME:
+ retval = ruleName ;
+ break;
+ case INDEX_FAIL_LOG_VIOLATION:
+ retval = Integer.toString(violation) + unit;
+ break;
+ case INDEX_FAIL_LOG_LIMIT:
+ retval = Integer.toString(limit) + unit;
+ break;
+ default:
+ break;
+ }
+ return retval;
+ }
+
+ /**
+ * getHistoryText.
+ * History View can use this to get description for each column in the grid
+ * @param index index of the column
+ * @return value for asked column
+ */
+ public String getHistoryText(int index) {
+ String retval = "";
+ switch (index) {
+ case INDEX_HISTORY_STATUS:
+ if(status == RuleStatus.FAIL){
+ retval = "Fail";
+ }
+ else{
+ retval = "Pass";
+ }
+ break;
+ case INDEX_HISTORY_TIME:
+ if(time != null){
+ SimpleDateFormat formatter = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss:SSS");
+ retval = formatter.format(time);
+ }
+ else{
+ return "";
+ }
+ break;
+ case INDEX_HISTORY_VALUE:
+ retval = Integer.toString(value) + unit;
+ break;
+ case INDEX_HISTORY_VIOLATION:
+ if(status == RuleStatus.FAIL){
+ retval = Integer.toString(value - limit) + unit;
+ }
+ else{
+ retval = "";
+ }
+ break;
+ default:
+ break;
+ }
+ return retval;
+ }
+
+ /* getters and setters for member variables */
+
+ public RuleStatus getStatus() {
+ return status;
+ }
+ public void setStatus(RuleStatus status) {
+ this.status = status;
+ }
+
+ public int getLimit() {
+ return limit;
+ }
+ public void setLimit(int limit) {
+ this.limit = limit;
+ }
+
+ public int getValue() {
+ return value;
+ }
+
+ public void setValue(int value) {
+ this.value = value;
+ }
+
+ public Date getTime() {
+ return time;
+ }
+
+ public void setTime(Date time) {
+ this.time = time;
+ }
+
+ public int[] getTraceNumbers() {
+ return traceNumbers;
+ }
+
+ public void setTraceNumbers(int[] traceNumbers) {
+ this.traceNumbers = traceNumbers;
+ }
+
+ public String getUnit() {
+ return unit;
+ }
+
+ public void setUnit(String unit) {
+ this.unit = unit;
+ }
+
+ public String getRuleName() {
+ return ruleName;
+ }
+
+ public void setRuleName(String ruleName) {
+ this.ruleName = ruleName;
+ }
+
+ public int getViolation() {
+ return violation;
+ }
+
+ public void setViolation(int violation) {
+ this.violation = violation;
+ }
+
+
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/src/com/nokia/s60tools/traceanalyser/export/TraceAnalyserRule.java Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,521 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.s60tools.traceanalyser.export;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInput;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutput;
+import java.io.ObjectOutputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+
+import com.nokia.traceviewer.engine.TraceProperties;
+
+
+/**
+ * class TraceAnalyserRule.
+ * Base class for every Trace Analyser rule.
+ */
+public abstract class TraceAnalyserRule {
+
+
+ /* indexes for TableViewer */
+ public static final int INDEX_RULE_NAME = 0;
+ public static final int INDEX_FILE_DESCRIPTION = 1;
+
+ /* XML-file names */
+ public static final String FILENAME_BASIC_INFO ="BasicInfo.xml";
+ public static final String FILENAME_ADDITIONAL_INFO ="AdditionalInfo.xml";
+ public static final String FILENAME_HISTORY = "History.log";
+
+ /* XML-tags that are used in saving rule data */
+ public static final String XML_NAME = " <Name=\"";
+ public static final String XML_DESCRIPTION = " <Description=\"";
+ public static final String XML_ACTIVATED = " <Activated=\"";
+
+
+ /* Rule name */
+ protected String name;
+
+ /* Rule's Description */
+ protected String description;
+
+ /* Rule's type name */
+ protected String ruleTypeName;
+
+ /* is rule activated */
+ protected boolean activated;
+
+ /* Path of rule folder */
+ protected String rulePath;
+
+ /**
+ * writeXML.
+ * Writes xml-information into file system. NOTE rulePath needs to be defined before calling this function.
+ * @return true if file operations were successful
+ */
+ public abstract boolean writeXML();
+
+ /**
+ * writeBasicInfoIntoFile.
+ * Writes basic info(name and description) into file system.
+ * @return true if file operations were successful
+ */
+ protected boolean writeBasicInfoIntoFile() {
+ String fileName = rulePath + FILENAME_BASIC_INFO;
+
+ try {
+ // Create file
+ FileWriter fstream = new FileWriter(fileName);
+ BufferedWriter output = new BufferedWriter(fstream);
+ output.write(this.getBasicInfoXmlString());
+ // Close the output stream
+ output.close();
+ return true;
+ }
+ catch (Exception e) {// Catch exception if any
+ return false;
+ }
+ }
+
+ /**
+ * getBasicInfoXmlString.
+ * @return XML-string that is written to file when saving.
+ */
+ private String getBasicInfoXmlString(){
+ String xml = "";
+ xml += "<BasicInfo>\n";
+ xml += XML_NAME;
+ xml += name + "\">\n";
+ xml += XML_DESCRIPTION;
+ xml += description + "\">\n";
+ xml += XML_ACTIVATED;
+ xml += activated + "\">\n";
+ xml += "</BasicInfo>\n";
+ return xml;
+ }
+
+
+
+ /**
+ * TraceAnalyserRule
+ * Constructor
+ * @param ruleType Rule Type's name
+ */
+ public TraceAnalyserRule(String ruleType){
+ this.ruleTypeName = ruleType;
+ this.activated = true;
+ }
+
+ /**
+ * getName.
+ * @return name of the rule
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * setName.
+ * @param name, new name for the rule
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * getDescription.
+ * @return description of the rule
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * setDescription.
+ * @param description, new description for the rule
+ */
+ public void setDescription(String definition) {
+ this.description = definition;
+ }
+
+ /**
+ * getRuleType
+ * @return type of the rule
+ */
+ public String getRuleType() {
+ return ruleTypeName;
+ }
+
+ /**
+ * setRuleType
+ * @param ruleType, a new rule type
+ */
+ public void setRuleName(String ruleName) {
+ this.ruleTypeName = ruleName;
+ }
+
+ /**
+ * getRulePath.
+ * @return path of rule's setting files
+ */
+ public String getRulePath() {
+ return rulePath;
+ }
+
+ /**
+ * setRulePath.
+ * @param rulePath, a new path for setting files.
+ */
+ public void setRulePath(String rulePath) {
+ this.rulePath = rulePath;
+ }
+
+
+ /**
+ * isActivated.
+ * @return true if rule is activated
+ */
+ public boolean isActivated() {
+ return activated;
+ }
+
+ /**
+ * setActivated
+ * sets activation value of rule.
+ * @param activated
+ */
+ public void setActivated(boolean activated) {
+ this.activated = activated;
+ }
+
+ /**
+ * getNextFreeDirectory.
+ * Creates next free directory for Trace Analyser Rule data files
+ * @return next free directory where files can be copied.
+ */
+ public String getNextFreeDirectory(String directory){
+
+ // Get file list
+ File file = new File( directory );
+ String[] fileList = file.list();
+
+
+ directory = TraceAnalyserRule.addSlashToEnd( directory );
+ int i = 0;
+ File newFile = null;
+
+ // if some files are found
+ if( fileList != null ){
+ // Go thru directory in a loop and search for first free integer value for directory name.
+ while( i <= fileList.length ){
+
+ newFile = new File( directory + Integer.toString(i) );
+ if ( !newFile.isDirectory() ){
+ break;
+ }
+ i++;
+ }
+ }
+ else{
+ newFile = new File( directory + "0" );
+ }
+
+ // if directories are created successfully, return path, if not return null
+ if( newFile.mkdirs() ){
+ String newFileString = TraceAnalyserRule.addSlashToEnd(newFile.toString());
+ return newFileString;
+ }
+ else{
+ return null;
+ }
+
+ }
+
+ /**
+ * getText.
+ * MainView can use this to get description for each column in the grid
+ * @param index index of the column
+ * @return value for asked column
+ */
+ public String getText(int index) {
+ String retval = "";
+ switch (index) {
+ case INDEX_RULE_NAME:
+ retval = name;
+ break;
+ case INDEX_FILE_DESCRIPTION:
+ retval = description;
+ break;
+ default:
+ break;
+ }
+ return retval;
+ }
+
+ /**
+ * readXML.
+ * Reads basic info from xml file. NOTE. rulePath variable must be defined before reading.
+ * @return true if rule info was read successfully
+ */
+ public boolean readXML(){
+ if (rulePath != null) {
+ String basicInfoPath = TraceAnalyserRule.addSlashToEnd(rulePath) + FILENAME_BASIC_INFO;
+
+ //Open file
+ File basicInfoFile = new File(basicInfoPath);
+ if (basicInfoFile.exists()) {
+ try {
+ // Create buffered reader
+ BufferedReader input = new BufferedReader(new FileReader(basicInfoFile));
+ try {
+ String line = null;
+
+ // Read file
+ while ((line = input.readLine()) != null) {
+ // detect XML-tags and save values.
+ if (line.contains(XML_NAME)) {
+ name = GeneralMethods.getTextBetweenQuotes(line);
+ }
+ else if (line.contains(XML_DESCRIPTION)) {
+ description = GeneralMethods.getTextBetweenQuotes(line);
+ }
+ else if(line.contains(XML_ACTIVATED)){
+ if(GeneralMethods.getTextBetweenQuotes(line).equals("false")){
+ activated = false;
+ }
+ else{
+ activated = true;
+ }
+
+ }
+ }
+
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ finally {
+
+ // close file.
+ input.close();
+
+ // confirm that all needed info was read
+ if (name != null && description != null) {
+ return true;
+ }
+ }
+ }
+ catch (IOException ex) {
+ ex.printStackTrace();
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * If the last character of the given path is not backslash, it is added
+ * and path with backslash is returned.
+ * @param path Path to which backslash is added
+ * @return Path which last character is backslash
+ */
+ public static String addSlashToEnd(String path) {
+ if (path.endsWith(File.separator)){
+ return path;
+ }
+ else{
+ return path + File.separator;
+ }
+ }
+
+ /**
+ * delete.
+ * Deletes this rule. I.e deletes all files under this
+ * rule folder and finally deletes the rule folder
+ */
+ public boolean delete() {
+ if (!"".equals(rulePath) && rulePath != null) {
+ return this.deleteDir(new File(rulePath));
+ }
+ else{
+ return true;
+ }
+
+ }
+
+ /**
+ * deleteDir
+ * Deletes directory and everything inside.
+ * @param dir directory name
+ * @return true if file operations were successful
+ */
+ private boolean deleteDir(File dir) {
+ if ( dir.isDirectory() ) {
+
+ // get list of everything inside file.
+ String[] children = dir.list();
+
+ // go thru file list and call this function recursively.
+ for ( int i=0; i < children.length; i++) {
+ boolean success = deleteDir(new File(dir, children[i]));
+ if (!success) {
+ return false;
+ }
+ }
+ }
+ // after everything inside directory is deleted, remove directory itself.
+ boolean value = dir.delete();
+ return value;
+ }
+
+ /**
+ * getTextBetweenQuotes.
+ * Returns text between two first quotation marks on line that is give as parameter
+ * @param line where quotations are searched.
+ * @return text between quotation marks
+ */
+ /*protected String getTextBetweenQuotes(String line){
+ int index = 0;
+ if((index =line.indexOf("\"")) > -1){
+ line = line.substring(index+1);
+ if((index =line.indexOf("\"")) > -1){
+ return line.substring(0,index);
+ }
+ }
+ return null;
+ }*/
+
+ /**
+ * getIndentString.
+ * @param indent indent.
+ * @return string containing as many spaces as parameter states.
+ */
+ protected String getIndentString(int indent){
+ String indentString = "";
+ while(indent > 0){
+ indentString += " ";
+ indent--;
+ }
+ return indentString;
+ }
+
+ /**
+ * checkRuleStatus.
+ * Checks if parameter trace has some affect on rule.
+ * @param traceProperties received trace
+ * @return ruleEvent.
+ */
+ public abstract RuleEvent checkRuleStatus(TraceProperties traceProperties);
+
+ /**
+ * getLimitUnit.
+ * @return unit of value that is measured.
+ */
+ public abstract String getUnit();
+
+ /**
+ * readHistory.
+ * Reads history data from file system.
+ * @return arraylist containing history data.
+ */
+ @SuppressWarnings("unchecked")
+ public ArrayList<RuleEvent> readHistory() {
+ ArrayList<RuleEvent> history = null;
+
+ try {
+ String fileName = addSlashToEnd(rulePath) + FILENAME_HISTORY;
+ // use buffering
+ InputStream file = new FileInputStream(fileName);
+ InputStream buffer = new BufferedInputStream(file);
+ ObjectInput input = new ObjectInputStream(buffer);
+ try {
+ // deserialize the List
+ history = (ArrayList<RuleEvent>) input.readObject();
+
+ } finally {
+ input.close();
+ if (history == null) {
+ history = new ArrayList<RuleEvent>();
+ }
+ }
+ } catch (ClassNotFoundException ex) {
+ ex.printStackTrace();
+ history = new ArrayList<RuleEvent>();
+ } catch (IOException ex) {
+ history = new ArrayList<RuleEvent>();
+ }
+ return history;
+ }
+
+ /**
+ * saveHistory.
+ * Saves given history data into this rule's own folder.
+ * @param history history data that is saved.
+ * @return true if file operations were successful
+ */
+ public boolean saveHistory(ArrayList<RuleEvent> history) {
+
+ boolean retVal = true;
+ try {
+ String fileName = addSlashToEnd(rulePath) + FILENAME_HISTORY;
+
+ OutputStream file = new FileOutputStream(fileName);
+ OutputStream buffer = new BufferedOutputStream(file);
+ ObjectOutput output = new ObjectOutputStream(buffer);
+ try {
+ // serialize fail list.
+ output.writeObject(history);
+ } finally {
+ output.close();
+ }
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ retVal = false;
+ }
+ return retVal;
+
+ }
+
+ /**
+ * equals,
+ * Comparator
+ * @param rule Rule that is compared to this rule.
+ * @return true if rules are equal.
+ */
+ public abstract boolean equals(TraceAnalyserRule rule);
+
+
+ /**
+ * getLimits.
+ * @return all limits that are defined for rule
+ */
+ public abstract int[] getLimits();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/src/com/nokia/s60tools/traceanalyser/export/TraceInfo.java Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,217 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.s60tools.traceanalyser.export;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+
+import com.nokia.traceviewer.engine.TraceInformation;
+
+/**
+ * class TraceInfo.
+ * Class that contains name and id numbers of one trace.
+ *
+ */
+public class TraceInfo {
+
+ public static final String XML_COMPONENT_ID = "ComponentID";
+ public static final String XML_GROUP_ID = "GroupID";
+ public static final String XML_TRACE_ID = "TraceID";
+ public static final String XML_TRACE_NAME = "TraceName";
+
+ /* TraceInformation object containing ComponentID, GroupID and TraceID */
+ private TraceInformation idNumbers;
+
+ /* Name of the Trace */
+ private String traceName;
+
+ /**
+ * TraceInfo.
+ * Constructor.
+ */
+ public TraceInfo() {
+ idNumbers = new TraceInformation();
+ traceName = "";
+ }
+
+ /**
+ * getXMLString.
+ * Returns XML-string that is written to file when saving rule.
+ * @param itemName Name of the trace item.
+ * @param indent indent that is used.
+ * @return xml string.
+ */
+ public String getXMLString(String itemName, int indent) {
+ String xml = "";
+ String indentString = getIndentString(indent);
+
+ xml += indentString + "<" + itemName + ">\n";
+
+ xml += indentString + " " + "<" + XML_COMPONENT_ID + "=\"";
+ xml += Integer.toHexString(idNumbers.getComponentId());
+ xml += "\">\n";
+
+ xml += indentString + " " + "<" + XML_GROUP_ID + "=\"";
+ xml += Integer.toHexString(idNumbers.getGroupId());
+ xml += "\">\n";
+
+ xml += indentString + " " + "<" + XML_TRACE_ID + "=\"";
+ xml += Integer.toHexString(idNumbers.getTraceId());
+ xml += "\">\n";
+
+ xml += indentString + " " + "<" + XML_TRACE_NAME + "=\"";
+ xml += traceName;
+ xml += "\">\n";
+
+ xml += indentString + "</" + itemName + ">\n";
+
+ return xml;
+ }
+
+ /**
+ * readXMLBuffer.
+ * Reads xml trace information from bufferedReader and saves it into this object
+ * @param input bufferedReader
+ * @param searchTraceName name of the trace in buffer
+ * @throws IOException
+ * @throws NumberFormatException
+ */
+
+ public boolean readXMLBuffer(BufferedReader input, String searchTraceName) throws NumberFormatException, IOException{
+
+ String line = null;
+
+
+ // This while loop searches xml tags from file. When tag is found information is saved and
+ // new searchPhrase is updated. Tags are searched in order where they should be.
+
+ String searchPhrase = searchTraceName;
+ while ((line = input.readLine()) != null) {
+ if (line.contains(searchPhrase)) {
+ if (searchPhrase.equals(searchTraceName)) {
+ searchPhrase = XML_COMPONENT_ID;
+ }
+
+
+ else if (searchPhrase.equals(XML_COMPONENT_ID)) {
+ Long id = Long.parseLong(GeneralMethods.getTextBetweenQuotes(line), 16);
+ idNumbers.setComponentId(id.intValue());
+ searchPhrase = XML_GROUP_ID;
+ }
+ else if (searchPhrase.equals(XML_GROUP_ID)) {
+ idNumbers.setGroupId(Integer.parseInt(GeneralMethods.getTextBetweenQuotes(line), 16));
+ searchPhrase = XML_TRACE_ID;
+ }
+ else if (searchPhrase.equals(XML_TRACE_ID)) {
+ idNumbers.setTraceId(Integer.parseInt(GeneralMethods.getTextBetweenQuotes(line), 16));
+ searchPhrase = XML_TRACE_NAME;
+ }
+ else if (searchPhrase.equals(XML_TRACE_NAME)) {
+ String name = GeneralMethods.getTextBetweenQuotes(line);
+ setTraceName(name);
+ return true;
+ }
+ }
+ }
+ return false;
+
+ }
+
+ /**
+ * getIndentString.
+ * @param indent indent.
+ * @return string containing as many spaces as parameter states.
+ */
+ protected String getIndentString(int indent){
+ String indentString = "";
+ while(indent > 0){
+ indentString += " ";
+ indent--;
+ }
+ return indentString;
+ }
+
+ /**
+ * getIdNumbers.
+ * @return id numbers of the trace.
+ */
+ public TraceInformation getIdNumbers() {
+ return idNumbers;
+ }
+
+ /**
+ * setIdNumbers.
+ * @param idNumbers
+ */
+ public void setIdNumbers(TraceInformation idNumbers) {
+ this.idNumbers = idNumbers;
+ }
+
+ /**
+ * getTraceName.
+ * @return name of the trace.
+ */
+ public String getTraceName() {
+ return traceName;
+ }
+
+ /**
+ * setTraceName.
+ * @param traceName
+ */
+ public void setTraceName(String traceName) {
+ this.traceName = traceName;
+ }
+
+ /**
+ * equals.
+ * compares two traceInfos
+ * @param traceB
+ * @return true if traceinfo objects are equal.
+ */
+ public boolean equals(TraceInfo traceB){
+ if(compareTraces(this.getIdNumbers(), traceB.getIdNumbers()) &&
+ this.traceName.equals(traceB.getTraceName())){
+ return true;
+ }
+ else{
+ return false;
+ }
+ }
+
+
+ /**
+ * compareTraces.
+ * compares two traces.
+ * @param traceA Trace A
+ * @param traceB Trace B
+ * @return true if trace information was same.
+ */
+ public static boolean compareTraces(TraceInformation traceA, TraceInformation traceB){
+ if(traceA.getComponentId() == traceB.getComponentId() &&
+ traceA.getGroupId() == traceB.getGroupId()&&
+ traceA.getTraceId() == traceB.getTraceId()){
+ return true;
+ }
+ else{
+ return false;
+ }
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/src/com/nokia/s60tools/traceanalyser/export/TraceSelectionComposite.java Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,188 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+
+package com.nokia.s60tools.traceanalyser.export;
+
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+import com.nokia.s60tools.traceanalyser.ui.dialogs.TraceSelectionDialog;
+import com.nokia.traceviewer.engine.TraceInformation;
+import com.nokia.traceviewer.engine.activation.TraceActivationTraceItem;
+
+
+/**
+ * class TraceSelectionComposite.
+ * Class that can be used for creating UI-components for selecting trace.
+ * creates
+ */
+public class TraceSelectionComposite implements SelectionListener {
+
+ /* UI-components */
+ private Text textTrace;
+ private Composite compositeTraceSelection;
+ private GridData gridDataTraceSelection;
+
+ /* Selected Trace item */
+ private TraceInfo traceItem;
+
+ /* selection listener */
+ ITraceSelectionCompositeListener listener;
+
+ /**
+ * TraceSelectionComposite.
+ * Constructor for Trace Selection component.
+ * @param composite composite where components are placed.
+ * @param traceName name for the label.
+ * @param listener trace item's change listener(optional).
+ */
+ public TraceSelectionComposite(Composite composite, String traceName, ITraceSelectionCompositeListener listener ){
+
+ this.listener = listener;
+
+ // create Composite for trace selection components
+ compositeTraceSelection = new Composite(composite, SWT.NONE);
+ GridLayout layoutTraceSelection = new GridLayout();
+ layoutTraceSelection.numColumns = 2;
+ compositeTraceSelection.setLayout(layoutTraceSelection);
+ gridDataTraceSelection = new GridData(GridData.FILL_HORIZONTAL);
+ compositeTraceSelection.setLayoutData(gridDataTraceSelection);
+
+ // create label
+ Label labelTrace = new Label(compositeTraceSelection, SWT.NONE);
+ labelTrace.setText(traceName);
+ GridData gridDataLabelTrace = new GridData(GridData.FILL_HORIZONTAL);
+ gridDataLabelTrace.horizontalSpan = 2;
+ labelTrace.setLayoutData(gridDataLabelTrace);
+
+ // created trace name text field.
+ textTrace = new Text(compositeTraceSelection, SWT.BORDER);
+ GridData gridDataTextTrace = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ textTrace.setToolTipText("Trace that is assigned for this rule.");
+ textTrace.setLayoutData(gridDataTextTrace);
+ textTrace.setEditable(false);
+
+ // Create select trace button.
+ Button buttonSelectTrace = new Button(compositeTraceSelection, SWT.PUSH);
+ buttonSelectTrace.setText("Select Trace");
+ buttonSelectTrace.addSelectionListener(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ public void widgetDefaultSelected(SelectionEvent arg0) {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ public void widgetSelected(SelectionEvent arg0) {
+ // create dialog
+ TraceSelectionDialog dialog = new TraceSelectionDialog( compositeTraceSelection.getShell() );
+ int retVal = dialog.open();
+ // open query dialog
+ if( retVal == 0 ){
+ //save trace;
+ TraceActivationTraceItem selectedItem = dialog.getSelectedTrace();
+
+ traceItem = new TraceInfo();
+ TraceInformation idNumbers = new TraceInformation();
+ idNumbers.setComponentId(selectedItem.getParent().getParent().getId());
+ idNumbers.setGroupId(selectedItem.getParent().getId());
+ idNumbers.setTraceId(selectedItem.getId());
+ traceItem.setIdNumbers(idNumbers);
+ traceItem.setTraceName(selectedItem.getName());
+
+ this.updateTraceInfo();
+ if(listener != null){
+ listener.traceInfoUpdated();
+ }
+ }
+
+ // Cancel pressed
+ else if( retVal == 1 ){
+
+ }
+ }
+
+ /**
+ * setVisible.
+ * Method that changes visibility of UI-components.
+ * @param value true, if components need to be shown.
+ */
+ public void setVisible(boolean value){
+ gridDataTraceSelection.exclude = !value;
+ compositeTraceSelection.setVisible(value);
+
+ }
+
+ /**
+ * updateTraceInfo.
+ * updates trace info into trace text box.
+ */
+ private void updateTraceInfo(){
+ if( traceItem != null){
+ String text = traceItem.getTraceName();
+
+ // if trace name is null, set trace id numbers into text box
+ if(text == null || text.equals("null")){
+ text = "Trace name not found( ComponentID = ";
+ text += Integer.toHexString(traceItem.getIdNumbers().getComponentId());
+ text += ", GroupID = ";
+ text += Integer.toHexString(traceItem.getIdNumbers().getGroupId());
+ text += ", TraceID = ";
+ text += Integer.toHexString(traceItem.getIdNumbers().getTraceId());
+ text += " )";
+ }
+ this.textTrace.setText(text);
+ }
+ }
+
+ /**
+ * getTraceInformation.
+ * @return selected trace item.
+ */
+ public TraceInfo getTraceInformation(){
+ return traceItem;
+
+ }
+
+
+ /**
+ * SetTraceItem.
+ * Sets trace item and updates
+ * @param traceItem a new trace item.
+ */
+ public void setTraceItem(TraceInfo traceItem) {
+ this.traceItem = traceItem;
+ updateTraceInfo();
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/src/com/nokia/s60tools/traceanalyser/interfaces/ITraceAnalyserFileObserver.java Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+
+package com.nokia.s60tools.traceanalyser.interfaces;
+
+/**
+ * interface ITraceAnalyserFileObserver.
+ * interface that Trace Analyser File managers use when "read files"- operation is finished.
+ */
+public interface ITraceAnalyserFileObserver {
+ /**
+ * rulesUpdated.
+ * Rules are updated and all rules need to be reread.
+ */
+ public void rulesUpdated();
+
+ /**
+ * ruleUpdated.
+ * One rule's history has been changed.
+ */
+ public void ruleUpdated(String ruleName);
+
+ /**
+ * failLogUpdated.
+ * Fail log is updated.
+ */
+ public void failLogUpdated();
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/src/com/nokia/s60tools/traceanalyser/model/Engine.java Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,314 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.s60tools.traceanalyser.model;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+
+
+import com.nokia.s60tools.traceanalyser.containers.RuleInformation;
+import com.nokia.s60tools.traceanalyser.export.ITraceAnalyserRuleType;
+import com.nokia.s60tools.traceanalyser.export.RuleEvent;
+import com.nokia.s60tools.traceanalyser.export.TraceAnalyserRule;
+import com.nokia.s60tools.traceanalyser.interfaces.ITraceAnalyserFileObserver;
+import com.nokia.s60tools.traceanalyser.plugin.TraceAnalyserPlugin;
+import com.nokia.s60tools.traceanalyser.ui.views.MainView;
+
+/**
+ * class engine.
+ * Engine of Trace Analyser extension.
+ */
+
+public class Engine implements ITraceAnalyserFileObserver {
+
+ /* Fail Log Manager */
+ private FailLogManager failLogManager;
+
+ /* Rule Manager */
+ private RuleManager ruleManager;
+
+ /* Trace Listener */
+ private TraceListener traceListener;
+
+ /* list of rule types */
+ ArrayList<ITraceAnalyserRuleType> ruleTypes;
+
+ /* Main view */
+ MainView mainView;
+
+ /**
+ * Engine.
+ * constructor.
+ */
+ public Engine(){
+
+ // Get rule types
+ ruleTypes = new ArrayList<ITraceAnalyserRuleType>();
+ getRuleTypeArray();
+
+ // create fail log manager
+ failLogManager = new FailLogManager(this);
+
+ // create rule manager
+ ruleManager = new RuleManager(this, ruleTypes);
+
+ // create trace listener
+ traceListener = new TraceListener(this);
+
+ // refresh fail log and rule information.
+ failLogManager.refresh();
+ ruleManager.refresh();
+ }
+
+ /**
+ * setMainView.
+ * @param mainView main view.
+ */
+ public void setMainView(MainView mainView){
+ this.mainView = mainView;
+ }
+
+
+ /**
+ * getRuleArray.
+ * Searches for rule type plug-ins and creates rule array from them.
+ */
+ private void getRuleTypeArray(){
+
+ final String EXTENSION_TRACE_ANALYSER_RULE = "traceanalyserrule"; //$NON-NLS-1$
+
+ try {
+ IExtensionRegistry er = Platform.getExtensionRegistry();
+ IExtensionPoint ep =
+ er.getExtensionPoint(TraceAnalyserPlugin.PLUGIN_ID, EXTENSION_TRACE_ANALYSER_RULE);
+ IExtension[] extensions = ep.getExtensions();
+
+ // if plug-ins were found.
+ if (extensions != null && extensions.length > 0) {
+
+ // read all found rules
+ for (int i = 0; i < extensions.length; i++) {
+ IConfigurationElement[] ce = extensions[i].getConfigurationElements();
+ if (ce != null && ce.length > 0) {
+ try {
+ ITraceAnalyserRuleType provider = (ITraceAnalyserRuleType)ce[0].createExecutableExtension("class");
+ if (provider != null) {
+ ruleTypes.add(provider);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * getFailLog
+ * @return fail log
+ */
+ public RuleEvent[] getFailLog(){
+ return failLogManager.getTraceAnalyserFailLog();
+ }
+
+ /**
+ * refreshFailLog.
+ * Refreshes Fail log
+ */
+ public void refreshFailLog(){
+ failLogManager.refresh();
+ }
+
+ /**
+ * clearFailLog.
+ * Clears fail log.
+ */
+ public void clearFailLog(){
+ failLogManager.clearLog();
+ }
+
+ /**
+ * addFailLogItem.
+ * @param item, new fail log item.
+ */
+ public void addFailLogItem(RuleEvent item){
+ failLogManager.addItem(item);
+ if(mainView != null){
+ mainView.blinkIcon();
+ }
+ }
+
+ /**
+ * stop.
+ * Stops Trace Analyser Engine.
+ */
+ public void stop(){
+ failLogManager.saveLogToFile();
+ ruleManager.saveData();
+ traceListener.stopListening();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.nokia.s60tools.traceanalyser.interfaces.ITraceAnalyserFileObserver#failLogUpdated()
+ */
+ public void failLogUpdated() {
+ if(mainView != null){
+ mainView.failLogUpdated();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.nokia.s60tools.traceanalyser.interfaces.ITraceAnalyserFileObserver#rulesUpdated()
+ */
+ public void rulesUpdated() {
+ TraceAnalyserRule[] rules = ruleManager.getActivatedRules();
+ traceListener.setRules(rules);
+ if(mainView != null){
+ mainView.rulesUpdated();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.nokia.s60tools.traceanalyser.interfaces.ITraceAnalyserFileObserver#ruleUpdated(java.lang.String)
+ */
+ public void ruleUpdated(String ruleName) {
+ if(mainView != null){
+ mainView.ruleUpdated(ruleName);
+ }
+ }
+
+ /**
+ * refreshRuleList.
+ * Refreshes rule list.
+ */
+ public void refreshRuleList(){
+ ruleManager.refresh();
+ }
+
+ /**
+ * getRuleInformation.
+ * @return Trace analyser rules.
+ */
+ public RuleInformation[] getRuleInformation(){
+ return ruleManager.getRuleInformation();
+ }
+
+ /**
+ * getRule.
+ * returns one rule.
+ * @param ruleName name of the rule that is requested.
+ * @return rule
+ */
+ public TraceAnalyserRule getRule(String ruleName){
+ return ruleManager.getRule(ruleName);
+ }
+
+ /**
+ * getRuleTypes.
+ * @return Trace Analyser Rule Types
+ */
+ public ArrayList<ITraceAnalyserRuleType> getRuleTypes() {
+ return ruleTypes;
+ }
+
+ /**
+ * addRule.
+ * @param newRule new Trace Analyser rule
+ * @return true if rule was added succesfully.
+ */
+ public boolean addRule(TraceAnalyserRule newRule){
+ boolean retval = ruleManager.addRule(newRule);
+ traceListener.setRules(ruleManager.getActivatedRules());
+ return retval;
+ }
+
+
+ /**
+ * getTraceListener.
+ * @return trace listener
+ */
+ public TraceListener getTraceListener() {
+ return traceListener;
+ }
+
+ /**
+ * changeRuleaActivation.
+ * @param ruleName name of the rule
+ */
+ public void changeRuleaActivation(String ruleName, boolean value){
+ ruleManager.changeRuleActivation(ruleName, value);
+ TraceAnalyserRule[] rules = ruleManager.getActivatedRules();
+ traceListener.setRules(rules);
+ }
+ /**
+ * removeRule
+ * @param ruleName rule that should be removed.
+ * @return true if rule was removed successfully.
+ */
+ public boolean removeRule(String ruleName){
+ return ruleManager.removeRule(ruleName);
+ }
+
+ /**
+ * addRuleEvent.
+ * @param ruleName name of rule where event is added.
+ * @param event rule that event is added into.
+ */
+ public void addRuleEvent(String ruleName, RuleEvent event){
+ ruleManager.addHistoryEvent(ruleName, event);
+ }
+
+ /**
+ * resets all rules history data.
+ */
+ public void resetHistory(){
+ ruleManager.clearHistory();
+ }
+
+ /**
+ * resets one rules history.
+ * @param ruleName
+ */
+ public void resetOneRulesHistory(String ruleName){
+ ruleManager.clearOneRulesHistory(ruleName);
+ }
+
+ /**
+ * ruleExists.
+ * @param ruleName name of the rule
+ * @return true if rule with that name already exists
+ */
+
+ public boolean ruleExists(String ruleName){
+ return ruleManager.ruleExists(ruleName);
+ }
+
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/src/com/nokia/s60tools/traceanalyser/model/FailLogManager.java Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,243 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.s60tools.traceanalyser.model;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInput;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutput;
+import java.io.ObjectOutputStream;
+import java.io.OutputStream;
+import java.util.*;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.jobs.ILock;
+
+
+import com.nokia.s60tools.traceanalyser.interfaces.ITraceAnalyserFileObserver;
+import com.nokia.s60tools.traceanalyser.plugin.TraceAnalyserPlugin;
+import com.nokia.s60tools.traceanalyser.export.RuleEvent;
+
+
+/**
+ * This class is responsible for providing Trace Analyser Fail Log items to MainView's content provider.
+ */
+public class FailLogManager extends Job {
+
+ /* file observer */
+ ITraceAnalyserFileObserver filesObserver = null;
+
+ /* accesslock */
+ ILock accessLock = null;
+
+ /* boolean value that is true when job is on-going */
+ boolean jobRunning = false;
+
+ /* list of fails */
+ //ArrayList<FailLogItem> failLog;
+ ArrayList<RuleEvent> failLog;
+
+
+ /**
+ * TraceAnalyserFileManager.
+ * Constructor.
+ * @param observer observer, which is notified when reading is finished.
+ */
+ public FailLogManager( ITraceAnalyserFileObserver observer ) {
+ super("Trace Analyser - Reading Fail Log");
+ filesObserver = observer;
+ accessLock = Job.getJobManager().newLock();
+ failLog = null;
+ }
+
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ protected IStatus run(IProgressMonitor monitor) {
+
+ accessLock.acquire();
+ jobRunning = true;
+
+ // if log has not yet been read, read it now.
+ if(failLog == null){
+ loadLogFromFile();
+ }
+ // notify main view that reading finished.
+ if(filesObserver != null){
+ filesObserver.failLogUpdated();
+ }
+ jobRunning = false;
+ accessLock.release();
+
+ return Status.OK_STATUS;
+ }
+
+
+ /**
+ * getTraceAnalyserFailLog.
+ * Method that returns read violations from fail log.
+ * If fails are not read method starts reading them.
+ * @return array containing all fail events.
+ */
+ public RuleEvent[] getTraceAnalyserFailLog() {
+ // files have not yet been read, start reading process
+ if (failLog == null ) {
+ if(!jobRunning){
+ jobRunning = true;
+ setPriority(Job.LONG);
+ setUser(false);
+ schedule(100);
+ }
+ RuleEvent[] cFiles = new RuleEvent[0];
+
+
+ return cFiles;
+ }
+ else{
+ return failLog.toArray(new RuleEvent[failLog.size()]);
+
+ }
+
+ }
+
+ /**
+ * addItem.
+ * adds one item to fail log.
+ * @param newItem
+ */
+ public void addItem(RuleEvent newItem){
+ if(failLog != null){
+ failLog.add(0,newItem);
+ }
+ if(filesObserver != null){
+ filesObserver.failLogUpdated();
+ }
+ }
+
+ public void clearLog(){
+ failLog.clear();
+ if(filesObserver != null){
+ filesObserver.failLogUpdated();
+ }
+ }
+
+ /**
+ * refresh.
+ * Refresh rule list.
+ */
+ public void refresh() {
+
+ accessLock.acquire();
+ try {
+ if (!jobRunning){
+ jobRunning = true;
+ setPriority(Job.LONG);
+ setUser(false);
+ schedule(100);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ accessLock.release();
+ }
+ }
+
+ /**
+ * getPluginWorkingLocation.
+ * Returns a path where Rule plug-in can do various tasks (located under workspace).
+ */
+ private String getFailLogFileName() {
+ IPath location = Platform.getStateLocation( TraceAnalyserPlugin.getDefault().getBundle());
+ return location.toOSString() + "//FailLog.log";
+ }
+
+ /**
+ * saveLogToFile.
+ * Saves fail log into file system.
+ */
+ public void saveLogToFile(){
+ try {
+
+ OutputStream file = new FileOutputStream(getFailLogFileName());
+ OutputStream buffer = new BufferedOutputStream(file);
+ ObjectOutput output = new ObjectOutputStream(buffer);
+ try {
+ // serialize fail list.
+ output.writeObject(failLog);
+ } finally {
+ output.close();
+ }
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ /**
+ * loadLogFromFile.
+ * Loads fail list from file system.
+ */
+ private void loadLogFromFile() {
+ try {
+ // use buffering
+ InputStream file = new FileInputStream(getFailLogFileName());
+ InputStream buffer = new BufferedInputStream(file);
+ ObjectInput input = new ObjectInputStream(buffer);
+ try {
+ // deserialize the List
+ failLog = (ArrayList<RuleEvent>) input.readObject();
+
+ } finally {
+ input.close();
+ if(failLog == null){
+ failLog = new ArrayList<RuleEvent>();
+ }
+ }
+ } catch (ClassNotFoundException ex) {
+ ex.printStackTrace();
+ failLog = new ArrayList<RuleEvent>();
+
+ } catch (IOException ex) {
+ failLog = new ArrayList<RuleEvent>();
+
+ }
+ }
+
+ /**
+ * setObserver.
+ * Sets observer.
+ * @param filesObserver, new observer.
+ */
+ public void setObserver(ITraceAnalyserFileObserver filesObserver){
+ this.filesObserver = filesObserver;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/src/com/nokia/s60tools/traceanalyser/model/RuleManager.java Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,429 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.s60tools.traceanalyser.model;
+
+import java.util.*;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.jobs.ILock;
+
+import com.nokia.s60tools.traceanalyser.containers.DummyRule;
+import com.nokia.s60tools.traceanalyser.containers.RuleInformation;
+import com.nokia.s60tools.traceanalyser.export.ITraceAnalyserRuleType;
+import com.nokia.s60tools.traceanalyser.export.RuleEvent;
+import com.nokia.s60tools.traceanalyser.export.TraceAnalyserRule;
+import com.nokia.s60tools.traceanalyser.export.RuleEvent.RuleStatus;
+import com.nokia.s60tools.traceanalyser.interfaces.ITraceAnalyserFileObserver;
+
+
+/**
+ * This class is responsible for providing Trace Analyser rules and history data to MainView's content provider.
+ * Class calls every rule types getRules-method to get every Trace Analyser Rule rule.
+ * After that class calls each rules getHistoryData method to get history data.
+ */
+public class RuleManager extends Job {
+
+ /* file observer */
+ ITraceAnalyserFileObserver engine = null;
+
+ /* accesslock */
+ ILock accessLock = null;
+
+ /* boolean value that is true when job is on-going */
+ boolean jobRunning = false;
+
+ /* List of rule types */
+ ArrayList<ITraceAnalyserRuleType> ruleTypes = null;
+
+ /* HashMap containing each rule and its history data. */
+ HashMap<String, RuleInformation> history = null;
+
+ /**
+ * TraceAnalyserFileManager.
+ * Constructor.
+ * @param engine, engine which is notified when reading is finished.
+ * @param ruleTypes, ArrayList, which contains all rule types.
+ */
+ public RuleManager( ITraceAnalyserFileObserver engine, ArrayList<ITraceAnalyserRuleType> ruleTypes ) {
+ super("Trace Analyser - Reading Rules");
+ this.engine = engine;
+ accessLock = Job.getJobManager().newLock();
+ jobRunning = false;
+ this.ruleTypes = ruleTypes;
+ }
+
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ protected IStatus run(IProgressMonitor monitor) {
+
+ accessLock.acquire();
+
+ // if history has never been read, read it now.
+ if(history == null){
+
+ history = new HashMap<String,RuleInformation>();
+ ArrayList<TraceAnalyserRule> ruleArray = new ArrayList<TraceAnalyserRule>();
+
+ // read rules
+ for(ITraceAnalyserRuleType item : ruleTypes){
+ ruleArray.addAll(item.getRules());
+ }
+
+ // Read History.
+ for(TraceAnalyserRule item : ruleArray){
+
+ // Get history data from rule
+ RuleInformation information = new RuleInformation(item);
+ information.setEvents(item.readHistory());
+
+ // count history data(amount off passes, fails....)
+ countHistory(information);
+ history.put(item.getName(), information);
+ }
+ }
+ engine.rulesUpdated();
+ accessLock.release();
+ jobRunning = false;
+ return Status.OK_STATUS;
+ }
+
+
+
+ /**
+ * getRuleInformation.
+ * Method that returns reads rules and history . If rules are not read method starts reading them.
+ * @return Rules and History data, or dummy object if job is on-going.
+ */
+ public RuleInformation[] getRuleInformation() {
+ // files have not yet been read, start reading process
+ if (history == null) {
+
+ if( jobRunning == false ){
+ jobRunning = true;
+ setPriority(Job.LONG);
+ setUser(false);
+ schedule(100);
+ }
+ RuleInformation[] cFiles = new RuleInformation[1];
+ DummyRule dummyRule = new DummyRule("Loading rules and history...");
+ cFiles[0] = new RuleInformation(dummyRule);
+ return cFiles;
+ }
+ else{
+ return history.values().toArray(new RuleInformation[history.size()]);
+ }
+
+ }
+
+
+
+
+ /**
+ * refresh.
+ * Resfresh rule list.
+ */
+ public void refresh() {
+
+ accessLock.acquire();
+ try {
+ if (!jobRunning) {
+ jobRunning = true;
+ setPriority(Job.LONG);
+ setUser(false);
+ schedule(100);
+ }
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ finally {
+ accessLock.release();
+ }
+ }
+
+ /**
+ * addRule.
+ * Adds new rule.
+ * @param newRule rule that should be added.
+ * @return true if rule was added(file operations successful)
+ */
+ public boolean addRule(TraceAnalyserRule newRule){
+ accessLock.acquire();
+ if(history.containsKey(newRule.getName())){
+ accessLock.release();
+ return false;
+ }
+ else{
+ history.put(newRule.getName(),new RuleInformation(newRule));
+ accessLock.release();
+ return true;
+ }
+ }
+
+ /**
+ * changeRuleActivation
+ * @param ruleName name of the rule
+
+ */
+ public void changeRuleActivation(String ruleName, boolean value){
+ RuleInformation information = history.get(ruleName);
+ if(information != null){
+ information.getRule().setActivated(value);
+
+ }
+ }
+
+
+ /**
+ * removeRule.
+ * Removes rule
+ * @param ruleName rule that should be removed.
+ * @return true if rule was removed(file operations successful)
+ */
+ public boolean removeRule(String ruleName){
+ accessLock.acquire();
+
+ RuleInformation item = history.get(ruleName);
+ boolean deleteComplete = item.delete();
+ if( deleteComplete ){
+ history.remove(ruleName);
+ }
+ accessLock.release();
+ return deleteComplete;
+
+
+ }
+
+
+ /**
+ * saveHistory.
+ * Saves history data into each rule.
+ */
+ @SuppressWarnings("unchecked")
+ public void saveData(){
+ Set set = history.entrySet();
+ Iterator i = set.iterator();
+ int index = 0;
+
+
+
+ while (i.hasNext()) {
+ Map.Entry me = (Map.Entry) i.next();
+ RuleInformation information = (RuleInformation) me.getValue();
+ if(!information.getRule().writeXML()){
+ System.out.println("Unable to save rule definitions"
+ + information.getRule().getName());
+ }
+ if (!information.getRule().saveHistory(information.getEvents())) {
+ System.out.println("Unable to save history data on rule"
+ + information.getRule().getName());
+ }
+
+ index++;
+ }
+ }
+
+ /**
+ * getActivatedRules.
+ * @return array of all activated rules.
+ */
+ @SuppressWarnings("unchecked")
+ public TraceAnalyserRule[] getActivatedRules() {
+ accessLock.acquire();
+ TraceAnalyserRule[] ruleArray = null;
+ ArrayList<TraceAnalyserRule> rules = new ArrayList<TraceAnalyserRule>();
+ if(history != null){
+ //ruleArray = new TraceAnalyserRule[history.size()];
+ Set set = history.entrySet();
+ Iterator i = set.iterator();
+ int index = 0;
+ while (i.hasNext()) {
+ Map.Entry me = (Map.Entry) i.next();
+ TraceAnalyserRule rule = ((RuleInformation) me.getValue()).getRule();
+ if(rule.isActivated()){
+ rules.add(rule);
+ }
+ //ruleArray[index] = ((RuleInformation) me.getValue()).getRule().isActivated();
+ index++;
+ }
+ ruleArray = rules.toArray(new TraceAnalyserRule[rules.size()]);
+
+ }
+ else{
+ ruleArray = new TraceAnalyserRule[0];
+ }
+ accessLock.release();
+ return ruleArray;
+ }
+
+ /**
+ * addHistoryEvent.
+ * Adds new history event.
+ * @param ruleName name of the rule where event is added.
+ * @param event history event.
+ */
+ public void addHistoryEvent(String ruleName, RuleEvent event){
+ accessLock.acquire();
+ RuleInformation item = history.get(ruleName);
+ item.getEvents().add(event);
+ countHistory(item);
+ engine.ruleUpdated(ruleName);
+ accessLock.release();
+
+ }
+
+
+ /**
+ * countHistory.
+ * Counts history values.
+ * @param information rule which history values are counted.
+ */
+ private void countHistory(RuleInformation information){
+ ArrayList<RuleEvent> events = information.getEvents();
+
+ int pass = 0;
+ int fail = 0;
+ int min = 0;
+ int max = 0;
+ int sum = 0;
+
+ int[] values = new int[events.size()];
+
+ for(int i = 0; i < events.size(); i++){
+
+
+ RuleEvent event = events.get(i);
+
+ // if first event set as max and min value.
+ if(i == 0){
+ min = event.getValue();
+ max = event.getValue();
+ }
+ else{
+ // if event value is smaller than min value set event value as min.
+ if(event.getValue() < min){
+ min = event.getValue();
+ }
+ // if event value is greater than max value set event value as max.
+ else if(event.getValue() > max){
+ max = event.getValue();
+ }
+ }
+
+ // count passes and fails.
+ if(event.getStatus() == RuleStatus.PASS){
+ pass++;
+ }
+ else{
+ fail++;
+ }
+
+ // count sum and add value to value-array.
+ sum += event.getValue();
+ values[i] = event.getValue();
+ }
+ information.setPass(pass);
+ information.setFail(fail);
+ information.setMin(min);
+ information.setMax(max);
+
+ // count average based on sum of values.
+ if(events.size() > 0){
+ information.setAvg(sum/events.size());
+ }
+
+ // count median based on value-array.
+ if(values.length > 0){
+ Arrays.sort(values);
+ information.setMed(values[values.length/2]);
+ }
+
+ }
+
+
+ /**
+ * clearHistory.
+ * Clears history data about each rule.
+ */
+ @SuppressWarnings("unchecked")
+ public void clearHistory(){
+ Set set = history.entrySet();
+ Iterator i = set.iterator();
+
+ int index = 0;
+
+ while (i.hasNext()) {
+ Map.Entry me = (Map.Entry) i.next();
+ ((RuleInformation) me.getValue()).setEvents(new ArrayList<RuleEvent>());
+ countHistory((RuleInformation) me.getValue());
+ index++;
+ }
+ engine.rulesUpdated();
+ }
+
+ /**
+ * clearOneRulesHistory.
+ * Clears history data about one rule.
+ * @param ruleName rule that's history is cleared.
+ */
+ public void clearOneRulesHistory(String ruleName){
+ RuleInformation information = history.get(ruleName);
+ information.setEvents(new ArrayList<RuleEvent>());
+ countHistory(information);
+ engine.ruleUpdated(ruleName);
+
+ }
+
+ /**
+ * ruleExists.
+ * @param ruleName name of the rule
+ * @return true if rule with that name already exists
+ */
+ public boolean ruleExists(String ruleName){
+ if(history.get(ruleName) != null){
+ return true;
+ }
+ else{
+ return false;
+ }
+ }
+
+
+ /**
+ * getRule.
+ * returns one rule.
+ * @param ruleName name of the rule that is requested.
+ * @return rule
+ */
+ public TraceAnalyserRule getRule(String ruleName){
+ RuleInformation information = history.get(ruleName);
+ if(information != null){
+ return information.getRule();
+ }
+ else{
+ return null;
+ }
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/src/com/nokia/s60tools/traceanalyser/model/StartupHandler.java Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+
+package com.nokia.s60tools.traceanalyser.model;
+
+import org.eclipse.ui.IStartup;
+
+import com.nokia.s60tools.traceanalyser.plugin.TraceAnalyserPlugin;
+
+/**
+ * Startup handler is called when Carbide is started.
+ * Engine is started when carbide starts.
+ *
+ */
+
+public class StartupHandler implements IStartup {
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.IStartup#earlyStartup()
+ */
+ public void earlyStartup() {
+ TraceAnalyserPlugin.startEngine();
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/src/com/nokia/s60tools/traceanalyser/model/TraceListener.java Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,120 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+
+package com.nokia.s60tools.traceanalyser.model;
+
+
+import com.nokia.s60tools.traceanalyser.export.RuleEvent;
+import com.nokia.s60tools.traceanalyser.export.TraceAnalyserRule;
+import com.nokia.s60tools.traceanalyser.export.RuleEvent.RuleStatus;
+import com.nokia.traceviewer.api.DPLocation;
+import com.nokia.traceviewer.api.TraceViewerAPI;
+import com.nokia.traceviewer.api.TraceViewerAPI.TVAPIError;
+import com.nokia.traceviewer.engine.TraceProperties;
+import com.nokia.traceviewer.engine.dataprocessor.DataProcessor;
+
+/**
+ * class TraceListener.
+ * Class that is responsible for listening to trace.
+ */
+public class TraceListener implements DataProcessor {
+
+ /* Trace Analyser engine */
+ Engine engine;
+
+ /* Rule array */
+ TraceAnalyserRule[] rules = null;
+
+ /**
+ * TraceListener.
+ * constructor.
+ * @param engine Trace Analyser Engine.
+ */
+ public TraceListener(Engine engine){
+ this.engine = engine;
+ //Add DataProcessor to TraceViewer
+ TVAPIError error = TVAPIError.NONE;
+ error = TraceViewerAPI.addDataProcessor(this, DPLocation.AFTER_VIEW, 50); // CodForChk_Dis_Magic
+
+ // Check error code
+ if( error != TVAPIError.NONE ){
+ System.out.println("Unable to add dataprocessor to TraceViewer");
+
+ }
+ }
+
+ /**
+ * stopListening.
+ * stops listening to trace.
+ */
+ public void stopListening(){
+ //Add DataProcessor to TraceViewer
+ TVAPIError error = TVAPIError.NONE;
+ error = TraceViewerAPI.removeDataProcessor(this);
+
+ // Check error code
+ if( error != TVAPIError.NONE ){
+ System.out.println("Unable to remove dataprocessor from TraceViewer");
+ }
+ }
+
+
+ /*
+ * (non-Javadoc)
+ * @see com.nokia.traceviewer.engine.dataprocessor.DataProcessor#processData(com.nokia.traceviewer.engine.TraceProperties)
+ */
+ public void processData(TraceProperties traceEvent) {
+
+ // Make sure that this is not scrolled trace
+ if(! traceEvent.traceConfiguration.isScrolledTrace()){
+ if(rules != null){
+
+ // forwards trace to all rules and if rule some rule event is detected it is sent to engine and fail log.
+ for(TraceAnalyserRule rule:rules){
+
+ // Check rule status.
+ RuleEvent event = rule.checkRuleStatus(traceEvent);
+
+
+ if(event.getStatus() == RuleStatus.FAIL){
+
+ // if rule failed, create add item to fail log log item.
+ engine.addFailLogItem(event);
+ }
+ if(event.getStatus() != RuleStatus.NONE){
+ // is some event(either fail or pass) is detected, sent it to engine.
+ engine.addRuleEvent(rule.getName(), event);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * setRules.
+ * @param traceAnalyserRules new rule array.
+ */
+ public void setRules(TraceAnalyserRule[] traceAnalyserRules) {
+ this.rules = traceAnalyserRules;
+ }
+
+
+
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/src/com/nokia/s60tools/traceanalyser/model/UserEnteredData.java Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,139 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+
+package com.nokia.s60tools.traceanalyser.model;
+
+import org.eclipse.jface.dialogs.IDialogSettings;
+
+import com.nokia.s60tools.traceanalyser.plugin.TraceAnalyserPlugin;
+
+/**
+ * This class is used to save and restore data which is entered by user in
+ * wizard pages.
+ *
+ */
+public class UserEnteredData {
+
+ // section names
+ public static final String SECTION_SELECT_TRACE = "TraceSelectionDialog";
+ public static final String PREVIOUS_DICTIONARY = "PreviousDictionary";
+ public static final String PREVIOUS_GROUP = "PreviousGroup";
+
+ public static enum ValueTypes { PREVIOUS_GROUP,
+ PREVIOUS_DICTIONARY }
+
+
+
+ /**
+ * getString
+ * gets string value from correct section
+ * @param valueType type of string
+ * @return String value
+ */
+
+ public String getString( ValueTypes valueType) {
+ try {
+ String retval = "";
+
+ // get value from correct section
+ switch(valueType){
+ case PREVIOUS_DICTIONARY:{
+ IDialogSettings section = getSection(SECTION_SELECT_TRACE);
+ if (section != null) {
+ retval = section.get(PREVIOUS_DICTIONARY);
+
+ }
+ break;
+
+ }
+ case PREVIOUS_GROUP:{
+ IDialogSettings section = getSection(SECTION_SELECT_TRACE);
+ if (section != null) {
+ retval = section.get(PREVIOUS_GROUP);
+ }
+ break;
+ }
+
+
+ default:{
+ break;
+ }
+ }
+ return retval;
+ } catch (Exception e) {
+ return "";
+ }
+ }
+
+ /**
+ * saveString
+ * saves string value into correct section.
+ * @param valueType type of string
+ * @param value value that is saved
+ */
+
+ public void saveString(ValueTypes valueType, String value) {
+ try {
+
+ // save value into correct section
+
+ switch(valueType){
+ case PREVIOUS_DICTIONARY:{
+ IDialogSettings section = getSection(SECTION_SELECT_TRACE);
+ if (section != null) {
+ section.put(PREVIOUS_DICTIONARY, value);
+ }
+ break;
+ }
+ case PREVIOUS_GROUP:{
+ IDialogSettings section = getSection(SECTION_SELECT_TRACE);
+ if (section != null) {
+ section.put(PREVIOUS_GROUP, value);
+ }
+ break;
+ }
+
+ default:{
+ break;
+ }
+ }
+
+
+ } catch (Exception E) {
+ // No actions needed
+ }
+ }
+
+
+ /**
+ * Returns wanted section
+ * @param section name of the wanted section
+ * @return wanted section
+ */
+ protected IDialogSettings getSection(String section) {
+ IDialogSettings retVal = null;
+ if (TraceAnalyserPlugin.getDefault().getDialogSettings() != null) {
+ retVal = TraceAnalyserPlugin.getDefault().getDialogSettings().getSection(section);
+ if (retVal == null) {
+ retVal = TraceAnalyserPlugin.getDefault().getDialogSettings().addNewSection(section);
+ }
+ }
+ return retVal;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/src/com/nokia/s60tools/traceanalyser/plugin/TraceAnalyserPlugin.java Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,202 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+
+package com.nokia.s60tools.traceanalyser.plugin;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.jobs.ILock;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+import com.nokia.s60tools.traceanalyser.model.Engine;
+import com.nokia.s60tools.traceanalyser.resources.ImageResourceManager;
+import com.nokia.s60tools.traceanalyser.ui.views.MainView;
+
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class TraceAnalyserPlugin extends AbstractUIPlugin {
+
+ /* Access lock */
+ private static ILock accessLock = null;
+
+ /* Install path of Plugin */
+ private String pluginInstallPath = "";
+
+ /* Main view of Trace Analyser */
+ private static MainView mainView;
+
+ /* Engine of Trace Analyser */
+ private static Engine engine;
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "com.nokia.s60tools.traceanalyser";
+
+ // The shared instance
+ private static TraceAnalyserPlugin plugin;
+
+ /**
+ * TraceAnalyserPlugin.
+ * The constructor
+ */
+ public TraceAnalyserPlugin() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+
+ String pluginInstallLocation = getPluginInstallPath();
+
+ String imagesPath = getImagesPath(pluginInstallLocation);
+
+ // Loading images required by this plug-in
+ ImageResourceManager.loadImages(imagesPath);
+
+ accessLock = Job.getJobManager().newLock();
+
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ engine.stop();
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * getDefault.
+ * Returns the shared instance
+ * @return the shared instance
+ */
+ public static TraceAnalyserPlugin getDefault() {
+ return plugin;
+ }
+
+ /**
+ * getImageDescriptor.
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+
+
+ /**
+ * getPluginInstallPath
+ * @return the path where this plugin is installed
+ */
+ public static String getPluginInstallPath() {
+ try {
+ if ( plugin.pluginInstallPath.equals("") ) { //$NON-NLS-1$
+ // URL to the plugin's root ("/")
+ URL relativeURL = plugin.getBundle().getEntry("/"); //$NON-NLS-1$
+ // Converting into local path
+ URL localURL = FileLocator.toFileURL(relativeURL);
+ // Getting install location in correct form
+ File f = new File(localURL.getPath());
+ plugin.pluginInstallPath = f.getAbsolutePath();
+ }
+ return plugin.pluginInstallPath;
+ } catch (Exception e) {
+ return ""; //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * getImagesPath.
+ * Gets images path relative to given plugin install path.
+ * @param pluginInstallPath Plugin installation path.
+ * @return Path were image resources are located.
+ * @throws IOException
+ */
+ private String getImagesPath(String pluginInstallPath) throws IOException{
+ return pluginInstallPath
+ + File.separatorChar + "icons"; //$NON-NLS-1$
+ }
+
+ /**
+ * startEngine.
+ * Starts Trace Analyser's engine.
+ */
+ public static void startEngine(){
+ accessLock.acquire();
+ if(engine == null){
+ engine = new Engine();
+ }
+ accessLock.release();
+ }
+
+ /**
+ * getEngine
+ * getter for engine. If engine is not yet started this method starts it.
+ * @return
+ */
+ public static Engine getEngine(){
+ startEngine();
+ return engine;
+ }
+
+ /**
+ * getMainView.
+ * @return main view of Trace Analyser
+ */
+ public static MainView getMainView() {
+ return mainView;
+ }
+
+ /**
+ * setMainView.
+ * @param newMainView new main view.
+ */
+ public static void setMainView(MainView newMainView) {
+ mainView = newMainView;
+ if(engine != null){
+ engine.setMainView(mainView);
+ }
+ }
+
+
+ /**
+ * resets engine
+ */
+ public static Engine restartEngine(){
+ engine = new Engine();
+ return engine;
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/src/com/nokia/s60tools/traceanalyser/resources/HelpContextIDs.java Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+
+package com.nokia.s60tools.traceanalyser.resources;
+
+/**
+ * IDs for context sensitive help.
+ * @see contexts.xml -file IDs links to <code> <context id="<ID>"> </code>
+ */
+public class HelpContextIDs {
+
+ /**
+ * The plug-in ID.
+ */
+ private static final String TRACE_ANALYSER_PROJECT_PLUGIN_ID = "com.nokia.s60tools.traceanalyser.help";
+
+ /**
+ * ID to Trace Analyser Help TOC
+ */
+
+
+ public static final String TRACE_ANALYSER_MAIN_VIEW =
+ TRACE_ANALYSER_PROJECT_PLUGIN_ID +".TRACE_ANALYSER_MAIN_VIEW";
+
+ public static final String TRACE_ANALYSER_HISTORY_VIEW=
+ TRACE_ANALYSER_PROJECT_PLUGIN_ID +".TRACE_ANALYSER_HISTORY_VIEW";
+
+ public static final String TRACE_ANALYSER_FAIL_LOG =
+ TRACE_ANALYSER_PROJECT_PLUGIN_ID +".TRACE_ANALYSER_FAIL_LOG";
+
+ public static final String TRACE_ANALYSER_RULE_EDITOR =
+ TRACE_ANALYSER_PROJECT_PLUGIN_ID +".TRACE_ANALYSER_RULE_EDITOR";
+
+ public static final String TRACE_ANALYSER_TRACE_SELECTION_DIALOG =
+ TRACE_ANALYSER_PROJECT_PLUGIN_ID +".TRACE_ANALYSER_TRACE_SELECTION_DIALOG";
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/src/com/nokia/s60tools/traceanalyser/resources/ImageKeys.java Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+
+package com.nokia.s60tools.traceanalyser.resources;
+
+public class ImageKeys {
+ public static final String IMG_APP_ICON = "TRACE_ANALYSER_IMG_APP_ICON";
+ public static final String IMG_CLEAR_ALL = "TRACE_ANALYSER_IMG_CLEAR_ALL";
+ public static final String IMG_CREATE_NEW = "TRACE_ANALYSER_IMG_CREATE_NEW";
+ public static final String IMG_FAIL_RECEIVED = "TRACE_ANALYSER_IMG_FAIL_RECEIVED";
+ public static final String IMG_CLEAR_FAIL_LOG = "TRACE_ANALYSER_IMG_CLEAR_FAIL_LOG";
+ public static final String IMG_TRACE_ANALYSER_BANNER = "TRACE_ANALYSER_IMG_APP_ICON_BANNER";
+
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/src/com/nokia/s60tools/traceanalyser/resources/ImageResourceManager.java Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,74 @@
+/*
+* ============================================================================
+* Revision : $Rev:$
+*
+* Copyright © 2009 Nokia. All rights reserved.
+* This material, including documentation and any related computer
+* programs, is protected by copyright controlled by Nokia. All
+* rights are reserved. Copying, including reproducing, storing,
+* adapting or translating, any or all of this material requires the
+* prior written consent of Nokia. This material also contains
+* confidential information which may not be disclosed to others
+* without the prior written consent of Nokia.
+============================================================================
+*/
+
+package com.nokia.s60tools.traceanalyser.resources;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+
+
+/**
+ * Class for handling Trace Analyser icons.
+ *
+ */
+public class ImageResourceManager {
+
+ public static void loadImages(String imagesPath){
+
+ Display disp = Display.getCurrent();
+
+ ImageRegistry imgReg = JFaceResources.getImageRegistry();
+
+ //
+ // Storing images to image registry
+ //
+
+ /*******************************************************************************
+ * Copyright for the following group of images.
+ * Copyright ©2009 Nokia Corporation. All rights reserved.
+ *******************************************************************************/
+ Image img = new Image( disp, imagesPath + "\\TraceAnalyser.png" );
+ imgReg.put( ImageKeys.IMG_APP_ICON, img );
+
+ img = new Image( disp, imagesPath + "\\ClearAllCounters.png" );
+ imgReg.put( ImageKeys.IMG_CLEAR_ALL, img );
+
+ img = new Image( disp, imagesPath + "\\CreateNewRule.png" );
+ imgReg.put( ImageKeys.IMG_CREATE_NEW, img );
+
+ img = new Image( disp, imagesPath + "\\FailReceived.png" );
+ imgReg.put( ImageKeys.IMG_FAIL_RECEIVED, img );
+
+ img = new Image( disp, imagesPath + "\\ClearFailLog.png" );
+ imgReg.put( ImageKeys.IMG_CLEAR_FAIL_LOG, img );
+
+ img = new Image( disp, imagesPath + "\\TraceAnalyser_banner.png" );
+ imgReg.put( ImageKeys.IMG_TRACE_ANALYSER_BANNER, img );
+
+ }
+
+ public static ImageDescriptor getImageDescriptor( String key ){
+ ImageRegistry imgReg = JFaceResources.getImageRegistry();
+ return imgReg.getDescriptor( key );
+ }
+
+ public static Image getImage( String key ){
+ ImageRegistry imgReg = JFaceResources.getImageRegistry();
+ return imgReg.get(key);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/src/com/nokia/s60tools/traceanalyser/ui/actions/ToolbarShortcutAction.java Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,76 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+
+package com.nokia.s60tools.traceanalyser.ui.actions;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+
+import com.nokia.s60tools.traceanalyser.ui.views.MainView;
+
+
+/**
+ * Action for toolbar and import shortcuts that launch Trace Analyser
+ * @see IWorkbenchWindowActionDelegate
+ */
+public class ToolbarShortcutAction implements IWorkbenchWindowActionDelegate {
+
+ /**
+ * The action has been activated. The argument of the
+ * method represents the 'real' action sitting
+ * in the workbench UI.
+ * @see IWorkbenchWindowActionDelegate#run
+ */
+ public void run(IAction action) {
+ // Open Trace Analyser Main View
+ MainView.showAndReturnYourself();
+
+ }
+
+ /**
+ * Selection in the workbench has been changed. We
+ * can change the state of the 'real' action here
+ * if we want, but this can only happen after
+ * the delegate has been created.
+ * @see IWorkbenchWindowActionDelegate#selectionChanged
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+ // nothing to be done
+ }
+
+ /**
+ * We can use this method to dispose of any system
+ * resources we previously allocated.
+ * @see IWorkbenchWindowActionDelegate#dispose
+ */
+ public void dispose() {
+ // nothing to be done
+ }
+
+ /**
+ * We will cache window object in order to
+ * be able to provide parent shell for the message dialog.
+ * @see IWorkbenchWindowActionDelegate#init
+ */
+ public void init(IWorkbenchWindow window) {
+ // nothing to be done
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/src/com/nokia/s60tools/traceanalyser/ui/dialogs/EditRuleDialog.java Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,453 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.s60tools.traceanalyser.ui.dialogs;
+
+import java.util.ArrayList;
+
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.s60tools.traceanalyser.export.ITraceAnalyserRuleType;
+import com.nokia.s60tools.traceanalyser.export.ITraceAnalyserRuleTypeListener;
+import com.nokia.s60tools.traceanalyser.export.TraceAnalyserRule;
+import com.nokia.s60tools.traceanalyser.model.Engine;
+import com.nokia.s60tools.traceanalyser.resources.ImageKeys;
+import com.nokia.s60tools.traceanalyser.resources.ImageResourceManager;
+
+
+/**
+ * class Edit rule dialog
+ * Dialog that can be used for editing rule's definitions.
+ */
+public class EditRuleDialog extends TitleAreaDialog implements SelectionListener, ModifyListener, ITraceAnalyserRuleTypeListener {
+
+ Composite contents;
+
+ /* UI-Components */
+ private Group groupConstComponents;
+
+ /* Rule Type related components */
+ private Composite compositeRuleType;
+ private Label labelRuleType;
+ private Combo comboRuleType;
+
+ /* Rule Name related components */
+ private Composite compositeRuleName;
+ private Label labelRuleName;
+ private Text textRuleName;
+
+ /* Rule Description relates components */
+ private Composite compositeRuleDescription;
+ private Label labelRuleDescription;
+ private Text textRuleDescription;
+
+ /* Rule type that is currently opened */
+ private ITraceAnalyserRuleType shownRule;
+
+ /* All rule types */
+ private ArrayList<ITraceAnalyserRuleType> rules;
+
+ /* Group for Rule plugins own UI-components */
+ private Group groupAdditionalComponents;
+
+ /* Rule that is used when formatting values to ui-components.*/
+ private TraceAnalyserRule rule;
+
+ private Engine engine;
+
+ private boolean createNewRule = false;
+
+ private String oldRuleName = null;
+
+ /**
+ * TraceSelectionDialog.
+ * Constructor.
+ * @param parentShell
+ */
+ public EditRuleDialog(Shell parentShell, ArrayList<ITraceAnalyserRuleType> rules, TraceAnalyserRule rule, Engine engine, boolean createNewRule) {
+ super(parentShell);
+ setShellStyle(SWT.DIALOG_TRIM | SWT.MODELESS | SWT.RESIZE);
+ this.rules = rules;
+ this.rule = rule;
+ this.engine = engine;
+ this.createNewRule = createNewRule;
+ if(createNewRule == false){
+ oldRuleName = rule.getName();
+ }
+ }
+
+
+ @Override
+ /**
+ * createDialogArea.
+ * Method that places ui components into give composite.
+ */
+ protected Control createDialogArea(Composite parent) {
+
+ getShell().setText("Edit Rule");
+ setTitle("Edit Rule Definitions");
+
+ setTitleImage(ImageResourceManager.getImage(ImageKeys.IMG_TRACE_ANALYSER_BANNER));
+
+ // Set the minimum size for dialog
+ getShell().setMinimumSize(new Point( 550, 500));
+
+ // create composite where all components are placed
+ contents = new Composite(parent, SWT.NONE);
+ GridLayout contentsLayout = new GridLayout();
+ contentsLayout.numColumns = 1;
+ contents.setLayout(contentsLayout);
+ contents.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ // create group for components that are present for every rule type.
+ groupConstComponents = new Group(contents, SWT.NONE);
+ GridLayout layoutGroupConstComponents = new GridLayout();
+ layoutGroupConstComponents.numColumns = 1;
+ groupConstComponents.setLayout(layoutGroupConstComponents);
+ GridData gridDataGroupConstComponents = new GridData(GridData.FILL_HORIZONTAL);
+ groupConstComponents.setLayoutData(gridDataGroupConstComponents);
+ groupConstComponents.setText("Basic Settings");
+
+
+ // create ui components that are present for every rule type.
+ this.createConstComponents(groupConstComponents);
+
+ // create Group for additional components
+ groupAdditionalComponents = new Group(contents, SWT.NONE);
+ GridLayout layoutGroupAdditionalComponents = new GridLayout();
+ layoutGroupAdditionalComponents.numColumns = 1;
+ groupAdditionalComponents.setLayout(layoutGroupAdditionalComponents);
+ groupAdditionalComponents.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ groupAdditionalComponents.setText("Rule type specific settings");
+
+
+ // Add all additional rule type's ui components into Group groupAdditionalComponents
+ for( ITraceAnalyserRuleType item : rules ){
+ item.createUIComponents(groupAdditionalComponents, this);
+ // hide components.
+ item.setVisible(false);
+
+ }
+
+ // if editing existing rule, format values from it to UI-components and disable rule type selection.
+ if(rule != null){
+ textRuleName.setText(rule.getName());
+ textRuleDescription.setText(rule.getDescription());
+ for(int i = 0; i < rules.size(); i++){
+ if( rules.get(i).formatRuleDefinitions(rule)){
+ comboRuleType.select(i);
+ comboRuleType.setEnabled(false);
+ break;
+ }
+ }
+ }
+
+ // hide all rule components except selected rule's components.
+ this.hideAndRevealItems();
+ setHelps();
+ return contents;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
+ */
+ public void createButtonsForButtonBar( Composite composite ){
+ super.createButtonsForButtonBar(composite);
+ this.canFinish();
+ }
+
+ /**
+ * createConstComponents.
+ * Method that created UI components that are same on every rule.
+ * @param composite composite where components are placed.
+ */
+ private void createConstComponents(Composite composite){
+ this.createRuleTypeComposite(composite);
+ this.createRuleNameComposite(composite);
+ this.createRuleDescriptionComposite(composite);
+ }
+
+ /**
+ * createRuleTypeComposite.
+ * Method that creates all rule name related components.
+ * @param composite
+ */
+ private void createRuleTypeComposite(Composite composite){
+
+ // create composite for rule type components
+ compositeRuleType = new Composite(composite, SWT.NONE);
+ GridLayout contentsLayout = new GridLayout();
+ contentsLayout.numColumns = 2;
+ compositeRuleType.setLayout(contentsLayout);
+ compositeRuleType.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ // Create rule type label
+ labelRuleType = new Label(compositeRuleType, SWT.NONE);
+ labelRuleType.setText("Rule Type:");
+
+ // Create rule type combo
+ comboRuleType = new Combo(compositeRuleType, SWT.READ_ONLY);
+ GridData dataGridComboRuleType = new GridData(GridData.FILL_HORIZONTAL);
+ comboRuleType.setLayoutData(dataGridComboRuleType);
+ comboRuleType.addSelectionListener(this);
+
+ // get rule type's names from rule array and add them to combo box.
+ for(ITraceAnalyserRuleType item : rules){
+ comboRuleType.add(item.getRuleType());
+ }
+
+ // Select first item if possible
+ if( comboRuleType.getItems().length > 0 ){
+ comboRuleType.select(0);
+ }
+
+
+
+ }
+
+ /**
+ * createRuleNameComposite.
+ * Method that creates all rule name related components.
+ * @param composite composite where components are placed.
+ */
+ private void createRuleNameComposite(Composite composite){
+
+ // create composite for rule name components
+ compositeRuleName = new Composite(composite, SWT.NONE);
+ GridLayout layoutCompositeRuleName = new GridLayout();
+ layoutCompositeRuleName.numColumns = 2;
+ compositeRuleName.setLayout(layoutCompositeRuleName);
+ compositeRuleName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ // Create rule name label
+ labelRuleName = new Label(compositeRuleName, SWT.NONE);
+ labelRuleName.setText("Rule Name:");
+
+ // Create rule name text field
+ textRuleName = new Text(compositeRuleName, SWT.BORDER);
+ GridData gridDataTextRuleName = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ textRuleName.setToolTipText("Define Name of the Rule.");
+ textRuleName.setLayoutData(gridDataTextRuleName);
+ textRuleName.addModifyListener(this);
+ }
+
+ /**
+ * createRuleDescriptionComposite.
+ * Method that creates all rule description related components.
+ * @param composite
+ */
+ private void createRuleDescriptionComposite(Composite composite){
+ // create composite for rule name components
+ compositeRuleDescription = new Composite(composite, SWT.NONE);
+ GridLayout layoutCompositeRuleDescription = new GridLayout();
+ layoutCompositeRuleDescription.numColumns = 1;
+ compositeRuleDescription.setLayout(layoutCompositeRuleDescription);
+ compositeRuleDescription.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ // Create rule type label
+ labelRuleDescription = new Label(compositeRuleDescription, SWT.NONE);
+ labelRuleDescription.setText("Rule Description(optional):");
+
+ // Create rule description text field
+ textRuleDescription = new Text(compositeRuleDescription, SWT.BORDER | SWT.MULTI);
+
+ GridData gridDataTextRuleDescription = new GridData(GridData.FILL_HORIZONTAL);
+ textRuleDescription.setToolTipText("Define description for rule.");
+ textRuleDescription.setLayoutData(gridDataTextRuleDescription);
+ }
+
+
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ public void widgetDefaultSelected(SelectionEvent arg0) {
+ // nothing to be done.
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ public void widgetSelected(SelectionEvent event) {
+ if( event.widget == comboRuleType ){
+ this.hideAndRevealItems();
+ }
+ this.canFinish();
+ }
+
+ /**
+ *
+ */
+ private void hideAndRevealItems(){
+ int selectedIndex = comboRuleType.getSelectionIndex();
+ if(selectedIndex >= 0 && selectedIndex < rules.size()){
+
+ if(shownRule != null){
+ shownRule.setVisible(false);
+ }
+ shownRule = rules.get(selectedIndex);
+ shownRule.setVisible(true);
+ }
+
+ contents.layout();
+ }
+
+ /**
+ * Set this page's context sensitive helps
+ */
+ protected void setHelps() {
+ // Set help
+ PlatformUI.getWorkbench().getHelpSystem().setHelp( getShell(), com.nokia.s60tools.traceanalyser.resources.HelpContextIDs.TRACE_ANALYSER_RULE_EDITOR);
+ }
+
+ /**
+ * canFinish.
+ * Method that checks that all needed information is filled into UI-components.
+ * Method also takes care enabling/disabling OK-button and printing error messages if needed.
+ */
+ public void canFinish(){
+ String message = "Some of the mandatory fields is not filled properly:\n";
+
+ if(this.getButton(OK) != null){
+
+ // if no rule types found, set error message and disable ok
+ if( comboRuleType.getItems().length == 0 ){
+ setMessage("No Trace Analyser rule types found from plugins-directory. Probably some parts of the Trace Analyser plug-in are missing.", org.eclipse.jface.dialogs.IMessageProvider.ERROR);
+ this.getButton(OK).setEnabled(false);
+ return;
+ }
+
+ // if name-field is empty, set warning message and disable ok-button.
+ else if( textRuleName.getText().length() == 0 ){
+ message += "Rule name missing";
+ setMessage(message, org.eclipse.jface.dialogs.IMessageProvider.INFORMATION);
+ this.getButton(OK).setEnabled(false);
+ return;
+ }
+
+ else if(engine.ruleExists(textRuleName.getText()) && createNewRule){
+ message += "Rule with same name already exists.";
+ setMessage(message, org.eclipse.jface.dialogs.IMessageProvider.INFORMATION);
+ this.getButton(OK).setEnabled(false);
+ return;
+ }
+
+ // ask from shown rule if all needed information is present.
+ else if(this.shownRule != null){
+ String error = shownRule.canFinish();
+ if( error != null){
+ message += error;
+ setMessage(message, org.eclipse.jface.dialogs.IMessageProvider.INFORMATION);
+ this.getButton(OK).setEnabled(false);
+ return;
+ }
+ }
+
+ // clear error message and set ok enabled.
+
+ setMessage("");
+ this.getButton(OK).setEnabled(true);
+ return;
+ }
+ return;
+
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
+ */
+ public void modifyText(ModifyEvent event) {
+ if(event.widget == textRuleName){
+ try{
+ this.canFinish();
+ }
+ catch (NullPointerException e) {
+ // Do nothing
+ }
+ }
+
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+ */
+ public void okPressed(){
+ if( shownRule != null){
+ TraceAnalyserRule newRule = shownRule.getRule(textRuleName.getText(), textRuleDescription.getText());
+ if(newRule!= null){
+
+ if(createNewRule == false){
+
+ // Confirm that rule user really wants to save new rule defitions.
+ MessageBox messageBox = new MessageBox(getShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO);
+ messageBox.setText("Trace Analyse - Edit Rule");
+ messageBox.setMessage("Editing rule will clear rule's history. Are you sure you want to save new rule definitions?");
+ int retval = messageBox.open();
+ if(retval == SWT.YES){
+ if(!engine.removeRule(oldRuleName)){
+ MessageDialog.openError( getShell(), "Trace Analyser - error", "An error occured when trying to save rule." );
+ return;
+ }
+
+ }
+ else{ //if retval == SWT.NO
+ return;
+ }
+
+
+ }
+
+ if(!engine.addRule(newRule)){
+ MessageDialog.openError( getShell(), "Trace Analyser - error", "Unable to save rule, perhaps rule with same name already exists?" );
+
+ }
+ this.close();
+ }
+ else{
+ MessageDialog.openError( getShell(), "Trace Analyser - error", "An error occured when trying to save rule." );
+ }
+
+ }
+ }
+
+
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/src/com/nokia/s60tools/traceanalyser/ui/dialogs/TraceSelectionDialog.java Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,691 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.s60tools.traceanalyser.ui.dialogs;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+
+import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PlatformUI;
+
+
+import com.nokia.s60tools.traceanalyser.model.UserEnteredData;
+import com.nokia.s60tools.traceanalyser.model.UserEnteredData.ValueTypes;
+import com.nokia.s60tools.traceanalyser.resources.ImageKeys;
+import com.nokia.s60tools.traceanalyser.resources.ImageResourceManager;
+import com.nokia.s60tools.traceanalyser.ui.views.MainView;
+import com.nokia.traceviewer.api.TraceViewerAPI;
+import com.nokia.traceviewer.engine.activation.TraceActivationComponentItem;
+import com.nokia.traceviewer.engine.activation.TraceActivationGroupItem;
+import com.nokia.traceviewer.engine.activation.TraceActivationTraceItem;
+
+
+/**
+ * class Trace selection dialog
+ * Dialog that can be used for selecting one Trace item from imported trace dictionaries.
+ */
+public class TraceSelectionDialog extends TitleAreaDialog implements SelectionListener, ModifyListener {
+
+
+ /* UI-components */
+
+ /* Dictionary-related components */
+ private Composite compositeDictionaries;
+ private Table tableGroups;
+ private Label labelDictinaryFilter;
+ private Text textDictionaryFilter;
+
+ /* Group related components */
+ private Composite compositeGroups;
+ private Table tableDictionaries;
+ private Label labelGroupFilter;
+ private Text textGroupFilter;
+
+ /* Trace related components */
+ private Composite compositeTraces;
+ private Table tableTraces;
+ private Label labelTraceFilter;
+ private Text textTraceFilter;
+
+
+ /* List of trace dictionaries */
+ private ArrayList<TraceActivationComponentItem> dictionaryList;
+
+ /* Currently selected trace item */
+ TraceActivationTraceItem selectedTrace;
+
+ /* Strings */
+ public final static String TEXT_FILTER = "Filter:";
+
+ /* Column width's for each table */
+ public final static int COLUMN_DICTIONARIES_NAME = 150;
+ public final static int COLUMN_GROUPS_ID = 45;
+ public final static int COLUMN_GROUPS_NAME = 200;
+ public final static int COLUMN_TRACES_ID = 45;
+ public final static int COLUMN_TRACES_NAME = 350;
+
+ @SuppressWarnings("unchecked")
+ public class TraceActivationComponentComparator implements Comparator {
+
+ public final int compare(Object pFirst, Object pSecond) {
+ String aFirstWeight = ((TraceActivationComponentItem) pFirst).getName();
+ String aSecondWeight = ((TraceActivationComponentItem) pSecond).getName();
+ return aFirstWeight.compareToIgnoreCase(aSecondWeight);
+ } // end compare
+
+ }
+
+ /**
+ * TraceSelectionDialog.
+ * Constructor.
+ * @param parentShell
+ */
+ public TraceSelectionDialog(Shell parentShell) {
+ super(parentShell);
+ setShellStyle(SWT.DIALOG_TRIM | SWT.MODELESS);
+ }
+
+ @Override
+ /**
+ * createDialogArea.
+ */
+ protected Control createDialogArea(Composite parent) {
+
+
+ getShell().setText("Select Trace");
+
+ setTitle("Select Trace For Rule");
+ setTitleImage(ImageResourceManager.getImage(ImageKeys.IMG_TRACE_ANALYSER_BANNER));
+
+ // Set the minimum size for dialog
+ getShell().setMinimumSize(new Point(600, 500));
+ // create composite where all components are placed
+ Composite contents = new Composite(parent, SWT.NONE);
+ GridLayout contentsLayout = new GridLayout();
+ contentsLayout.numColumns = 1;
+ contents.setLayout(contentsLayout);
+ contents.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ // create group where all components are placed
+ Group group = new Group(contents, SWT.NONE);
+ GridLayout layoutContents = new GridLayout();
+ layoutContents.numColumns = 3;
+ group.setLayout(layoutContents);
+ group.setText("Select Trace");
+ GridData contentsGridData = new GridData(GridData.FILL_BOTH);
+ group.setLayoutData(contentsGridData);
+
+ // create tables for trace selection
+ this.createDictionaryTable( group );
+ this.createGroupsTable(group);
+ this.createTracesTable(group);
+ loadUserEnteredData();
+
+ setHelps();
+ return contents;
+ }
+
+ /**
+ * createDictionaryTable.
+ * Places dictionary table into given composite.
+ * @param composite composite where table is placed.
+ */
+ private void createDictionaryTable( Composite composite ){
+
+ // Create dictionaries - composite
+ compositeDictionaries = new Composite( composite, SWT.NONE );
+ compositeDictionaries.setLayoutData(new GridData(GridData.FILL_BOTH));
+ GridLayout layoutDictionaries = new GridLayout();
+ layoutDictionaries.numColumns = 2;
+ compositeDictionaries.setLayout(layoutDictionaries);
+
+ // Table that contains all traces from selected dictionary
+ tableDictionaries = new Table(compositeDictionaries, SWT.BORDER | SWT.FULL_SELECTION );
+ GridData gridDataDictionaryTable = new GridData(GridData.FILL_BOTH);
+ gridDataDictionaryTable.horizontalSpan = 2;
+ gridDataDictionaryTable.heightHint = 250;
+ tableDictionaries.setLayoutData(gridDataDictionaryTable);
+ tableDictionaries.setHeaderVisible(true);
+ tableDictionaries.addSelectionListener( this );
+
+ // add columns into table
+ TableColumn columnDictionary = new TableColumn(tableDictionaries, SWT.LEFT);
+ columnDictionary.setText("Dictionary Name");
+ columnDictionary.setWidth(COLUMN_DICTIONARIES_NAME);
+
+ // Create dictionary filter label
+ labelDictinaryFilter = new Label(compositeDictionaries, SWT.NONE);
+ labelDictinaryFilter.setText(TEXT_FILTER);
+
+ // Create dictionary filter text field
+ textDictionaryFilter = new Text(compositeDictionaries, SWT.BORDER);
+ GridData groupFilterTextGridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ textDictionaryFilter.setToolTipText("Filter for Dictionary");
+ textDictionaryFilter.setLayoutData(groupFilterTextGridData);
+ textDictionaryFilter.addModifyListener(this);
+
+ // update dictionary list(load list from TraceViewer):
+ updateDictionaryList();
+
+
+ }
+
+
+ /**
+ * createGroupsTable.
+ * Places group table into given composite.
+ * @param composite composite where table is placed.
+ */
+ private void createGroupsTable( Composite composite ){
+
+ // create composite for group table
+ compositeGroups = new Composite( composite, SWT.NONE );
+ compositeGroups.setLayoutData(new GridData(GridData.FILL_BOTH));
+ GridLayout layoutGroups = new GridLayout();
+ layoutGroups.numColumns = 2;
+ compositeGroups.setLayout(layoutGroups);
+
+ // Table that contains all groups from selected dictionary
+ tableGroups = new Table(compositeGroups, SWT.BORDER | SWT.FULL_SELECTION );
+ GridData gridDataTableGroups = new GridData(GridData.FILL_BOTH);
+ gridDataTableGroups.horizontalSpan = 2;
+ gridDataTableGroups.heightHint = 250;
+ tableGroups.setLayoutData(gridDataTableGroups);
+ tableGroups.setHeaderVisible(true);
+ tableGroups.addSelectionListener( this );
+
+ // add columns into table
+ TableColumn columnID = new TableColumn(tableGroups, SWT.LEFT);
+ columnID.setText("ID");
+ columnID.setWidth(COLUMN_GROUPS_ID);
+ TableColumn columnGroup = new TableColumn(tableGroups, SWT.LEFT);
+ columnGroup.setText("Group Name");
+ columnGroup.setWidth(COLUMN_GROUPS_NAME);
+
+ // Create Group filter label
+ labelGroupFilter = new Label(compositeGroups, SWT.NONE);
+ labelGroupFilter.setText(TEXT_FILTER);
+
+ // Create trace filter text field
+ textGroupFilter = new Text(compositeGroups, SWT.BORDER);
+ GridData gridDataTextTraceFilter = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ textGroupFilter.setToolTipText("Filter for Group");
+ textGroupFilter.setLayoutData(gridDataTextTraceFilter);
+ textGroupFilter.addModifyListener(this);
+
+ }
+
+
+ /**
+ * createTracesTable.
+ * Places group table into given composite.
+ * @param composite composite where table is placed.
+ */
+ private void createTracesTable(Composite composite){
+
+ // create composite for Traces table
+ compositeTraces = new Composite( composite, SWT.NONE );
+ compositeTraces.setLayoutData(new GridData(GridData.FILL_BOTH));
+ GridLayout layoutTraces = new GridLayout();
+ layoutTraces.numColumns = 2;
+ compositeTraces.setLayout(layoutTraces);
+
+ // Table that contains all traces from selected dictionary
+ tableTraces = new Table(compositeTraces, SWT.BORDER | SWT.FULL_SELECTION );
+ GridData gridDataTableTraces = new GridData(GridData.FILL_BOTH);
+ gridDataTableTraces.horizontalSpan = 2;
+ gridDataTableTraces.heightHint = 250;
+ tableTraces.setLayoutData(gridDataTableTraces);
+ tableTraces.setHeaderVisible(true);
+ tableTraces.addSelectionListener( this );
+
+ // add columns into table
+ TableColumn columnID = new TableColumn(tableTraces, SWT.LEFT);
+ columnID.setText("ID");
+ columnID.setWidth(COLUMN_TRACES_ID);
+ TableColumn columnGroup = new TableColumn(tableTraces, SWT.LEFT);
+ columnGroup.setText("Trace Name");
+ columnGroup.setWidth(COLUMN_TRACES_NAME);
+
+ // Create trace filter label
+ labelTraceFilter = new Label(compositeTraces, SWT.NONE);
+ labelTraceFilter.setText(TEXT_FILTER);
+
+ // Create trace filter text field
+ textTraceFilter = new Text(compositeTraces, SWT.BORDER);
+ GridData gridDataTextTraceFilter = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ textTraceFilter.setToolTipText("Filter for Group");
+ textTraceFilter.setLayoutData(gridDataTextTraceFilter);
+ textTraceFilter.addModifyListener(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ public void widgetDefaultSelected(SelectionEvent event) {
+
+ // if doubleclick detected in trace-table, close dialog.
+ if(event.widget == tableTraces){
+ okPressed();
+ }
+
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ public void widgetSelected(SelectionEvent event) {
+ if( event.widget == tableDictionaries ){
+
+ // when selection in dictionary-table changes, update group list
+ this.updateGroupList();
+ this.updateTraceList();
+ this.setSelectedTraceItem();
+ }
+ else if( event.widget == tableGroups ){
+
+ // when selection in groups-table changes, update trace list
+ this.updateTraceList();
+ this.setSelectedTraceItem();
+
+ }
+ else if( event.widget == tableTraces ){
+
+ this.setSelectedTraceItem();
+
+ }
+ }
+
+ /**
+ * containsIgnoreCase.
+ * Contains-operation that ignores stings case.
+ * @param line string where another parameter is searched from
+ * @param searchPhrase String that is searched from another given parameter
+ * @return
+ */
+ private boolean containsIgnoreCase( String line, String searchPhrase ){
+
+ // convert both Strings to lowercase.
+ line = line.toLowerCase();
+ searchPhrase = searchPhrase.toLowerCase();
+
+ // compare lowercase strings to each other.
+ return line.contains(searchPhrase);
+
+ }
+
+ /**
+ * updateDictionaryList.
+ * Loads dictionary list from TraveViewer and updates dictionary-table
+ */
+ @SuppressWarnings("unchecked")
+ private void updateDictionaryList(){
+
+
+ // remove all items from dictionary-table
+ tableDictionaries.removeAll();
+
+
+ // get dictionary components from TraceViewer
+ dictionaryList = TraceViewerAPI.getDictionaryComponents();
+
+ // Sort list into aphabetical order.
+ Collections.sort(dictionaryList, new TraceActivationComponentComparator());
+
+ if(dictionaryList.size() == 0){
+ //TODO do something!
+ MainView.showTraceViewer();
+ MainView.showAndReturnYourself();
+ dictionaryList = TraceViewerAPI.getDictionaryComponents();
+
+ }
+
+ int tableIndexNumber = 0;
+
+ // go thru dictionary list and add dictionaries to table
+ while( tableIndexNumber < dictionaryList.size() ){
+ if( textDictionaryFilter.getText() != "" &&
+ !this.containsIgnoreCase( dictionaryList.get(tableIndexNumber).getName(), textDictionaryFilter.getText() ) ){
+ // if filter is set, delete dictionary name if it does not contain filter text.
+ dictionaryList.remove(tableIndexNumber);
+ }
+ else{
+ // create new table item into table
+ TableItem newItem = new TableItem(tableDictionaries, SWT.NONE, tableIndexNumber);
+ newItem.setText( new String[]{ dictionaryList.get(tableIndexNumber).getName() } );
+ tableIndexNumber++;
+ }
+ }
+
+ if( dictionaryList.size() > 0){
+ setMessage("Select dictionary where needed trace is found.", org.eclipse.jface.dialogs.IMessageProvider.INFORMATION);
+ }
+
+ if( dictionaryList.size() == 0){
+ setMessage("No loaded trace dictionaries found from TraceViewer. See help for more information.", org.eclipse.jface.dialogs.IMessageProvider.WARNING);
+
+ }
+
+
+ }
+
+ /**
+ * updateGroupList.
+ * Loads Group list from TraceViewer and updates Groups-table
+ */
+ private void updateGroupList(){
+
+
+ // Reset array
+ tableGroups.removeAll();
+
+ ArrayList<TraceActivationGroupItem> groupList = this.getSelectedDictionarysItems();
+
+ if( groupList != null ){
+
+ int tableIndexNumber = 0;
+ // go thru dictionary list
+ while( tableIndexNumber < groupList.size() ){
+ if( textGroupFilter.getText() != "" &&
+ !this.containsIgnoreCase( groupList.get(tableIndexNumber).getName(), textGroupFilter.getText() ) ){
+ // if filter is set, delete dictionary name if it does not contain filter text.
+ groupList.remove(tableIndexNumber);
+ }
+ else{
+ // add new item into table
+ TableItem newItem = new TableItem(tableGroups, SWT.NONE, tableIndexNumber);
+ newItem.setText( new String[]{ "0x"+Integer.toHexString(groupList.get(tableIndexNumber).getId()), groupList.get(tableIndexNumber).getName() } );
+ tableIndexNumber++;
+ }
+ }
+ }
+
+ if( groupList != null && groupList.size() > 0){
+ setMessage("Select group where needed trace is found.",org.eclipse.jface.dialogs.IMessageProvider.INFORMATION);
+ }
+
+
+
+ }
+
+ /**
+ * updateTraceList.
+ * Loads Trace list from TraceViewer and updates traces-table.
+ */
+ private void updateTraceList(){
+
+
+ // Reset array
+ tableTraces.removeAll();
+
+ ArrayList<TraceActivationTraceItem> traceList = this.getSelectedGroupsItems();
+
+ boolean nullNamesFound = false;
+
+ if( traceList != null ){
+ int tableIndexNumber = 0;
+
+ // go thru dictionary list
+ while( tableIndexNumber < traceList.size() ){
+ if( textTraceFilter.getText() != "" &&
+
+ !this.containsIgnoreCase( traceList.get(tableIndexNumber).getName(), textTraceFilter.getText() ) ){
+ // if filter is set, delete dictionary name if it does not contain filter text.
+ traceList.remove(tableIndexNumber);
+ }
+ else{
+ // add new item into table
+ TableItem newItem = new TableItem(tableTraces, SWT.NONE, tableIndexNumber);
+
+ // get id and convert id to hex
+ String id = "0x"+Integer.toHexString(traceList.get(tableIndexNumber).getId());
+ String name = traceList.get(tableIndexNumber).getName();
+
+ if(name == null){
+ nullNamesFound = true;
+ }
+
+ newItem.setText(new String[]{id ,name});
+ tableIndexNumber++;
+ }
+ }
+ }
+
+ if( traceList != null && traceList.size() > 0){
+ setMessage("Select Trace.", org.eclipse.jface.dialogs.IMessageProvider.INFORMATION);
+
+ }
+
+
+
+ if (nullNamesFound){
+ setMessage("No trace names were found from trace definitions file. See help for more information.", org.eclipse.jface.dialogs.IMessageProvider.INFORMATION);
+ }
+
+
+
+ }
+
+
+
+ /**
+ * setSelectedGroupItem.
+ * sets selected trace item into private variable called selectedTrace and enables of disables.
+ */
+ private void setSelectedTraceItem(){
+
+ ArrayList<TraceActivationTraceItem> traceList = this.getSelectedGroupsItems();
+
+ if( traceList != null ){
+
+ int index = tableTraces.getSelectionIndex();
+ if( index != -1 == index < traceList.size()){
+ this.selectedTrace = traceList.get(index);
+ this.getButton(OK).setEnabled(true);
+ setMessage(null);
+
+ return;
+ }
+ }
+ this.getButton(OK).setEnabled(false);
+ this.selectedTrace = null;
+ }
+
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
+ */
+ public void modifyText(ModifyEvent event) {
+ if( event.widget == textDictionaryFilter ){
+ // if Dictionary filter is edited
+
+ // update dictionary list
+ this.updateDictionaryList();
+
+ // update groups list
+ this.updateGroupList();
+
+ // update trace list.
+ this.updateTraceList();
+
+ // Update selected trece
+ this.setSelectedTraceItem();
+
+ }
+ else if( event.widget == textGroupFilter ){
+ // if Group filter is edited
+
+ // update group list.
+ this.updateGroupList();
+
+ // update trace list.
+ this.updateTraceList();
+
+ }
+ else if( event.widget == textTraceFilter ){
+ // if Trace filter is edited
+
+ // update trace list.
+ this.updateTraceList();
+
+ }
+ }
+
+ /**
+ * getSelectedDictionarysItems.
+ * @return currently selected dictionarys items and null is no dictionary is selected.
+ */
+ private ArrayList<TraceActivationGroupItem> getSelectedDictionarysItems(){
+ int index = tableDictionaries.getSelectionIndex();
+ if(index != -1 && index < dictionaryList.size()){
+
+ //Get selected dictionary
+ TraceActivationComponentItem dictionary = dictionaryList.get(index);
+ ArrayList<TraceActivationGroupItem> groupList = new ArrayList<TraceActivationGroupItem>( dictionary.getGroups() );
+ return groupList;
+ }
+ else{
+ return null;
+ }
+ }
+
+ /**
+ * getSelectedGroupsItems.
+ * @return currently selected groups items and null if no group is selected.
+ */
+ private ArrayList<TraceActivationTraceItem> getSelectedGroupsItems(){
+ ArrayList<TraceActivationGroupItem> groupItems = this.getSelectedDictionarysItems();
+ if( groupItems != null ){
+ int index = tableGroups.getSelectionIndex();
+ if(index != -1 && index < groupItems.size()){
+ ArrayList<TraceActivationTraceItem> traceList = new ArrayList<TraceActivationTraceItem> (groupItems.get(index).getTraces());
+ return traceList;
+ }
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
+ */
+ public void createButtonsForButtonBar( Composite composite ){
+ super.createButtonsForButtonBar(composite);
+ // OK button is always disabled when dialog is opened.
+ this.setSelectedTraceItem();
+
+ }
+
+ /**
+ * getSelectedTrace
+ * @return Selected trace, null if no trace is selected.
+ */
+ public TraceActivationTraceItem getSelectedTrace() {
+ return selectedTrace;
+ }
+
+
+
+ /**
+ * loadUserEnteredData
+ * loads previous values into UI components
+ */
+ private void loadUserEnteredData(){
+ UserEnteredData data = new UserEnteredData();
+
+ String previousDictionary = data.getString(ValueTypes.PREVIOUS_DICTIONARY);
+ String previousGroup = data.getString(ValueTypes.PREVIOUS_GROUP);
+ int ii = 0;
+ while(ii < tableDictionaries.getItemCount()){
+ if( tableDictionaries.getItem(ii).getText(0).equals(previousDictionary)){
+ tableDictionaries.setSelection(ii);
+ updateGroupList();
+ ii = 0;
+ while(ii < tableGroups.getItemCount()){
+ if(tableGroups.getItem(ii).getText(0).equals(previousGroup)){
+ tableGroups.setSelection(ii);
+ updateTraceList();
+ break;
+ }
+ ii++;
+ }
+ break;
+ }
+ ii++;
+ }
+
+
+
+ }
+
+ /**
+ * saveUserEnteredData
+ * Saves current user entered data from UI components
+ */
+ public void saveUserEnteredData(){
+ UserEnteredData data = new UserEnteredData();
+
+ String item = tableDictionaries.getSelection()[0].getText(0);
+ data.saveString(ValueTypes.PREVIOUS_DICTIONARY, item);
+
+ item = tableGroups.getSelection()[0].getText(0);
+ data.saveString(ValueTypes.PREVIOUS_GROUP, item);
+ }
+
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+ */
+ public void okPressed(){
+ saveUserEnteredData();
+ this.close();
+
+ }
+
+ /**
+ * Set this page's context sensitive helps
+ */
+ protected void setHelps() {
+ // Set help
+ PlatformUI.getWorkbench().getHelpSystem().setHelp( getShell(), com.nokia.s60tools.traceanalyser.resources.HelpContextIDs.TRACE_ANALYSER_TRACE_SELECTION_DIALOG);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/src/com/nokia/s60tools/traceanalyser/ui/editors/HistoryEditor.java Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,212 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+
+package com.nokia.s60tools.traceanalyser.ui.editors;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.MultiPageEditorPart;
+
+import com.nokia.s60tools.traceanalyser.export.RuleEvent;
+import com.nokia.s60tools.traceanalyser.plugin.TraceAnalyserPlugin;
+import com.nokia.s60tools.traceanalyser.ui.views.MainView;
+import com.nokia.s60tools.ui.S60ToolsTable;
+import com.nokia.s60tools.ui.S60ToolsTableColumnData;
+import com.nokia.s60tools.ui.S60ToolsTableFactory;
+
+
+/**
+ * HistoryEditor.
+ * History view of Trace Analyser
+ */
+public class HistoryEditor extends MultiPageEditorPart{
+
+ /* Tableviewer for history table */
+ TableViewer viewer;
+
+ /* contentprovider for history table */
+ HistoryTableContentProvider contentProvider;
+
+ /* Name of the rule */
+ String ruleName;
+
+ /* History Graph object */
+ HistoryGraph graph;
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.part.MultiPageEditorPart#createPages()
+ */
+ @Override
+ protected void createPages() {
+ int index = 0;
+ createGraphPage(index);
+ index++;
+ createTablePage(index);
+
+ ruleName = ((HistoryEditorInput)this.getEditorInput()).getEvents().getRule().getName();
+ setPartName(ruleName);
+ setHelps();
+ }
+
+ /**
+ * createTablePage.
+ * Method that creates table page of view
+ * @param index tab index of this page
+ */
+ private void createTablePage(int index){
+ // create composite where all components are placed
+ Composite composite = new Composite(getContainer(), SWT.NONE);
+ GridLayout contentsLayout = new GridLayout();
+ contentsLayout.numColumns = 1;
+ composite.setLayout(contentsLayout);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ // Create column name array
+ ArrayList<S60ToolsTableColumnData> columnArrayList = new ArrayList<S60ToolsTableColumnData>();
+
+ // add column names
+ columnArrayList.add(new S60ToolsTableColumnData("Status", 60, 0, HistoryTableDataSorter.STATUS));
+ columnArrayList.add(new S60ToolsTableColumnData("Time", 150, 1, HistoryTableDataSorter.TIME));
+ columnArrayList.add(new S60ToolsTableColumnData("Value", 60, 2, HistoryTableDataSorter.VALUE));
+ columnArrayList.add(new S60ToolsTableColumnData("Violation", 60, 3, HistoryTableDataSorter.VIOLATION));
+
+
+ S60ToolsTableColumnData[] columnDataTableHistory = columnArrayList.toArray(new S60ToolsTableColumnData[0]);
+
+ // Create table for history events
+ S60ToolsTable tableHistory = S60ToolsTableFactory.create(composite, columnDataTableHistory);
+ ArrayList<RuleEvent> events = ((HistoryEditorInput)this.getEditorInput()).getEvents().getEvents();
+
+ viewer = new TableViewer(tableHistory.getTableInstance());
+ contentProvider = new HistoryTableContentProvider(events);
+ viewer.setContentProvider(contentProvider);
+ viewer.setLabelProvider(new HistoryTableLabelProvider());
+ viewer.setComparator(new HistoryTableDataSorter());
+ viewer.setSorter(new HistoryTableDataSorter());
+ //viewer.setInput(getViewSite());
+ viewer.setInput(this.getSite());
+ tableHistory.setHostingViewer(viewer);
+
+ // add this page to composite
+ addPage(composite);
+
+ // set page name
+ setPageText(index,"Table" );
+
+ }
+
+ /**
+ * createGraphPage.
+ * Method that creates graph page of view
+ * @param index tab index of this page
+ */
+ private void createGraphPage(int index){
+
+ // create composite where all components are placed
+ Composite composite = new Composite(getContainer(), SWT.NONE);
+ GridLayout contentsLayout = new GridLayout();
+ contentsLayout.numColumns = 1;
+ composite.setLayout(contentsLayout);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ graph = new HistoryGraph(composite,
+ ((HistoryEditorInput)this.getEditorInput()).getEvents());
+ graph.drawGraph();
+
+ addPage(composite);
+ setPageText(index,"Graph" );
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.part.EditorPart#doSave(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void doSave(IProgressMonitor arg0) {
+ // Nothing to be done
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.part.EditorPart#doSaveAs()
+ */
+ @Override
+ public void doSaveAs() {
+ // Nothing to be done
+
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.part.EditorPart#isSaveAsAllowed()
+ */
+ @Override
+ public boolean isSaveAsAllowed() {
+ // Nothing to be done
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.part.MultiPageEditorPart#dispose()
+ */
+ public void dispose(){
+ MainView view = TraceAnalyserPlugin.getMainView();
+ graph.dispose();
+ if(view != null){
+ view.editorClosed(ruleName);
+ }
+ }
+
+ /**
+ * getRuleName.
+ * @return rule name
+ */
+ public String getRuleName(){
+ return ruleName;
+ }
+
+ /**
+ * historyUpdated.
+ * Method that is called when rule's history is updated
+ * so that graph and table needs to be refreshed.
+ */
+ public void historyUpdated(){
+ graph.redraw();
+ viewer.refresh();
+ }
+
+ /**
+ * Set this page's context sensitive helps
+ */
+ protected void setHelps() {
+ // Set help
+ PlatformUI.getWorkbench().getHelpSystem().setHelp( viewer.getControl(), com.nokia.s60tools.traceanalyser.resources.HelpContextIDs.TRACE_ANALYSER_HISTORY_VIEW);
+ graph.setHelps();
+ }
+
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/src/com/nokia/s60tools/traceanalyser/ui/editors/HistoryEditorInput.java Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,115 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+
+package com.nokia.s60tools.traceanalyser.ui.editors;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IPersistableElement;
+import com.nokia.s60tools.traceanalyser.containers.RuleInformation;
+
+/**
+ * Trace Analyser specific input to the HistoryEditor.
+ *
+ */
+public class HistoryEditorInput implements IEditorInput {
+
+ /* Event history */
+ private RuleInformation events;
+
+ /**
+ * HistoryEditorInput.
+ * constructor
+ * @param events history events.
+ */
+ public HistoryEditorInput(RuleInformation events) {
+ this.events = events;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.IEditorInput#exists()
+ */
+ public boolean exists() {
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.IEditorInput#getImageDescriptor()
+ */
+ public ImageDescriptor getImageDescriptor() {
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.IEditorInput#getPersistable()
+ */
+ public IPersistableElement getPersistable() {
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.IEditorInput#getToolTipText()
+ */
+ public String getToolTipText() {
+ return events.getRule().getName();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
+ */
+ @SuppressWarnings("unchecked")
+ public Object getAdapter(Class adapter) {
+ return null;
+ }
+
+
+ /*
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object o) {
+ if(!(o instanceof HistoryEditorInput)){
+ return false;
+ }
+ HistoryEditorInput otherInput = (HistoryEditorInput) o;
+ return otherInput.getEvents().getRule().getName().equals(events.getRule().getName());
+
+
+ }
+
+ /**
+ * getEvents.
+ * @return history events
+ */
+ public RuleInformation getEvents() {
+ return events;
+ }
+
+ /**
+ * getName
+ * @return name of the rule.
+ */
+ public String getName() {
+ return events.getRule().getName();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/src/com/nokia/s60tools/traceanalyser/ui/editors/HistoryGraph.java Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,404 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+
+package com.nokia.s60tools.traceanalyser.ui.editors;
+
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseMoveListener;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.s60tools.traceanalyser.containers.RuleInformation;
+import com.nokia.s60tools.traceanalyser.export.RuleEvent;
+import com.nokia.s60tools.traceanalyser.export.TraceAnalyserRule;
+import com.nokia.s60tools.traceanalyser.model.Engine;
+import com.nokia.s60tools.traceanalyser.plugin.TraceAnalyserPlugin;
+
+
+/**
+ * HistoryGraph.
+ * Graph UI-component for Trace Analyser
+ */
+public class HistoryGraph implements MouseMoveListener {
+
+ // Margins for each border
+ private static final int MARGIN_LEFT = 100;
+ private static final int MARGIN_OTHERS = 40;
+ private static final int GRAPHMARGIN = 10;
+
+ /* RuleInformation that is drawn to screen */
+ private RuleInformation information;
+
+ /* TraceAnalyser engine */
+ Engine engine;
+
+ /* UI components */
+ private Composite composite;
+ private Canvas canvas;
+
+ /**
+ * HistoryGraph.
+ * @param composite composite where components are placed.
+ * @param information information which is drawn to screen.
+ */
+ HistoryGraph(Composite composite, RuleInformation information){
+ this.composite = composite;
+ this.information = information;
+ this.engine = TraceAnalyserPlugin.getEngine();
+ }
+
+ /**
+ * drawGraph.
+ * Draws graph to screen.
+ */
+ void drawGraph(){
+ if(canvas != null){
+ canvas.dispose();
+ }
+ canvas = new Canvas(composite, SWT.BORDER);
+ canvas.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ // Add mouse mouse listener.
+ canvas.addMouseMoveListener(this);
+
+ // Add paint listener
+ canvas.addPaintListener(new PaintListener() {
+ public void paintControl(PaintEvent e) {
+ GC gc = e.gc;
+ drawBox(gc);
+ drawLimits(gc);
+ drawEvents(gc);
+ }
+
+
+ });
+
+ }
+
+
+ /**
+ * redraw.
+ * Redraws screen.
+ */
+ public void redraw(){
+ canvas.redraw();
+ }
+
+
+ /**
+ * getCanvasSize.
+ * @return size or the canvas.
+ */
+ private Point getCanvasSize(){
+ Point point = canvas.getSize();
+ point.x -= 5;
+ point.y -= 5;
+ return point;
+ }
+
+ /**
+ * drawBox.
+ * Draws box for graph into graphics content.
+ * @param gc graphics content where content is drawn
+ */
+ private void drawBox(GC gc){
+
+ gc.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
+
+ // count start points of box
+ int startPointX = MARGIN_LEFT - GRAPHMARGIN;
+ int startPointY = MARGIN_OTHERS - GRAPHMARGIN;
+
+ // Count width and height of box
+ Point canvasSize = getCanvasSize();
+ int width = canvasSize.x - (MARGIN_LEFT + MARGIN_OTHERS - GRAPHMARGIN*2);
+ int height = canvasSize.y - (MARGIN_OTHERS*2 - GRAPHMARGIN*2);
+
+ // draw and fill rectangle.
+ gc.fillRectangle(startPointX, startPointY, width, height);
+ gc.drawRectangle(startPointX, startPointY, width, height);
+
+
+ }
+
+
+ /**
+ * drawEvents.
+ * Draws all history events to screen.
+ * @param gc graphics content where content is drawn
+ */
+ private void drawEvents(GC gc){
+
+ ArrayList<RuleEvent> events = information.getEvents();
+ Point canvasSize = getCanvasSize();
+
+ // Count start points
+ double sizeY = canvasSize.y - MARGIN_OTHERS * 2;
+ double sizeX = canvasSize.x - (MARGIN_LEFT + MARGIN_OTHERS);
+
+
+ int[] minAndMax = getMinAndMax();
+ int min = minAndMax[0];
+ int max = minAndMax[1];
+
+
+ // get difference between min and max value.
+ int difference = max - min;
+
+ // get multiplier for Y values from that difference.
+ double yMultiplier = sizeY / difference;
+
+ // get multiplier for X values from canvas size and smount of events.
+ double xMultiplier = sizeX / (events.size() - 1);
+
+ gc.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));
+ int[] previousValues = new int[2];
+ int i = 0;
+
+ while(i < events.size()){
+
+ gc.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));
+
+ // count x-value based on what event is drawn to screen
+ int xValue = (int)(i * xMultiplier);
+
+ // count y-value based on what event value is.
+ double yValueDouble = events.get(i).getValue() - min;
+ yValueDouble *= yMultiplier;
+ int yValue = (int)(sizeY - yValueDouble);
+
+ // add margins
+ xValue += MARGIN_LEFT;
+ yValue += MARGIN_OTHERS;
+
+ // Draw mark on one event(currently disabled)
+ // drawMark(gc, xValue, yValue);
+
+ gc.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));
+
+ // Draw line between this and previous event.
+ if(i > 0 ){
+ gc.drawLine(xValue, yValue, previousValues[0], previousValues[1]);
+ }
+
+ // save value to previous value variable
+ previousValues[0] = xValue;
+ previousValues[1] = yValue;
+
+ i++;
+ }
+ }
+
+ /**
+ * drawMark.
+ * Draws mark of one event into given coordinate
+ * @param gc graphics content where content is drawn
+ * @param xValue x-coordinate
+ * @param yValue y-coordinate
+ */
+ @SuppressWarnings("unused")
+ private void drawMark(GC gc, int xValue, int yValue){
+ gc.fillOval(xValue - 3, yValue - 3, 6, 6);
+ gc.drawOval(xValue - 3, yValue - 3, 6, 6);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.swt.events.MouseMoveListener#mouseMove(org.eclipse.swt.events.MouseEvent)
+ */
+ public void mouseMove(MouseEvent event) {
+
+ // sets tooltip based on what is x-coordinate of mouse.
+
+ Point canvasSize = getCanvasSize();
+ int drawingAreaSize = canvasSize.x - (MARGIN_LEFT + MARGIN_OTHERS) ;
+
+ // Count divider for x-coordinate
+ double unit = (double)drawingAreaSize / ((double)information.getEvents().size() - 1);
+
+ // If mouse pointer is over graph area
+ if(event.x < (canvasSize.x - (MARGIN_OTHERS-GRAPHMARGIN)) &&
+ event.x > (MARGIN_LEFT - GRAPHMARGIN) &&
+ event.y > (MARGIN_OTHERS - GRAPHMARGIN) &&
+ event.y < (canvasSize.y - (MARGIN_OTHERS-GRAPHMARGIN)) )
+ {
+ // Count item's index based on x-coordinate
+ double indexDouble = (event.x - MARGIN_LEFT) / unit;
+ indexDouble += 0.5;
+ int index = (int)indexDouble;
+
+ if(index > information.getEvents().size()){
+ index = information.getEvents().size()-1;
+ }
+
+ // Get time and measured value from object and set tooltip
+ Date date = information.getEvents().get(index).getTime();
+ SimpleDateFormat formatter = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss:SSS");
+ canvas.setToolTipText("Time:" + formatter.format(date) + " Value:" + Integer.toString(information.getEvents().get(index).getValue()));
+
+ }
+ else{
+ canvas.setToolTipText(null);
+ }
+
+
+
+ }
+
+ /**
+ * dispose.
+ */
+ public void dispose(){
+ canvas.dispose();
+ }
+
+
+ /**
+ * drawLimits.
+ * Draws y-axis max and min values + 3 values between those into given graphics content.
+ * @param gc graphics content where content is drawn
+ */
+ private void drawLimits(GC gc) {
+
+ // Left margin before texts
+ int numberMargin = 20;
+ int letterSize = 12;
+ Point canvasSize = getCanvasSize();
+
+ int min = 0;
+ int max = 0;
+
+ int[] minAndMax = getMinAndMax();
+ min = minAndMax[0];
+ max = minAndMax[1];
+
+ // get difference between min and max value.
+ double difference = max - min;
+
+ // get multiplier for Y values from that difference.
+ double yMultiplier = (canvasSize.y - MARGIN_OTHERS * 2) / difference;
+
+
+ double xCoordDifference = ((double)(canvasSize.y - MARGIN_OTHERS * 2)) / 4;
+ double valueDifference = ((double)(difference)) / 4;
+
+ // Set colors
+ gc.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));
+ gc.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
+
+ // Get start values
+ double yCoord = (double)MARGIN_OTHERS;
+ double value = (double)max;
+
+ int i = 0;
+ while(i < 5){
+
+ // draw value
+ String printedValueText = Integer.toString((int)(value + 0.5)) + information.getRule().getUnit();
+ gc.drawText(printedValueText, numberMargin, (int) yCoord - letterSize);
+
+ // draw text
+ drawLine(gc, (int)yCoord, numberMargin, Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));
+ yCoord += xCoordDifference;
+ value -= valueDifference;
+ i++;
+
+ }
+
+ // draw "Time ->" text into x-axis.
+ Point timeText = new Point(canvasSize.x / 2, canvasSize.y - MARGIN_OTHERS + 12);
+ gc.drawText("Time ->", timeText.x, timeText.y);
+
+
+ // draw limits into graph
+
+ TraceAnalyserRule rule = engine.getRule(this.information.getRule().getName());
+ int[] limits = rule.getLimits();
+
+
+ for(int item : limits){
+ int yValue = (int)((item - min) * yMultiplier);
+ yCoord = canvasSize.y - MARGIN_OTHERS - yValue;
+ drawLine(gc, (int)yCoord, numberMargin, Display.getCurrent().getSystemColor(SWT.COLOR_RED));
+ }
+
+ }
+
+ /**
+ * drawLine.
+ * Draws straight line into given y-coordinate.
+ * @param gc graphics content where content is drawn
+ * @param yCoord y-coordinate
+ * @param numbeMargin margin in front of line.
+ */
+ private void drawLine(GC gc, int yCoord, int numberMargin, Color color){
+ Color previousColor = gc.getForeground();
+ gc.setForeground(color);
+ gc.drawLine(numberMargin, yCoord,getCanvasSize().x-(MARGIN_OTHERS-GRAPHMARGIN), yCoord );
+ gc.setForeground(previousColor);
+
+
+ }
+
+ /**
+ * Returnns min and max value from one rule's history
+ * @return
+ */
+ private int[] getMinAndMax(){
+ TraceAnalyserRule rule = engine.getRule(this.information.getRule().getName());
+
+ int[] limits = rule.getLimits();
+
+ int min = information.getMin();
+ int max = information.getMax();
+
+ for(int item : limits){
+ if(item > max){
+ max = item;
+ }
+ else if(item < min){
+ min = item;
+ }
+ }
+
+ return new int[]{min,max};
+ }
+
+ /**
+ * sets context sensitive helps
+ */
+ public void setHelps(){
+ PlatformUI.getWorkbench().getHelpSystem().setHelp( canvas, com.nokia.s60tools.traceanalyser.resources.HelpContextIDs.TRACE_ANALYSER_HISTORY_VIEW);
+
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/src/com/nokia/s60tools/traceanalyser/ui/editors/HistoryTableContentProvider.java Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,70 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+
+package com.nokia.s60tools.traceanalyser.ui.editors;
+
+import java.util.ArrayList;
+
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+import com.nokia.s60tools.traceanalyser.export.RuleEvent;
+
+ /*
+ * HistoryTableContentProvider.
+ * Content provider for history table
+ */
+
+ class HistoryTableContentProvider implements IStructuredContentProvider {
+
+ /* event list */
+ ArrayList<RuleEvent> events;
+
+ /**
+ * HistoryTableContentProvider.
+ * Constructor
+ * @param events event list
+ */
+ public HistoryTableContentProvider(ArrayList<RuleEvent> events){
+ this.events = events;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+ */
+ public void inputChanged(Viewer v, Object oldInput, Object newInput) {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+ */
+ public void dispose() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+ */
+ public Object[] getElements(Object parent) {
+ return events.toArray(new RuleEvent[events.size()]);
+ }
+
+ }
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/src/com/nokia/s60tools/traceanalyser/ui/editors/HistoryTableDataSorter.java Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,112 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.s60tools.traceanalyser.ui.editors;
+import org.eclipse.jface.viewers.Viewer;
+import com.nokia.s60tools.traceanalyser.export.RuleEvent;
+import com.nokia.s60tools.traceanalyser.export.RuleEvent.RuleStatus;
+import com.nokia.s60tools.ui.S60ToolsViewerSorter;
+
+/**
+ * class HistoryTableDataSorter
+ * Data sorter for Trace Analyser's history view.
+ */
+
+public class HistoryTableDataSorter extends S60ToolsViewerSorter {
+
+ /**
+ * Numbers of columns that can be sorted.
+ */
+ public static final int STATUS = 1;
+ public static final int TIME = 2;
+ public static final int VALUE = 3;
+ public static final int VIOLATION = 4;
+
+ public HistoryTableDataSorter() {
+ super();
+ // By default set sort criteria to time
+ setSortCriteria(TIME);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ViewerSorter#compare(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+ */
+ public int compare(Viewer viewer, Object e1, Object e2) {
+
+
+ // By default comparison does not do any ordering
+ int comparisonResult = 0;
+
+ RuleEvent f1 = (RuleEvent) e1;
+ RuleEvent f2 = (RuleEvent) e2;
+
+ switch (sortCriteria) {
+
+ case STATUS:
+
+ if(f1.getStatus() == f2.getStatus()){
+ comparisonResult = 0;
+ }
+ else if(f1.getStatus() == RuleStatus.FAIL){
+ comparisonResult = 1;
+ }
+ else{
+ comparisonResult = -1;
+ }
+ break;
+
+ case -1:
+ case TIME:
+ if(f1.getTime().before(f2.getTime())){
+ comparisonResult = 1;
+ }
+ else{
+ comparisonResult = -1;
+ }
+ break;
+
+ case VALUE:
+ if(f1.getValue() < f2.getValue()){
+ comparisonResult = 1;
+ }
+ else{
+ comparisonResult = -1;
+ }
+ break;
+
+ case VIOLATION:
+ if(f1.getViolation() > f2.getViolation()){
+ comparisonResult = 1;
+ }
+ else{
+ comparisonResult = -1;
+ }
+
+ break;
+
+ default:
+ break;
+ }
+
+ return comparisonResult;
+
+ }
+
+
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/src/com/nokia/s60tools/traceanalyser/ui/editors/HistoryTableLabelProvider.java Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+
+package com.nokia.s60tools.traceanalyser.ui.editors;
+
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+
+
+import com.nokia.s60tools.traceanalyser.export.RuleEvent;
+
+/**
+ * HistoryTableLabelProvider.
+ * Label provider for history table.
+ */
+class HistoryTableLabelProvider extends LabelProvider implements ITableLabelProvider {
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
+ */
+ public String getColumnText(Object obj, int index) {
+ RuleEvent item = (RuleEvent)obj;
+ return item.getHistoryText(index);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
+ */
+ public Image getColumnImage(Object obj, int index) {
+ return getImage(obj);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
+ */
+ public Image getImage(Object obj) {
+ return null;
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/src/com/nokia/s60tools/traceanalyser/ui/views/FailLogTableContentProvider.java Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,77 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+
+package com.nokia.s60tools.traceanalyser.ui.views;
+
+
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+
+import com.nokia.s60tools.traceanalyser.model.Engine;
+
+/**
+ * class FailLogTableContentProvider
+ * content provides for fail log table.
+ */
+class FailLogTableContentProvider implements IStructuredContentProvider {
+
+ /* Trace Analyser engine */
+ private final Engine engine;
+
+ /**
+ * FailLogTableContentProvider.
+ * constructor.
+ * @param engine
+ */
+ public FailLogTableContentProvider( Engine engine ){
+ this.engine = engine;
+ }
+
+ /**
+ * refresh.
+ * refreshes fail log.
+ */
+ public void refresh() {
+ engine.refreshFailLog();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+ */
+ public void inputChanged(Viewer v, Object oldInput, Object newInput) {
+ }
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+ */
+ public void dispose() {
+ }
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+ */
+ public Object[] getElements(Object parent) {
+ return engine.getFailLog();
+
+ }
+
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/src/com/nokia/s60tools/traceanalyser/ui/views/FailLogTableDataSorter.java Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,107 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.s60tools.traceanalyser.ui.views;
+import org.eclipse.jface.viewers.Viewer;
+
+import com.nokia.s60tools.traceanalyser.export.RuleEvent;
+import com.nokia.s60tools.ui.S60ToolsViewerSorter;
+
+
+/**
+ * class FailLogTableDataSorter
+ * Data sorter for Trace Analyser's fail log view.
+ */
+
+public class FailLogTableDataSorter extends S60ToolsViewerSorter {
+
+ /**
+ * Numbers of columns that can be sorted.
+ */
+ public static final int TIME = 1;
+ public static final int RULE = 2;
+ public static final int VIOLATION = 3;
+ public static final int LIMIT = 4;
+
+
+ public FailLogTableDataSorter() {
+ super();
+ // By default set sort criteria to time
+ setSortCriteria(TIME);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ViewerSorter#compare(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+ */
+ public int compare(Viewer viewer, Object e1, Object e2) {
+
+
+ // By default comparison does not do any ordering
+ int comparisonResult = 0;
+
+ RuleEvent f1 = (RuleEvent) e1;
+ RuleEvent f2 = (RuleEvent) e2;
+
+ switch (sortCriteria) {
+
+
+ case TIME:
+ case -1:
+ if(f1.getTime().before(f2.getTime())){
+ comparisonResult = 1;
+ }
+ else{
+ comparisonResult = -1;
+ }
+ break;
+
+ case RULE:
+ comparisonResult = f1.getRuleName().compareToIgnoreCase(f2.getRuleName());
+
+ break;
+
+ case VIOLATION:
+ if(f1.getViolation() > f2.getViolation()){
+ comparisonResult = 1;
+ }
+ else{
+ comparisonResult = -1;
+ }
+
+ break;
+
+ case LIMIT:
+ if(f1.getLimit() > f2.getLimit()){
+ comparisonResult = 1;
+ }
+ else{
+ comparisonResult = -1;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return comparisonResult;
+
+ }
+
+
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/src/com/nokia/s60tools/traceanalyser/ui/views/FailLogTableLabelProvider.java Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+
+package com.nokia.s60tools.traceanalyser.ui.views;
+
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+import com.nokia.s60tools.traceanalyser.export.RuleEvent;
+
+/**
+ * class FailLogTableLabelProvider
+ * fail log label provider.
+ */
+class FailLogTableLabelProvider extends LabelProvider implements ITableLabelProvider {
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
+ */
+ public String getColumnText(Object obj, int index) {
+ RuleEvent logItem = (RuleEvent)obj;
+ return logItem.getFailLogText(index);
+
+ }
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
+ */
+ public Image getColumnImage(Object obj, int index) {
+ /*if (index == MemSpyFileBundle.INDEX_FILE_TYPE){
+ return getImage(obj);
+ }
+ else{
+ return null;
+ }*/
+ return null;
+
+ }
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
+ */
+ public Image getImage(Object obj) {
+ /*MemSpyFileBundle bundle = (MemSpyFileBundle)obj;
+ if( bundle.isHeapDumpFile() ){
+ return ImageResourceManager.getImage(ImageKeys.IMG_HEAP_DUMP);
+ }
+ else{
+ return ImageResourceManager.getImage(ImageKeys.IMG_SWMT_LOG);
+ }*/
+ return PlatformUI.getWorkbench().
+ getSharedImages().getImage(ISharedImages.IMG_OBJ_ELEMENT);
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/src/com/nokia/s60tools/traceanalyser/ui/views/MainView.java Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,1124 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+
+package com.nokia.s60tools.traceanalyser.ui.views;
+
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.swing.Timer;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.ui.part.*;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.jface.action.*;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.ui.*;
+import org.eclipse.swt.widgets.Menu;
+
+import com.nokia.s60tools.traceanalyser.containers.RuleInformation;
+import com.nokia.s60tools.traceanalyser.export.ITraceAnalyserRuleType;
+import com.nokia.s60tools.traceanalyser.export.RuleEvent;
+import com.nokia.s60tools.traceanalyser.export.TraceAnalyserRule;
+import com.nokia.s60tools.traceanalyser.interfaces.ITraceAnalyserFileObserver;
+import com.nokia.s60tools.traceanalyser.model.Engine;
+import com.nokia.s60tools.traceanalyser.plugin.TraceAnalyserPlugin;
+import com.nokia.s60tools.traceanalyser.resources.ImageKeys;
+import com.nokia.s60tools.traceanalyser.resources.ImageResourceManager;
+import com.nokia.s60tools.traceanalyser.ui.dialogs.EditRuleDialog;
+import com.nokia.s60tools.traceanalyser.ui.editors.HistoryEditor;
+import com.nokia.s60tools.traceanalyser.ui.editors.HistoryEditorInput;
+import com.nokia.s60tools.ui.S60ToolsTable;
+import com.nokia.s60tools.ui.S60ToolsTableColumnData;
+import com.nokia.s60tools.ui.S60ToolsTableFactory;
+import com.nokia.traceviewer.api.TraceViewerAPI;
+import com.nokia.traceviewer.api.TraceViewerAPI.TVAPIError;
+
+
+/**
+ * <p>
+ * MainView.
+ * The main view of Trace Analyser Carbide extension.
+ * <p>
+ */
+
+public class MainView extends ViewPart implements ITraceAnalyserFileObserver, SelectionListener, ActionListener, KeyListener {
+
+
+ /* TraceViewers ID */
+ public static final String TRACE_VIEWER_VIEW_ID = "com.nokia.traceviewer.view.TraceViewerView";
+
+ /* Main view's ID */
+ public static final String ID = "com.nokia.s60tools.traceanalyser.ui.views.MainView";
+ private static final int TAB_INDEX_RULE_LIST = 0;
+ private static final int TAB_INDEX_FAIL_LOG =1;
+
+ /* Table Viewers for both main view's tables. */
+ private CheckboxTableViewer viewerRuleTable;
+ private TableViewer viewerFailLogTable;
+
+ /* content providers for both main view's tables */
+ private RuleTableContentProvider contentProviderRuleTable;
+ private FailLogTableContentProvider contentProviderFailLogTable;
+
+ /* actions */
+
+ private Action doubleClickAction;
+ private Action actionCopyRule;
+
+ /* rule view actions */
+ private Action actionDeleteRule;
+ private Action actionClearOneRuleCounters;
+ private Action actionClearAllCounters;
+ private Action actionCreateNewRule;
+ private Action actionEditRule;
+ private Action actionShowHistory;
+
+ /* fail log actions */
+ private Action actionClearFailLog;
+ private Action actionShowInTraceViewer;
+
+ /* list of rule types */
+ ArrayList<ITraceAnalyserRuleType> ruleTypes;
+
+ /* composites for both tabs */
+ private Composite compositeRules;
+ private Composite compositeFailLog;
+
+
+ /* Tab Folder for main view */
+ TabFolder tabFolder;
+
+ /* Trace Analyser engine */
+ Engine engine;
+
+ /* Timer that is used when blinking icon */
+ Timer timer;
+
+ /* count of how many times icon is blinked */
+ int blinkCount;
+
+ /* Arraylist containing all open editor views */
+ ArrayList<HistoryEditor> openEditors;
+
+
+ /**
+ * The constructor.
+ */
+ public MainView() {
+ ruleTypes = new ArrayList<ITraceAnalyserRuleType>();
+ engine = TraceAnalyserPlugin.getEngine();
+ TraceAnalyserPlugin.setMainView(this);
+ ruleTypes = engine.getRuleTypes();
+ blinkCount = 0;
+ openEditors = new ArrayList<HistoryEditor>();
+ }
+
+ /**
+ * showAndReturnYourself.
+ * Makes main view visible and returns an instance of itself. Can be called from
+ * an UI thread only.
+ * @return instance of main view
+ */
+ public static MainView showAndReturnYourself() {
+ return showAndReturnYourself(false);
+ }
+ /**
+ * showAndReturnYourself.
+ * Makes main view visible and returns an instance of itself. Can be called from
+ * an UI thread only.
+ * @return instance of main view
+ */
+ public static MainView showAndReturnYourself(boolean openOnly) {
+ try {
+
+ IWorkbenchWindow ww = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ if (ww == null)
+ return null;
+
+ IWorkbenchPage page = ww.getActivePage();
+ IWorkbenchPart currentPart = page.getActivePart();
+ // Checking if view is already open
+ IViewReference[] viewRefs = page.getViewReferences();
+ for (int i = 0; i < viewRefs.length; i++) {
+ IViewReference reference = viewRefs[i];
+ String id = reference.getId();
+ if(id.equalsIgnoreCase(MainView.ID)){
+ // Found, restoring the view
+ IViewPart viewPart = reference.getView(true);
+ if (!openOnly)
+ page.activate(viewPart);
+ return (MainView)viewPart;
+ }
+ }
+
+ // View was not found, opening it up as a new view.
+ MainView mView = (MainView)page.showView(MainView.ID);
+ if (openOnly)
+ page.bringToTop(currentPart);
+ return mView;
+
+ } catch (Exception e) {
+ e.printStackTrace();
+
+ return null;
+ }
+ }
+
+
+ /**
+ * This is a callback that will allow us
+ * to create the viewer and initialize it.
+ */
+ public void createPartControl(Composite parent) {
+
+ createTabControls(parent);
+ createFailLogTable();
+ createRuleTable();
+
+
+ // Create the help context id for the viewer's control
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(viewerRuleTable.getControl(), "com.nokia.s60tools.traceanalyser.viewer");
+ makeActions();
+ hookContextMenu();
+ hookDoubleClickAction();
+ contributeToActionBars();
+
+ refreshRuleContentAndViewAsynch();
+ refreshFailLogContentAndViewAsynch();
+ readActivationStatus();
+ setHelps();
+ }
+
+ /**
+ * Creates Tab controls
+ * @param parent composite where tab controls are placed.
+ */
+ private void createTabControls(Composite parent){
+ // create tab folder.
+ tabFolder = new TabFolder (parent, SWT.DOWN);
+ tabFolder.addSelectionListener(this);
+
+ // create rule composite
+ compositeRules = new Composite(tabFolder, SWT.NONE);
+ GridLayout layoutCompositeRules = new GridLayout();
+ layoutCompositeRules.numColumns = 1;
+ compositeRules.setLayout(layoutCompositeRules);
+
+ // create fail log composite
+ compositeFailLog = new Composite(tabFolder, SWT.NONE);
+ GridLayout layoutCompositeFailLog = new GridLayout();
+ layoutCompositeFailLog.numColumns = 1;
+ compositeFailLog.setLayout(layoutCompositeFailLog);
+
+ // create tab items
+ TabItem item = new TabItem (tabFolder, SWT.NONE);
+ item.setText ("Trace Analyser rules");
+ item.setControl(compositeRules);
+ tabFolder.pack();
+
+ TabItem item2 = new TabItem (tabFolder, SWT.NONE);
+ item2.setText ("Fail Log");
+ item2.setControl(compositeFailLog);
+ tabFolder.pack();
+ }
+
+ /**
+ * Creates fail log table
+ */
+ private void createFailLogTable(){
+ // Create fail log table
+ ArrayList<S60ToolsTableColumnData> failLogColumnArrayList = new ArrayList<S60ToolsTableColumnData>();
+
+ failLogColumnArrayList.add(new S60ToolsTableColumnData("Time", 150, 0, FailLogTableDataSorter.TIME));
+ failLogColumnArrayList.add(new S60ToolsTableColumnData("Rule", 175, 1, FailLogTableDataSorter.RULE));
+ failLogColumnArrayList.add(new S60ToolsTableColumnData("Violation", 75, 2, FailLogTableDataSorter.VIOLATION));
+ failLogColumnArrayList.add(new S60ToolsTableColumnData("Limit", 75, 3, FailLogTableDataSorter.LIMIT));
+
+ S60ToolsTableColumnData[] columnDataTableFailLog = failLogColumnArrayList.toArray(new S60ToolsTableColumnData[0]);
+ S60ToolsTable tableFailLog = S60ToolsTableFactory.create(compositeFailLog, columnDataTableFailLog);
+
+ viewerFailLogTable = new TableViewer(tableFailLog.getTableInstance());
+ contentProviderFailLogTable = new FailLogTableContentProvider(engine);
+ viewerFailLogTable.setContentProvider(contentProviderFailLogTable);
+ viewerFailLogTable.setLabelProvider(new FailLogTableLabelProvider());
+ viewerFailLogTable.setComparator(new FailLogTableDataSorter());
+ viewerFailLogTable.setSorter(new FailLogTableDataSorter());
+ viewerFailLogTable.setInput(getViewSite());
+ tableFailLog.setHostingViewer(viewerFailLogTable);
+ }
+
+
+ /**
+ * Creates rule table
+ */
+ private void createRuleTable(){
+ Table tableRules = new Table(compositeRules, SWT.CHECK | SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER);
+
+ tableRules.setLayoutData(new GridData(GridData.FILL_BOTH));
+ tableRules.setLinesVisible(true);
+ tableRules.setHeaderVisible(true);
+
+ // Add selection listeners for each column after creating it
+ tableRules.addSelectionListener(this);
+
+ int parameter_column_length = 60;
+
+ TableColumn tableColumn = new TableColumn(tableRules, SWT.NONE);
+ tableColumn.setWidth(20);
+ tableColumn.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ checkAllPressed();
+ }
+ });
+
+ TableColumn tableColumn2 = new TableColumn(tableRules, SWT.NONE);
+ tableColumn2.setWidth(150);
+ tableColumn2.setText("Rule Name");
+
+ tableColumn2.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ viewerRuleTable.setSorter(new RuleTableDataSorter(
+ RuleTableDataSorter.RULE_NAME));
+ }
+ });
+
+ TableColumn tableColumn3 = new TableColumn(tableRules, SWT.NONE);
+ tableColumn3.setWidth(parameter_column_length);
+ tableColumn3.setText("Pass");
+
+ tableColumn3.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ viewerRuleTable.setSorter(
+ new RuleTableDataSorter(RuleTableDataSorter.PASS));
+ }
+ });
+
+
+ TableColumn tableColumn4 = new TableColumn(tableRules, SWT.NONE);
+ tableColumn4.setWidth(parameter_column_length);
+ tableColumn4.setText("Fail");
+ tableColumn4.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ viewerRuleTable.setSorter(
+ new RuleTableDataSorter(RuleTableDataSorter.FAIL));
+ }
+ });
+
+ TableColumn tableColumn5 = new TableColumn(tableRules, SWT.NONE);
+ tableColumn5.setWidth(parameter_column_length);
+ tableColumn5.setText("Pass %");
+ tableColumn5.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ viewerRuleTable.setSorter(
+ new RuleTableDataSorter(RuleTableDataSorter.PASSPERCENT));
+ }
+ });
+
+ TableColumn tableColumn6 = new TableColumn(tableRules, SWT.NONE);
+ tableColumn6.setWidth(parameter_column_length);
+ tableColumn6.setText("Min");
+ tableColumn6.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ viewerRuleTable.setSorter(
+ new RuleTableDataSorter(RuleTableDataSorter.MIN));
+ }
+ });
+
+ TableColumn tableColumn7 = new TableColumn(tableRules, SWT.NONE);
+ tableColumn7.setWidth(parameter_column_length);
+ tableColumn7.setText("Max");
+ tableColumn7.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ viewerRuleTable.setSorter(
+ new RuleTableDataSorter(RuleTableDataSorter.MAX));
+ }
+ });
+
+ TableColumn tableColumn8 = new TableColumn(tableRules, SWT.NONE);
+ tableColumn8.setWidth(parameter_column_length);
+ tableColumn8.setText("Avg");
+ tableColumn8.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ viewerRuleTable.setSorter(
+ new RuleTableDataSorter(RuleTableDataSorter.AVG));
+ }
+ });
+
+ TableColumn tableColumn9 = new TableColumn(tableRules, SWT.NONE);
+ tableColumn9.setWidth(parameter_column_length);
+ tableColumn9.setText("Med");
+ tableColumn9.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ viewerRuleTable.setSorter(
+ new RuleTableDataSorter(RuleTableDataSorter.MED));
+ }
+ });
+
+ viewerRuleTable = new CheckboxTableViewer(tableRules);
+ contentProviderRuleTable = new RuleTableContentProvider(engine);
+ viewerRuleTable.setContentProvider(contentProviderRuleTable);
+ viewerRuleTable.setLabelProvider(new RuleTableLabelProvider());
+ /*viewerRuleTable.setComparator(new RuleTableDataSorter());
+ viewerRuleTable.setSorter(new RuleTableDataSorter());*/
+ viewerRuleTable.setInput(getViewSite());
+ tableRules.addKeyListener(this);
+
+ }
+
+
+ /**
+ * hookContextMenu.
+ * Creates context menu for main view.
+ */
+ private void hookContextMenu() {
+ MenuManager menuMgrRuleTable = new MenuManager("#PopupMenu");
+ menuMgrRuleTable.setRemoveAllWhenShown(true);
+ menuMgrRuleTable.addMenuListener(new IMenuListener() {
+ public void menuAboutToShow(IMenuManager manager) {
+ MainView.this.fillContextMenuRuleTable(manager);
+ }
+ });
+ Menu menuRuleTable = menuMgrRuleTable.createContextMenu(viewerRuleTable.getControl());
+ viewerRuleTable.getControl().setMenu(menuRuleTable);
+ getSite().registerContextMenu(menuMgrRuleTable, viewerRuleTable);
+
+
+ MenuManager menuMgrFailLog = new MenuManager("#PopupMenu");
+ menuMgrFailLog.setRemoveAllWhenShown(true);
+ menuMgrFailLog.addMenuListener(new IMenuListener() {
+ public void menuAboutToShow(IMenuManager manager) {
+ MainView.this.fillContextMenuFailLog(manager);
+ }
+ });
+ Menu menuFailLog = menuMgrFailLog.createContextMenu(viewerFailLogTable.getControl());
+ viewerFailLogTable.getControl().setMenu(menuFailLog);
+ getSite().registerContextMenu(menuMgrFailLog, viewerFailLogTable);
+ }
+
+
+
+ /**
+ * contributeToActionBars
+ */
+ private void contributeToActionBars() {
+ IActionBars bars = getViewSite().getActionBars();
+ fillLocalPullDown(bars.getMenuManager());
+ fillLocalToolBar(bars.getToolBarManager());
+ }
+
+ /**
+ * fillContextMenuRuleTable
+ * fills context menu for rule table.
+ * @param manager menumanager
+ */
+
+ @SuppressWarnings("unchecked")
+ private void fillContextMenuRuleTable(IMenuManager manager) {
+ ISelection selection = viewerRuleTable.getSelection();
+ Object obj = ((IStructuredSelection)selection).toList();
+ List<RuleInformation> selectionList = (List<RuleInformation>)obj;
+ if(selectionList.size() == 1){
+ manager.add(actionEditRule);
+ manager.add(actionClearOneRuleCounters);
+ manager.add(actionShowHistory);
+ manager.add(actionCopyRule);
+ manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ manager.add(actionDeleteRule);
+ }
+ else if(selectionList.size() > 1){
+ manager.add(actionClearOneRuleCounters);
+ manager.add(actionShowHistory);
+ manager.add(actionDeleteRule);
+ manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ }
+ }
+
+
+ /**
+ * fillContextMenuFailLog.
+ * fills context menu for fail log view.
+ * @param manager menumanager
+ */
+
+ private void fillContextMenuFailLog(IMenuManager manager) {
+ manager.add(actionShowInTraceViewer);
+ }
+
+ /**
+ * fillLocalToolBar.
+ * fills local toolbar.
+ * @param manager menumanager
+ */
+ private void fillLocalToolBar(IToolBarManager manager) {
+ manager.removeAll();
+ if(tabFolder.getSelectionIndex() == TAB_INDEX_RULE_LIST && actionCopyRule != null){
+ manager.add(actionCreateNewRule);
+ manager.add(actionClearAllCounters);
+ manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ manager.add(actionDeleteRule);
+ manager.update(true);
+ }
+ else if (tabFolder.getSelectionIndex() == TAB_INDEX_FAIL_LOG && actionCopyRule != null){
+ manager.add(actionClearFailLog);
+ manager.update(true);
+ }
+ }
+
+ /**
+ * fills local menu
+ */
+ private void fillLocalPullDown(IMenuManager manager) {
+ manager.removeAll();
+ if(tabFolder.getSelectionIndex() == TAB_INDEX_RULE_LIST && actionCopyRule != null){
+ manager.add(actionCreateNewRule);
+ manager.add(actionClearAllCounters);
+ manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ manager.add(actionDeleteRule);
+ manager.update(true);
+ }
+ else if (tabFolder.getSelectionIndex() == TAB_INDEX_FAIL_LOG && actionCopyRule != null){
+ manager.add(actionClearFailLog);
+ manager.update(true);
+ }
+ }
+
+ /**
+ * makeActions.
+ * Creates actions for main view.
+ */
+ @SuppressWarnings("unchecked")
+ private void makeActions() {
+
+ actionDeleteRule = new Action() {
+ public void run() {
+ if(tabFolder.getSelectionIndex() == TAB_INDEX_RULE_LIST){
+ ISelection selection = viewerRuleTable.getSelection();
+ Object obj = ((IStructuredSelection)selection).toList();
+ List<RuleInformation> selectionList = (List<RuleInformation>)obj;
+
+ // Confirm deletion
+ if(showConfirmation("Trace Analyser - Delete Rule", "Are you sure you want to delete selected files?")){
+ boolean error = false;
+
+ for(RuleInformation item : selectionList){
+ if(!engine.removeRule(item.getRule().getName())){
+ error = true;
+ }
+ }
+ if(error){
+ showErrorMessage("Trace Analyser - Error", "An error occured when deleting rule(s).");
+ }
+ refreshRuleContentAndView();
+ }
+ }
+
+ }
+ };
+ actionDeleteRule.setText("Delete Selected Rule");
+ actionDeleteRule.setToolTipText("Delete Selected Rule");
+ actionDeleteRule.setImageDescriptor( PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
+
+
+
+ actionClearOneRuleCounters = new Action() {
+ public void run() {
+ ISelection selection = viewerRuleTable.getSelection();
+ Object obj = ((IStructuredSelection)selection).toList();
+ List<RuleInformation> selectionList = (List<RuleInformation>)obj;
+
+ if(showConfirmation("Trace Analyser - Clear History", "Are you sure you want to clear selected rule's history information?")){
+ for(RuleInformation item : selectionList){
+ engine.resetOneRulesHistory(item.getRule().getName());
+ }
+ }
+
+ }
+ };
+ actionClearOneRuleCounters.setText("Clear Selected Rule's Counters");
+ actionClearOneRuleCounters.setToolTipText("Clear Selected Rule's Counters");
+
+
+
+ actionClearAllCounters = new Action() {
+ public void run() {
+ if(showConfirmation("Trace Analyser - Clear History", "Are you sure you want to clear all rule's history information?")){
+ engine.resetHistory();
+ }
+ }
+ };
+ actionClearAllCounters.setText("Clear All Rule's counters");
+ actionClearAllCounters.setToolTipText("Clear All Rule's counters");
+ actionClearAllCounters.setImageDescriptor(ImageResourceManager.getImageDescriptor(ImageKeys.IMG_CLEAR_ALL));
+
+ actionCreateNewRule = new Action() {
+ public void run() {
+ // create dialog
+ EditRuleDialog dialog = new EditRuleDialog(getSite().getShell(), ruleTypes, null, engine, true);
+
+ // open query dialog
+ int retVal = dialog.open();
+
+ // if ok pressed
+ if( retVal == 0 ){
+ refreshRuleContentAndViewAsynch();
+ }
+
+ }
+ };
+ actionCreateNewRule.setText("Create New Rule");
+ actionCreateNewRule.setToolTipText("Create New Rule");
+ actionCreateNewRule.setImageDescriptor(ImageResourceManager.getImageDescriptor(ImageKeys.IMG_CREATE_NEW));
+
+
+ doubleClickAction = new Action() {
+ public void run() {
+ if(tabFolder.getSelectionIndex() == TAB_INDEX_RULE_LIST){
+ actionEditRule.run();
+ }
+ else if(tabFolder.getSelectionIndex() == TAB_INDEX_FAIL_LOG){
+ actionShowInTraceViewer.run();
+
+ }
+ }
+ };
+
+ actionEditRule = new Action() {
+ public void run() {
+ ISelection selection = viewerRuleTable.getSelection();
+ Object obj = ((IStructuredSelection)selection).toList();
+ List<RuleInformation> selectionList = (List<RuleInformation>)obj;
+ //verify that only one file is selected.
+ if( selectionList.size() == 1 ){
+
+ TraceAnalyserRule rule = selectionList.get(0).getRule();
+ String ruleName = rule.getName();
+ EditRuleDialog dialog = new EditRuleDialog(getSite().getShell(), ruleTypes, rule, engine, false);
+ int retVal = dialog.open();
+ // open query dialog
+ if( retVal == 0 ){
+ for(HistoryEditor item : openEditors){
+ if(item.getRuleName().equals(ruleName)){
+ IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ activePage.closeAllEditors(false);
+
+ }
+ }
+ refreshRuleContentAndViewAsynch();
+ }
+ // Cancel pressed
+ else if( retVal == 1 ){
+
+ }
+ }
+
+ }
+ };
+ actionEditRule.setText("Edit Selected Rule");
+ actionEditRule.setToolTipText("Edit Selected Rule");
+
+ actionClearFailLog = new Action() {
+ public void run() {
+ if(showConfirmation("Trace Analyser - Clear Fail Log", "Are your sure you want to clear Fail Log")){
+ engine.clearFailLog();
+ }
+ }
+ };
+ actionClearFailLog.setText("Clear Fail Log");
+ actionClearFailLog.setToolTipText("Clear Fail Log");
+ actionClearFailLog.setImageDescriptor(ImageResourceManager.getImageDescriptor(ImageKeys.IMG_CLEAR_FAIL_LOG));
+
+
+
+ actionShowInTraceViewer = new Action() {
+ public void run() {
+ ISelection selection = viewerFailLogTable.getSelection();
+ Object obj = ((IStructuredSelection)selection).toList();
+ List<RuleEvent> selectionList = (List<RuleEvent>)obj;
+ //verify that only one file is selected.
+ if( selectionList.size() == 1 ){
+ //sync to trace
+
+ TVAPIError error;
+ if(selectionList.get(0).getTraceNumbers().length == 1){
+ error = TraceViewerAPI.syncToTrace(selectionList.get(0).getTraceNumbers()[0], 0);
+
+ }
+ else{
+ error = TraceViewerAPI.syncToTrace(selectionList.get(0).getTraceNumbers()[0], selectionList.get(0).getTraceNumbers()[1]);
+ }
+
+
+ if(error == TVAPIError.NONE){
+ showTraceViewer();
+ }
+ else{
+ showErrorMessage("Trace Analyser - Error",
+ "Unable to locate events from TraceViewer's log. Perhaps the log has been cleared.");
+ }
+
+ }
+ }
+ };
+ actionShowInTraceViewer.setText("Show in TraceViewer");
+ actionShowInTraceViewer.setToolTipText("Show in TraceViewer");
+
+ actionShowHistory = new Action() {
+ public void run() {
+ ISelection selection = viewerRuleTable.getSelection();
+ Object obj = ((IStructuredSelection)selection).toList();
+ List<RuleInformation> selectionList = (List<RuleInformation>)obj;
+ //verify that only one file is selected.
+ if( selectionList.size() == 1 ){
+ HistoryEditorInput input = new HistoryEditorInput(selectionList.get(0));
+ IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ try {
+ openEditors.add((HistoryEditor)activePage.openEditor(input,"com.nokia.s60tools.traceanalyser.ui.editors.HistoryEditor"));
+ } catch (PartInitException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ };
+ actionShowHistory.setText("Show History");
+ actionShowHistory.setToolTipText("Show History");
+
+
+ actionCopyRule = new Action() {
+ public void run() {
+ ISelection selection = viewerRuleTable.getSelection();
+ Object obj = ((IStructuredSelection)selection).toList();
+ List<RuleInformation> selectionList = (List<RuleInformation>)obj;
+ //verify that only one file is selected.
+ if( selectionList.size() == 1 ){
+
+ TraceAnalyserRule rule = selectionList.get(0).getRule();
+
+ EditRuleDialog dialog = new EditRuleDialog(getSite().getShell(), ruleTypes, rule, engine, true);
+ int retVal = dialog.open();
+ // open query dialog
+ if( retVal == 0 ){
+
+ refreshRuleContentAndViewAsynch();
+ }
+ // Cancel pressed
+ else if( retVal == 1 ){
+
+ }
+
+
+
+ }
+ }
+ };
+ actionCopyRule.setText("Copy Selected Rule");
+ actionCopyRule.setToolTipText("Copy Selected Rule");
+ }
+
+ /**
+ * hookDoubleClickAction.
+ */
+ private void hookDoubleClickAction() {
+ IDoubleClickListener listener = new IDoubleClickListener() {
+ public void doubleClick(DoubleClickEvent event) {
+ doubleClickAction.run();
+ }
+ };
+
+ viewerRuleTable.addDoubleClickListener(listener);
+ viewerFailLogTable.addDoubleClickListener(listener);
+ }
+
+
+
+ /**
+ * Passing the focus request to the viewer's control.
+ */
+ public void setFocus() {
+ viewerRuleTable.getControl().setFocus();
+ }
+
+
+
+
+ /*
+ * (non-Javadoc)
+ * @see com.nokia.s60tools.traceanalyser.interfaces.ITraceAnalyserFileObserver#rulesUpdated()
+ */
+ public void rulesUpdated() {
+ Runnable refreshRunnable = new Runnable(){
+ public void run(){
+
+ viewerRuleTable.refresh();
+ readActivationStatus();
+ for(HistoryEditor item : openEditors){
+ item.historyUpdated();
+
+ }
+
+ }
+ };
+
+ Display.getDefault().asyncExec(refreshRunnable);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.nokia.s60tools.traceanalyser.interfaces.ITraceAnalyserFileObserver#ruleUpdated(java.lang.String)
+ */
+ public void ruleUpdated(final String ruleName){
+
+ Runnable refreshRunnable = new Runnable(){
+ public void run(){
+
+ viewerRuleTable.refresh();
+ readActivationStatus();
+
+ for(HistoryEditor item : openEditors){
+ item.historyUpdated();
+
+ }
+
+ }
+ };
+
+ Display.getDefault().asyncExec(refreshRunnable);
+
+ }
+
+ /**
+ * refreshRuleContentAndViewAsynch.
+ * Refreshes content and view asynchronously.
+ */
+ private void refreshRuleContentAndViewAsynch(){
+ Runnable refreshRunnable = new Runnable(){
+ public void run(){
+ refreshRuleContentAndView();
+ }
+ };
+
+ Display.getDefault().asyncExec(refreshRunnable);
+
+ }
+ /**
+ * refreshRuleContentAndView.
+ * Refreshes content and view asynchronously.
+ */
+ private void refreshRuleContentAndView(){
+ contentProviderRuleTable.refresh();
+ viewerRuleTable.refresh();
+ readActivationStatus();
+
+
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ public void widgetDefaultSelected(SelectionEvent arg0) {
+ // nothing to be done.
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ public void widgetSelected(SelectionEvent event) {
+ if(event.widget == tabFolder){
+ contributeToActionBars();
+ }
+ if(event.detail == SWT.CHECK){
+ RuleInformation info = (RuleInformation)event.item.getData();
+ boolean value = viewerRuleTable.getChecked(event.item.getData());
+ engine.changeRuleaActivation(info.getRule().getName(), value);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see com.nokia.s60tools.traceanalyser.interfaces.ITraceAnalyserFileObserver#failLogUpdated()
+ */
+ public void failLogUpdated() {
+ Runnable refreshRunnable = new Runnable(){
+ public void run(){
+
+ viewerFailLogTable.refresh();
+ }
+ };
+
+ Display.getDefault().asyncExec(refreshRunnable);
+
+ }
+
+ /**
+ * refreshFailLogContentAndViewAsynch.
+ * Refreshes content and view asynchronously.
+ */
+ private void refreshFailLogContentAndViewAsynch(){
+ Runnable refreshRunnable = new Runnable(){
+ public void run(){
+ refreshFailLogContentAndView();
+ }
+ };
+
+ Display.getDefault().asyncExec(refreshRunnable);
+
+ }
+ /**
+ * refreshFailLogContentAndView.
+ * Refreshes content and view asynchronously.
+ */
+ private void refreshFailLogContentAndView(){
+ contentProviderFailLogTable.refresh();
+ viewerFailLogTable.refresh();
+ }
+
+ public void dispose(){
+ TraceAnalyserPlugin.setMainView(null);
+ }
+
+
+ /**
+ * showTraceViewer
+ * shows trace viewer plugin
+ */
+ public static void showTraceViewer() {
+ try {
+
+ IWorkbenchWindow ww = TraceAnalyserPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow();
+ if (ww == null)
+ return;
+ IWorkbenchPage page = ww.getActivePage();
+
+ // Checking if view is already open
+ IViewReference[] viewRefs = page.getViewReferences();
+ for (int i = 0; i < viewRefs.length; i++) {
+ IViewReference reference = viewRefs[i];
+ String id = reference.getId();
+ if(id.equalsIgnoreCase(TRACE_VIEWER_VIEW_ID)){
+ // Found, restoring the view
+ IViewPart viewPart = reference.getView(true);
+ page.activate(viewPart);
+ return;
+ }
+ }
+
+ // View was not found, opening it up as a new view.
+ page.showView(TRACE_VIEWER_VIEW_ID);
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * blinks icon when fail received.
+ */
+ public void blinkIcon(){
+ Runnable refreshRunnable = new Runnable(){
+ public void run(){
+ setTitleImage(ImageResourceManager.getImage(ImageKeys.IMG_FAIL_RECEIVED));
+ }
+ };
+
+
+ if(timer == null || !timer.isRunning()){
+ timer = new Timer(500, this);
+ timer.start();
+ Display.getDefault().asyncExec(refreshRunnable);
+
+ }
+ else{
+
+ }
+
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
+ */
+ public void actionPerformed(ActionEvent arg0) {
+ Runnable refreshRunnable = new Runnable(){
+ public void run(){
+
+ if(blinkCount % 2 == 1){
+ setTitleImage(ImageResourceManager.getImage(ImageKeys.IMG_FAIL_RECEIVED));
+ }
+ else{
+ setTitleImage(ImageResourceManager.getImage(ImageKeys.IMG_APP_ICON));
+ }
+ blinkCount++;
+
+ if( blinkCount == 3){
+ blinkCount = 0;
+ timer.stop();
+ }
+ }
+ };
+ Display.getDefault().asyncExec(refreshRunnable);
+
+ }
+
+ /**
+ * Reads activation status and sets table's check/uncheck status correct
+ */
+ private void readActivationStatus(){
+ int i = 0;
+ while(true){
+ Object information = viewerRuleTable.getElementAt(i);
+ if(information != null){
+ if( ((RuleInformation)information).getRule().isActivated()){
+ viewerRuleTable.setChecked(information, true);
+ }
+ }
+ else{
+ break;
+ }
+ i++;
+
+ }
+ }
+
+
+
+ /**
+ * showErrorMessage.
+ * shows error message asynchronously
+ * @param header header of message
+ * @param text error text
+ */
+ public void showErrorMessage(String header, String text){
+ MessageDialog.openError( getSite().getShell(), header, text);
+ }
+
+
+
+ /**
+ * showConfirmation.
+ * Displays a Confirmation dialog
+ * @param header text for window header
+ * @param text text for window text
+ * @return true, if yes was pressed.
+ */
+ public boolean showConfirmation(String header, String text){
+ MessageBox messageBox = new MessageBox(this.getSite().getShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO);
+ messageBox.setText(header);
+ messageBox.setMessage(text);
+ int retval = messageBox.open();
+ if(retval == SWT.YES){
+ return true;
+ }
+ else{
+ return false;
+ }
+
+ }
+
+
+ /**
+ * editorClosed
+ * removes editor pointer from openEditors-array
+ * @param ruleName name of the rule.
+ */
+ public void editorClosed(String ruleName){
+ HistoryEditor closeEditor = null;
+ for(HistoryEditor item : openEditors){
+ if(item.getRuleName().equals(ruleName)){
+ closeEditor = item;
+ }
+ }
+ openEditors.remove(closeEditor);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.swt.events.KeyListener#keyPressed(org.eclipse.swt.events.KeyEvent)
+ */
+ public void keyPressed(KeyEvent keyEvent) {
+
+ // if delete key is pressed run delete -action.
+ if( keyEvent.keyCode == java.awt.event.KeyEvent.VK_DELETE){
+ actionDeleteRule.run();
+ }
+ }
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.swt.events.KeyListener#keyReleased(org.eclipse.swt.events.KeyEvent)
+ */
+ public void keyReleased(KeyEvent arg0) {
+ // can be left empty.
+ }
+
+ /**
+ * Activate/deactivate all rules in main view
+ */
+ private void checkAllPressed(){
+ boolean activationStatus = false;
+
+ // compare amount of checked and unchecked rules
+ if( viewerRuleTable.getCheckedElements().length <= (viewerRuleTable.getTable().getItemCount() / 2)){
+ activationStatus = true;
+ }
+ int i = 0;
+ while(true){
+ RuleInformation information = (RuleInformation)viewerRuleTable.getElementAt(i);
+ if(information != null){
+ viewerRuleTable.setChecked(information, activationStatus);
+ engine.changeRuleaActivation(information.getRule().getName(), activationStatus);
+ }
+ else{
+ break;
+ }
+ i++;
+
+ }
+ }
+
+ /**
+ * Sets this page's context sensitive helps
+ */
+ protected void setHelps() {
+ PlatformUI.getWorkbench().getHelpSystem().setHelp( viewerFailLogTable.getControl(), com.nokia.s60tools.traceanalyser.resources.HelpContextIDs.TRACE_ANALYSER_FAIL_LOG);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp( tabFolder, com.nokia.s60tools.traceanalyser.resources.HelpContextIDs.TRACE_ANALYSER_MAIN_VIEW);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp( viewerRuleTable.getControl(), com.nokia.s60tools.traceanalyser.resources.HelpContextIDs.TRACE_ANALYSER_MAIN_VIEW);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp( getSite().getShell(), com.nokia.s60tools.traceanalyser.resources.HelpContextIDs.TRACE_ANALYSER_MAIN_VIEW);
+
+ }
+
+
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/src/com/nokia/s60tools/traceanalyser/ui/views/RuleTableContentProvider.java Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+
+package com.nokia.s60tools.traceanalyser.ui.views;
+
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import com.nokia.s60tools.traceanalyser.model.Engine;
+
+/**
+ * class RuleTableContentProvider
+ * content provider for rule table.
+ */
+class RuleTableContentProvider implements IStructuredContentProvider {
+
+ /* Trace Analyser Engine */
+ private final Engine engine;
+
+ /**
+ * RuleTableContentProvider.
+ * constructor.
+ * @param engine
+ */
+ public RuleTableContentProvider(Engine engine){
+ this.engine = engine;
+ }
+
+ /**
+ * refresh
+ * refreshes rule list.
+ */
+ public void refresh() {
+ engine.refreshRuleList();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+ */
+ public void inputChanged(Viewer v, Object oldInput, Object newInput) {
+ }
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+ */
+ public void dispose() {
+ }
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+ */
+ public Object[] getElements(Object parent) {
+ return engine.getRuleInformation();
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/src/com/nokia/s60tools/traceanalyser/ui/views/RuleTableDataSorter.java Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,151 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.s60tools.traceanalyser.ui.views;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerSorter;
+
+import com.nokia.s60tools.traceanalyser.containers.RuleInformation;
+
+
+/**
+ * class RuleTableDataSorter
+ * Data sorter for Trace Analyser's rule view.
+ */
+
+public class RuleTableDataSorter extends ViewerSorter {
+
+ /**
+ * Import function data is sorted by file name
+ */
+ public static final int RULE_NAME = 2;
+ /**
+ *
+ */
+ public static final int PASS = 3;
+ public static final int FAIL = 4;
+ public static final int PASSPERCENT = 5;
+ public static final int MIN = 6;
+ public static final int MAX = 7;
+ public static final int AVG = 8;
+ public static final int MED = 9;
+
+ private int sortCriteria;
+
+ public RuleTableDataSorter(int sortCriteria) {
+ super();
+ // By default set sort criterie
+ this.sortCriteria = sortCriteria;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ViewerSorter#compare(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+ */
+ public int compare(Viewer viewer, Object e1, Object e2) {
+
+
+ // By default comparison does not do any ordering
+ int comparisonResult = 0;
+
+ RuleInformation f1 = (RuleInformation) e1;
+ RuleInformation f2 = (RuleInformation) e2;
+
+ switch (sortCriteria) {
+
+ case RULE_NAME:
+ comparisonResult = f1.getRule().getName().compareToIgnoreCase(f2.getRule().getName());
+ break;
+ case PASS:
+ if(f1.getPass() < f2.getPass()){
+ comparisonResult = 1;
+ }
+ else{
+ comparisonResult = -1;
+
+ }
+ break;
+ case FAIL:
+ if(f1.getFail() < f2.getFail()){
+ comparisonResult = 1;
+ }
+ else{
+ comparisonResult = -1;
+
+ }
+ break;
+
+ case PASSPERCENT:
+ if(f1.getPassPercent() < f2.getPassPercent()){
+ comparisonResult = 1;
+ }
+ else{
+ comparisonResult = -1;
+ }
+ break;
+
+ case MIN:
+ if(f1.getMin() < f2.getMin()){
+ comparisonResult = 1;
+ }
+ else{
+ comparisonResult = -1;
+
+ }
+ break;
+
+ case MAX:
+ if(f1.getMax() < f2.getMax()){
+ comparisonResult = 1;
+ }
+ else{
+ comparisonResult = -1;
+
+ }
+ break;
+
+ case MED:
+ if(f1.getMed() < f2.getMed()){
+ comparisonResult = 1;
+ }
+ else{
+ comparisonResult = -1;
+
+ }
+ break;
+ case AVG:
+ if(f1.getAvg() < f2.getAvg()){
+ comparisonResult = 1;
+ }
+ else{
+ comparisonResult = -1;
+
+ }
+ break;
+
+
+ default:
+ break;
+ }
+
+ return comparisonResult;
+
+ }
+
+
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceanalyser/com.nokia.s60tools.traceanalyser/src/com/nokia/s60tools/traceanalyser/ui/views/RuleTableLabelProvider.java Wed Jun 23 13:57:56 2010 +0300
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+
+package com.nokia.s60tools.traceanalyser.ui.views;
+
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.s60tools.traceanalyser.containers.RuleInformation;
+
+/**
+ * class RuleTableLabelProvider
+ * label provider for rule table.
+ *
+ */
+
+class RuleTableLabelProvider extends LabelProvider implements ITableLabelProvider {
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
+ */
+ public String getColumnText(Object obj, int index) {
+ RuleInformation rule = (RuleInformation)obj;
+ return rule.getText(index);
+
+
+ }
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
+ */
+ public Image getColumnImage(Object obj, int index) {
+ /*if (index == MemSpyFileBundle.INDEX_FILE_TYPE){
+ return getImage(obj);
+ }
+ else{
+ return null;
+ }*/
+ return null;
+
+ }
+
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
+ */
+
+ public Image getImage(Object obj) {
+ /*MemSpyFileBundle bundle = (MemSpyFileBundle)obj;
+ if( bundle.isHeapDumpFile() ){
+ return ImageResourceManager.getImage(ImageKeys.IMG_HEAP_DUMP);
+ }
+ else{
+ return ImageResourceManager.getImage(ImageKeys.IMG_SWMT_LOG);
+ }*/
+ return PlatformUI.getWorkbench().
+ getSharedImages().getImage(ISharedImages.IMG_OBJ_ELEMENT);
+ }
+}
\ No newline at end of file