TraceViewer 2.6.0
authorMatti Laitinen <matti.t.laitinen@nokia.com>
Wed, 23 Jun 2010 14:49:59 +0300
changeset 11 5b9d4d8641ce
parent 10 ed1c9f64298a
child 12 ae255c9aa552
TraceViewer 2.6.0
trace/traceviewer/com.nokia.carbide.extensions.traceviewer/build.properties
trace/traceviewer/com.nokia.carbide.extensions.traceviewer/feature.xml
trace/traceviewer/com.nokia.carbide.extensions.traceviewer/license.htm
trace/traceviewer/com.nokia.trace.dictionary/.classpath
trace/traceviewer/com.nokia.trace.dictionary/.settings/org.eclipse.jdt.core.prefs
trace/traceviewer/com.nokia.trace.dictionary/META-INF/MANIFEST.MF
trace/traceviewer/com.nokia.trace.dictionary/about.html
trace/traceviewer/com.nokia.trace.dictionary/build.properties
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/TraceDictionaryEngine.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/TraceDictionaryPlugin.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/decoder/TraceDictionaryDecoder.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/decoder/package.html
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/DecodeObject.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/DecodeObjectFactory.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/DictionaryContentHandler.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/DictionaryContentVariables.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/DictionaryDecodeModel.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/DictionaryModelBuilder.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/DictionaryModelParserThread.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/Location.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/Messages.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/Options.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/Path.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/Trace.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/TraceComponent.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/TraceData.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/TraceGroup.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/TraceInstanceList.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/decodeparameters/ArrayParameter.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/decodeparameters/BinaryParameter.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/decodeparameters/CompoundParameter.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/decodeparameters/ConstantParameter.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/decodeparameters/DecodeParameter.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/decodeparameters/DecodeUtils.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/decodeparameters/EnumMember.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/decodeparameters/EnumParameter.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/decodeparameters/FillerParameter.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/decodeparameters/FloatParameter.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/decodeparameters/HexParameter.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/decodeparameters/IntegerParameter.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/decodeparameters/Messages.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/decodeparameters/OctalParameter.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/decodeparameters/RawParameter.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/decodeparameters/StringParameter.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/decodeparameters/messages.properties
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/decodeparameters/package.html
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/handlers/BaseHandler.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/handlers/ComponentHandler.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/handlers/DataHandler.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/handlers/DefHandler.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/handlers/DictionaryFileConstants.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/handlers/DictionaryHandler.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/handlers/DictionaryHandlerCreator.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/handlers/ExternalDefHandler.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/handlers/FileHandler.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/handlers/GroupHandler.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/handlers/InstanceHandler.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/handlers/LocationsHandler.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/handlers/Messages.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/handlers/MetaDataHandler.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/handlers/ObjectHandler.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/handlers/OptionsHandler.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/handlers/PathHandler.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/handlers/TraceDictionaryHandler.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/handlers/TraceHandler.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/handlers/TypeDefHandler.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/handlers/TypeMemberHandler.java
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/handlers/messages.properties
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/handlers/package.html
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/messages.properties
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/package.html
trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/package.html
trace/traceviewer/com.nokia.trace.eventrouter/.classpath
trace/traceviewer/com.nokia.trace.eventrouter/.settings/org.eclipse.jdt.core.prefs
trace/traceviewer/com.nokia.trace.eventrouter/META-INF/MANIFEST.MF
trace/traceviewer/com.nokia.trace.eventrouter/about.html
trace/traceviewer/com.nokia.trace.eventrouter/build.properties
trace/traceviewer/com.nokia.trace.eventrouter/src/com/nokia/trace/eventrouter/Activator.java
trace/traceviewer/com.nokia.trace.eventrouter/src/com/nokia/trace/eventrouter/PropertyMap.java
trace/traceviewer/com.nokia.trace.eventrouter/src/com/nokia/trace/eventrouter/PropertySource.java
trace/traceviewer/com.nokia.trace.eventrouter/src/com/nokia/trace/eventrouter/TraceEvent.java
trace/traceviewer/com.nokia.trace.eventrouter/src/com/nokia/trace/eventrouter/TraceEventListener.java
trace/traceviewer/com.nokia.trace.eventrouter/src/com/nokia/trace/eventrouter/TraceEventRouter.java
trace/traceviewer/com.nokia.trace.eventrouter/src/com/nokia/trace/eventrouter/package.html
trace/traceviewer/com.nokia.trace.eventview/.classpath
trace/traceviewer/com.nokia.trace.eventview/.settings/org.eclipse.jdt.core.prefs
trace/traceviewer/com.nokia.trace.eventview/META-INF/MANIFEST.MF
trace/traceviewer/com.nokia.trace.eventview/about.html
trace/traceviewer/com.nokia.trace.eventview/build.properties
trace/traceviewer/com.nokia.trace.eventview/plugin.properties
trace/traceviewer/com.nokia.trace.eventview/plugin.xml
trace/traceviewer/com.nokia.trace.eventview/src/com/nokia/trace/eventview/Activator.java
trace/traceviewer/com.nokia.trace.eventview/src/com/nokia/trace/eventview/ContentChangeListener.java
trace/traceviewer/com.nokia.trace.eventview/src/com/nokia/trace/eventview/EventAdder.java
trace/traceviewer/com.nokia.trace.eventview/src/com/nokia/trace/eventview/EventListContentProvider.java
trace/traceviewer/com.nokia.trace.eventview/src/com/nokia/trace/eventview/EventListEntry.java
trace/traceviewer/com.nokia.trace.eventview/src/com/nokia/trace/eventview/EventListEntryString.java
trace/traceviewer/com.nokia.trace.eventview/src/com/nokia/trace/eventview/EventListEntryThrowable.java
trace/traceviewer/com.nokia.trace.eventview/src/com/nokia/trace/eventview/EventListLabelProvider.java
trace/traceviewer/com.nokia.trace.eventview/src/com/nokia/trace/eventview/Messages.java
trace/traceviewer/com.nokia.trace.eventview/src/com/nokia/trace/eventview/RemoveAllEventsAction.java
trace/traceviewer/com.nokia.trace.eventview/src/com/nokia/trace/eventview/RemoveEventAction.java
trace/traceviewer/com.nokia.trace.eventview/src/com/nokia/trace/eventview/ShowExceptionAction.java
trace/traceviewer/com.nokia.trace.eventview/src/com/nokia/trace/eventview/TableColumnSorter.java
trace/traceviewer/com.nokia.trace.eventview/src/com/nokia/trace/eventview/TraceEventHandler.java
trace/traceviewer/com.nokia.trace.eventview/src/com/nokia/trace/eventview/TraceEventList.java
trace/traceviewer/com.nokia.trace.eventview/src/com/nokia/trace/eventview/TraceEventView.java
trace/traceviewer/com.nokia.trace.eventview/src/com/nokia/trace/eventview/messages.properties
trace/traceviewer/com.nokia.trace.eventview/src/com/nokia/trace/eventview/package.html
trace/traceviewer/com.nokia.trace.help/META-INF/MANIFEST.MF
trace/traceviewer/com.nokia.trace.help/book.css
trace/traceviewer/com.nokia.trace.help/build.properties
trace/traceviewer/com.nokia.trace.help/html/concepts/concepts.htm
trace/traceviewer/com.nokia.trace.help/html/gettingstarted/GS_index.htm
trace/traceviewer/com.nokia.trace.help/html/gettingstarted/walk_through.htm
trace/traceviewer/com.nokia.trace.help/html/images/about_cpp.png
trace/traceviewer/com.nokia.trace.help/html/images/background_carbide.jpg
trace/traceviewer/com.nokia.trace.help/html/images/brandmark_cpp.gif
trace/traceviewer/com.nokia.trace.help/html/images/gold_header.png
trace/traceviewer/com.nokia.trace.help/html/images/green_fade_left_68_165_28.png
trace/traceviewer/com.nokia.trace.help/html/images/traceanalyser.png
trace/traceviewer/com.nokia.trace.help/html/images/tracebuilder.png
trace/traceviewer/com.nokia.trace.help/html/images/traceviewer.png
trace/traceviewer/com.nokia.trace.help/html/images/tracing.png
trace/traceviewer/com.nokia.trace.help/html/images/tracing.ppt
trace/traceviewer/com.nokia.trace.help/html/legal.htm
trace/traceviewer/com.nokia.trace.help/html/plugin.xml
trace/traceviewer/com.nokia.trace.help/html/reference/references.htm
trace/traceviewer/com.nokia.trace.help/html/toc.htm
trace/traceviewer/com.nokia.trace.help/html/toolTOC.xml
trace/traceviewer/com.nokia.trace.help/html/whats_new.htm
trace/traceviewer/com.nokia.trace.help/plugin.xml
trace/traceviewer/com.nokia.traceviewer.dictionary/.classpath
trace/traceviewer/com.nokia.traceviewer.dictionary/.settings/org.eclipse.jdt.core.prefs
trace/traceviewer/com.nokia.traceviewer.dictionary/META-INF/MANIFEST.MF
trace/traceviewer/com.nokia.traceviewer.dictionary/about.html
trace/traceviewer/com.nokia.traceviewer.dictionary/build.properties
trace/traceviewer/com.nokia.traceviewer.dictionary/plugin.xml
trace/traceviewer/com.nokia.traceviewer.dictionary/src/com/nokia/traceviewer/dictionary/ActivationHandler.java
trace/traceviewer/com.nokia.traceviewer.dictionary/src/com/nokia/traceviewer/dictionary/DecodeHandler.java
trace/traceviewer/com.nokia.traceviewer.dictionary/src/com/nokia/traceviewer/dictionary/TraceViewerDictionaryEngine.java
trace/traceviewer/com.nokia.traceviewer.dictionary/src/com/nokia/traceviewer/dictionary/TraceViewerDictionaryPlugin.java
trace/traceviewer/com.nokia.traceviewer.eventhandler/.classpath
trace/traceviewer/com.nokia.traceviewer.eventhandler/.settings/org.eclipse.jdt.core.prefs
trace/traceviewer/com.nokia.traceviewer.eventhandler/META-INF/MANIFEST.MF
trace/traceviewer/com.nokia.traceviewer.eventhandler/about.html
trace/traceviewer/com.nokia.traceviewer.eventhandler/build.properties
trace/traceviewer/com.nokia.traceviewer.eventhandler/plugin.xml
trace/traceviewer/com.nokia.traceviewer.eventhandler/src/com/nokia/traceviewer/eventhandler/Activator.java
trace/traceviewer/com.nokia.traceviewer.eventhandler/src/com/nokia/traceviewer/eventhandler/EventHandlerStartup.java
trace/traceviewer/com.nokia.traceviewer.eventhandler/src/com/nokia/traceviewer/eventhandler/TrimInformation.java
trace/traceviewer/com.nokia.traceviewer.eventhandler/src/com/nokia/traceviewer/eventhandler/TrimUpdater.java
trace/traceviewer/com.nokia.traceviewer.help/.classpath
trace/traceviewer/com.nokia.traceviewer.help/.settings/org.eclipse.jdt.core.prefs
trace/traceviewer/com.nokia.traceviewer.help/META-INF/MANIFEST.MF
trace/traceviewer/com.nokia.traceviewer.help/about.html
trace/traceviewer/com.nokia.traceviewer.help/book.css
trace/traceviewer/com.nokia.traceviewer.help/build.properties
trace/traceviewer/com.nokia.traceviewer.help/html/concepts/concepts.htm
trace/traceviewer/com.nokia.traceviewer.help/html/concepts/decode_file.htm
trace/traceviewer/com.nokia.traceviewer.help/html/concepts/filter.htm
trace/traceviewer/com.nokia.traceviewer.help/html/concepts/trace_format.htm
trace/traceviewer/com.nokia.traceviewer.help/html/concepts/tracecompiler.htm
trace/traceviewer/com.nokia.traceviewer.help/html/concepts/tracing.htm
trace/traceviewer/com.nokia.traceviewer.help/html/concepts/when_to_use_ost.htm
trace/traceviewer/com.nokia.traceviewer.help/html/contexts.xml
trace/traceviewer/com.nokia.traceviewer.help/html/gettingstarted/basic_steps.htm
trace/traceviewer/com.nokia.traceviewer.help/html/gettingstarted/gs_index.htm
trace/traceviewer/com.nokia.traceviewer.help/html/gettingstarted/images/mainview2.png
trace/traceviewer/com.nokia.traceviewer.help/html/gettingstarted/images/ost_standard.png
trace/traceviewer/com.nokia.traceviewer.help/html/gettingstarted/overview.htm
trace/traceviewer/com.nokia.traceviewer.help/html/images/about_cpp.png
trace/traceviewer/com.nokia.traceviewer.help/html/images/background_carbide.jpg
trace/traceviewer/com.nokia.traceviewer.help/html/images/brandmark_cpp.gif
trace/traceviewer/com.nokia.traceviewer.help/html/images/gold_header.png
trace/traceviewer/com.nokia.traceviewer.help/html/images/green_fade_left_68_165_28.png
trace/traceviewer/com.nokia.traceviewer.help/html/index.xml
trace/traceviewer/com.nokia.traceviewer.help/html/legal.htm
trace/traceviewer/com.nokia.traceviewer.help/html/reference/images/connection_01.png
trace/traceviewer/com.nokia.traceviewer.help/html/reference/images/connection_musti.png
trace/traceviewer/com.nokia.traceviewer.help/html/reference/images/connection_platsim.png
trace/traceviewer/com.nokia.traceviewer.help/html/reference/images/connection_usb.png
trace/traceviewer/com.nokia.traceviewer.help/html/reference/images/iconclear.gif
trace/traceviewer/com.nokia.traceviewer.help/html/reference/images/iconcolor.gif
trace/traceviewer/com.nokia.traceviewer.help/html/reference/images/iconconnect.gif
trace/traceviewer/com.nokia.traceviewer.help/html/reference/images/iconconnectionsettings.gif
trace/traceviewer/com.nokia.traceviewer.help/html/reference/images/iconcount.gif
trace/traceviewer/com.nokia.traceviewer.help/html/reference/images/iconexternalfilter.gif
trace/traceviewer/com.nokia.traceviewer.help/html/reference/images/iconfilter.gif
trace/traceviewer/com.nokia.traceviewer.help/html/reference/images/iconlog.gif
trace/traceviewer/com.nokia.traceviewer.help/html/reference/images/iconpause.gif
trace/traceviewer/com.nokia.traceviewer.help/html/reference/images/iconsearch.gif
trace/traceviewer/com.nokia.traceviewer.help/html/reference/images/icontraceactivation.gif
trace/traceviewer/com.nokia.traceviewer.help/html/reference/images/icontracevariable.gif
trace/traceviewer/com.nokia.traceviewer.help/html/reference/images/icontrigger.gif
trace/traceviewer/com.nokia.traceviewer.help/html/reference/images/preferencesAdvanced.png
trace/traceviewer/com.nokia.traceviewer.help/html/reference/images/preferencesConnection.png
trace/traceviewer/com.nokia.traceviewer.help/html/reference/images/toolbar.png
trace/traceviewer/com.nokia.traceviewer.help/html/reference/preferencesadvanced.htm
trace/traceviewer/com.nokia.traceviewer.help/html/reference/preferencesconnection.htm
trace/traceviewer/com.nokia.traceviewer.help/html/reference/preferencesgeneral.htm
trace/traceviewer/com.nokia.traceviewer.help/html/reference/preferencesplugins.htm
trace/traceviewer/com.nokia.traceviewer.help/html/reference/references.htm
trace/traceviewer/com.nokia.traceviewer.help/html/reference/toolbar.htm
trace/traceviewer/com.nokia.traceviewer.help/html/release_notes.htm
trace/traceviewer/com.nokia.traceviewer.help/html/tasks/advancedfilter.htm
trace/traceviewer/com.nokia.traceviewer.help/html/tasks/connect.htm
trace/traceviewer/com.nokia.traceviewer.help/html/tasks/decoding_traces.htm
trace/traceviewer/com.nokia.traceviewer.help/html/tasks/externalfilter.htm
trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/LoadConfiguration_dialog.png
trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/advancedFilterDialogGroup.png
trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/advancedFilterDialogReady.png
trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/browse_button.png
trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/clearviewBar.png
trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/colorPropertyDialog.png
trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/connectBar1.png
trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/connectBar2.png
trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/externalFilterToolbar.png
trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/externalFilterView.png
trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/filterDialog.png
trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/icon_menu_open.png
trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/iconcolor.gif
trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/iconcount.gif
trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/iconexternalfilter.gif
trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/iconfilter.gif
trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/icontracevariable.gif
trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/icontrigger.gif
trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/pauseBar.png
trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/preferencesAdvanced.png
trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/sample_start_trigger.png
trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/searchView.png
trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/selected_rules.png
trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/traceactivationConf.png
trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/traceactivationDialog.png
trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/triggerDialog.png
trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/variabletracingHistoryDialog.png
trace/traceviewer/com.nokia.traceviewer.help/html/tasks/log.htm
trace/traceviewer/com.nokia.traceviewer.help/html/tasks/preferences.htm
trace/traceviewer/com.nokia.traceviewer.help/html/tasks/search.htm
trace/traceviewer/com.nokia.traceviewer.help/html/tasks/setup_rules.htm
trace/traceviewer/com.nokia.traceviewer.help/html/tasks/tasks.htm
trace/traceviewer/com.nokia.traceviewer.help/html/tasks/traceactivation.htm
trace/traceviewer/com.nokia.traceviewer.help/html/tasks/trigger.htm
trace/traceviewer/com.nokia.traceviewer.help/html/tasks/viewing_traces.htm
trace/traceviewer/com.nokia.traceviewer.help/html/tocConcepts.xml
trace/traceviewer/com.nokia.traceviewer.help/html/tocGettingStarted.xml
trace/traceviewer/com.nokia.traceviewer.help/html/tocReference.xml
trace/traceviewer/com.nokia.traceviewer.help/html/tocTasks.xml
trace/traceviewer/com.nokia.traceviewer.help/html/tool.htm
trace/traceviewer/com.nokia.traceviewer.help/html/toolTOC.xml
trace/traceviewer/com.nokia.traceviewer.help/plugin.xml
trace/traceviewer/com.nokia.traceviewer.ost/.classpath
trace/traceviewer/com.nokia.traceviewer.ost/.settings/org.eclipse.jdt.core.prefs
trace/traceviewer/com.nokia.traceviewer.ost/META-INF/MANIFEST.MF
trace/traceviewer/com.nokia.traceviewer.ost/about.html
trace/traceviewer/com.nokia.traceviewer.ost/build.properties
trace/traceviewer/com.nokia.traceviewer.ost/plugin.xml
trace/traceviewer/com.nokia.traceviewer.ost/src/com/nokia/traceviewer/ost/Messages.java
trace/traceviewer/com.nokia.traceviewer.ost/src/com/nokia/traceviewer/ost/OstBaseReader.java
trace/traceviewer/com.nokia.traceviewer.ost/src/com/nokia/traceviewer/ost/OstConnectionHandler.java
trace/traceviewer/com.nokia.traceviewer.ost/src/com/nokia/traceviewer/ost/OstConsts.java
trace/traceviewer/com.nokia.traceviewer.ost/src/com/nokia/traceviewer/ost/OstDataMatcherChecker.java
trace/traceviewer/com.nokia.traceviewer.ost/src/com/nokia/traceviewer/ost/OstEngine.java
trace/traceviewer/com.nokia.traceviewer.ost/src/com/nokia/traceviewer/ost/OstMessageCallback.java
trace/traceviewer/com.nokia.traceviewer.ost/src/com/nokia/traceviewer/ost/OstMessageProcessor.java
trace/traceviewer/com.nokia.traceviewer.ost/src/com/nokia/traceviewer/ost/OstMessageSender.java
trace/traceviewer/com.nokia.traceviewer.ost/src/com/nokia/traceviewer/ost/OstPlugin.java
trace/traceviewer/com.nokia.traceviewer.ost/src/com/nokia/traceviewer/ost/OstReader.java
trace/traceviewer/com.nokia.traceviewer.ost/src/com/nokia/traceviewer/ost/OstScrollReader.java
trace/traceviewer/com.nokia.traceviewer.ost/src/com/nokia/traceviewer/ost/OstWriter.java
trace/traceviewer/com.nokia.traceviewer.ost/src/com/nokia/traceviewer/ost/messages.properties
trace/traceviewer/com.nokia.traceviewer/.classpath
trace/traceviewer/com.nokia.traceviewer/.settings/org.eclipse.jdt.core.prefs
trace/traceviewer/com.nokia.traceviewer/META-INF/MANIFEST.MF
trace/traceviewer/com.nokia.traceviewer/about.html
trace/traceviewer/com.nokia.traceviewer/about.ini
trace/traceviewer/com.nokia.traceviewer/about.mappings
trace/traceviewer/com.nokia.traceviewer/about.properties
trace/traceviewer/com.nokia.traceviewer/build.properties
trace/traceviewer/com.nokia.traceviewer/icons/activationtrigger.gif
trace/traceviewer/com.nokia.traceviewer/icons/advancedfilter.gif
trace/traceviewer/com.nokia.traceviewer/icons/backarrow.gif
trace/traceviewer/com.nokia.traceviewer/icons/clear.gif
trace/traceviewer/com.nokia.traceviewer/icons/color.gif
trace/traceviewer/com.nokia.traceviewer/icons/coloradd.gif
trace/traceviewer/com.nokia.traceviewer/icons/coloredit.gif
trace/traceviewer/com.nokia.traceviewer/icons/colorremove.gif
trace/traceviewer/com.nokia.traceviewer/icons/connect.gif
trace/traceviewer/com.nokia.traceviewer/icons/connectionsettings.gif
trace/traceviewer/com.nokia.traceviewer/icons/count.gif
trace/traceviewer/com.nokia.traceviewer/icons/disconnect.gif
trace/traceviewer/com.nokia.traceviewer/icons/empty.gif
trace/traceviewer/com.nokia.traceviewer/icons/endset.gif
trace/traceviewer/com.nokia.traceviewer/icons/exclamation.gif
trace/traceviewer/com.nokia.traceviewer/icons/filter.gif
trace/traceviewer/com.nokia.traceviewer/icons/filteradd.gif
trace/traceviewer/com.nokia.traceviewer/icons/filteredit.gif
trace/traceviewer/com.nokia.traceviewer/icons/filteritem.gif
trace/traceviewer/com.nokia.traceviewer/icons/filterremove.gif
trace/traceviewer/com.nokia.traceviewer/icons/folder.gif
trace/traceviewer/com.nokia.traceviewer/icons/folderadd.gif
trace/traceviewer/com.nokia.traceviewer/icons/gotolocation.gif
trace/traceviewer/com.nokia.traceviewer/icons/listcomponentitem.gif
trace/traceviewer/com.nokia.traceviewer/icons/listitem.gif
trace/traceviewer/com.nokia.traceviewer/icons/log.gif
trace/traceviewer/com.nokia.traceviewer/icons/logclose.gif
trace/traceviewer/com.nokia.traceviewer/icons/logicaland.gif
trace/traceviewer/com.nokia.traceviewer/icons/logicalnot.gif
trace/traceviewer/com.nokia.traceviewer/icons/logicalor.gif
trace/traceviewer/com.nokia.traceviewer/icons/logopen.gif
trace/traceviewer/com.nokia.traceviewer/icons/logsaveascii.gif
trace/traceviewer/com.nokia.traceviewer/icons/logsavebinary.gif
trace/traceviewer/com.nokia.traceviewer/icons/opendecodefile.gif
trace/traceviewer/com.nokia.traceviewer/icons/pause.gif
trace/traceviewer/com.nokia.traceviewer/icons/resume.gif
trace/traceviewer/com.nokia.traceviewer/icons/sample.gif
trace/traceviewer/com.nokia.traceviewer/icons/search.gif
trace/traceviewer/com.nokia.traceviewer/icons/simplefilter.gif
trace/traceviewer/com.nokia.traceviewer/icons/startexternal.gif
trace/traceviewer/com.nokia.traceviewer/icons/startset.gif
trace/traceviewer/com.nokia.traceviewer/icons/state.gif
trace/traceviewer/com.nokia.traceviewer/icons/stopexternal.gif
trace/traceviewer/com.nokia.traceviewer/icons/stoptrigger.gif
trace/traceviewer/com.nokia.traceviewer/icons/traceactivation.gif
trace/traceviewer/com.nokia.traceviewer/icons/traceproperty.gif
trace/traceviewer/com.nokia.traceviewer/icons/tracevariable.gif
trace/traceviewer/com.nokia.traceviewer/icons/traceviewer.gif
trace/traceviewer/com.nokia.traceviewer/icons/trigger.gif
trace/traceviewer/com.nokia.traceviewer/plugin.properties
trace/traceviewer/com.nokia.traceviewer/plugin.xml
trace/traceviewer/com.nokia.traceviewer/schema/com.nokia.traceviewer.decodeprovider.exsd
trace/traceviewer/com.nokia.traceviewer/schema/com.nokia.traceviewer.traceprovider.exsd
trace/traceviewer/com.nokia.traceviewer/schema/com.nokia.traceviewer.trimprovider.exsd
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/Messages.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/TraceViewerHelpContextIDs.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/TraceViewerPlugin.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/ActionFactory.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/AddCommentToTraceAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/AddLineCountRuleAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/AddVariableTracingRuleAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/AppendDecodeFileAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/AppendDecodeFileGlobalAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/ClearViewAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/ClearViewRunnable.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/CloseAndRestartLoggingAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/ColorAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/ConnectAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/CopyFileProgressCallback.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/CopySelectionAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/CopySelectionDataFetcher.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/CountLinesAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/DeactivateLineCountRuleAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/DeactivateVariableTracingRuleAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/EditLineCountRuleAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/EditTraceCommentAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/EditVariableTracingRuleAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/FilterAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/JumpToTraceAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/LogCloseAsciiAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/LogCloseAsciiGlobalAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/LogCloseBinaryAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/LogCloseBinaryGlobalAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/LogNewAsciiAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/LogNewAsciiGlobalAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/LogNewBinaryAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/LogNewBinaryGlobalAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/LogOpenLogAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/LogOpenLogGlobalAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/LogSaveAsciiAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/LogSaveAsciiGlobalAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/LogSaveBinaryAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/LogSaveBinaryGlobalAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/Messages.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/OpenConnectionSettingsAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/OpenDecodeFileAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/OpenDecodeFileInStartupHandler.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/OpenDecodeFileThread.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/OpenTraceLocationAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/OpenVariableTracingHistoryAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/PauseAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/ReloadDecodeFilesAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/RemoveTraceCommentAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/SearchAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/SelectAllAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/ShowTraceInfoAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/StartExternalFilterAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/ToolbarShortcutAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/TraceActivationAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/TraceActivationGlobalAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/TraceCommentValidator.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/TraceVariablesAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/TraceViewerAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/TraceViewerActionUtils.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/TraceViewerGlobalAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/TriggerAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/TriggerGlobalAction.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/messages.properties
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/api/ConnectionHandler.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/api/DPLocation.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/api/DataProcessorAdder.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/api/DataProcessorLocation.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/api/DataSender.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/api/DecodeHandler.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/api/ITraceConnClient.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/api/ITraceConnInfo.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/api/LogHandler.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/api/Messages.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/api/TraceConnectivityException.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/api/TraceViewerAPI.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/api/TraceViewerAPI2.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/api/ViewHandler.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/api/messages.properties
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/BaseDialog.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/BasePropertyDialog.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/BaseTreeDialog.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/ColorDialog.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/ColorPropertyDialog.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/ComponentSelectionDialog.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/FilterAdvancedDialog.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/FilterAdvancedParser.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/FilterDialog.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/FilterPropertyDialog.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/LineCountDialog.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/LineCountPropertyDialog.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/LogAsciiOptionsSelectionDialog.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/Messages.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/ProgressBarCloseHandler.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/ProgressBarDialog.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/SearchDialog.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/SearchDialogProgressBarUpdater.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/SearchHitEOFUpdater.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/SearchHitFullRoundUpdater.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/ShowTraceInfoDialog.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/TraceActivationDialog.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/TraceActivationGroupTableItem.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/TraceConfigurationLoadDialog.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/TraceConfigurationSaveDialog.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/TriggerDialog.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/TriggerPropertyDialog.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/VariableTracingDialog.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/VariableTracingHistoryDialog.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/VariableTracingPropertyDialog.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/messages.properties
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/ColorTreeBaseItem.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/ColorTreeComponentItem.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/ColorTreeItem.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/ColorTreeTextItem.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/FilterTreeBaseItem.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/FilterTreeComponentItem.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/FilterTreeItem.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/FilterTreeTextItem.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/LineCountTreeBaseItem.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/LineCountTreeComponentItem.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/LineCountTreeItem.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/LineCountTreeTextItem.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/TreeCheckboxStateListener.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/TreeItem.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/TreeItemContentProvider.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/TreeItemImpl.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/TreeItemLabelProvider.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/TreeItemListener.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/TriggerTreeBaseItem.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/TriggerTreeItem.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/TriggerTreeTextItem.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/VariableTracingTreeBaseItem.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/VariableTracingTreeItem.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/VariableTracingTreeTextItem.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/BTraceConstants.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/BTraceInformation.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/BaseDataReader.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/Connection.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/ConnectionChangedListener.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/ConnectionCreator.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/ConnectionHelper.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/ConnectionStatusListener.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/DataProcessorAccess.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/DataReader.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/DataReaderAccess.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/DataScrollReader.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/DataWriter.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/DecodeProvider.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/DummyDialogs.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/DummyTrim.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/FileMap.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/InternalFileHandler.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/MediaCallback.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/Messages.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/MultiPartItem.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/PlainTextReader.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/PlainTextScrollReader.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/StateHolder.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/TraceConfiguration.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/TraceFetcher.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/TraceFileHandler.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/TraceInformation.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/TraceMetaData.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/TraceProperties.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/TraceProvider.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/TraceViewer.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/TraceViewerConst.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/TraceViewerDialog.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/TraceViewerDialogInterface.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/TraceViewerEventListener.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/TraceViewerGlobals.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/TraceViewerInterface.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/TraceViewerPropertyViewInterface.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/TraceViewerTraceViewInterface.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/TraceViewerUtils.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/TraceViewerViewInterface.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/TrimProvider.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/activation/Messages.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/activation/OstTraceActivator.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/activation/TraceActivationComponentItem.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/activation/TraceActivationGroupItem.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/activation/TraceActivationTraceItem.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/activation/TraceActivationXMLConstants.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/activation/TraceActivationXMLExporter.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/activation/TraceActivationXMLImporter.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/activation/TraceActivator.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/activation/messages.properties
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/ColorProcessor.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/DataProcessor.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/Decoder.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/DummyView.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/ExternalFilterDataReader.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/ExternalFilterDataWriter.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/ExternalFilterProcessor.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/FilterProcessor.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/FilterRuleObject.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/FilterRuleSet.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/LineCountItem.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/LineCountProcessor.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/Logger.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/Messages.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/SearchProcessor.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/SearchProperties.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/SearchUtils.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/TimestampParser.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/TraceCommentHandler.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/TriggerProcessor.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/VariableTracingEvent.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/VariableTracingItem.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/VariableTracingProcessor.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/messages.properties
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/messages.properties
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/metafile/MetaFileXMLConstants.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/metafile/MetaFileXMLExporter.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/metafile/MetaFileXMLImporter.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/LabelFieldEditor.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/Messages.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/PreferenceConstants.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/PreferenceInitializer.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/SpacerFieldEditor.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/TraceViewerAdvancedPreferencesPage.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/TraceViewerConnectionPreferencesPage.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/TraceViewerPluginsPreferencesPage.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/TraceViewerPreferencesPage.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/XMLBaseConfigurationExporter.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/XMLBaseConfigurationImporter.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/XMLColorConfigurationExporter.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/XMLColorConfigurationImporter.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/XMLConfigurationFileConstants.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/XMLFilterConfigurationExporter.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/XMLFilterConfigurationImporter.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/XMLGeneralConfigurationExporter.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/XMLGeneralConfigurationImporter.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/XMLLineCountConfigurationExporter.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/XMLLineCountConfigurationImporter.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/XMLTriggerConfigurationExporter.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/XMLTriggerConfigurationImporter.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/XMLVariableTracingConfigurationExporter.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/XMLVariableTracingConfigurationImporter.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/messages.properties
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/wizard/AbstractImportExportPage.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/wizard/ExportPage.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/wizard/ExportWizard.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/wizard/ImportPage.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/wizard/ImportWizard.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/wizard/Messages.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/wizard/messages.properties
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/internal/api/Messages.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/internal/api/TraceConnInfo.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/internal/api/TraceViewerAPI2Impl.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/internal/api/messages.properties
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/view/ColorRuleUpdater.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/view/DialogFactory.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/view/Messages.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/view/ProcessProgressBarUpdater.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/view/TracePropertyView.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/view/TraceViewerView.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/view/listener/Messages.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/view/listener/ScrollerSelectionListener.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/view/listener/SelectionProperties.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/view/listener/ViewerClickListener.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/view/listener/ViewerKeyListener.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/view/listener/ViewerMouseWheelListener.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/view/listener/ViewerSelectionChangedListener.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/view/listener/WindowResizeListener.java
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/view/listener/messages.properties
trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/view/messages.properties
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.carbide.extensions.traceviewer/build.properties	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,2 @@
+bin.includes = feature.xml,\
+               license.htm
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.carbide.extensions.traceviewer/feature.xml	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+      id="com.nokia.carbide.extensions.traceviewer"
+      label="Carbide.c++ Extensions - TraceViewer"
+      version="2.6.0"
+      provider-name="Nokia"
+      plugin="com.nokia.traceviewer">
+
+   <description>
+      TraceViewer is used for receiving and manipulating traces.
+   </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 &quot;Eclipse Public License v1.0&quot; which accompanies this 
+  distribution, and is available at the URL &quot;http://www.eclipse.org/legal/epl-v10.html&quot;.
+  
+  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"/>
+      <discovery label="Carbide.c++ Extensions Nokia Update Server" url="http://trwwwaps.nmp.nokia.com/programs/carbide"/>
+   </url>
+
+   <requires>
+      <import plugin="org.eclipse.core.runtime"/>
+      <import plugin="org.eclipse.ui"/>
+      <import plugin="org.eclipse.ui.console"/>
+      <import plugin="org.eclipse.jface.text"/>
+      <import plugin="org.eclipse.ui.ide"/>
+      <import plugin="org.eclipse.core.resources"/>
+      <import plugin="com.nokia.tcf"/>
+      <import plugin="com.nokia.carbide.remoteConnections"/>
+      <import plugin="com.nokia.carbide.trk.support"/>
+   </requires>
+
+   <plugin
+         id="com.nokia.traceviewer"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+
+   <plugin
+         id="com.nokia.traceviewer.dictionary"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+
+   <plugin
+         id="com.nokia.traceviewer.eventhandler"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+
+   <plugin
+         id="com.nokia.traceviewer.help"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+
+
+   <plugin
+         id="com.nokia.traceviewer.ost"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+         
+   <plugin
+         id="com.nokia.trace.eventrouter"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+
+   <plugin
+         id="com.nokia.trace.eventview"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+
+   <plugin
+         id="com.nokia.trace.dictionary"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+
+   <plugin
+         id="com.nokia.trace.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/traceviewer/com.nokia.carbide.extensions.traceviewer/license.htm	Wed Jun 23 14:49:59 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/traceviewer/com.nokia.trace.dictionary/.classpath	Wed Jun 23 14:49:59 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/traceviewer/com.nokia.trace.dictionary/.settings/org.eclipse.jdt.core.prefs	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,2 @@
+#Wed Mar 14 17:24:05 EET 2007
+org.eclipse.jdt.core.compiler.source=1.5
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/META-INF/MANIFEST.MF	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,17 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Carbide.c++ Extensions - Trace Common
+Bundle-SymbolicName: com.nokia.trace.dictionary;singleton:=true
+Bundle-Version: 2.6.0
+Bundle-Activator: com.nokia.trace.dictionary.TraceDictionaryPlugin
+Bundle-Vendor: Nokia
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.ui,
+ com.nokia.trace.eventrouter
+Bundle-ActivationPolicy: lazy
+Export-Package: com.nokia.trace.dictionary,
+ com.nokia.trace.dictionary.decoder,
+ com.nokia.trace.dictionary.model,
+ com.nokia.trace.dictionary.model.decodeparameters,
+ com.nokia.trace.dictionary.model.handlers
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/about.html	Wed Jun 23 14:49:59 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 &copy; 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/traceviewer/com.nokia.trace.dictionary/build.properties	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .,\
+               about.html
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/TraceDictionaryEngine.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,101 @@
+/*
+ * 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:
+ *
+ * Trace Dictionary Engine
+ *
+ */
+package com.nokia.trace.dictionary;
+
+import com.nokia.trace.dictionary.decoder.TraceDictionaryDecoder;
+import com.nokia.trace.dictionary.model.DictionaryDecodeModel;
+import com.nokia.trace.dictionary.model.DictionaryModelBuilder;
+import com.nokia.trace.eventrouter.TraceEvent;
+import com.nokia.trace.eventrouter.TraceEventRouter;
+
+/**
+ * Trace Dictionary Engine
+ */
+public class TraceDictionaryEngine {
+
+	/**
+	 * Decoder
+	 */
+	private TraceDictionaryDecoder decoder;
+
+	/**
+	 * Model Builder
+	 */
+	private DictionaryModelBuilder modelBuilder;
+
+	/**
+	 * Decode Model
+	 */
+	private DictionaryDecodeModel decodeModel;
+
+	/**
+	 * Constructor
+	 */
+	public TraceDictionaryEngine() {
+		decodeModel = new DictionaryDecodeModel();
+	}
+
+	/**
+	 * Gets decoder
+	 * 
+	 * @return the decoder
+	 */
+	public TraceDictionaryDecoder getDecoder() {
+		if (decoder == null) {
+			decoder = new TraceDictionaryDecoder(decodeModel);
+		}
+		return decoder;
+	}
+
+	/**
+	 * Gets model builder
+	 * 
+	 * @return the model builder
+	 */
+	public DictionaryModelBuilder getModelBuilder() {
+		if (modelBuilder == null) {
+			modelBuilder = new DictionaryModelBuilder(decodeModel);
+		}
+		return modelBuilder;
+	}
+
+	/**
+	 * Gets model
+	 * 
+	 * @return the decode model
+	 */
+	public DictionaryDecodeModel getModel() {
+		return decodeModel;
+	}
+
+	/**
+	 * Posts event to event view
+	 * 
+	 * @param event
+	 *            event
+	 */
+	public static void postEvent(final TraceEvent event) {
+		// If source has line number, add also file name
+		if (event.getSource() != null && event.getSource() instanceof Integer) {
+			event.setSource(DictionaryModelBuilder.getCurrentFile()
+					+ " line " + event.getSource()); //$NON-NLS-1$
+		}
+		TraceEventRouter.getInstance().postEvent(event);
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/TraceDictionaryPlugin.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,81 @@
+/*
+ * 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:
+ *
+ * The activator class controls the plug-in life cycle
+ *
+ */
+package com.nokia.trace.dictionary;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ * 
+ */
+public class TraceDictionaryPlugin extends AbstractUIPlugin {
+
+	/**
+	 * The plug-in ID
+	 */
+	public static final String PLUGIN_ID = "com.nokia.trace.dictionary"; //$NON-NLS-1$
+
+	/**
+	 * The shared instance
+	 */
+	private static TraceDictionaryPlugin plugin;
+
+	/**
+	 * The constructor
+	 */
+	public TraceDictionaryPlugin() {
+		plugin = this;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
+	 * )
+	 */
+	@Override
+	public void start(BundleContext context) throws Exception {
+		super.start(context);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
+	 * )
+	 */
+	@Override
+	public void stop(BundleContext context) throws Exception {
+		plugin = null;
+		super.stop(context);
+	}
+
+	/**
+	 * Returns the shared instance
+	 * 
+	 * @return the shared instance
+	 */
+	public static TraceDictionaryPlugin getDefault() {
+		return plugin;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/decoder/TraceDictionaryDecoder.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,385 @@
+/*
+ * 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:
+ *
+ * Trace Dictionary Decoder
+ *
+ */
+package com.nokia.trace.dictionary.decoder;
+
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import com.nokia.trace.dictionary.model.DictionaryDecodeModel;
+import com.nokia.trace.dictionary.model.Location;
+import com.nokia.trace.dictionary.model.Trace;
+import com.nokia.trace.dictionary.model.TraceComponent;
+import com.nokia.trace.dictionary.model.TraceData;
+import com.nokia.trace.dictionary.model.TraceGroup;
+import com.nokia.trace.dictionary.model.decodeparameters.DecodeParameter;
+
+/**
+ * Trace Dictionary Decoder
+ * 
+ */
+public final class TraceDictionaryDecoder {
+
+	/**
+	 * Estimated trace size
+	 */
+	private static final int ESTIMATED_TRACE_SIZE = 70;
+
+	/**
+	 * Separator between class and function
+	 */
+	private static final String CLASS_FUNCTION_SEPARATOR = "::"; //$NON-NLS-1$
+
+	/**
+	 * Separator after function name
+	 */
+	private static final String AFTER_FUNCTION_SEPARATOR = ": "; //$NON-NLS-1$
+
+	/**
+	 * Model to use for decoding
+	 */
+	private DictionaryDecodeModel model;
+
+	/**
+	 * Previous trace used when getting metadata so that trace is only need to
+	 * be get once
+	 */
+	private Trace previousMetaTrace;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            dictionary model
+	 */
+	public TraceDictionaryDecoder(DictionaryDecodeModel model) {
+		this.model = model;
+	}
+
+	/**
+	 * Decodes the contents of a trace
+	 * 
+	 * @param dataBuffer
+	 *            buffer containing data
+	 * @param dataStart
+	 *            data start offset
+	 * @param dataLength
+	 *            data length
+	 * @param componentId
+	 *            component ID of the trace
+	 * @param groupId
+	 *            group ID of the trace
+	 * @param traceId
+	 *            trace ID
+	 * @param showClassPrefixes
+	 *            if true, add class and function name to the trace text if they
+	 *            exist
+	 * @param showComponentGroupPrefixes
+	 *            if true, add component and group name to the trace text if
+	 *            they exist
+	 * @param parameterList
+	 *            parameter list where to add each parameters separately when
+	 *            decoding
+	 * @return decoded trace string buffer
+	 */
+	public StringBuffer decode(ByteBuffer dataBuffer, int dataStart,
+			int dataLength, int componentId, int groupId, int traceId,
+			boolean showClassPrefixes, boolean showComponentGroupPrefixes,
+			ArrayList<String> parameterList) {
+
+		// Get trace
+		Trace trace = getTrace(componentId, groupId, traceId);
+
+		// Create variables
+		StringBuffer buf = null;
+		ArrayList<DecodeParameter> parameters = null;
+		TraceData traceData = null;
+
+		// Get trace data
+		if (trace != null) {
+			traceData = trace.getTraceData();
+
+			// Get trace parameters
+			if (traceData != null) {
+				parameters = traceData.getDecodeParameters();
+
+				// Check if the trace only contains one variable and tell it to
+				// the decoders
+				if (traceData.containsOnlyOneVariable()) {
+					DecodeParameter.isOnlyVariableInTrace = true;
+				} else {
+					DecodeParameter.isOnlyVariableInTrace = false;
+				}
+			}
+		}
+
+		// Decode the trace to the StringBuffer
+		if (parameters != null && trace != null) {
+			buf = new StringBuffer(ESTIMATED_TRACE_SIZE);
+
+			// Create parameter list if it doesn't exist so the decode
+			// parameters doesn't have to make a null check
+			if (parameterList == null) {
+				parameterList = new ArrayList<String>();
+			}
+
+			// Insert prefixes
+			TraceGroup group = trace.getGroup();
+			insertPrefixes(buf, trace, group, showClassPrefixes,
+					showComponentGroupPrefixes);
+
+			// Decode all parameters
+			Iterator<DecodeParameter> it = parameters.iterator();
+			int offset = dataStart;
+
+			while (it.hasNext()) {
+				DecodeParameter par = it.next();
+				offset = par.decode(dataBuffer, offset, buf, dataStart,
+						dataLength, parameterList);
+			}
+
+			// Insert suffixes
+			insertSuffixes(buf, group);
+		}
+
+		return buf;
+	}
+
+	/**
+	 * Inserts prefixes
+	 * 
+	 * @param buf
+	 *            trace buffer
+	 * @param trace
+	 *            trace
+	 * @param group
+	 *            trace group
+	 * @param showClassPrefixes
+	 *            if true, add class and function name to the trace text if they
+	 *            exist
+	 * @param showComponentGroupPrefixes
+	 *            if true, add component and group name to the trace text if
+	 *            they exist
+	 */
+	private void insertPrefixes(StringBuffer buf, Trace trace,
+			TraceGroup group, boolean showClassPrefixes,
+			boolean showComponentGroupPrefixes) {
+		if (showComponentGroupPrefixes) {
+			if (group.getComponent().getPrefix() != null) {
+				buf.append(group.getComponent().getPrefix());
+			}
+			if (group.getPrefix() != null) {
+				buf.append(group.getPrefix());
+			}
+		}
+		if (showClassPrefixes && trace.getClassName() != null
+				&& trace.getMethodName() != null) {
+			buf.append(trace.getClassName());
+			buf.append(CLASS_FUNCTION_SEPARATOR);
+			buf.append(trace.getMethodName());
+			buf.append(AFTER_FUNCTION_SEPARATOR);
+		}
+	}
+
+	/**
+	 * Insert suffixes
+	 * 
+	 * @param buf
+	 *            trace buffer
+	 * @param group
+	 *            trace group
+	 */
+	private void insertSuffixes(StringBuffer buf, TraceGroup group) {
+		if (group.getSuffix() != null) {
+			buf.append(group.getSuffix());
+		}
+		if (group.getComponent().getSuffix() != null) {
+			buf.append(group.getComponent().getSuffix());
+		}
+	}
+
+	/**
+	 * Gets trace with component, group and trace IDs
+	 * 
+	 * @param componentId
+	 *            component Id
+	 * @param groupId
+	 *            group Id
+	 * @param traceId
+	 *            trace Id
+	 * @return Trace
+	 */
+	private Trace getTrace(int componentId, int groupId, int traceId) {
+		TraceGroup group = null;
+		Trace trace = null;
+
+		// Get component
+		TraceComponent comp = model.getComponent(componentId);
+
+		// Get group
+		if (comp != null) {
+			group = comp.getGroup(groupId);
+			// Get trace
+			if (group != null) {
+				trace = group.getTrace(traceId);
+			}
+		}
+		return trace;
+	}
+
+	/**
+	 * Sets previous trace where to get data from. Must be set before calling
+	 * decode or getMetaData functions
+	 * 
+	 * @param componentId
+	 *            component Id
+	 * @param groupId
+	 *            group Id
+	 * @param traceId
+	 *            trace Id
+	 */
+	public void setTraceWhereToGetMetaData(int componentId, int groupId,
+			int traceId) {
+		previousMetaTrace = getTrace(componentId, groupId, traceId);
+	}
+
+	/**
+	 * Gets location
+	 * 
+	 * @return location
+	 */
+	public Location getLocation() {
+		Location location = null;
+		if (previousMetaTrace != null) {
+			location = previousMetaTrace.getLocation();
+		}
+		return location;
+	}
+
+	/**
+	 * Gets line number
+	 * 
+	 * @return line number
+	 */
+	public int getLineNumber() {
+		int lineNum = 0;
+		if (previousMetaTrace != null) {
+			lineNum = previousMetaTrace.getLineNumber();
+		}
+		return lineNum;
+	}
+
+	/**
+	 * Gets class name
+	 * 
+	 * @return class name
+	 */
+	public String getClassName() {
+		String className = null;
+		if (previousMetaTrace != null) {
+			className = previousMetaTrace.getClassName();
+		}
+		return className;
+	}
+
+	/**
+	 * Gets method name
+	 * 
+	 * @return method name
+	 */
+	public String getMethodName() {
+		String methodName = null;
+		if (previousMetaTrace != null) {
+			methodName = previousMetaTrace.getMethodName();
+		}
+		return methodName;
+	}
+
+	/**
+	 * Gets metadata map
+	 * 
+	 * @return metadata map
+	 */
+	public HashMap<String, HashMap<String, Object>> getMetadata() {
+		HashMap<String, HashMap<String, Object>> metadata = null;
+
+		// Create a new metadata map if trace has some metadata
+		if (previousMetaTrace != null
+				&& (previousMetaTrace.getMetadata() != null
+						|| previousMetaTrace.getGroup().getMetadata() != null || previousMetaTrace
+						.getGroup().getComponent().getMetadata() != null)) {
+			TraceGroup group = previousMetaTrace.getGroup();
+			metadata = new HashMap<String, HashMap<String, Object>>();
+
+			// Add trace metadata
+			if (previousMetaTrace.getMetadata() != null) {
+				addMissingMetadataToList(previousMetaTrace.getMetadata(),
+						metadata);
+			}
+
+			// Add group metadata
+			if (group.getMetadata() != null) {
+				addMissingMetadataToList(group.getMetadata(), metadata);
+			}
+
+			// Add component metadata
+			if (group.getComponent().getMetadata() != null) {
+				addMissingMetadataToList(group.getComponent().getMetadata(),
+						metadata);
+			}
+		}
+		return metadata;
+	}
+
+	/**
+	 * Adds missing metadata to list
+	 * 
+	 * @param oldList
+	 *            old list to append from
+	 * @param newList
+	 *            new list to append to
+	 */
+	private void addMissingMetadataToList(
+			HashMap<String, HashMap<String, Object>> oldList,
+			HashMap<String, HashMap<String, Object>> newList) {
+		Iterator<String> it = oldList.keySet().iterator();
+		while (it.hasNext()) {
+			String key = it.next();
+
+			// Doesn't contain this key, add it
+			if (!newList.containsKey(key)) {
+				newList.put(key, oldList.get(key));
+
+				// Contains the key, check values inside
+			} else {
+				Iterator<String> valueIt = oldList.get(key).keySet().iterator();
+				while (valueIt.hasNext()) {
+					String valueKey = valueIt.next();
+
+					// Doesn't contain value key, add it
+					if (!newList.get(key).containsKey(valueKey)) {
+						newList.get(key).put(valueKey,
+								newList.get(key).get(valueKey));
+					}
+				}
+			}
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/decoder/package.html	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,5 @@
+<html><body>
+Dictionary decoder uses the 
+{@link com.nokia.tracedictionary.model.DictionaryDecodeModel DictionaryDecodeModel} 
+to convert binary traces to text
+</body></html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/DecodeObject.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,105 @@
+/*
+ * 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:
+ *
+ * Decode object
+ *
+ */
+package com.nokia.trace.dictionary.model;
+
+import java.util.HashMap;
+
+/**
+ * Decode object
+ * 
+ */
+public class DecodeObject {
+
+	/**
+	 * ID number
+	 */
+	private int id;
+
+	/**
+	 * Name
+	 */
+	private String name;
+
+	/**
+	 * Hashmap containing metadata for this object
+	 */
+	protected HashMap<String, HashMap<String, Object>> metadataMap;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param id
+	 *            id of this component
+	 * @param name
+	 *            name of this component
+	 */
+	public DecodeObject(int id, String name) {
+		this.id = id;
+		this.name = name;
+	}
+
+	/**
+	 * Gets ID
+	 * 
+	 * @return the id
+	 */
+	public int getId() {
+		return id;
+	}
+
+	/**
+	 * Gets name
+	 * 
+	 * @return the name
+	 */
+	public String getName() {
+		return name;
+	}
+
+	/**
+	 * Attaches metadata to this trace
+	 * 
+	 * @param id
+	 *            id of the metadata
+	 * @param tagName
+	 *            tag name of the metadata
+	 * @param metadata
+	 *            the metadata object
+	 */
+	public void addMetadata(String id, String tagName, Object metadata) {
+		if (metadataMap == null) {
+			metadataMap = new HashMap<String, HashMap<String, Object>>();
+		}
+		HashMap<String, Object> tagMap = metadataMap.get(id);
+		if (tagMap == null) {
+			tagMap = new HashMap<String, Object>();
+			metadataMap.put(id, tagMap);
+		}
+		tagMap.put(tagName, metadata);
+	}
+
+	/**
+	 * Gets metadata map
+	 * 
+	 * @return the metadata
+	 */
+	public HashMap<String, HashMap<String, Object>> getMetadata() {
+		return metadataMap;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/DecodeObjectFactory.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,107 @@
+/*
+ * 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:
+ *
+ * Decode Object Factory
+ *
+ */
+package com.nokia.trace.dictionary.model;
+
+/**
+ * Decode Object Factory creates components, groups and traces
+ * 
+ */
+public class DecodeObjectFactory {
+
+	/**
+	 * Constructor
+	 */
+	public DecodeObjectFactory() {
+
+	}
+
+	/**
+	 * Creates and returns new TraceComponent
+	 * 
+	 * @param id
+	 *            id
+	 * @param name
+	 *            name
+	 * @param prefix
+	 *            prefix
+	 * @param suffix
+	 *            suffix
+	 * @param model
+	 *            model
+	 * @return component
+	 */
+	public TraceComponent createTraceComponent(int id, String name,
+			String prefix, String suffix, DictionaryDecodeModel model) {
+		TraceComponent newComponent = new TraceComponent(id, name, prefix,
+				suffix, DictionaryModelBuilder.getCurrentFile(), model);
+		return newComponent;
+	}
+
+	/**
+	 * Creates and returns new TraceGroup
+	 * 
+	 * @param id
+	 *            id
+	 * @param name
+	 *            name
+	 * @param prefix
+	 *            prefix
+	 * @param suffix
+	 *            suffix
+	 * @param component
+	 *            component
+	 * @return group
+	 */
+	public TraceGroup createTraceGroup(int id, String name, String prefix,
+			String suffix, TraceComponent component) {
+		TraceGroup newGroup = new TraceGroup(id, name, prefix, suffix,
+				component);
+		return newGroup;
+	}
+
+	/**
+	 * Creates and return new Trace
+	 * 
+	 * @param id
+	 *            id
+	 * @param name
+	 *            name
+	 * @param traceData
+	 *            reference to traceData
+	 * @param location
+	 *            reference to location
+	 * @param lineNum
+	 *            line number
+	 * @param methodName
+	 *            method name
+	 * @param className
+	 *            class name
+	 * @param group
+	 *            parent group
+	 * @return new trace
+	 */
+	public Trace createTrace(int id, String name, TraceData traceData,
+			Location location, int lineNum, String methodName,
+			String className, TraceGroup group) {
+		Trace newTrace = new Trace(id, name, traceData, location, lineNum,
+				methodName, className, group);
+		return newTrace;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/DictionaryContentHandler.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,310 @@
+/*
+ * 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:
+ *
+ * Dictionary Content Handler
+ *
+ */
+package com.nokia.trace.dictionary.model;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+
+import com.nokia.trace.dictionary.model.DictionaryContentVariables.ParentDecodeObject;
+import com.nokia.trace.dictionary.model.handlers.DictionaryHandler;
+import com.nokia.trace.dictionary.model.handlers.DictionaryHandlerCreator;
+
+/**
+ * Dictionary Content Handler
+ * 
+ */
+public class DictionaryContentHandler implements ContentHandler {
+
+	/**
+	 * Tag for metadata
+	 */
+	private static final String METADATA_TAG = "options"; //$NON-NLS-1$
+
+	/**
+	 * Decode Model
+	 */
+	private DictionaryDecodeModel model;
+
+	/**
+	 * Handlers for start elements in dictionary file
+	 */
+	private ArrayList<DictionaryHandler> startHandlers;
+
+	/**
+	 * Handlers for end elements in dictionary file
+	 */
+	private ArrayList<DictionaryHandler> endHandlers;
+
+	/**
+	 * Metadata handlers
+	 */
+	private ArrayList<DictionaryHandler> metadataHandlers;
+
+	/**
+	 * Are we catching characters
+	 */
+	private boolean catchCharacters;
+
+	/**
+	 * Buffer where to store characters
+	 */
+	private StringBuffer elementContent;
+
+	/**
+	 * Content variables used to get all needed information when creating model
+	 */
+	private DictionaryContentVariables variables;
+
+	/**
+	 * Unfinished object which will be finished in endElement
+	 */
+	private Object unFinishedObject;
+
+	/**
+	 * Locator object
+	 */
+	private Locator locator;
+
+	/**
+	 * Handler creator
+	 */
+	private DictionaryHandlerCreator handlerCreator;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            model
+	 * @param handlers
+	 *            list of metadata handlers
+	 */
+	public DictionaryContentHandler(DictionaryDecodeModel model,
+			ArrayList<DictionaryHandler> handlers) {
+		handlerCreator = new DictionaryHandlerCreator(model);
+		this.model = model;
+		this.metadataHandlers = handlers;
+		variables = new DictionaryContentVariables();
+		elementContent = new StringBuffer();
+		startHandlers = handlerCreator.createStartHandlers();
+		endHandlers = handlerCreator.createEndHandlers();
+
+		// Sort metadata handlers
+		handlerCreator.sortHandlers(metadataHandlers);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.xml.sax.ContentHandler#characters(char[], int, int)
+	 */
+	public void characters(char[] ch, int start, int length)
+			throws SAXException {
+		if (catchCharacters) {
+			elementContent.append(new String(ch, start, length));
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.xml.sax.ContentHandler#endDocument()
+	 */
+	public void endDocument() throws SAXException {
+		model.clearAfterModelIsReady();
+		model.setValid(true);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.xml.sax.ContentHandler#endElement(java.lang.String,
+	 * java.lang.String, java.lang.String)
+	 */
+	public void endElement(String uri, String localName, String qName)
+			throws SAXException {
+
+		// If processing metadata, use metadata handlers
+		ArrayList<DictionaryHandler> handlers;
+		if (variables.isInsideMetadataBlock() && !qName.equals(METADATA_TAG)) {
+			handlers = metadataHandlers;
+		} else {
+			handlers = endHandlers;
+		}
+
+		int pos = Collections.binarySearch(handlers, qName,
+				new Comparator<Object>() {
+
+					public int compare(Object o1, Object o2) {
+						int val = ((DictionaryHandler) o1).getName().compareTo(
+								(String) o2);
+						return val > 0 ? 1 : val < 0 ? -1 : 0;
+					}
+				});
+
+		// Handler found, insert the right parent element as a parameter
+		if (pos >= 0) {
+			DecodeObject parentObj = null;
+			if (variables.getParentDecodeObject() == ParentDecodeObject.COMPONENT) {
+				parentObj = variables.getPreviousComponent();
+			} else if (variables.getParentDecodeObject() == ParentDecodeObject.GROUP) {
+				parentObj = variables.getPreviousGroup();
+			} else if (variables.getParentDecodeObject() == ParentDecodeObject.TRACE) {
+				parentObj = variables.getTraceInstanceList();
+			} else if (variables.getParentDecodeObject() == ParentDecodeObject.TRACEINSTANCE) {
+				parentObj = variables.getPreviousTrace();
+			}
+			handlers.get(pos).processEndElement(elementContent,
+					unFinishedObject, this, parentObj);
+		}
+
+		// Don't check any more end elements automatically and don't catch
+		// characters
+		catchCharacters = false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.xml.sax.ContentHandler#endPrefixMapping(java.lang.String)
+	 */
+	public void endPrefixMapping(String prefix) throws SAXException {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.xml.sax.ContentHandler#ignorableWhitespace(char[], int, int)
+	 */
+	public void ignorableWhitespace(char[] ch, int start, int length)
+			throws SAXException {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.xml.sax.ContentHandler#processingInstruction(java.lang.String,
+	 * java.lang.String)
+	 */
+	public void processingInstruction(String target, String data)
+			throws SAXException {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.xml.sax.ContentHandler#setDocumentLocator(org.xml.sax.Locator)
+	 */
+	public void setDocumentLocator(Locator locator) {
+		this.locator = locator;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.xml.sax.ContentHandler#skippedEntity(java.lang.String)
+	 */
+	public void skippedEntity(String name) throws SAXException {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.xml.sax.ContentHandler#startDocument()
+	 */
+	public void startDocument() throws SAXException {
+		model.setValid(false);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.xml.sax.ContentHandler#startElement(java.lang.String,
+	 * java.lang.String, java.lang.String, org.xml.sax.Attributes)
+	 */
+	public void startElement(String uri, String localName, String qName,
+			Attributes atts) throws SAXException {
+
+		// If processing metadata, use metadata handlers
+		ArrayList<DictionaryHandler> handlers;
+		if (variables.isInsideMetadataBlock()) {
+			handlers = metadataHandlers;
+		} else {
+			handlers = startHandlers;
+		}
+
+		int pos = Collections.binarySearch(handlers, qName,
+				new Comparator<Object>() {
+
+					public int compare(Object o1, Object o2) {
+						int val = ((DictionaryHandler) o1).getName().compareTo(
+								(String) o2);
+						return val > 0 ? 1 : val < 0 ? -1 : 0;
+					}
+				});
+		if (pos >= 0) {
+			handlers.get(pos).processStartElement(atts, this);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.xml.sax.ContentHandler#startPrefixMapping(java.lang.String,
+	 * java.lang.String)
+	 */
+	public void startPrefixMapping(String prefix, String uri)
+			throws SAXException {
+	}
+
+	/**
+	 * Tells this handler to catch element contents
+	 * 
+	 * @param object
+	 *            unfinished object
+	 */
+	public void catchElementContents(Object object) {
+		unFinishedObject = object;
+		catchCharacters = true;
+		elementContent.setLength(0);
+	}
+
+	/**
+	 * Gets variables
+	 * 
+	 * @return the variables
+	 */
+	public DictionaryContentVariables getVariables() {
+		return variables;
+	}
+
+	/**
+	 * Gets locator
+	 * 
+	 * @return locator
+	 */
+	public Locator getLocator() {
+		return locator;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/DictionaryContentVariables.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,334 @@
+/*
+ * 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:
+ *
+ * Dictionary Content Variables
+ *
+ */
+package com.nokia.trace.dictionary.model;
+
+import com.nokia.trace.dictionary.model.decodeparameters.CompoundParameter;
+import com.nokia.trace.dictionary.model.decodeparameters.EnumParameter;
+
+/**
+ * Dictionary Content Variables keeps track on all important variables that are
+ * needed when creating model
+ * 
+ */
+public class DictionaryContentVariables {
+
+	/**
+	 * Enumeration telling what is the parent decode object of the current
+	 * object
+	 */
+	public enum ParentDecodeObject {
+
+		/**
+		 * Nothing
+		 */
+		NOTHING,
+
+		/**
+		 * Component
+		 */
+		COMPONENT,
+
+		/**
+		 * Group
+		 */
+		GROUP,
+
+		/**
+		 * Trace
+		 */
+		TRACE,
+
+		/**
+		 * Trace instance
+		 */
+		TRACEINSTANCE
+	}
+
+	/**
+	 * Previous component element
+	 */
+	private TraceComponent previousComponent;
+
+	/**
+	 * Previous group element
+	 */
+	private TraceGroup previousGroup;
+
+	/**
+	 * Previous trace
+	 */
+	private Trace previousTrace;
+
+	/**
+	 * Previous trace data-ref element
+	 */
+	private int previousTraceDataRef;
+
+	/**
+	 * Previous trace name
+	 */
+	private String previousTraceName;
+
+	/**
+	 * Previous enum parameter
+	 */
+	private EnumParameter previousEnumParameter;
+
+	/**
+	 * Previous compound parameter
+	 */
+	private CompoundParameter previousCompoundParameter;
+
+	/**
+	 * Previous path element
+	 */
+	private Path previousPath;
+
+	/**
+	 * Indicates are we inside a metadata block
+	 */
+	private boolean insideMetadataBlock;
+
+	/**
+	 * List containing trace instances and metadata from previous trace tag
+	 */
+	private TraceInstanceList traceInstanceList;
+
+	/**
+	 * Parent decode object
+	 */
+	private ParentDecodeObject parentDecodeObject = ParentDecodeObject.NOTHING;
+
+	/**
+	 * Constructor
+	 */
+	public DictionaryContentVariables() {
+
+	}
+
+	/**
+	 * Gets previous path
+	 * 
+	 * @return the previousPath
+	 */
+	public Path getPreviousPath() {
+		return previousPath;
+	}
+
+	/**
+	 * Sets previous path
+	 * 
+	 * @param previousPath
+	 *            the previousPath to set
+	 */
+	public void setPreviousPath(Path previousPath) {
+		this.previousPath = previousPath;
+	}
+
+	/**
+	 * Gets previous component
+	 * 
+	 * @return the previousComponent
+	 */
+	public TraceComponent getPreviousComponent() {
+		return previousComponent;
+	}
+
+	/**
+	 * Sets previous component
+	 * 
+	 * @param previousComponent
+	 *            the previousComponent to set
+	 */
+	public void setPreviousComponent(TraceComponent previousComponent) {
+		this.previousComponent = previousComponent;
+	}
+
+	/**
+	 * Gets previous group
+	 * 
+	 * @return the previousGroup
+	 */
+	public TraceGroup getPreviousGroup() {
+		return previousGroup;
+	}
+
+	/**
+	 * Sets previous group
+	 * 
+	 * @param previousGroup
+	 *            the previousGroup to set
+	 */
+	public void setPreviousGroup(TraceGroup previousGroup) {
+		this.previousGroup = previousGroup;
+	}
+
+	/**
+	 * Gets previous trace
+	 * 
+	 * @return the previous trace
+	 */
+	public Trace getPreviousTrace() {
+		return previousTrace;
+	}
+
+	/**
+	 * Sets previous trace
+	 * 
+	 * @param previousTrace
+	 *            the previous trace to set
+	 */
+	public void setPreviousTrace(Trace previousTrace) {
+		this.previousTrace = previousTrace;
+	}
+
+	/**
+	 * Gets the previous trace data reference
+	 * 
+	 * @return the previous trace data reference
+	 */
+	public int getPreviousTraceDataRef() {
+		return previousTraceDataRef;
+	}
+
+	/**
+	 * Sets the previous trace reference
+	 * 
+	 * @param previousTraceDataRef
+	 *            the previousTrace to set
+	 */
+	public void setPreviousTraceDataRef(int previousTraceDataRef) {
+		this.previousTraceDataRef = previousTraceDataRef;
+	}
+
+	/**
+	 * Gets the previous trace name
+	 * 
+	 * @return the previous trace name
+	 */
+	public String getPreviousTraceName() {
+		return previousTraceName;
+	}
+
+	/**
+	 * Sets the previous trace name
+	 * 
+	 * @param previousTraceName
+	 *            the previousTraceName to set
+	 */
+	public void setPreviousTraceName(String previousTraceName) {
+		this.previousTraceName = previousTraceName;
+	}
+
+	/**
+	 * Gets previous enum parameter
+	 * 
+	 * @return the previousEnumParameter
+	 */
+	public EnumParameter getPreviousEnumParameter() {
+		return previousEnumParameter;
+	}
+
+	/**
+	 * Sets previous enum parameter
+	 * 
+	 * @param previousEnumParameter
+	 *            the previousEnumParater to set
+	 */
+	public void setPreviousEnumParameter(EnumParameter previousEnumParameter) {
+		this.previousEnumParameter = previousEnumParameter;
+	}
+
+	/**
+	 * Gets previous compound parameter
+	 * 
+	 * @return the previousCompoundParameter
+	 */
+	public CompoundParameter getPreviousCompoundParameter() {
+		return previousCompoundParameter;
+	}
+
+	/**
+	 * Sets previous compound parameter
+	 * 
+	 * @param previousCompoundParameter
+	 *            the previousCompoundParameter to set
+	 */
+	public void setPreviousCompoundParameter(
+			CompoundParameter previousCompoundParameter) {
+		this.previousCompoundParameter = previousCompoundParameter;
+	}
+
+	/**
+	 * Gets inside metadata block boolean
+	 * 
+	 * @return the insideMetadataBlock
+	 */
+	public boolean isInsideMetadataBlock() {
+		return insideMetadataBlock;
+	}
+
+	/**
+	 * Sets inside metadata block boolean
+	 * 
+	 * @param insideMetadataBlock
+	 *            the insideMetadataBlock to set
+	 */
+	public void setInsideMetadataBlock(boolean insideMetadataBlock) {
+		this.insideMetadataBlock = insideMetadataBlock;
+	}
+
+	/**
+	 * Gets the parent decode object
+	 * 
+	 * @return the parent Decode Object
+	 */
+	public ParentDecodeObject getParentDecodeObject() {
+		return parentDecodeObject;
+	}
+
+	/**
+	 * Sets the parent decode object
+	 * 
+	 * @param parentDecodeObject
+	 *            the parentDecodeObject to set
+	 */
+	public void setParentDecodeObject(ParentDecodeObject parentDecodeObject) {
+		this.parentDecodeObject = parentDecodeObject;
+	}
+
+	/**
+	 * Gets trace instance list
+	 * 
+	 * @return the traceInstanceList
+	 */
+	public TraceInstanceList getTraceInstanceList() {
+		return traceInstanceList;
+	}
+
+	/**
+	 * Sets trace instance list
+	 * 
+	 * @param traceInstanceList
+	 *            the traceInstanceList to set
+	 */
+	public void setTraceInstanceList(TraceInstanceList traceInstanceList) {
+		this.traceInstanceList = traceInstanceList;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/DictionaryDecodeModel.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,487 @@
+/*
+ * 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:
+ *
+ * Dictionary Decode Model
+ *
+ */
+package com.nokia.trace.dictionary.model;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+
+import com.nokia.trace.dictionary.model.decodeparameters.ConstantParameter;
+import com.nokia.trace.dictionary.model.decodeparameters.DecodeParameter;
+import com.nokia.trace.dictionary.model.decodeparameters.FillerParameter;
+
+/**
+ * Dictionary Decode Model
+ * 
+ */
+public class DictionaryDecodeModel {
+
+	/**
+	 * List of Components
+	 */
+	private ArrayList<TraceComponent> components;
+
+	/**
+	 * List of decode parameters except constantParameters
+	 */
+	private ArrayList<DecodeParameter> decodeParameters;
+
+	/**
+	 * List of constant decode parameters
+	 */
+	private ArrayList<ConstantParameter> constantParameters;
+
+	/**
+	 * List of locations
+	 */
+	private ArrayList<Location> locations;
+
+	/**
+	 * List of trace data objects
+	 */
+	private ArrayList<TraceData> traceDatas;
+
+	/**
+	 * List of metadata for this Dictionary
+	 */
+	private ArrayList<Options> metaData;
+
+	/**
+	 * Factory for creating decode objects
+	 */
+	private DecodeObjectFactory factory;
+
+	/**
+	 * Indicates is the model valid
+	 */
+	private boolean valid = true;
+
+	/**
+	 * Filler parameter
+	 */
+	private DecodeParameter fillerParameter;
+
+	/**
+	 * Constructor
+	 */
+	public DictionaryDecodeModel() {
+		// Create lists
+		components = new ArrayList<TraceComponent>();
+		decodeParameters = new ArrayList<DecodeParameter>();
+		constantParameters = new ArrayList<ConstantParameter>();
+		locations = new ArrayList<Location>();
+		traceDatas = new ArrayList<TraceData>();
+		metaData = new ArrayList<Options>();
+
+		// Create decodeobject factory
+		factory = new DecodeObjectFactory();
+
+		// Create filler parameter
+		fillerParameter = new FillerParameter("Filler", false); //$NON-NLS-1$
+	}
+
+	/**
+	 * Gets components to be used in creating activation information
+	 * 
+	 * @return list of components
+	 */
+	public ArrayList<TraceComponent> getActivationInformation() {
+		return components;
+	}
+
+	/**
+	 * Gets valid status
+	 * 
+	 * @return the valid
+	 */
+	public boolean isValid() {
+		return valid;
+	}
+
+	/**
+	 * Sets valid status
+	 * 
+	 * @param valid
+	 *            the valid to set
+	 */
+	public void setValid(boolean valid) {
+		this.valid = valid;
+	}
+
+	/**
+	 * Adds component to the list to right position
+	 * 
+	 * @param component
+	 *            component to add
+	 * @return null if adding was ok, old component if component with the same
+	 *         id already exists
+	 */
+	public TraceComponent addComponent(TraceComponent component) {
+		TraceComponent returnComponent = null;
+		int pos = Collections.binarySearch(components, component,
+				new Comparator<TraceComponent>() {
+
+					public int compare(TraceComponent o1, TraceComponent o2) {
+						int id1 = o1.getId();
+						int id2 = o2.getId();
+						return id1 > id2 ? 1 : id1 < id2 ? -1 : 0;
+					}
+
+				});
+		if (pos < 0) {
+			components.add(-pos - 1, component);
+		} else {
+			returnComponent = components.get(pos);
+		}
+		return returnComponent;
+	}
+
+	/**
+	 * Gets component for specific id
+	 * 
+	 * @param id
+	 *            id of the component
+	 * @return the component or null if not found
+	 */
+	public TraceComponent getComponent(int id) {
+		int pos = Collections.binarySearch(components, Integer.valueOf(id),
+				new Comparator<Object>() {
+
+					public int compare(Object o1, Object o2) {
+						int id1 = ((TraceComponent) o1).getId();
+						int id2 = ((Integer) o2).intValue();
+						return id1 > id2 ? 1 : id1 < id2 ? -1 : 0;
+					}
+
+				});
+		TraceComponent component = null;
+		if (pos >= 0) {
+			component = components.get(pos);
+		}
+		return component;
+
+	}
+
+	/**
+	 * Removes component from the model
+	 * 
+	 * @param id
+	 *            id of the component
+	 * @return true if component was found and removed
+	 */
+	public boolean removeComponent(int id) {
+		boolean removed = false;
+		int pos = Collections.binarySearch(components, Integer.valueOf(id),
+				new Comparator<Object>() {
+
+					public int compare(Object o1, Object o2) {
+						int id1 = ((TraceComponent) o1).getId();
+						int id2 = ((Integer) o2).intValue();
+						return id1 > id2 ? 1 : id1 < id2 ? -1 : 0;
+					}
+
+				});
+		if (pos >= 0) {
+			components.remove(pos);
+			removed = true;
+		}
+		return removed;
+
+	}
+
+	/**
+	 * Adds decode parameter to the list to right position
+	 * 
+	 * @param parameter
+	 *            parameter
+	 * @return null if insertion went fine and old parameter if parameter with
+	 *         same type already exists. Parameter must be then checked for case
+	 *         of collision in decode files.
+	 */
+	public DecodeParameter addDecodeParameter(DecodeParameter parameter) {
+		DecodeParameter returnParameter = null;
+		int pos = Collections.binarySearch(decodeParameters, parameter,
+				new Comparator<DecodeParameter>() {
+
+					public int compare(DecodeParameter o1, DecodeParameter o2) {
+						int val;
+						if (o1 == null || o2 == null) {
+							val = -1;
+						} else {
+							val = o1.getType().compareTo(o2.getType());
+						}
+						return val > 0 ? 1 : val < 0 ? -1 : 0;
+					}
+				});
+		if (pos < 0) {
+			decodeParameters.add(-pos - 1, parameter);
+		} else {
+			returnParameter = decodeParameters.get(pos);
+		}
+		return returnParameter;
+	}
+
+	/**
+	 * Gets decode parameter with type
+	 * 
+	 * @param type
+	 *            type of the decode parameter
+	 * @return decode parameter or null if not found
+	 */
+	public DecodeParameter getDecodeParameter(String type) {
+		int pos = Collections.binarySearch(decodeParameters, type,
+				new Comparator<Object>() {
+
+					public int compare(Object o1, Object o2) {
+						int val = ((DecodeParameter) o1).getType().compareTo(
+								(String) o2);
+						return val > 0 ? 1 : val < 0 ? -1 : 0;
+					}
+				});
+
+		DecodeParameter parameter = null;
+		if (pos >= 0) {
+			parameter = decodeParameters.get(pos);
+		}
+		return parameter;
+	}
+
+	/**
+	 * Adds constant parameter to the list to right position
+	 * 
+	 * @param parameter
+	 */
+	public void addConstantParameter(ConstantParameter parameter) {
+		int pos = Collections.binarySearch(constantParameters, parameter,
+				new Comparator<ConstantParameter>() {
+
+					public int compare(ConstantParameter o1,
+							ConstantParameter o2) {
+						int val;
+						if (o1 == null || o2 == null) {
+							val = -1;
+						} else {
+							val = o1.getType().compareTo(o2.getType());
+						}
+						return val > 0 ? 1 : val < 0 ? -1 : 0;
+					}
+				});
+		if (pos < 0) {
+			constantParameters.add(-pos - 1, parameter);
+		}
+	}
+
+	/**
+	 * Gets constant parameter with name(text)
+	 * 
+	 * @param name
+	 *            name of the constant parameter
+	 * @return constant parameter or null if not found
+	 */
+	public ConstantParameter getConstantParameter(String name) {
+		int pos = Collections.binarySearch(constantParameters, name,
+				new Comparator<Object>() {
+
+					public int compare(Object o1, Object o2) {
+						int val = ((ConstantParameter) o1).getType().compareTo(
+								(String) o2);
+						return val > 0 ? 1 : val < 0 ? -1 : 0;
+					}
+				});
+		ConstantParameter parameter = null;
+		if (pos >= 0) {
+			parameter = constantParameters.get(pos);
+		}
+		return parameter;
+	}
+
+	/**
+	 * Adds location to the list to right position
+	 * 
+	 * @param location
+	 */
+	public void addLocation(Location location) {
+		int pos = Collections.binarySearch(locations, location,
+				new Comparator<Location>() {
+
+					public int compare(Location o1, Location o2) {
+						int id1 = o1.getId();
+						int id2 = o2.getId();
+						return id1 > id2 ? 1 : id1 < id2 ? -1 : 0;
+					}
+
+				});
+		if (pos < 0) {
+			locations.add(-pos - 1, location);
+		}
+
+	}
+
+	/**
+	 * Gets location for specific id
+	 * 
+	 * @param id
+	 *            id of the location
+	 * @return the location or null if not found
+	 */
+	public Location getLocation(int id) {
+		int pos = Collections.binarySearch(locations, Integer.valueOf(id),
+				new Comparator<Object>() {
+
+					public int compare(Object o1, Object o2) {
+						int id1 = ((Location) o1).getId();
+						int id2 = ((Integer) o2).intValue();
+						return id1 > id2 ? 1 : id1 < id2 ? -1 : 0;
+					}
+
+				});
+		Location location = null;
+		if (pos >= 0) {
+			location = locations.get(pos);
+		}
+		return location;
+
+	}
+
+	/**
+	 * Adds trace data to the list to right position
+	 * 
+	 * @param traceData
+	 *            trace data
+	 */
+	public void addTraceData(TraceData traceData) {
+		int pos = Collections.binarySearch(traceDatas, traceData,
+				new Comparator<TraceData>() {
+
+					public int compare(TraceData o1, TraceData o2) {
+						int id1 = o1.getId();
+						int id2 = o2.getId();
+						return id1 > id2 ? 1 : id1 < id2 ? -1 : 0;
+					}
+
+				});
+		if (pos < 0) {
+			traceDatas.add(-pos - 1, traceData);
+		}
+
+	}
+
+	/**
+	 * Gets trace data for specific id
+	 * 
+	 * @param id
+	 *            id of the trace data
+	 * @return the trace data or null if not found
+	 */
+	public TraceData getTraceData(int id) {
+		int pos = Collections.binarySearch(traceDatas, Integer.valueOf(id),
+				new Comparator<Object>() {
+
+					public int compare(Object o1, Object o2) {
+						int id1 = ((TraceData) o1).getId();
+						int id2 = ((Integer) o2).intValue();
+						return id1 > id2 ? 1 : id1 < id2 ? -1 : 0;
+					}
+
+				});
+		TraceData traceData = null;
+		if (pos >= 0) {
+			traceData = traceDatas.get(pos);
+		}
+		return traceData;
+	}
+
+	/**
+	 * Gets the metadata
+	 * 
+	 * @return the metaData
+	 */
+	public ArrayList<Options> getMetaData() {
+		return metaData;
+	}
+
+	/**
+	 * Gets DecodeObjectFactory
+	 * 
+	 * @return the factory
+	 */
+	public DecodeObjectFactory getFactory() {
+		return factory;
+	}
+
+	/**
+	 * Gets the filler parameter
+	 * 
+	 * @return the fillerParameter
+	 */
+	public DecodeParameter getFillerParameter() {
+		return fillerParameter;
+	}
+
+	/**
+	 * Clears whole model
+	 */
+	public void clearModel() {
+		components.clear();
+		decodeParameters.clear();
+		constantParameters.clear();
+		locations.clear();
+		traceDatas.clear();
+		metaData.clear();
+		valid = true;
+	}
+
+	/**
+	 * Clear unneeded arrays from the model after it's complete
+	 */
+	public void clearAfterModelIsReady() {
+		locations.clear();
+		traceDatas.clear();
+	}
+
+	/**
+	 * Gets group ID with component ID and group name
+	 * 
+	 * @param componentId
+	 *            component ID
+	 * @param groupName
+	 *            group name
+	 * @return group ID or -1 if not found
+	 */
+	public int getGroupIdWithName(int componentId, String groupName) {
+		int groupId = -1;
+
+		// Find the correct component
+		TraceComponent component = getComponent(componentId);
+		if (component != null) {
+
+			// Go through groups
+			ArrayList<TraceGroup> groups = component.getGroups();
+			for (int i = 0; i < groups.size(); i++) {
+
+				// Check if the name equals
+				if (groups.get(i).getName().equals(groupName)) {
+					groupId = groups.get(i).getId();
+					break;
+				}
+			}
+		}
+		return groupId;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/DictionaryModelBuilder.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,193 @@
+/*
+ * 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:
+ *
+ * Dictionary Model Builder
+ *
+ */
+package com.nokia.trace.dictionary.model;
+
+import java.io.BufferedInputStream;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.util.ArrayList;
+
+import com.nokia.trace.dictionary.TraceDictionaryEngine;
+import com.nokia.trace.dictionary.model.handlers.DictionaryHandler;
+import com.nokia.trace.eventrouter.TraceEvent;
+
+/**
+ * Dictionary Model Builder
+ */
+public class DictionaryModelBuilder {
+
+	/**
+	 * Allowed extension for files
+	 */
+	private static final String ALLOWED_EXTENSION = ".xml"; //$NON-NLS-1$
+
+	/**
+	 * Category for events
+	 */
+	private final static String EVENT_CATEGORY = "Dictionary Model Builder"; //$NON-NLS-1$
+
+	/**
+	 * Sleeping time when waiting model to be ready
+	 */
+	private static final long WAIT_FOR_MODEL_READY_TIME = 5;
+
+	/**
+	 * Model to build
+	 */
+	private DictionaryDecodeModel model;
+
+	/**
+	 * Current file opening
+	 */
+	private static String currentFile;
+
+	/**
+	 * Metadata handlers
+	 */
+	private static ArrayList<DictionaryHandler> metadataHandlers = new ArrayList<DictionaryHandler>();
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            the trace model
+	 */
+	public DictionaryModelBuilder(DictionaryDecodeModel model) {
+		this.model = model;
+	}
+
+	/**
+	 * Opens decode file
+	 * 
+	 * @param filePath
+	 *            file path. Must end with .xml to be loaded
+	 * @param fileStream
+	 *            file stream. If null, file stream is created by opening a file
+	 *            from filePath variable
+	 * @param createNew
+	 *            true if creating new model, false if not
+	 */
+	public void openDecodeFile(String filePath, InputStream fileStream,
+			boolean createNew) {
+		// If there if parsing going on, wait for it to finish
+		waitForPreviousParse();
+
+		// Set current file and check the extension
+		currentFile = filePath;
+		if (!filePath.trim().toLowerCase().endsWith(ALLOWED_EXTENSION)) {
+			postErrorMessage(Messages
+					.getString("DictionaryModelBuilder.FileSkipped"), //$NON-NLS-1$
+					filePath);
+		} else {
+
+			// If file stream doesn't exist, create if from the file
+			if (fileStream == null) {
+				fileStream = createFileStream(filePath);
+			}
+
+			// File stream must now exist or quit
+			if (fileStream != null) {
+
+				// Creating new model so erase old one first
+				if (createNew) {
+					model.clearModel();
+				}
+
+				// Model is not valid anymore
+				model.setValid(false);
+
+				// Create new thread for parsing
+				DictionaryModelParserThread parseThread = new DictionaryModelParserThread(
+						fileStream, filePath, model, metadataHandlers);
+
+				// Start parsing
+				parseThread.start();
+			}
+		}
+	}
+
+	/**
+	 * Wait for previous parse
+	 */
+	private void waitForPreviousParse() {
+		try {
+			while (!model.isValid()) {
+
+				// Model not valid, wait
+				Thread.sleep(WAIT_FOR_MODEL_READY_TIME);
+			}
+		} catch (InterruptedException e) {
+		}
+	}
+
+	/**
+	 * Creates file stream from file path
+	 * 
+	 * @param filePath
+	 *            file path
+	 * @return file input stream
+	 */
+	private InputStream createFileStream(String filePath) {
+		BufferedInputStream bin = null;
+		try {
+			FileInputStream fin = new FileInputStream(filePath);
+			bin = new BufferedInputStream(fin);
+		} catch (FileNotFoundException e) {
+			postErrorMessage(e.toString(), filePath);
+			model.setValid(true);
+		}
+		return bin;
+	}
+
+	/**
+	 * Post error message
+	 * 
+	 * @param string
+	 *            error message
+	 * @param fileName
+	 *            file name
+	 */
+	private void postErrorMessage(String string, String fileName) {
+		TraceEvent event = new TraceEvent(TraceEvent.ERROR, string);
+		event.setCategory(EVENT_CATEGORY);
+		event.setSource(fileName);
+		TraceDictionaryEngine.postEvent(event);
+	}
+
+	/**
+	 * Gets the file path of the dictionary file that is currently being parsed
+	 * 
+	 * @return the file path of the dictionary file that is currently beging
+	 *         parsed
+	 */
+	public static String getCurrentFile() {
+		return currentFile;
+	}
+
+	/**
+	 * Adds a metadata handler
+	 * 
+	 * @param metadataHandler
+	 *            the handler to be added
+	 */
+	public static void addMetadataHandler(DictionaryHandler metadataHandler) {
+		metadataHandlers.add(metadataHandler);
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/DictionaryModelParserThread.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,151 @@
+/*
+ * 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:
+ *
+ * Thread parsing one dictionary file
+ *
+ */
+package com.nokia.trace.dictionary.model;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+
+import com.nokia.trace.dictionary.TraceDictionaryEngine;
+import com.nokia.trace.dictionary.model.handlers.DictionaryHandler;
+import com.nokia.trace.eventrouter.TraceEvent;
+
+/**
+ * Thread parsing one dictionary file
+ * 
+ */
+public class DictionaryModelParserThread extends Thread {
+
+	/**
+	 * Category for events
+	 */
+	private final static String EVENT_CATEGORY = "Dictionary Model Builder"; //$NON-NLS-1$
+
+	/**
+	 * XML Reader
+	 */
+	private XMLReader reader;
+
+	/**
+	 * Decode model
+	 */
+	private DictionaryDecodeModel model;
+
+	/**
+	 * InputSource to read the dictionary file from
+	 */
+	private InputSource inputSource;
+
+	/**
+	 * Dictionary file name
+	 */
+	private String fileName;
+
+	/**
+	 * List of metadata handlers
+	 */
+	private ArrayList<DictionaryHandler> metadataHandlers;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param inputSource
+	 *            the input source
+	 */
+	DictionaryModelParserThread(InputStream inputStream, String fileName,
+			DictionaryDecodeModel model,
+			ArrayList<DictionaryHandler> metadataHandlers) {
+		this.fileName = fileName;
+		this.model = model;
+		this.metadataHandlers = metadataHandlers;
+
+		// Create input source
+		createInputSource(inputStream);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Thread#run()
+	 */
+	@Override
+	public void run() {
+		if (inputSource != null) {
+			try {
+
+				// Parse
+				reader.parse(inputSource);
+
+			} catch (Exception e) {
+
+				// Set error to eventview
+				postErrorMessage(e.toString());
+
+				// There might be something wrong with the decode file, set
+				// model to valid to close progress bar
+				model.setValid(true);
+			}
+		}
+	}
+
+	/**
+	 * Creates input source
+	 * 
+	 * @param fileStream
+	 *            file stream
+	 */
+	private void createInputSource(InputStream fileStream) {
+		try {
+			SAXParserFactory factory = SAXParserFactory.newInstance();
+			factory.setValidating(false);
+
+			SAXParser sp = factory.newSAXParser();
+			reader = sp.getXMLReader();
+			reader.setContentHandler(new DictionaryContentHandler(model,
+					metadataHandlers));
+			inputSource = new InputSource(fileStream);
+
+		} catch (ParserConfigurationException e) {
+			postErrorMessage(e.toString());
+		} catch (SAXException e) {
+			postErrorMessage(e.toString());
+		}
+	}
+
+	/**
+	 * Post error message
+	 * 
+	 * @param string
+	 *            error message
+	 */
+	private void postErrorMessage(String string) {
+		TraceEvent event = new TraceEvent(TraceEvent.ERROR, string);
+		event.setCategory(EVENT_CATEGORY);
+		event.setSource(fileName);
+		TraceDictionaryEngine.postEvent(event);
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/Location.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,114 @@
+/*
+ * 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:
+ *
+ * Location class
+ *
+ */
+package com.nokia.trace.dictionary.model;
+
+/**
+ * Location class
+ * 
+ */
+public class Location {
+
+	/**
+	 * ID of the location
+	 */
+	private int id;
+
+	/**
+	 * Path of this location
+	 */
+	private Path path;
+
+	/**
+	 * File name of this location
+	 */
+	private String filename;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param id
+	 *            id of the location
+	 * @param path
+	 *            path of the location
+	 * @param fileName
+	 *            file name of the location
+	 */
+	public Location(int id, Path path, String fileName) {
+		this.id = id;
+		this.path = path;
+		this.filename = fileName;
+	}
+
+	/**
+	 * Gets id
+	 * 
+	 * @return the id
+	 */
+	public int getId() {
+		return id;
+	}
+
+	/**
+	 * Sets id
+	 * 
+	 * @param id
+	 *            the id to set
+	 */
+	public void setId(int id) {
+		this.id = id;
+	}
+
+	/**
+	 * Gets file name
+	 * 
+	 * @return the filename
+	 */
+	public String getFilename() {
+		return filename;
+	}
+
+	/**
+	 * Sets file name
+	 * 
+	 * @param filename
+	 *            the filename to set
+	 */
+	public void setFilename(String filename) {
+		this.filename = filename;
+	}
+
+	/**
+	 * Gets path
+	 * 
+	 * @return the path
+	 */
+	public Path getPath() {
+		return path;
+	}
+
+	/**
+	 * Sets path
+	 * 
+	 * @param path
+	 *            the path to set
+	 */
+	public void setPath(Path path) {
+		this.path = path;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/Messages.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,63 @@
+/*
+ * 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:
+ *
+ * String localization for model package.
+ *
+ */
+package com.nokia.trace.dictionary.model;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * String localization for model package.
+ * 
+ */
+class Messages {
+
+	/**
+	 * Bundle name
+	 */
+	private static final String BUNDLE_NAME = "com.nokia.trace.dictionary.model.messages"; //$NON-NLS-1$
+
+	/**
+	 * Resource bundle
+	 */
+	private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
+			.getBundle(BUNDLE_NAME);
+
+	/**
+	 * Prevents construction.
+	 */
+	private Messages() {
+	}
+
+	/**
+	 * Maps a key to localized string.
+	 * 
+	 * @param key
+	 *            the key for the string
+	 * @return the localized string
+	 */
+	public static String getString(String key) {
+		String value;
+		try {
+			value = RESOURCE_BUNDLE.getString(key);
+		} catch (MissingResourceException e) {
+			value = '!' + key + '!';
+		}
+		return value;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/Options.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,27 @@
+/*
+ * 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:
+ *
+ * Options
+ *
+ */
+package com.nokia.trace.dictionary.model;
+
+/**
+ * Options
+ * 
+ */
+public class Options {
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/Path.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,60 @@
+/*
+ * 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:
+ *
+ * Path
+ *
+ */
+package com.nokia.trace.dictionary.model;
+
+/**
+ * Path
+ * 
+ */
+public class Path {
+
+	/**
+	 * File path
+	 */
+	private String filePath;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param filePath
+	 *            filePath
+	 */
+	public Path(String filePath) {
+		this.filePath = filePath;
+	}
+
+	/**
+	 * Gets file path
+	 * 
+	 * @return the filePath
+	 */
+	public String getFilePath() {
+		return filePath;
+	}
+
+	/**
+	 * Sets file path
+	 * 
+	 * @param filePath
+	 *            the filePath to set
+	 */
+	public void setFilePath(String filePath) {
+		this.filePath = filePath;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/Trace.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,192 @@
+/*
+ * 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:
+ *
+ * Trace element
+ *
+ */
+package com.nokia.trace.dictionary.model;
+
+/**
+ * Trace element
+ * 
+ */
+public class Trace extends DecodeObject {
+
+	/**
+	 * Group this trace belongs to
+	 */
+	private TraceGroup group;
+
+	/**
+	 * Trace data containing list of decode parameters of this trace
+	 */
+	private TraceData traceData;
+
+	/**
+	 * Location of this trace
+	 */
+	private Location location;
+
+	/**
+	 * Line number where this trace is defined
+	 */
+	private int lineNumber;
+
+	/**
+	 * Method name where this trace is defined
+	 */
+	private String methodName;
+
+	/**
+	 * Class name where this string is defined
+	 */
+	private String className;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param id
+	 *            id of the trace
+	 * @param name
+	 *            name of the trace
+	 * @param traceData
+	 *            trace data
+	 * @param location
+	 *            trace location
+	 * @param lineNum
+	 *            line number where trace is defined
+	 * @param methodName
+	 *            method name where trace is defined
+	 * @param className
+	 *            class name where trace is defined
+	 * @param group
+	 *            group where trace belongs to
+	 */
+	public Trace(int id, String name, TraceData traceData, Location location,
+			int lineNum, String methodName, String className, TraceGroup group) {
+		super(id, name);
+		this.traceData = traceData;
+		this.location = location;
+		this.lineNumber = lineNum;
+		this.methodName = methodName;
+		this.className = className;
+		this.group = group;
+	}
+
+	/**
+	 * Gets the class name
+	 * 
+	 * @return the className
+	 */
+	public String getClassName() {
+		return className;
+	}
+
+	/**
+	 * Sets the class name
+	 * 
+	 * @param className
+	 *            the className to set
+	 */
+	public void setClassName(String className) {
+		this.className = className;
+	}
+
+	/**
+	 * Gets the line number
+	 * 
+	 * @return the lineNumber
+	 */
+	public int getLineNumber() {
+		return lineNumber;
+	}
+
+	/**
+	 * Sets the line number
+	 * 
+	 * @param lineNumber
+	 *            the lineNumber to set
+	 */
+	public void setLineNumber(int lineNumber) {
+		this.lineNumber = lineNumber;
+	}
+
+	/**
+	 * Gets the location
+	 * 
+	 * @return the location
+	 */
+	public Location getLocation() {
+		return location;
+	}
+
+	/**
+	 * Sets the location
+	 * 
+	 * @param location
+	 *            the location to set
+	 */
+	public void setLocation(Location location) {
+		this.location = location;
+	}
+
+	/**
+	 * Gets the method name
+	 * 
+	 * @return the methodName
+	 */
+	public String getMethodName() {
+		return methodName;
+	}
+
+	/**
+	 * Sets the method name
+	 * 
+	 * @param methodName
+	 *            the methodName to set
+	 */
+	public void setMethodName(String methodName) {
+		this.methodName = methodName;
+	}
+
+	/**
+	 * Gets the trace data
+	 * 
+	 * @return the traceData
+	 */
+	public TraceData getTraceData() {
+		return traceData;
+	}
+
+	/**
+	 * Sets the trace data
+	 * 
+	 * @param traceData
+	 *            the traceData to set
+	 */
+	public void setTraceData(TraceData traceData) {
+		this.traceData = traceData;
+	}
+
+	/**
+	 * Gets the parent group
+	 * 
+	 * @return the group
+	 */
+	public TraceGroup getGroup() {
+		return group;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/TraceComponent.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,202 @@
+/*
+ * 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:
+ *
+ * Component
+ *
+ */
+package com.nokia.trace.dictionary.model;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+
+/**
+ * Component
+ * 
+ */
+public class TraceComponent extends DecodeObject {
+
+	/**
+	 * Prefix of the component
+	 */
+	private String prefix;
+
+	/**
+	 * Suffix of the component
+	 */
+	private String suffix;
+
+	/**
+	 * Model this component belongs to
+	 */
+	private DictionaryDecodeModel model;
+
+	/**
+	 * File path where this component is defined
+	 */
+	private String definedInFile;
+
+	/**
+	 * List of groups belonging to this component
+	 */
+	private ArrayList<TraceGroup> groups;
+
+	/**
+	 * Constructor Should be only used from DecodeObjectFactory
+	 * 
+	 * @param id
+	 *            id
+	 * @param name
+	 *            name
+	 * @param prefix
+	 *            prefix
+	 * @param suffix
+	 *            suffix
+	 * @param filePath
+	 *            file path
+	 * @param model
+	 *            model
+	 */
+	public TraceComponent(int id, String name, String prefix, String suffix,
+			String filePath, DictionaryDecodeModel model) {
+		super(id, name);
+		this.prefix = prefix;
+		this.suffix = suffix;
+		this.model = model;
+		this.definedInFile = filePath;
+		groups = new ArrayList<TraceGroup>();
+	}
+
+	/**
+	 * Adds group to the list to right position
+	 * 
+	 * @param group
+	 *            group to be added
+	 * @return null if adding succeeded, old group if group with same ID already
+	 *         exists.
+	 */
+	public TraceGroup addGroup(TraceGroup group) {
+		TraceGroup returnGroup = null;
+		int pos = Collections.binarySearch(groups, group,
+				new Comparator<TraceGroup>() {
+
+					public int compare(TraceGroup o1, TraceGroup o2) {
+						int id1 = o1.getId();
+						int id2 = o2.getId();
+						return id1 > id2 ? 1 : id1 < id2 ? -1 : 0;
+					}
+
+				});
+		if (pos < 0) {
+			groups.add(-pos - 1, group);
+		} else {
+			returnGroup = groups.get(pos);
+		}
+		return returnGroup;
+
+	}
+
+	/**
+	 * Gets group for specific id
+	 * 
+	 * @param id
+	 *            id of the group
+	 * @return the group
+	 */
+	public TraceGroup getGroup(int id) {
+		int pos = Collections.binarySearch(groups, Integer.valueOf(id),
+				new Comparator<Object>() {
+
+					public int compare(Object o1, Object o2) {
+						int id1 = ((TraceGroup) o1).getId();
+						int id2 = ((Integer) o2).intValue();
+						return id1 > id2 ? 1 : id1 < id2 ? -1 : 0;
+					}
+
+				});
+		TraceGroup group = null;
+		if (pos >= 0) {
+			group = groups.get(pos);
+		}
+		return group;
+
+	}
+
+	/**
+	 * Gets all groups as a list
+	 * 
+	 * @return all groups
+	 */
+	public ArrayList<TraceGroup> getGroups() {
+		return groups;
+	}
+
+	/**
+	 * Gets prefix
+	 * 
+	 * @return the prefix
+	 */
+	public String getPrefix() {
+		return prefix;
+	}
+
+	/**
+	 * Sets prefix
+	 * 
+	 * @param prefix
+	 *            the prefix to set
+	 */
+	public void setPrefix(String prefix) {
+		this.prefix = prefix;
+	}
+
+	/**
+	 * Gets suffix
+	 * 
+	 * @return the suffix
+	 */
+	public String getSuffix() {
+		return suffix;
+	}
+
+	/**
+	 * Sets suffix
+	 * 
+	 * @param suffix
+	 *            the suffix to set
+	 */
+	public void setSuffix(String suffix) {
+		this.suffix = suffix;
+	}
+
+	/**
+	 * Gets file where this component is defined in
+	 * 
+	 * @return the file path
+	 */
+	public String getDefinedInFilePath() {
+		return definedInFile;
+	}
+
+	/**
+	 * Gets the model
+	 * 
+	 * @return the model
+	 */
+	public DictionaryDecodeModel getModel() {
+		return model;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/TraceData.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,117 @@
+/*
+ * 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:
+ *
+ * Trace Data
+ *
+ */
+package com.nokia.trace.dictionary.model;
+
+import java.util.ArrayList;
+
+import com.nokia.trace.dictionary.model.decodeparameters.DecodeParameter;
+
+/**
+ * Trace Data
+ * 
+ */
+public final class TraceData {
+
+	/**
+	 * ID of the trace data
+	 */
+	private int id;
+
+	/**
+	 * Type of the data
+	 */
+	private String type;
+
+	/**
+	 * Indicates that this trace contains only one variable
+	 */
+	private boolean containsOnlyOneVariable;
+
+	/**
+	 * Decode parameters
+	 */
+	private ArrayList<DecodeParameter> decodeParameters;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param id
+	 *            the trace ID
+	 * @param type
+	 *            the trace type
+	 */
+	public TraceData(int id, String type) {
+		this.id = id;
+		this.type = type;
+		decodeParameters = new ArrayList<DecodeParameter>();
+	}
+
+	/**
+	 * @return the id
+	 */
+	public int getId() {
+		return id;
+	}
+
+	/**
+	 * Gets type
+	 * 
+	 * @return the type
+	 */
+	public String getType() {
+		return type;
+	}
+
+	/**
+	 * Adds decode parameters to list
+	 * 
+	 * @param parameter
+	 */
+	public void addDecodeParameter(DecodeParameter parameter) {
+		decodeParameters.add(parameter);
+	}
+
+	/**
+	 * Gets decode parameters
+	 * 
+	 * @return the decodeParameters
+	 */
+	public ArrayList<DecodeParameter> getDecodeParameters() {
+		return decodeParameters;
+	}
+
+	/**
+	 * Gets the contains only one variable value
+	 * 
+	 * @return the containsOnlyOneVariable
+	 */
+	public boolean containsOnlyOneVariable() {
+		return containsOnlyOneVariable;
+	}
+
+	/**
+	 * Sets the contains only one variable value
+	 * 
+	 * @param containsOnlyOneVariable
+	 *            the new value
+	 */
+	public void setContainsOnlyOneVariable(boolean containsOnlyOneVariable) {
+		this.containsOnlyOneVariable = containsOnlyOneVariable;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/TraceGroup.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,179 @@
+/*
+ * 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:
+ *
+ * Trace Group
+ *
+ */
+package com.nokia.trace.dictionary.model;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+
+/**
+ * Trace Group
+ */
+public class TraceGroup extends DecodeObject {
+
+	/**
+	 * Prefix of the group
+	 */
+	private String prefix;
+
+	/**
+	 * Suffix of the group
+	 */
+	private String suffix;
+
+	/**
+	 * Component this groups belongs to
+	 */
+	private TraceComponent component;
+
+	/**
+	 * List of traces in this group
+	 */
+	private ArrayList<Trace> traces;
+
+	/**
+	 * Constructor Should only be called from DecodeObjectFactory
+	 * 
+	 * @param id
+	 * @param name
+	 * @param prefix
+	 * @param suffix
+	 * @param component
+	 */
+	public TraceGroup(int id, String name, String prefix, String suffix,
+			TraceComponent component) {
+		super(id, name);
+		this.prefix = prefix;
+		this.suffix = suffix;
+		this.component = component;
+		traces = new ArrayList<Trace>();
+	}
+
+	/**
+	 * Adds trace to the list to right position
+	 * 
+	 * @param trace
+	 *            trace to be added
+	 * @return null if adding was ok, old trace if a trace with same ID already
+	 *         exists
+	 */
+	public Trace addTrace(Trace trace) {
+		Trace returnTrace = null;
+		int pos = Collections.binarySearch(traces, trace,
+				new Comparator<Trace>() {
+
+					public int compare(Trace o1, Trace o2) {
+						int id1 = o1.getId();
+						int id2 = o2.getId();
+						return id1 > id2 ? 1 : id1 < id2 ? -1 : 0;
+					}
+
+				});
+		if (pos < 0) {
+			traces.add(-pos - 1, trace);
+		} else {
+			returnTrace = traces.get(pos);
+		}
+		return returnTrace;
+
+	}
+
+	/**
+	 * Gets trace for specific id
+	 * 
+	 * @param id
+	 *            id of the trace
+	 * @return the trace
+	 */
+	public Trace getTrace(int id) {
+		int pos = Collections.binarySearch(traces, Integer.valueOf(id),
+				new Comparator<Object>() {
+
+					public int compare(Object o1, Object o2) {
+						int id1 = ((Trace) o1).getId();
+						int id2 = ((Integer) o2).intValue();
+						return id1 > id2 ? 1 : id1 < id2 ? -1 : 0;
+					}
+
+				});
+		Trace trace = null;
+		if (pos >= 0) {
+			trace = traces.get(pos);
+		}
+		return trace;
+
+	}
+
+	/**
+	 * Gets all traces as a list
+	 * 
+	 * @return all traces
+	 */
+	public ArrayList<Trace> getTraces() {
+		return traces;
+	}
+
+	/**
+	 * Gets prefix
+	 * 
+	 * @return the prefix
+	 */
+	public String getPrefix() {
+		return prefix;
+	}
+
+	/**
+	 * Sets prefix
+	 * 
+	 * @param prefix
+	 *            the prefix to set
+	 */
+	public void setPrefix(String prefix) {
+		this.prefix = prefix;
+	}
+
+	/**
+	 * Gets suffix
+	 * 
+	 * @return the suffix
+	 */
+	public String getSuffix() {
+		return suffix;
+	}
+
+	/**
+	 * Sets suffix
+	 * 
+	 * @param suffix
+	 *            the suffix to set
+	 */
+	public void setSuffix(String suffix) {
+		this.suffix = suffix;
+	}
+
+	/**
+	 * Gets parent component
+	 * 
+	 * @return the component
+	 */
+	public TraceComponent getComponent() {
+		return component;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/TraceInstanceList.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,110 @@
+/*
+ * 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:
+ *
+ * Holds trace instances for a trace structure
+ *
+ */
+package com.nokia.trace.dictionary.model;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+
+/**
+ * Holds trace instances for a trace structure
+ * 
+ */
+public class TraceInstanceList extends DecodeObject {
+
+	/**
+	 * Trace list
+	 */
+	private ArrayList<Trace> traces;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param id
+	 *            Id
+	 * @param name
+	 *            Name
+	 */
+	public TraceInstanceList(int id, String name) {
+		super(id, name);
+		traces = new ArrayList<Trace>();
+	}
+
+	/**
+	 * Add trace
+	 * 
+	 * @param trace
+	 *            new trace
+	 */
+	public void addTrace(Trace trace) {
+		traces.add(trace);
+	}
+
+	/**
+	 * Sets metadata to all the traces in the list. Is called when trace tag
+	 * ends in dictionary file.
+	 */
+	public void setMetadataToTraces() {
+		if (getMetadata() != null) {
+			Iterator<Trace> it = traces.iterator();
+			while (it.hasNext()) {
+				Trace trace = it.next();
+				if (trace.metadataMap == null) {
+					trace.metadataMap = new HashMap<String, HashMap<String, Object>>();
+				}
+				addMissingMetadataToList(getMetadata(), trace.metadataMap);
+			}
+		}
+	}
+
+	/**
+	 * Adds missing metadata to list
+	 * 
+	 * @param oldList
+	 *            old list to append from
+	 * @param newList
+	 *            new list to append to
+	 */
+	private void addMissingMetadataToList(
+			HashMap<String, HashMap<String, Object>> oldList,
+			HashMap<String, HashMap<String, Object>> newList) {
+		Iterator<String> it = oldList.keySet().iterator();
+		while (it.hasNext()) {
+			String key = it.next();
+
+			// Doesn't contain this key, add it
+			if (!newList.containsKey(key)) {
+				newList.put(key, oldList.get(key));
+
+				// Contains the key, check values inside
+			} else {
+				Iterator<String> valueIt = oldList.get(key).keySet().iterator();
+				while (valueIt.hasNext()) {
+					String valueKey = valueIt.next();
+
+					// Doesn't contain value key, add it
+					if (!newList.get(key).containsKey(valueKey)) {
+						newList.get(key).put(valueKey,
+								newList.get(key).get(valueKey));
+					}
+				}
+			}
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/decodeparameters/ArrayParameter.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,158 @@
+/*
+ * 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:
+ *
+ * Array parameter
+ *
+ */
+package com.nokia.trace.dictionary.model.decodeparameters;
+
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Array parameter
+ * 
+ */
+public final class ArrayParameter extends DecodeParameter {
+
+	/**
+	 * Reference to a type that this array is full of
+	 */
+	private DecodeParameter parameterType;
+
+	/**
+	 * Length in bytes of length data in binary format
+	 */
+	private static final int LENGTH_OF_ARRAYLENGTH = 4;
+
+	/**
+	 * Datablock size
+	 */
+	private static final int DATABLOCK_SIZE = 4;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param type
+	 *            type
+	 * @param hidden
+	 *            hidden value
+	 * @param parameterType
+	 *            parameterType
+	 */
+	public ArrayParameter(String type, boolean hidden,
+			DecodeParameter parameterType) {
+		super(type, hidden);
+		this.parameterType = parameterType;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.trace.dictionary.model.decodeparameters.DecodeParameter#decode
+	 * (java.nio.ByteBuffer, int, java.lang.StringBuffer, int, int,
+	 * java.util.List)
+	 */
+	@Override
+	public int decode(ByteBuffer dataFrame, int offset,
+			StringBuffer traceString, int dataStart, int dataLength,
+			List<String> parameterList) {
+
+		// Check that there is enough data left in the buffer
+		int bytesRemaining = dataLength - (offset - dataStart);
+		if (bytesRemaining <= 0) {
+			postDataMissingEvent(traceString, 0, LENGTH_OF_ARRAYLENGTH);
+		}
+
+		int parameterLen = parameterType.getSize();
+		int arrayLength;
+
+		// If the only variable in the trace, length is the data left
+		if (isOnlyVariableInTrace) {
+			arrayLength = bytesRemaining / parameterLen;
+
+			// Read the length if this array is not the only variable in the
+			// trace
+		} else {
+
+			arrayLength = DecodeUtils.getIntegerFromBuffer(dataFrame, offset,
+					LENGTH_OF_ARRAYLENGTH);
+
+			offset = offset + LENGTH_OF_ARRAYLENGTH;
+			dataFrame.position(offset);
+		}
+
+		List<String> arrayParameterString = new ArrayList<String>();
+		StringBuffer arrayParameterBuf = new StringBuffer();
+
+		// Calculate how many elements there are in the array
+		int nrOfElements = arrayLength;
+
+		// Decode all the parameters from the array
+		for (int i = 0; i < nrOfElements
+				&& offset + parameterLen <= dataStart + dataLength; i++) {
+
+			offset = parameterType.decode(dataFrame, offset, traceString,
+					dataStart, dataLength, arrayParameterString);
+
+			// Add next array element to array parameter String
+			if (arrayParameterString.size() > 0) {
+				arrayParameterBuf.append(arrayParameterString.get(0));
+				arrayParameterString.clear();
+			}
+
+			// Append commas between elements
+			if (i != nrOfElements - 1) {
+				traceString.append(',');
+				arrayParameterBuf.append(',');
+			}
+		}
+
+		parameterList.add(arrayParameterBuf.toString());
+
+		// Check fillers
+		int fillerCount = DATABLOCK_SIZE
+				- ((arrayLength * parameterLen) % DATABLOCK_SIZE);
+		if (fillerCount == DATABLOCK_SIZE) {
+			// All good
+		} else {
+			// Add fillerCount to offset
+			offset = offset + fillerCount;
+		}
+
+		return offset;
+	}
+
+	/**
+	 * Gets parameter type
+	 * 
+	 * @return the parameterType
+	 */
+	public DecodeParameter getParameterType() {
+		return parameterType;
+	}
+
+	/**
+	 * Sets parameter type
+	 * 
+	 * @param parameterType
+	 *            the parameterType to set
+	 */
+	public void setParameterType(DecodeParameter parameterType) {
+		this.parameterType = parameterType;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/decodeparameters/BinaryParameter.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,122 @@
+/*
+ * 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:
+ *
+ * Binary parameter
+ *
+ */
+package com.nokia.trace.dictionary.model.decodeparameters;
+
+import java.nio.ByteBuffer;
+import java.util.List;
+
+/**
+ * Binary parameter
+ */
+public class BinaryParameter extends DecodeParameter {
+
+	/**
+	 * Size of the binary
+	 */
+	private int size;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param type
+	 *            type
+	 * @param hidden
+	 *            hidden
+	 * @param size
+	 *            size
+	 */
+	public BinaryParameter(String type, boolean hidden, int size) {
+		super(type, hidden);
+		this.size = size;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.trace.dictionary.model.decodeparameters.DecodeParameter#decode
+	 * (java.nio.ByteBuffer, int, java.lang.StringBuffer, int, int,
+	 * java.util.List)
+	 */
+	@Override
+	public int decode(ByteBuffer dataFrame, int offset,
+			StringBuffer traceString, int dataStart, int dataLength,
+			List<String> parameterList) {
+
+		// Check that there is enough data left in the buffer
+		int bytesRemaining = dataLength - (offset - dataStart);
+		if (bytesRemaining < size) {
+			postDataMissingEvent(traceString, bytesRemaining, size);
+		} else {
+
+			int data = 0;
+			if (size == ONE_BYTE) {
+				data = DecodeUtils.getIntegerFromBuffer(dataFrame, offset,
+						ONE_BYTE);
+				String binaryString = Integer.toBinaryString(data);
+				traceString.append(binaryString);
+				parameterList.add(binaryString);
+			} else if (size == TWO_BYTES) {
+				data = DecodeUtils.getIntegerFromBuffer(dataFrame, offset,
+						TWO_BYTES);
+				String binaryString = Integer.toBinaryString(data);
+				traceString.append(binaryString);
+				parameterList.add(binaryString);
+			} else if (size == FOUR_BYTES) {
+				data = DecodeUtils.getIntegerFromBuffer(dataFrame, offset,
+						FOUR_BYTES);
+				String binaryString = Integer.toBinaryString(data);
+				traceString.append(binaryString);
+				parameterList.add(binaryString);
+			} else if (size == EIGHT_BYTES) {
+				long bigData = DecodeUtils.getLongFromBuffer(dataFrame, offset,
+						EIGHT_BYTES);
+				String binaryString = Long.toBinaryString(bigData);
+				traceString.append(binaryString);
+				parameterList.add(binaryString);
+			}
+		}
+		offset = offset + size;
+
+		return offset;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.trace.dictionary.model.decodeparameters.DecodeParameter#getSize
+	 * ()
+	 */
+	@Override
+	public int getSize() {
+		return size;
+	}
+
+	/**
+	 * Sets size
+	 * 
+	 * @param size
+	 *            the size to set
+	 */
+	public void setSize(int size) {
+		this.size = size;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/decodeparameters/CompoundParameter.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,100 @@
+/*
+ * 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:
+ *
+ * Compound parameter
+ *
+ */
+package com.nokia.trace.dictionary.model.decodeparameters;
+
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Compound parameter
+ * 
+ */
+public class CompoundParameter extends DecodeParameter {
+
+	/**
+	 * List of parameter types
+	 */
+	private ArrayList<DecodeParameter> parameters;
+
+	/**
+	 * Name of the parameter types
+	 */
+	private ArrayList<String> parameterNames;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param type
+	 *            type
+	 * @param hidden
+	 *            hidden
+	 */
+	public CompoundParameter(String type, boolean hidden) {
+		super(type, hidden);
+		parameters = new ArrayList<DecodeParameter>();
+		parameterNames = new ArrayList<String>();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.trace.dictionary.model.decodeparameters.DecodeParameter#decode
+	 * (java.nio.ByteBuffer, int, java.lang.StringBuffer, int, int,
+	 * java.util.List)
+	 */
+	@Override
+	public int decode(ByteBuffer dataFrame, int offset,
+			StringBuffer traceString, int dataStart, int dataLength,
+			List<String> parameterList) {
+		// Check that there is enough data left in the buffer
+		int bytesRemaining = dataLength - (offset - dataStart);
+		if (bytesRemaining <= 0) {
+			postDataMissingEvent(traceString, 0, 4);
+		}
+		return offset;
+	}
+
+	/**
+	 * Adds new decode parameter to list
+	 * 
+	 * @param parameter
+	 *            the parameter
+	 * @param name
+	 *            the name of the parameter
+	 */
+	public void addParameter(DecodeParameter parameter, String name) {
+		parameters.add(parameter);
+		parameterNames.add(name);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.trace.dictionary.model.decodeparameters.DecodeParameter#getSize
+	 * ()
+	 */
+	@Override
+	public int getSize() {
+		// Not implemented yet
+		return 0;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/decodeparameters/ConstantParameter.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,57 @@
+/*
+ * 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:
+ *
+ * Constant parameter
+ *
+ */
+package com.nokia.trace.dictionary.model.decodeparameters;
+
+import java.nio.ByteBuffer;
+import java.util.List;
+
+/**
+ * Constant parameter
+ */
+public class ConstantParameter extends DecodeParameter {
+
+	/**
+	 * Constructor
+	 * 
+	 * @param type
+	 *            type
+	 * @param hidden
+	 *            hidden
+	 */
+	public ConstantParameter(String type, boolean hidden) {
+		super(type, hidden);
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.trace.dictionary.model.decodeparameters.DecodeParameter#decode
+	 * (java.nio.ByteBuffer, int, java.lang.StringBuffer, int, int,
+	 * java.util.List)
+	 */
+	@Override
+	public int decode(ByteBuffer dataFrame, int offset,
+			StringBuffer traceString, int dataStart, int dataLength,
+			List<String> parameterList) {
+		traceString.append(type);
+		return offset;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/decodeparameters/DecodeParameter.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,196 @@
+/*
+ * 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:
+ *
+ * Decode parameter
+ *
+ */
+package com.nokia.trace.dictionary.model.decodeparameters;
+
+import java.nio.ByteBuffer;
+import java.util.List;
+
+import com.nokia.trace.dictionary.TraceDictionaryEngine;
+import com.nokia.trace.eventrouter.TraceEvent;
+
+/**
+ * Decode parameter
+ * 
+ */
+public abstract class DecodeParameter {
+
+	/**
+	 * One byte
+	 */
+	protected static final int ONE_BYTE = 1;
+
+	/**
+	 * Two bytes
+	 */
+	protected static final int TWO_BYTES = 2;
+
+	/**
+	 * Four bytes
+	 */
+	protected static final int FOUR_BYTES = 4;
+
+	/**
+	 * Eight bytes
+	 */
+	protected static final int EIGHT_BYTES = 8;
+
+	/**
+	 * Category for events
+	 */
+	private final static String EVENT_CATEGORY = Messages
+			.getString("DecodeParameter.EventCategory"); //$NON-NLS-1$
+
+	/**
+	 * Explanation of data missing error
+	 */
+	private final static String DATA_MISSING = Messages
+			.getString("DecodeParameter.DataMissingMsg"); //$NON-NLS-1$
+
+	/**
+	 * Boolean indicating that we have already informed about data missing once
+	 */
+	private boolean informedAboutDataMissing;
+
+	/**
+	 * Type of the parameter
+	 */
+	protected String type;
+
+	/**
+	 * Is this parameter hidden from the trace output
+	 */
+	protected boolean hidden;
+
+	/**
+	 * If this flag is on, it means that this decode parameter is the only
+	 * variable in the trace. This affects for example to the way how arrays are
+	 * decoded.
+	 */
+	public static boolean isOnlyVariableInTrace = false;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param type
+	 *            type of the parameter
+	 * @param hidden
+	 *            hidden or not
+	 * 
+	 */
+	public DecodeParameter(String type, boolean hidden) {
+		this.type = type;
+		this.hidden = hidden;
+	}
+
+	/**
+	 * Decodes this parameter and puts the input to the stringbuffer
+	 * 
+	 * @param dataFrame
+	 *            dataFrame where data is
+	 * @param offset
+	 *            offset where to start reading
+	 * @param traceString
+	 *            trace where to append data
+	 * @param dataStart
+	 *            data start offset
+	 * @param dataLength
+	 *            data length
+	 * @param parameterList
+	 *            parameter list where to append parameters separately
+	 * @return the offset after parameters
+	 */
+	public abstract int decode(ByteBuffer dataFrame, int offset,
+			StringBuffer traceString, int dataStart, int dataLength,
+			List<String> parameterList);
+
+	/**
+	 * Gets the type
+	 * 
+	 * @return the type
+	 */
+	public String getType() {
+		return type;
+	}
+
+	/**
+	 * Gets hidden value
+	 * 
+	 * @return the hidden
+	 */
+	public boolean isHidden() {
+		return hidden;
+	}
+
+	/**
+	 * Sets hidden value
+	 * 
+	 * @param hidden
+	 *            the hidden to set
+	 */
+	public void setHidden(boolean hidden) {
+		this.hidden = hidden;
+	}
+
+	/**
+	 * Sets type
+	 * 
+	 * @param type
+	 *            the type to set
+	 */
+	public void setType(String type) {
+		this.type = type;
+	}
+
+	/**
+	 * Gets size of the parameter
+	 * 
+	 * @return size of the parameter. 0 if there is no size with this parameter.
+	 *         Function should be overridden by every parameter that has a size
+	 */
+	public int getSize() {
+		return 0;
+	}
+
+	/**
+	 * Posts data missing error
+	 * 
+	 * @param string
+	 *            string from which some data is missing
+	 * @param remaining
+	 *            remaining bytes
+	 * @param required
+	 *            required bytes
+	 */
+	public void postDataMissingEvent(StringBuffer string, int remaining,
+			int required) {
+		if (!informedAboutDataMissing) {
+			TraceEvent event = new TraceEvent(TraceEvent.ERROR, DATA_MISSING
+					+ Messages.getString("DecodeParameter.DataMissingMsgLine1") //$NON-NLS-1$
+					+ required
+					+ Messages.getString("DecodeParameter.DataMissingMsgLine2") //$NON-NLS-1$
+					+ remaining
+					+ Messages.getString("DecodeParameter.DataMissingMsgLine3")); //$NON-NLS-1$
+			event.setCategory(EVENT_CATEGORY);
+			event.setSource(new String(string));
+			TraceDictionaryEngine.postEvent(event);
+		}
+		informedAboutDataMissing = true;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/decodeparameters/DecodeUtils.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,95 @@
+/*
+ * 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:
+ *
+ * Decode Utils
+ *
+ */
+package com.nokia.trace.dictionary.model.decodeparameters;
+
+import java.nio.ByteBuffer;
+
+/**
+ * Decode Utils
+ * 
+ */
+final class DecodeUtils {
+
+	/**
+	 * Prevents construction
+	 */
+	private DecodeUtils() {
+	}
+
+	/**
+	 * Gets integer from buffer
+	 * 
+	 * @param buffer
+	 *            dataBuffer
+	 * @param offset
+	 *            offset of the data
+	 * @param size
+	 *            size of the data
+	 * @return integer read from buffer
+	 */
+	static int getIntegerFromBuffer(ByteBuffer buffer, int offset, int size) {
+		int data = 0;
+		try {
+			if (size == 1) {
+				data |= buffer.get(offset);
+			} else if (size == 2) {
+				data |= buffer.getShort(offset) & 0xFFFF;
+				data = Short.reverseBytes((short) data);
+			} else if (size == 4) {
+				data = buffer.getInt(offset);
+				data = Integer.reverseBytes(data);
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		return data;
+	}
+
+	/**
+	 * Gets long from buffer
+	 * 
+	 * @param buffer
+	 *            dataBuffer
+	 * @param offset
+	 *            offset of the data
+	 * @param size
+	 *            size of the data
+	 * @return long read from buffer
+	 */
+	static long getLongFromBuffer(ByteBuffer buffer, int offset, int size) {
+		long data = 0;
+		try {
+			if (size == 1) {
+				data |= buffer.get(offset) & 0xFF;
+			} else if (size == 2) {
+				data |= buffer.getShort(offset) & 0xFFFF;
+				data = Short.reverseBytes((short) data);
+			} else if (size == 4) {
+				data = buffer.getInt(offset);
+				data = Integer.reverseBytes((int) data);
+			} else if (size == 8) {
+				data |= buffer.getLong(offset) & 0xFFFFFFFFFFFFFFFFL;
+				data = Long.reverseBytes(data);
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		return data;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/decodeparameters/EnumMember.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,88 @@
+/*
+ * 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:
+ *
+ * Enum member
+ *
+ */
+package com.nokia.trace.dictionary.model.decodeparameters;
+
+/**
+ * Enum member
+ * 
+ */
+public class EnumMember {
+
+	/**
+	 * Name of the member
+	 */
+	private String name;
+
+	/**
+	 * Value of the member
+	 */
+	private int value;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param name
+	 *            name of member
+	 * @param value
+	 *            value of member
+	 */
+	public EnumMember(String name, int value) {
+		this.name = name;
+		this.value = value;
+	}
+
+	/**
+	 * Gets name
+	 * 
+	 * @return the name
+	 */
+	public String getName() {
+		return name;
+	}
+
+	/**
+	 * Sets name
+	 * 
+	 * @param name
+	 *            the name to set
+	 */
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	/**
+	 * Gets value
+	 * 
+	 * @return the value
+	 */
+	public int getValue() {
+		return value;
+	}
+
+	/**
+	 * Sets value
+	 * 
+	 * @param value
+	 *            the value to set
+	 */
+	public void setValue(int value) {
+		this.value = value;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/decodeparameters/EnumParameter.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,162 @@
+/*
+ * 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:
+ *
+ * Enum parameter
+ *
+ */
+package com.nokia.trace.dictionary.model.decodeparameters;
+
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Collections;
+import java.util.Comparator;
+
+/**
+ * Enum parameter
+ */
+public class EnumParameter extends DecodeParameter {
+
+	/**
+	 * Size of the enum
+	 */
+	private int size;
+
+	/**
+	 * List of Enum members
+	 */
+	private ArrayList<EnumMember> members;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param type
+	 *            type
+	 * @param hidden
+	 *            hidden
+	 * @param size
+	 *            size
+	 */
+	public EnumParameter(String type, boolean hidden, int size) {
+		super(type, hidden);
+		this.size = size;
+		members = new ArrayList<EnumMember>();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.trace.dictionary.model.decodeparameters.DecodeParameter#decode
+	 * (java.nio.ByteBuffer, int, java.lang.StringBuffer, int, int,
+	 * java.util.ArrayList)
+	 */
+	@Override
+	public int decode(ByteBuffer dataFrame, int offset,
+			StringBuffer traceString, int dataStart, int dataLength,
+			List<String> parameterList) {
+		// Check that there is enough data left in the buffer
+		int bytesRemaining = dataLength - (offset - dataStart);
+		if (bytesRemaining < size) {
+			postDataMissingEvent(traceString, bytesRemaining, size);
+		} else {
+			int data = 0;
+			if (size == ONE_BYTE) {
+				data = DecodeUtils.getIntegerFromBuffer(dataFrame, offset,
+						ONE_BYTE);
+			} else if (size == TWO_BYTES) {
+				data = DecodeUtils.getIntegerFromBuffer(dataFrame, offset,
+						TWO_BYTES);
+			} else if (size == FOUR_BYTES) {
+				data = DecodeUtils.getIntegerFromBuffer(dataFrame, offset,
+						FOUR_BYTES);
+			}
+			String memberName = getMemberName(data);
+			traceString.append(memberName);
+			parameterList.add(memberName);
+		}
+		offset = offset + size;
+		return offset;
+	}
+
+	/**
+	 * Adds enum member to this parameter
+	 * 
+	 * @param member
+	 */
+	public void addMember(EnumMember member) {
+		int pos = Collections.binarySearch(members, member,
+				new Comparator<EnumMember>() {
+
+					public int compare(EnumMember o1, EnumMember o2) {
+						int id1 = o1.getValue();
+						int id2 = o2.getValue();
+						return id1 > id2 ? 1 : id1 < id2 ? -1 : 0;
+					}
+
+				});
+		if (pos < 0) {
+			members.add(-pos - 1, member);
+		}
+	}
+
+	/**
+	 * Gets members name with value
+	 * 
+	 * @param value
+	 * @return members name
+	 */
+	public String getMemberName(int value) {
+		int pos = Collections.binarySearch(members, Integer.valueOf(value),
+				new Comparator<Object>() {
+
+					public int compare(Object o1, Object o2) {
+						int id1 = ((EnumMember) o1).getValue();
+						int id2 = ((Integer) o2).intValue();
+						return id1 > id2 ? 1 : id1 < id2 ? -1 : 0;
+					}
+
+				});
+		String name = ""; //$NON-NLS-1$
+		if (pos >= 0) {
+			EnumMember member = members.get(pos);
+			name = member.getName();
+		}
+		return name;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.trace.dictionary.model.decodeparameters.DecodeParameter#getSize
+	 * ()
+	 */
+	@Override
+	public int getSize() {
+		return size;
+	}
+
+	/**
+	 * Sets size
+	 * 
+	 * @param size
+	 *            the size to set
+	 */
+	public void setSize(int size) {
+		this.size = size;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/decodeparameters/FillerParameter.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,60 @@
+/*
+ * 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:
+ *
+ * Filler parameter
+ *
+ */
+package com.nokia.trace.dictionary.model.decodeparameters;
+
+import java.nio.ByteBuffer;
+import java.util.List;
+
+/**
+ * Filler parameter
+ */
+public class FillerParameter extends DecodeParameter {
+
+	/**
+	 * Constructor
+	 * 
+	 * @param type
+	 *            type
+	 * @param hidden
+	 *            hidden
+	 */
+	public FillerParameter(String type, boolean hidden) {
+		super(type, hidden);
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.trace.dictionary.model.decodeparameters.DecodeParameter#decode
+	 * (java.nio.ByteBuffer, int, java.lang.StringBuffer, int, int,
+	 * java.util.ArrayList)
+	 */
+	@Override
+	public int decode(ByteBuffer dataFrame, int offset,
+			StringBuffer traceString, int dataStart, int dataLength,
+			List<String> parameterList) {
+
+		// Just add offset by one
+		offset++;
+
+		return offset;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/decodeparameters/FloatParameter.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,144 @@
+/*
+ * 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:
+ *
+ * Float parameter
+ *
+ */
+package com.nokia.trace.dictionary.model.decodeparameters;
+
+import java.nio.ByteBuffer;
+import java.util.List;
+
+/**
+ * Float parameter
+ */
+public final class FloatParameter extends DecodeParameter {
+
+	/**
+	 * Size of the float
+	 */
+	private int size;
+
+	/**
+	 * Signed or not
+	 */
+	private boolean signed;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param type
+	 *            type
+	 * @param hidden
+	 *            hidden
+	 * @param size
+	 *            size
+	 * @param signed
+	 *            signed
+	 */
+	public FloatParameter(String type, boolean hidden, int size, boolean signed) {
+		super(type, hidden);
+		this.size = size;
+		this.signed = signed;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.trace.dictionary.model.decodeparameters.DecodeParameter#decode
+	 * (java.nio.ByteBuffer, int, java.lang.StringBuffer, int, int,
+	 * java.util.ArrayList)
+	 */
+	@Override
+	public int decode(ByteBuffer dataFrame, int offset,
+			StringBuffer traceString, int dataStart, int dataLength,
+			List<String> parameterList) {
+		// Check that there is enough data left in the buffer
+		int bytesRemaining = dataLength - (offset - dataStart);
+		if (bytesRemaining < size) {
+			postDataMissingEvent(traceString, bytesRemaining, size);
+		} else {
+
+			long data = 0;
+			if (size == TWO_BYTES) {
+				data = DecodeUtils.getLongFromBuffer(dataFrame, offset,
+						TWO_BYTES);
+				double floatData = Double.longBitsToDouble(data);
+				String floatStr = Double.toString(floatData);
+				traceString.append(floatStr);
+				parameterList.add(floatStr);
+			} else if (size == FOUR_BYTES) {
+				data = DecodeUtils.getLongFromBuffer(dataFrame, offset,
+						FOUR_BYTES);
+				double floatData = Double.longBitsToDouble(data);
+				String floatStr = Double.toString(floatData);
+				traceString.append(floatStr);
+				parameterList.add(floatStr);
+			} else if (size == EIGHT_BYTES) {
+				data = DecodeUtils.getLongFromBuffer(dataFrame, offset,
+						EIGHT_BYTES);
+				double floatData = Double.longBitsToDouble(data);
+				String floatStr = Double.toString(floatData);
+				traceString.append(floatStr);
+				parameterList.add(floatStr);
+			}
+		}
+		offset = offset + size;
+		return offset;
+	}
+
+	/**
+	 * Gets the signed value
+	 * 
+	 * @return the signed
+	 */
+	public boolean isSigned() {
+		return signed;
+	}
+
+	/**
+	 * Sets the signed value
+	 * 
+	 * @param signed
+	 *            the signed to set
+	 */
+	public void setSigned(boolean signed) {
+		this.signed = signed;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.trace.dictionary.model.decodeparameters.DecodeParameter#getSize
+	 * ()
+	 */
+	@Override
+	public int getSize() {
+		return size;
+	}
+
+	/**
+	 * Sets size
+	 * 
+	 * @param size
+	 *            the size to set
+	 */
+	public void setSize(int size) {
+		this.size = size;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/decodeparameters/HexParameter.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,223 @@
+/*
+ * 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:
+ *
+ * Hex parameter
+ *
+ */
+package com.nokia.trace.dictionary.model.decodeparameters;
+
+import java.nio.ByteBuffer;
+import java.util.List;
+
+/**
+ * Hex parameter
+ * 
+ */
+public final class HexParameter extends DecodeParameter {
+
+	/**
+	 * Size of the hex
+	 */
+	private int size;
+
+	/**
+	 * Print in upper case boolean
+	 */
+	private boolean printInUpperCase;
+
+	/**
+	 * Format to how many characters
+	 */
+	private int formatToChars;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param type
+	 *            type
+	 * @param hidden
+	 *            hidden
+	 * @param size
+	 *            size
+	 */
+	public HexParameter(String type, boolean hidden, int size) {
+		super(type, hidden);
+		this.size = size;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.trace.dictionary.model.decodeparameters.DecodeParameter#decode
+	 * (java.nio.ByteBuffer, int, java.lang.StringBuffer, int, int,
+	 * java.util.ArrayList)
+	 */
+	@Override
+	public int decode(ByteBuffer dataFrame, int offset,
+			StringBuffer traceString, int dataStart, int dataLength,
+			List<String> parameterList) {
+		// Check that there is enough data left in the buffer
+		int bytesRemaining = dataLength - (offset - dataStart);
+		if (bytesRemaining < size) {
+			postDataMissingEvent(traceString, bytesRemaining, size);
+		} else {
+			int data = 0;
+			int numberOfChars = formatToChars;
+			if (numberOfChars == 0) {
+				numberOfChars = size * 2;
+			}
+
+			// One byte
+			if (size == ONE_BYTE) {
+				data = DecodeUtils.getIntegerFromBuffer(dataFrame, offset,
+						ONE_BYTE);
+				String hexStr = Integer.toHexString(data);
+				addValue(traceString, parameterList, numberOfChars, hexStr,
+						size);
+
+				// Two bytes
+			} else if (size == TWO_BYTES) {
+				data = DecodeUtils.getIntegerFromBuffer(dataFrame, offset,
+						TWO_BYTES);
+				String hexStr = Integer.toHexString(data);
+				addValue(traceString, parameterList, numberOfChars, hexStr,
+						size);
+
+				// Four bytes
+			} else if (size == FOUR_BYTES) {
+				data = DecodeUtils.getIntegerFromBuffer(dataFrame, offset,
+						FOUR_BYTES);
+				String hexStr = Integer.toHexString(data);
+				addValue(traceString, parameterList, numberOfChars, hexStr,
+						size);
+
+				// Eight bytes
+			} else if (size == EIGHT_BYTES) {
+				long bigData = DecodeUtils.getLongFromBuffer(dataFrame, offset,
+						EIGHT_BYTES);
+				String hexStr = Long.toHexString(bigData);
+				addValue(traceString, parameterList, numberOfChars, hexStr,
+						size);
+			}
+		}
+		offset = offset + size;
+
+		return offset;
+	}
+
+	/**
+	 * Adds the value
+	 * 
+	 * @param traceString
+	 *            trace buffer
+	 * @param parameterList
+	 *            parameter list
+	 * @param numberOfChars
+	 *            number of characters where this hex should be fitted
+	 * @param hexStr
+	 *            the value to be added
+	 * @param size
+	 *            size of the parameter
+	 */
+	private void addValue(StringBuffer traceString, List<String> parameterList,
+			int numberOfChars, String hexStr, int size) {
+
+		// If size 1 or 2 bytes, the value can be like 0xFFFFFF10. Let's remove
+		// the FFFFFF.
+		if (hexStr.length() > size * 2) {
+			hexStr = hexStr.substring(hexStr.length() - (size * 2));
+		}
+
+		// Upper case
+		if (printInUpperCase) {
+			hexStr = hexStr.toUpperCase();
+		}
+
+		int hexLen = hexStr.length();
+		if (hexLen < numberOfChars) {
+
+			// Create a buffer for the original string and the starting
+			// zeros
+			StringBuffer buf = new StringBuffer(hexLen
+					+ (numberOfChars - hexLen));
+
+			// Append zeros
+			while (hexLen < numberOfChars) {
+				buf.append('0');
+				hexLen++;
+			}
+
+			// Append original string
+			buf.append(hexStr);
+			hexStr = buf.toString();
+		}
+
+		traceString.append(hexStr);
+		parameterList.add(hexStr);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.trace.dictionary.model.decodeparameters.DecodeParameter#getSize
+	 * ()
+	 */
+	@Override
+	public int getSize() {
+		return size;
+	}
+
+	/**
+	 * Sets size
+	 * 
+	 * @param size
+	 *            the size to set
+	 */
+	public void setSize(int size) {
+		this.size = size;
+	}
+
+	/**
+	 * Gets print in upper case boolean
+	 * 
+	 * @return true if this hex parameter should be printed in upper case
+	 */
+	public boolean getPrintInUpperCase() {
+		return printInUpperCase;
+	}
+
+	/**
+	 * Sets print in upper case boolean
+	 * 
+	 * @param printInUpperCase
+	 *            the new value
+	 */
+	public void setPrintInUpperCase(boolean printInUpperCase) {
+		this.printInUpperCase = printInUpperCase;
+	}
+
+	/**
+	 * Sets to how many characters should the parameter be formatted to
+	 * 
+	 * @param formatToChars
+	 *            the number of characters
+	 */
+	public void setFormatToChars(int formatToChars) {
+		this.formatToChars = formatToChars;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/decodeparameters/IntegerParameter.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,200 @@
+/*
+ * 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:
+ *
+ * Integer parameter
+ *
+ */
+package com.nokia.trace.dictionary.model.decodeparameters;
+
+import java.nio.ByteBuffer;
+import java.util.List;
+
+/**
+ * Integer parameter
+ * 
+ */
+public final class IntegerParameter extends DecodeParameter {
+
+	/**
+	 * Size of the integer
+	 */
+	private int size;
+
+	/**
+	 * Signed or not
+	 */
+	private boolean signed;
+
+	/**
+	 * Format to how many characters
+	 */
+	private int formatToChars;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param type
+	 *            type
+	 * @param hidden
+	 *            hidden
+	 * @param size
+	 *            size
+	 * @param signed
+	 *            signed
+	 */
+	public IntegerParameter(String type, boolean hidden, int size,
+			boolean signed) {
+		super(type, hidden);
+		this.size = size;
+		this.signed = signed;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.trace.dictionary.model.decodeparameters.DecodeParameter#decode
+	 * (java.nio.ByteBuffer, int, java.lang.StringBuffer, int, int,
+	 * java.util.List)
+	 */
+	@Override
+	public int decode(ByteBuffer dataFrame, int offset,
+			StringBuffer traceString, int dataStart, int dataLength,
+			List<String> parameterList) {
+
+		// Check that there is enough data left in the buffer
+		int bytesRemaining = dataLength - (offset - dataStart);
+		if (bytesRemaining < size) {
+			postDataMissingEvent(traceString, bytesRemaining, size);
+		} else {
+			int data = 0;
+			if (size == ONE_BYTE) {
+				data = DecodeUtils.getIntegerFromBuffer(dataFrame, offset,
+						ONE_BYTE);
+				String integer = Integer.toString(data);
+				addValue(traceString, parameterList, integer);
+			} else if (size == TWO_BYTES) {
+				data = DecodeUtils.getIntegerFromBuffer(dataFrame, offset,
+						TWO_BYTES);
+				String integer = Integer.toString(data);
+				addValue(traceString, parameterList, integer);
+			} else if (size == FOUR_BYTES) {
+				data = DecodeUtils.getIntegerFromBuffer(dataFrame, offset,
+						FOUR_BYTES);
+				String integer = Integer.toString(data);
+				addValue(traceString, parameterList, integer);
+			} else if (size == EIGHT_BYTES) {
+				long bigData = DecodeUtils.getLongFromBuffer(dataFrame, offset,
+						EIGHT_BYTES);
+				String integer = Long.toString(bigData);
+				addValue(traceString, parameterList, integer);
+			}
+		}
+		offset = offset + size;
+
+		return offset;
+	}
+
+	/**
+	 * Adds the value
+	 * 
+	 * @param traceString
+	 *            trace buffer
+	 * @param parameterList
+	 *            parameter list
+	 * @param integer
+	 *            the value to be added
+	 */
+	private void addValue(StringBuffer traceString, List<String> parameterList,
+			String integer) {
+
+		// If we need to add starting zeros
+		if (formatToChars != 0) {
+			int intLen = integer.length();
+			if (intLen < formatToChars) {
+
+				// Create a buffer for the original string and the starting
+				// zeros
+				StringBuffer buf = new StringBuffer(intLen
+						+ (formatToChars - intLen));
+
+				// Append zeros
+				while (intLen < formatToChars) {
+					buf.append('0');
+					intLen++;
+				}
+
+				// Append original string
+				buf.append(integer);
+				integer = buf.toString();
+			}
+		}
+
+		traceString.append(integer);
+		parameterList.add(integer);
+	}
+
+	/**
+	 * Gets the signed value
+	 * 
+	 * @return the signed
+	 */
+	public boolean isSigned() {
+		return signed;
+	}
+
+	/**
+	 * Sets the signed value
+	 * 
+	 * @param signed
+	 *            the signed to set
+	 */
+	public void setSigned(boolean signed) {
+		this.signed = signed;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.trace.dictionary.model.decodeparameters.DecodeParameter#getSize
+	 * ()
+	 */
+	@Override
+	public int getSize() {
+		return size;
+	}
+
+	/**
+	 * Sets size
+	 * 
+	 * @param size
+	 *            the size to set
+	 */
+	public void setSize(int size) {
+		this.size = size;
+	}
+
+	/**
+	 * Sets to how many characters should the parameter be formatted to
+	 * 
+	 * @param formatToChars
+	 *            the number of characters
+	 */
+	public void setFormatToChars(int formatToChars) {
+		this.formatToChars = formatToChars;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/decodeparameters/Messages.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,63 @@
+/*
+ * 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:
+ *
+ * String localization for model decodeparameters package.
+ *
+ */
+package com.nokia.trace.dictionary.model.decodeparameters;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * String localization for model decodeparameters package.
+ * 
+ */
+class Messages {
+
+	/**
+	 * Bundle name
+	 */
+	private static final String BUNDLE_NAME = "com.nokia.trace.dictionary.model.decodeparameters.messages"; //$NON-NLS-1$
+
+	/**
+	 * Resource bundle
+	 */
+	private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
+			.getBundle(BUNDLE_NAME);
+
+	/**
+	 * Prevents construction.
+	 */
+	private Messages() {
+	}
+
+	/**
+	 * Maps a key to localized string.
+	 * 
+	 * @param key
+	 *            the key for the string
+	 * @return the localized string
+	 */
+	public static String getString(String key) {
+		String value;
+		try {
+			value = RESOURCE_BUNDLE.getString(key);
+		} catch (MissingResourceException e) {
+			value = '!' + key + '!';
+		}
+		return value;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/decodeparameters/OctalParameter.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,121 @@
+/*
+ * 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:
+ *
+ * Octal parameter
+ *
+ */
+package com.nokia.trace.dictionary.model.decodeparameters;
+
+import java.nio.ByteBuffer;
+import java.util.List;
+
+/**
+ * Octal parameter
+ */
+public class OctalParameter extends DecodeParameter {
+
+	/**
+	 * Size of the octal
+	 */
+	private int size;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param type
+	 *            type
+	 * @param hidden
+	 *            hidden
+	 * @param size
+	 *            size
+	 */
+	public OctalParameter(String type, boolean hidden, int size) {
+		super(type, hidden);
+		this.size = size;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.trace.dictionary.model.decodeparameters.DecodeParameter#decode
+	 * (java.nio.ByteBuffer, int, java.lang.StringBuffer, int, int,
+	 * java.util.List)
+	 */
+	@Override
+	public int decode(ByteBuffer dataFrame, int offset,
+			StringBuffer traceString, int dataStart, int dataLength,
+			List<String> parameterList) {
+
+		// Check that there is enough data left in the buffer
+		int bytesRemaining = dataLength - (offset - dataStart);
+		if (bytesRemaining < size) {
+			postDataMissingEvent(traceString, bytesRemaining, size);
+		} else {
+
+			int data = 0;
+			if (size == ONE_BYTE) {
+				data = DecodeUtils.getIntegerFromBuffer(dataFrame, offset,
+						ONE_BYTE);
+				String octalString = Integer.toOctalString(data);
+				traceString.append(octalString);
+				parameterList.add(octalString);
+			} else if (size == TWO_BYTES) {
+				data = DecodeUtils.getIntegerFromBuffer(dataFrame, offset,
+						TWO_BYTES);
+				String octalString = Integer.toOctalString(data);
+				traceString.append(octalString);
+				parameterList.add(octalString);
+			} else if (size == FOUR_BYTES) {
+				data = DecodeUtils.getIntegerFromBuffer(dataFrame, offset,
+						FOUR_BYTES);
+				String octalString = Integer.toOctalString(data);
+				traceString.append(octalString);
+				parameterList.add(octalString);
+			} else if (size == EIGHT_BYTES) {
+				long bigData = DecodeUtils.getLongFromBuffer(dataFrame, offset,
+						EIGHT_BYTES);
+				String octalString = Long.toOctalString(bigData);
+				traceString.append(octalString);
+				parameterList.add(octalString);
+			}
+		}
+		offset = offset + size;
+		return offset;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.trace.dictionary.model.decodeparameters.DecodeParameter#getSize
+	 * ()
+	 */
+	@Override
+	public int getSize() {
+		return size;
+	}
+
+	/**
+	 * Sets size
+	 * 
+	 * @param size
+	 *            the size to set
+	 */
+	public void setSize(int size) {
+		this.size = size;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/decodeparameters/RawParameter.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,62 @@
+/*
+ * 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:
+ *
+ * Raw parameter
+ *
+ */
+package com.nokia.trace.dictionary.model.decodeparameters;
+
+import java.nio.ByteBuffer;
+import java.util.List;
+
+/**
+ * Raw parameter
+ * 
+ */
+public class RawParameter extends DecodeParameter {
+
+	/**
+	 * Constructor
+	 * 
+	 * @param type
+	 *            type
+	 * @param hidden
+	 *            hidden
+	 */
+	public RawParameter(String type, boolean hidden) {
+		super(type, hidden);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.trace.dictionary.model.decodeparameters.DecodeParameter#decode
+	 * (java.nio.ByteBuffer, int, java.lang.StringBuffer, int, int,
+	 * java.util.List)
+	 */
+	@Override
+	public int decode(ByteBuffer dataFrame, int offset,
+			StringBuffer traceString, int dataStart, int dataLength,
+			List<String> parameterList) {
+		// Check that there is enough data left in the buffer
+		int bytesRemaining = dataLength - (offset - dataStart);
+		if (bytesRemaining <= 0) {
+			postDataMissingEvent(traceString, 0, 4);
+		}
+
+		return offset;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/decodeparameters/StringParameter.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,306 @@
+/*
+ * 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:
+ *
+ * String parameter
+ *
+ */
+package com.nokia.trace.dictionary.model.decodeparameters;
+
+import java.io.UnsupportedEncodingException;
+import java.nio.ByteBuffer;
+import java.util.List;
+
+/**
+ * String parameter
+ * 
+ */
+public class StringParameter extends DecodeParameter {
+
+	/**
+	 * Datablock size
+	 */
+	private static final int DATABLOCK_SIZE = 4;
+
+	/**
+	 * Length of ascii data in XML file
+	 */
+	private static final int LENGTH_OF_ASCII = 1;
+
+	/**
+	 * Length of unicode data in XML file
+	 */
+	private static final int LENGTH_OF_UNICODE = 2;
+
+	/**
+	 * Length in bytes of length data in binary format
+	 */
+	private static final int LENGTH_OF_STRINGLENGTH = 4;
+
+	/**
+	 * String end character
+	 */
+	private static final char STR_END_CHAR = '\0';
+
+	/**
+	 * Length of this string parameter
+	 */
+	private int length;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param type
+	 *            type
+	 * @param hidden
+	 *            hidden
+	 * @param length
+	 *            length
+	 */
+	public StringParameter(String type, boolean hidden, int length) {
+		super(type, hidden);
+		this.length = length;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.trace.dictionary.model.decodeparameters.DecodeParameter#decode
+	 * (java.nio.ByteBuffer, int, java.lang.StringBuffer, int, int,
+	 * java.util.List)
+	 */
+	@Override
+	public int decode(ByteBuffer dataFrame, int offset,
+			StringBuffer traceString, int dataStart, int dataLength,
+			List<String> parameterList) {
+
+		// Check that there is enough data left in the buffer
+		int bytesRemaining = dataLength - (offset - dataStart);
+		if (bytesRemaining <= 0) {
+			postDataMissingEvent(traceString, 0, LENGTH_OF_STRINGLENGTH);
+		} else {
+
+			int stringLength;
+
+			// If the only variable in the trace, length can be get by dividing
+			// the number of bytes with bytes per character. One for ASCII and
+			// two for UNICODE
+			if (isOnlyVariableInTrace) {
+				stringLength = bytesRemaining / length;
+
+				// Read the length if this string is not the only variable in
+				// the trace
+			} else {
+				stringLength = DecodeUtils.getIntegerFromBuffer(dataFrame,
+						offset, LENGTH_OF_STRINGLENGTH);
+
+				// If not enough data left, check if all length bytes seemed to
+				// be characters. If yes, add them also the the string
+				if (stringLength > bytesRemaining) {
+					int a = DecodeUtils.getIntegerFromBuffer(dataFrame, offset,
+							ONE_BYTE);
+					int b = DecodeUtils.getIntegerFromBuffer(dataFrame,
+							offset + 1, ONE_BYTE);
+					int c = DecodeUtils.getIntegerFromBuffer(dataFrame,
+							offset + 2, ONE_BYTE);
+					int d = DecodeUtils.getIntegerFromBuffer(dataFrame,
+							offset + 3, ONE_BYTE);
+
+					// Go back 4 bytes of length
+					if (isAscii(a) && isAscii(b) && isAscii(c) && isAscii(d)) {
+						offset = offset - LENGTH_OF_STRINGLENGTH;
+					}
+				}
+
+				offset = offset + LENGTH_OF_STRINGLENGTH;
+			}
+
+			// Set data frame to right position
+			dataFrame.position(offset);
+
+			// Read from databuffer
+			byte[] byteArr = null;
+			String newString = null;
+
+			// Process ASCII string
+			if (length == LENGTH_OF_ASCII) {
+				bytesRemaining = dataLength - (offset - dataStart);
+				if (stringLength > bytesRemaining) {
+					stringLength = bytesRemaining;
+				}
+
+				// Get bytes and create the String
+				if (stringLength > 0) {
+					byteArr = new byte[stringLength];
+					dataFrame.get(byteArr, 0, stringLength);
+					removeLineBreaks(byteArr);
+					int stringLenWithoutZeros = removeStringEndChars(byteArr,
+							true);
+					newString = new String(byteArr, 0, stringLenWithoutZeros);
+				}
+
+				// Process UNICODE string
+			} else if (length == LENGTH_OF_UNICODE) {
+				stringLength = stringLength * LENGTH_OF_UNICODE;
+				bytesRemaining = dataLength - (offset - dataStart);
+				if (stringLength > bytesRemaining) {
+					stringLength = bytesRemaining;
+				}
+
+				if (stringLength > 0) {
+					// Get bytes and create the String
+					byteArr = new byte[stringLength];
+					dataFrame.get(byteArr, 0, stringLength);
+					removeLineBreaks(byteArr);
+					int stringLenWithoutZeros = removeStringEndChars(byteArr,
+							false);
+					try {
+						newString = new String(byteArr, 0,
+								stringLenWithoutZeros, "UTF-16LE"); //$NON-NLS-1$
+					} catch (UnsupportedEncodingException e) {
+						e.printStackTrace();
+					}
+				}
+			}
+
+			// String must have been created
+			if (newString != null) {
+				boolean foundEndChar = false;
+
+				// Find possible end chars
+				for (int i = newString.length() - DATABLOCK_SIZE; i < newString
+						.length()
+						&& i >= 0; i++) {
+					char c = newString.charAt(i);
+					if (c == STR_END_CHAR) {
+						String str = newString.substring(0, i);
+						traceString.append(str);
+						parameterList.add(str);
+						foundEndChar = true;
+						break;
+					}
+				}
+
+				if (!foundEndChar) {
+					traceString.append(newString);
+					parameterList.add(newString);
+				}
+			}
+
+			// Check fillers
+			int fillerCount = DATABLOCK_SIZE - (stringLength % DATABLOCK_SIZE);
+			if (fillerCount == DATABLOCK_SIZE) {
+				// All good
+			} else {
+				// Add fillerCount to offset
+				offset = offset + fillerCount;
+			}
+
+			// Add string length to offset
+			if (stringLength > 0) {
+				offset = offset + stringLength;
+			}
+		}
+		return offset;
+	}
+
+	/**
+	 * Checks if given parameters seems to be ASCII character
+	 * 
+	 * @param value
+	 * @return true if parameter seems to be ASCII
+	 */
+	private boolean isAscii(int value) {
+		boolean isAscii = false;
+		if (value >= 32 && value <= 126) {
+			isAscii = true;
+		}
+
+		return isAscii;
+	}
+
+	/**
+	 * Removes string end characters
+	 * 
+	 * @param byteArr
+	 *            byte array
+	 * @param ascii
+	 *            if true, ASCII string. Otherwise UNICODE string
+	 * @return length of the string without string end characters
+	 */
+	private int removeStringEndChars(byte[] byteArr, boolean ascii) {
+		int len = byteArr.length;
+		boolean firstCharFound = false;
+
+		for (int i = byteArr.length - 1; i >= 0; i--) {
+			if (byteArr[i] == '\0') {
+
+				// In case of ASCII, remove one byte at a time
+				if (ascii) {
+					len--;
+
+					// In case of UNICODE, remove two bytes at a time
+				} else {
+					if (firstCharFound) {
+						len = len - LENGTH_OF_UNICODE;
+						firstCharFound = false;
+					} else {
+						firstCharFound = true;
+					}
+				}
+			} else {
+				break;
+			}
+		}
+		return len;
+	}
+
+	/**
+	 * Removes line breaks from the byte array
+	 * 
+	 * @param byteArr
+	 *            byte array to process
+	 */
+	private void removeLineBreaks(byte[] byteArr) {
+
+		// Remove line breaks from the buffer
+		for (int i = 0; i < byteArr.length; i++) {
+			byte b = byteArr[i];
+			if (b == '\n' || b == '\r') {
+				byteArr[i] = ' ';
+			}
+		}
+	}
+
+	/**
+	 * Gets length
+	 * 
+	 * @return the length
+	 */
+	public int getLength() {
+		return length;
+	}
+
+	/**
+	 * Sets length
+	 * 
+	 * @param length
+	 *            the length to set
+	 */
+	public void setLength(int length) {
+		this.length = length;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/decodeparameters/messages.properties	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,5 @@
+DecodeParameter.DataMissingMsg=Data missing from trace\! Wrong / Old dictionary file?
+DecodeParameter.DataMissingMsgLine1=\ Data needed 
+DecodeParameter.DataMissingMsgLine2=\ bytes but only 
+DecodeParameter.DataMissingMsgLine3=\ left in the trace.
+DecodeParameter.EventCategory=Dictionary Decoder
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/decodeparameters/package.html	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,3 @@
+<html><body>
+Parameter types parsed from dictionary XML files
+</body></html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/handlers/BaseHandler.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,92 @@
+/*
+ * 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:
+ *
+ * Base class for handlers
+ *
+ */
+package com.nokia.trace.dictionary.model.handlers;
+
+import org.xml.sax.Attributes;
+
+import com.nokia.trace.dictionary.model.DecodeObject;
+import com.nokia.trace.dictionary.model.DictionaryContentHandler;
+import com.nokia.trace.dictionary.model.DictionaryDecodeModel;
+
+/**
+ * Base class for handlers
+ * 
+ */
+abstract class BaseHandler implements DictionaryHandler,
+		DictionaryFileConstants {
+
+	/**
+	 * Model
+	 */
+	protected DictionaryDecodeModel model;
+
+	/**
+	 * Name
+	 */
+	private String name;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            decode model
+	 * @param name
+	 *            handler name
+	 */
+	protected BaseHandler(DictionaryDecodeModel model, String name) {
+		this.model = model;
+		this.name = name;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.trace.dictionary.model.handlers.DictionaryHandler#getName()
+	 */
+	public String getName() {
+		return name;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.trace.dictionary.model.handlers.DictionaryHandler#
+	 * processStartElement(org.xml.sax.Attributes,
+	 * com.nokia.trace.dictionary.model.DictionaryContentHandler)
+	 */
+	public void processStartElement(Attributes atts,
+			DictionaryContentHandler handler) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.trace.dictionary.model.handlers.DictionaryHandler#processEndElement
+	 * (java.lang.StringBuffer, java.lang.Object,
+	 * com.nokia.trace.dictionary.model.DictionaryContentHandler,
+	 * com.nokia.trace.dictionary.model.DecodeObject)
+	 */
+	public void processEndElement(StringBuffer elementContent,
+			Object unFinishedObject, DictionaryContentHandler handler,
+			DecodeObject parentObject) {
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/handlers/ComponentHandler.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,128 @@
+/*
+ * 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:
+ *
+ * Component handler
+ *
+ */
+package com.nokia.trace.dictionary.model.handlers;
+
+import org.xml.sax.Attributes;
+
+import com.nokia.trace.dictionary.TraceDictionaryEngine;
+import com.nokia.trace.dictionary.model.DecodeObject;
+import com.nokia.trace.dictionary.model.DictionaryContentHandler;
+import com.nokia.trace.dictionary.model.DictionaryDecodeModel;
+import com.nokia.trace.dictionary.model.TraceComponent;
+import com.nokia.trace.dictionary.model.DictionaryContentVariables.ParentDecodeObject;
+import com.nokia.trace.eventrouter.TraceEvent;
+
+/**
+ * Component handler
+ * 
+ */
+final class ComponentHandler extends BaseHandler {
+
+	/**
+	 * Tag name this handler handles
+	 */
+	private final static String COMPONENT_TAG = "component"; //$NON-NLS-1$
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            the model
+	 */
+	ComponentHandler(DictionaryDecodeModel model) {
+		super(model, COMPONENT_TAG);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.trace.dictionary.model.handlers.DictionaryHandler#
+	 * processElement(org.xml.sax.Attributes)
+	 */
+	@Override
+	public void processStartElement(Attributes atts,
+			DictionaryContentHandler handler) {
+		TraceComponent component = model.getFactory().createTraceComponent(
+				Integer.parseInt(atts.getValue(ID)), atts.getValue(NAME),
+				atts.getValue(PREFIX), atts.getValue(SUFFIX), model);
+		TraceComponent oldComponent = model.addComponent(component);
+
+		// Check collision
+		component = checkCollision(oldComponent, component, handler);
+
+		// Set this component as the previous component and decode object
+		handler.getVariables().setPreviousComponent(component);
+		handler.getVariables().setParentDecodeObject(
+				ParentDecodeObject.COMPONENT);
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.trace.dictionary.model.handlers.BaseHandler#processEndElement
+	 * (java.lang.StringBuffer, java.lang.Object,
+	 * com.nokia.trace.dictionary.model.DictionaryContentHandler,
+	 * com.nokia.trace.dictionary.model.DecodeObject)
+	 */
+	@Override
+	public void processEndElement(StringBuffer elementContent,
+			Object unFinishedObject, DictionaryContentHandler handler,
+			DecodeObject parentObject) {
+		// Parent decode object is set back to nothing
+		handler.getVariables()
+				.setParentDecodeObject(ParentDecodeObject.NOTHING);
+	}
+
+	/**
+	 * Check collision
+	 * 
+	 * @param oldComponent
+	 *            old component
+	 * @param newComponent
+	 *            new component
+	 * @param handler
+	 *            Dictionary handler
+	 * @return component to be set as previous component
+	 */
+	private TraceComponent checkCollision(TraceComponent oldComponent,
+			TraceComponent newComponent, DictionaryContentHandler handler) {
+		boolean collision = true;
+		// If old component is null, everyrything is ok. If not, check collision
+		if (oldComponent != null) {
+			// UIDs must be same
+			if (oldComponent.getId() == newComponent.getId()) {
+				collision = false;
+			}
+			if (collision) {
+				newComponent = oldComponent;
+				TraceEvent event = new TraceEvent(TraceEvent.WARNING, Messages
+						.getString("ComponentHandler.CollisionComponentID") //$NON-NLS-1$
+						+ Integer.toHexString(oldComponent.getId()));
+				event.setCategory(EVENT_CATEGORY);
+				event.setSource(Integer.valueOf(handler.getLocator()
+						.getLineNumber()));
+				TraceDictionaryEngine.postEvent(event);
+			}
+		}
+		return newComponent;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/handlers/DataHandler.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,59 @@
+/*
+ * 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:
+ *
+ * Data handler
+ *
+ */
+package com.nokia.trace.dictionary.model.handlers;
+
+import org.xml.sax.Attributes;
+
+import com.nokia.trace.dictionary.model.DictionaryContentHandler;
+import com.nokia.trace.dictionary.model.DictionaryDecodeModel;
+
+/**
+ * Data handler
+ * 
+ */
+final class DataHandler extends BaseHandler {
+
+	/**
+	 * Tag name this handler handles
+	 */
+	private static final String DATA_TAG = "data"; //$NON-NLS-1$
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            the model
+	 */
+	public DataHandler(DictionaryDecodeModel model) {
+		super(model, DATA_TAG);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.trace.dictionary.model.handlers.DictionaryHandler#
+	 * processElement(org.xml.sax.Attributes)
+	 */
+	@Override
+	public void processStartElement(Attributes atts,
+			DictionaryContentHandler handler) {
+		// Do nothing at least now
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/handlers/DefHandler.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,432 @@
+/*
+ * 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:
+ *
+ * Def handler
+ *
+ */
+package com.nokia.trace.dictionary.model.handlers;
+
+import org.xml.sax.Attributes;
+
+import com.nokia.trace.dictionary.TraceDictionaryEngine;
+import com.nokia.trace.dictionary.model.DecodeObject;
+import com.nokia.trace.dictionary.model.DictionaryContentHandler;
+import com.nokia.trace.dictionary.model.DictionaryDecodeModel;
+import com.nokia.trace.dictionary.model.TraceData;
+import com.nokia.trace.dictionary.model.decodeparameters.ArrayParameter;
+import com.nokia.trace.dictionary.model.decodeparameters.ConstantParameter;
+import com.nokia.trace.dictionary.model.decodeparameters.DecodeParameter;
+import com.nokia.trace.dictionary.model.decodeparameters.HexParameter;
+import com.nokia.trace.dictionary.model.decodeparameters.IntegerParameter;
+import com.nokia.trace.eventrouter.TraceEvent;
+
+/**
+ * Def handler
+ */
+final class DefHandler extends BaseHandler {
+
+	/**
+	 * Tag name this handler handles
+	 */
+	private static final String DEF_TAG = "def"; //$NON-NLS-1$
+
+	/**
+	 * Bytes in block
+	 */
+	private int bytesInBlock;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            the model
+	 */
+	DefHandler(DictionaryDecodeModel model) {
+		super(model, DEF_TAG);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.trace.dictionary.model.handlers.BaseHandler#
+	 * processStartElement(org.xml.sax.Attributes,
+	 * com.nokia.trace.dictionary.model.DictionaryContentHandler)
+	 */
+	@Override
+	public void processStartElement(Attributes atts,
+			DictionaryContentHandler handler) {
+		TraceData traceData = new TraceData(
+				Integer.parseInt(atts.getValue(ID)), atts.getValue(TYPE));
+		handler.catchElementContents(traceData);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.trace.dictionary.model.handlers.BaseHandler#processEndElement
+	 * (java.lang.StringBuffer, java.lang.Object,
+	 * com.nokia.trace.dictionary.model.DictionaryContentHandler,
+	 * com.nokia.trace.dictionary.model.DecodeObject)
+	 */
+	@Override
+	public void processEndElement(StringBuffer elementContent,
+			Object unFinishedObject, DictionaryContentHandler handler,
+			DecodeObject parentObject) {
+
+		TraceData traceData = (TraceData) unFinishedObject;
+
+		// Check if there is only one variable in the trace. If
+		// split has two parts, there is only one variable indicator
+		if (elementContent.toString().split(VARIABLE_INDICATOR).length <= 2) {
+			traceData.setContainsOnlyOneVariable(true);
+		}
+
+		int startOffset = 0;
+		int foundOffset = 0;
+		int endOffset = 0;
+
+		// Search all variables from the string
+		while ((foundOffset = elementContent.indexOf(VARIABLE_INDICATOR,
+				startOffset)) != -1) {
+			createConstantParameter(elementContent, traceData, startOffset,
+					foundOffset);
+
+			String parameterType;
+			StringBuilder digitsSB = new StringBuilder();
+			boolean isArray = false;
+
+			int nextCharOffset = foundOffset + 1;
+
+			// First gather all possible digits to variable. e.g. from %02x
+			// gather 02
+			char c = elementContent.charAt(nextCharOffset);
+			while (Character.isDigit(c)) {
+				digitsSB.append(c);
+				nextCharOffset++;
+				c = elementContent.charAt(nextCharOffset);
+			}
+
+			// Check if next char is {
+			if (c == START_BRACKET) {
+				// Find offset of char }
+				endOffset = elementContent.indexOf(Character
+						.toString(END_BRACKET), foundOffset) + 1;
+
+				// End offset was not found,let's change it to end of whole
+				// string to get some reasonable error message
+				if (endOffset == 0) {
+					endOffset = elementContent.length();
+				}
+
+				// Try to find array indicator characters
+				int indexOfBrackets = elementContent.indexOf(ARRAY_INDICATOR,
+						nextCharOffset);
+				// Indicator is found and is inside this parameter -> array
+				if (indexOfBrackets != -1
+						&& indexOfBrackets + ARRAY_INDICATOR.length() < endOffset) {
+					isArray = true;
+				}
+
+				// Parse from between
+				parameterType = elementContent.substring(nextCharOffset,
+						endOffset);
+
+				// Next char is not {, so it's a format char
+			} else {
+
+				// If the first char is L, l, or h, format char has 2 or 3 chars
+				if (c == FORMATCHAR_INDICATOR_BIG_L
+						|| c == FORMATCHAR_INDICATOR_SMALL_L
+						|| c == FORMATCHAR_INDICATOR_H) {
+					c = elementContent.charAt(nextCharOffset + 1);
+
+					// Next char is also h or l, format char is 3 chars
+					if (c == FORMATCHAR_INDICATOR_H
+							|| c == FORMATCHAR_INDICATOR_SMALL_L) {
+						parameterType = elementContent.substring(
+								nextCharOffset, nextCharOffset
+										+ LONG_FORMATCHAR_LENGTH + 1);
+						endOffset = nextCharOffset + LONG_FORMATCHAR_LENGTH + 1;
+
+						// Format char is 2 chars
+					} else {
+						parameterType = elementContent.substring(
+								nextCharOffset, nextCharOffset
+										+ LONG_FORMATCHAR_LENGTH);
+						endOffset = nextCharOffset + LONG_FORMATCHAR_LENGTH;
+					}
+
+					// Only 1 char
+				} else {
+					parameterType = elementContent.substring(nextCharOffset,
+							nextCharOffset + SHORT_FORMATCHAR_LENGTH);
+					endOffset = nextCharOffset + SHORT_FORMATCHAR_LENGTH;
+				}
+			}
+
+			DecodeParameter parameter;
+
+			// Array parameter
+			if (isArray) {
+				parameter = handleArray(traceData, parameterType, digitsSB
+						.toString());
+
+				// Normal parameter
+			} else {
+				parameter = getDecodeParameter(parameterType, digitsSB
+						.toString());
+
+				if (parameter != null) {
+					// Add possible fillers before this new parameter
+					addFillers(traceData, parameter.getSize());
+
+					// Add to the parameter list
+					traceData.addDecodeParameter(parameter);
+				}
+			}
+
+			// Parameter couldn't be found or created, inform user
+			if (parameter == null) {
+				postParameterNotFoundMsg(handler, parameterType);
+			}
+
+			// Set start offset to previous end offset
+			startOffset = endOffset;
+		} // while ends
+
+		// Create constant from the remaining
+		createConstantParameter(elementContent, traceData, startOffset,
+				elementContent.length());
+
+		// Add trace data to model
+		model.addTraceData(traceData);
+
+		// Null bytes in block value afterwards
+		bytesInBlock = 0;
+	}
+
+	/**
+	 * Handles array
+	 * 
+	 * @param traceData
+	 *            trace data
+	 * @param parameterType
+	 *            parameter type
+	 * @param digits
+	 * @return created parameter or null if cannot be created
+	 */
+	private DecodeParameter handleArray(TraceData traceData,
+			String parameterType, String digits) {
+		DecodeParameter parameter = null;
+
+		// Remove array indicator and try decode parameter again
+		String arrayContainsStr = parameterType.replace(ARRAY_INDICATOR, ""); //$NON-NLS-1$
+		DecodeParameter arrayContains = getDecodeParameter(arrayContainsStr,
+				digits);
+
+		// Basic type is found, create array parameter and add it
+		// also to the model and to the trace parameter list
+		if (arrayContains != null) {
+			parameter = new ArrayParameter(parameterType, false, arrayContains);
+
+			model.addDecodeParameter(parameter);
+			traceData.addDecodeParameter(parameter);
+		}
+
+		return parameter;
+	}
+
+	/**
+	 * Gets (either from model or creates new) decode parameter
+	 * 
+	 * @param parameterType
+	 *            parameter type to be get
+	 * @param digits
+	 *            possible format digits
+	 * @return found or new decode parameter or null if not found
+	 */
+	private DecodeParameter getDecodeParameter(String parameterType,
+			String digits) {
+		String parameterWithFormat = digits + parameterType;
+
+		// Find from parameter list using the possible formatting (e.g. %02)
+		DecodeParameter parameter = model
+				.getDecodeParameter(parameterWithFormat);
+
+		// Not found, try to find without the formatting
+		if (parameter == null) {
+			parameter = model.getDecodeParameter(parameterType);
+
+			// If found, we need to create new decode parameter with the
+			// formatting included
+			if (parameter != null) {
+				parameter = createNewFormatDecodeParameter(parameter,
+						parameterWithFormat, digits);
+			}
+		}
+
+		return parameter;
+	}
+
+	/**
+	 * Create new decode parameter with formatting
+	 * 
+	 * @param oldParameter
+	 *            old parameter
+	 * @param parameterWithFormat
+	 *            new parameter name
+	 * @param digits
+	 *            how should the parameter be formatted
+	 * @return new decode parameter
+	 */
+	private DecodeParameter createNewFormatDecodeParameter(
+			DecodeParameter oldParameter, String parameterWithFormat,
+			String digits) {
+		DecodeParameter newParameter = null;
+
+		// This is already checked with "isDigit()" so doesn't need try catch
+		int digit = Integer.parseInt(digits);
+
+		// Integer parameter
+		if (oldParameter instanceof IntegerParameter) {
+			newParameter = new IntegerParameter(parameterWithFormat, false,
+					oldParameter.getSize(), true);
+			((IntegerParameter) newParameter).setFormatToChars(digit);
+		}
+
+		// Hex parameter
+		else if (oldParameter instanceof HexParameter) {
+			newParameter = new HexParameter(parameterWithFormat, false,
+					oldParameter.getSize());
+			((HexParameter) newParameter)
+					.setPrintInUpperCase(((HexParameter) oldParameter)
+							.getPrintInUpperCase());
+			((HexParameter) newParameter).setFormatToChars(digit);
+		}
+
+		// Add to the parameter list
+		if (newParameter != null) {
+			model.addDecodeParameter(newParameter);
+		}
+
+		return newParameter;
+	}
+
+	/**
+	 * Posts parameter not found message to user
+	 * 
+	 * @param handler
+	 *            Dictionary handler
+	 * @param parameterType
+	 *            parameter type that is not found
+	 */
+	private void postParameterNotFoundMsg(DictionaryContentHandler handler,
+			String parameterType) {
+		String parameterNotFound = Messages
+				.getString("DefHandler.ParameterNotFoundMsg"); //$NON-NLS-1$
+		TraceEvent event = new TraceEvent(TraceEvent.ERROR, parameterNotFound
+				+ parameterType);
+		event.setCategory(EVENT_CATEGORY);
+		event.setSource(Integer.valueOf(handler.getLocator().getLineNumber()));
+		TraceDictionaryEngine.postEvent(event);
+	}
+
+	/**
+	 * Adds possible filler parameters to traceData
+	 * 
+	 * @param traceData
+	 *            traceData
+	 * @param paramSize
+	 *            size of the new item
+	 */
+	private void addFillers(TraceData traceData, int paramSize) {
+		// Parameters are aligned to 32 bits. Parameter after
+		// end-of-string is aligned dynamically and thus no filler is
+		// created for it
+		if (paramSize == 0 || paramSize == 4 || paramSize == 8) {
+			if (bytesInBlock > 0) {
+				int fillerCount = 4 - bytesInBlock;
+				for (int i = 0; i < fillerCount; i++) {
+					traceData.addDecodeParameter(model.getFillerParameter());
+				}
+				bytesInBlock = 0;
+			}
+		} else if (paramSize == 2) {
+			if (bytesInBlock == 1 || bytesInBlock == 3) {
+				traceData.addDecodeParameter(model.getFillerParameter());
+				// If there was 1 existing byte and filler was added,
+				// the number of bytes in the block is now 4 including
+				// the 2-byte parameter. If there was 3 bytes, the
+				// filler brings it to 4 and the 16-bit parameter
+				// changes it to 2
+				bytesInBlock += 3;
+			} else {
+				bytesInBlock += 2;
+			}
+			if (bytesInBlock >= 4) {
+				bytesInBlock -= 4;
+			}
+		} else {
+			bytesInBlock++;
+			if (bytesInBlock == 4) {
+				bytesInBlock = 0;
+			}
+		}
+	}
+
+	/**
+	 * Create constant parameter
+	 * 
+	 * @param elementContent
+	 *            buffer where data is
+	 * @param traceData
+	 *            TraceData where to insert this parameter
+	 * @param startOffset
+	 *            start offset from buffer
+	 * @param endOffset
+	 *            end offset from buffer
+	 */
+	private void createConstantParameter(StringBuffer elementContent,
+			TraceData traceData, int startOffset, int endOffset) {
+
+		// Remove line breaks from the buffer
+		int len = elementContent.length();
+		for (int i = 0; i < len; i++) {
+			char c = elementContent.charAt(i);
+			if (c == '\n' || c == '\r') {
+				elementContent.setCharAt(i, ' ');
+			}
+		}
+
+		// First create constant parameter
+		String constantPar = elementContent.substring(startOffset, endOffset);
+		if (constantPar.length() > 0) {
+			// Try to find from the list
+			ConstantParameter parameter = model
+					.getConstantParameter(constantPar);
+
+			// Couldn't be found
+			if (parameter == null) {
+				parameter = new ConstantParameter(constantPar, false);
+			}
+
+			// Add to lists
+			traceData.addDecodeParameter(parameter);
+			model.addConstantParameter(parameter);
+		}
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/handlers/DictionaryFileConstants.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,152 @@
+/*
+ * 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:
+ *
+ * Dictionary File Constants
+ *
+ */
+package com.nokia.trace.dictionary.model.handlers;
+
+/**
+ * Dictionary File Constants
+ * 
+ */
+interface DictionaryFileConstants {
+
+	/**
+	 * Category for events
+	 */
+	String EVENT_CATEGORY = Messages
+			.getString("DictionaryFileConstants.EventCategory"); //$NON-NLS-1$
+
+	/**
+	 * Variable indicator
+	 */
+	String VARIABLE_INDICATOR = "%"; //$NON-NLS-1$
+
+	/**
+	 * ID String
+	 */
+	String ID = "id"; //$NON-NLS-1$
+
+	/**
+	 * Name String
+	 */
+	String NAME = "name"; //$NON-NLS-1$
+
+	/**
+	 * Prefix String
+	 */
+	String PREFIX = "prefix"; //$NON-NLS-1$
+
+	/**
+	 * Suffix String
+	 */
+	String SUFFIX = "suffix"; //$NON-NLS-1$
+
+	/**
+	 * Type String
+	 */
+	String TYPE = "type"; //$NON-NLS-1$
+
+	/**
+	 * Location reference String
+	 */
+	String LOCREF = "loc-ref"; //$NON-NLS-1$
+
+	/**
+	 * Line String
+	 */
+	String LINE = "line"; //$NON-NLS-1$
+
+	/**
+	 * Method name String
+	 */
+	String METHODNAME = "methodname"; //$NON-NLS-1$
+
+	/**
+	 * Class name String
+	 */
+	String CLASSNAME = "classname"; //$NON-NLS-1$
+
+	/**
+	 * Array indicator
+	 */
+	String ARRAY_INDICATOR = "[]"; //$NON-NLS-1$
+
+	/**
+	 * Classification String
+	 */
+	String CLASSIFICATION = "classification"; //$NON-NLS-1$
+
+	/**
+	 * Format character String
+	 */
+	String FORMATCHAR = "formatchar"; //$NON-NLS-1$
+
+	/**
+	 * Size String
+	 */
+	String SIZE = "size"; //$NON-NLS-1$
+
+	/**
+	 * Val String
+	 */
+	String VAL = "val"; //$NON-NLS-1$
+
+	/**
+	 * Value String
+	 */
+	String VALUE = "value"; //$NON-NLS-1$
+
+	/**
+	 * Data reference String
+	 */
+	String DATAREF = "data-ref"; //$NON-NLS-1$
+
+	/**
+	 * Start bracket character
+	 */
+	char START_BRACKET = '{';
+
+	/**
+	 * End bracket character
+	 */
+	char END_BRACKET = '}';
+
+	/**
+	 * Long format character indicator L
+	 */
+	char FORMATCHAR_INDICATOR_BIG_L = 'L';
+
+	/**
+	 * Long format character indicator l
+	 */
+	char FORMATCHAR_INDICATOR_SMALL_L = 'l';
+
+	/**
+	 * Long format character indicator h
+	 */
+	char FORMATCHAR_INDICATOR_H = 'h';
+
+	/**
+	 * Short format character length
+	 */
+	int SHORT_FORMATCHAR_LENGTH = 1;
+
+	/**
+	 * Long format character length
+	 */
+	int LONG_FORMATCHAR_LENGTH = 2;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/handlers/DictionaryHandler.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,65 @@
+/*
+ * 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:
+ *
+ * Interface DictionaryHandler
+ *
+ */
+package com.nokia.trace.dictionary.model.handlers;
+
+import org.xml.sax.Attributes;
+
+import com.nokia.trace.dictionary.model.DecodeObject;
+import com.nokia.trace.dictionary.model.DictionaryContentHandler;
+
+/**
+ * Interface DictionaryHandler
+ * 
+ */
+public interface DictionaryHandler {
+
+	/**
+	 * Gets the name of the handler, same as tag in decode file
+	 * 
+	 * @return the handler name
+	 */
+	public String getName();
+
+	/**
+	 * Processes start element
+	 * 
+	 * @param atts
+	 *            attributes
+	 * @param handler
+	 *            reference to content handler
+	 */
+	public void processStartElement(Attributes atts,
+			DictionaryContentHandler handler);
+
+	/**
+	 * Processes end element
+	 * 
+	 * @param elementContent
+	 *            elements contents
+	 * @param unFinishedObject
+	 *            unfinished object
+	 * @param handler
+	 *            dictionary content handler
+	 * @param parentObject
+	 *            parent decode object
+	 */
+	public void processEndElement(StringBuffer elementContent,
+			Object unFinishedObject, DictionaryContentHandler handler,
+			DecodeObject parentObject);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/handlers/DictionaryHandlerCreator.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,140 @@
+/*
+ * 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:
+ *
+ * Handler creator
+ *
+ */
+package com.nokia.trace.dictionary.model.handlers;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+
+import com.nokia.trace.dictionary.model.DictionaryDecodeModel;
+
+/**
+ * Creates Dictionary handlers
+ * 
+ */
+public class DictionaryHandlerCreator {
+
+	/**
+	 * Model
+	 */
+	private DictionaryDecodeModel model;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            the model
+	 */
+	public DictionaryHandlerCreator(DictionaryDecodeModel model) {
+		this.model = model;
+	}
+
+	/**
+	 * Creates start handlers and puts them into this array
+	 * 
+	 * @return arrayList of start handlers
+	 */
+	public ArrayList<DictionaryHandler> createStartHandlers() {
+		ArrayList<DictionaryHandler> handlers = new ArrayList<DictionaryHandler>();
+
+		// Add start handlers. Handlers that are commented out have no use in
+		// this time. In the future, they can be commented in and implemented
+
+		handlers.add(new ComponentHandler(model));
+		// handlers.add(new DataHandler(model));
+		handlers.add(new DefHandler(model));
+		// handlers.add(new ExternalDefHandler(model));
+		handlers.add(new FileHandler(model));
+		handlers.add(new GroupHandler(model));
+		handlers.add(new InstanceHandler(model));
+		// handlers.add(new LocationsHandler(model));
+		// handlers.add(new MetaDataHandler(model));
+		handlers.add(new ObjectHandler(model));
+		handlers.add(new OptionsHandler(model));
+		handlers.add(new PathHandler(model));
+		handlers.add(new TraceHandler(model));
+		// handlers.add(new TraceDictionaryHandler(model));
+		// handlers.add(new TypeDefHandler(model));
+		handlers.add(new TypeMemberHandler(model));
+
+		// Sort and return the handlers
+		sortHandlers(handlers);
+		return handlers;
+	}
+
+	/**
+	 * Creates end handlers and puts them into this array
+	 * 
+	 * @return arrayList of end handlers
+	 */
+	public ArrayList<DictionaryHandler> createEndHandlers() {
+		ArrayList<DictionaryHandler> handlers = new ArrayList<DictionaryHandler>();
+
+		// Add end handlers. Handlers that are commented out have no use in this
+		// time. In the future, they can be commented in if they need to
+		// implement processEndElement function.
+
+		handlers.add(new ComponentHandler(model));
+		// handlers.add(new DataHandler(model));
+		handlers.add(new DefHandler(model));
+		// handlers.add(new ExternalDefHandler(model));
+		handlers.add(new FileHandler(model));
+		handlers.add(new GroupHandler(model));
+		handlers.add(new InstanceHandler(model));
+		// handlers.add(new LocationsHandler(model));
+		// handlers.add(new MetaDataHandler(model));
+		// handlers.add(new ObjectHandler(model));
+		handlers.add(new OptionsHandler(model));
+		// handlers.add(new PathHandler(model));
+		handlers.add(new TraceHandler(model));
+		// handlers.add(new TraceDictionaryHandler(model));
+		// handlers.add(new TypeDefHandler(model));
+		// handlers.add(new TypeMemberHandler(model));
+
+		// Sort and return the handlers
+		sortHandlers(handlers);
+		return handlers;
+	}
+
+	/**
+	 * Sorts the handlers by the name attribute
+	 * 
+	 * @param handlers
+	 *            the dictionary handlers
+	 */
+	public void sortHandlers(ArrayList<DictionaryHandler> handlers) {
+		Collections.sort(handlers, new Comparator<DictionaryHandler>() {
+
+			/**
+			 * Compares two handler names
+			 * 
+			 * @param o1
+			 *            first handler
+			 * @param o2
+			 *            second handler
+			 * @return less than zero if first one is first in alphabetic order.
+			 *         More than zero if second is first.
+			 */
+			public int compare(DictionaryHandler o1, DictionaryHandler o2) {
+				int val = o1.getName().compareTo(o2.getName());
+				return val;
+			}
+		});
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/handlers/ExternalDefHandler.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,58 @@
+/*
+ * 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:
+ *
+ * External-def handler
+ *
+ */
+package com.nokia.trace.dictionary.model.handlers;
+
+import org.xml.sax.Attributes;
+
+import com.nokia.trace.dictionary.model.DictionaryContentHandler;
+import com.nokia.trace.dictionary.model.DictionaryDecodeModel;
+
+/**
+ * External-def handler
+ * 
+ */
+final class ExternalDefHandler extends BaseHandler {
+
+	/**
+	 * Tag name this handler handles
+	 */
+	private static final String EXTERNALDEF_TAG = "external-def"; //$NON-NLS-1$
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            the model
+	 */
+	ExternalDefHandler(DictionaryDecodeModel model) {
+		super(model, EXTERNALDEF_TAG);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.trace.dictionary.model.handlers.DictionaryHandler#
+	 * processElement(org.xml.sax.Attributes)
+	 */
+	@Override
+	public void processStartElement(Attributes atts,
+			DictionaryContentHandler handler) {
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/handlers/FileHandler.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,87 @@
+/*
+ * 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:
+ *
+ * File handler
+ *
+ */
+package com.nokia.trace.dictionary.model.handlers;
+
+import org.xml.sax.Attributes;
+
+import com.nokia.trace.dictionary.model.DecodeObject;
+import com.nokia.trace.dictionary.model.DictionaryContentHandler;
+import com.nokia.trace.dictionary.model.DictionaryDecodeModel;
+import com.nokia.trace.dictionary.model.Location;
+
+/**
+ * File handler
+ * 
+ */
+final class FileHandler extends BaseHandler {
+
+	/**
+	 * Tag name this handler handles
+	 */
+	private static final String FILE_TAG = "file"; //$NON-NLS-1$
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            the model
+	 */
+	FileHandler(DictionaryDecodeModel model) {
+		super(model, FILE_TAG);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.trace.dictionary.model.handlers.BaseHandler#processStartElement
+	 * (org.xml.sax.Attributes,
+	 * com.nokia.trace.dictionary.model.DictionaryContentHandler)
+	 */
+	@Override
+	public void processStartElement(Attributes atts,
+			DictionaryContentHandler handler) {
+
+		// Create new location object. Value will be set in EndElement
+		Location location = new Location(Integer.parseInt(atts.getValue(ID)),
+				handler.getVariables().getPreviousPath(), null);
+		handler.catchElementContents(location);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.trace.dictionary.model.handlers.BaseHandler#processEndElement
+	 * (java.lang.StringBuffer, java.lang.Object,
+	 * com.nokia.trace.dictionary.model.DictionaryContentHandler,
+	 * com.nokia.trace.dictionary.model.DecodeObject)
+	 */
+	@Override
+	public void processEndElement(StringBuffer elementContent,
+			Object unFinishedObject, DictionaryContentHandler handler,
+			DecodeObject parentObject) {
+		Location location = (Location) unFinishedObject;
+		location.setFilename(elementContent.toString());
+
+		// Add to the model
+		model.addLocation(location);
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/handlers/GroupHandler.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,161 @@
+/*
+ * 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:
+ *
+ * Group handler
+ *
+ */
+package com.nokia.trace.dictionary.model.handlers;
+
+import org.xml.sax.Attributes;
+
+import com.nokia.trace.dictionary.TraceDictionaryEngine;
+import com.nokia.trace.dictionary.model.DecodeObject;
+import com.nokia.trace.dictionary.model.DictionaryContentHandler;
+import com.nokia.trace.dictionary.model.DictionaryDecodeModel;
+import com.nokia.trace.dictionary.model.TraceComponent;
+import com.nokia.trace.dictionary.model.TraceGroup;
+import com.nokia.trace.dictionary.model.DictionaryContentVariables.ParentDecodeObject;
+import com.nokia.trace.eventrouter.TraceEvent;
+
+/**
+ * Group handler
+ */
+final class GroupHandler extends BaseHandler {
+
+	/**
+	 * Tag name this handler handles
+	 */
+	private static final String GROUP_TAG = "group"; //$NON-NLS-1$
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            the model
+	 */
+	GroupHandler(DictionaryDecodeModel model) {
+		super(model, GROUP_TAG);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.trace.dictionary.model.handlers.BaseHandler#processStartElement
+	 * (org.xml.sax.Attributes,
+	 * com.nokia.trace.dictionary.model.DictionaryContentHandler)
+	 */
+	@Override
+	public void processStartElement(Attributes atts,
+			DictionaryContentHandler handler) {
+
+		// Get parent component
+		TraceComponent parentComponent = handler.getVariables()
+				.getPreviousComponent();
+
+		// Create new group
+		TraceGroup group = model.getFactory().createTraceGroup(
+				Integer.parseInt(atts.getValue(ID)), atts.getValue(NAME),
+				atts.getValue(PREFIX), atts.getValue(SUFFIX), parentComponent);
+
+		// Add group to the component
+		TraceGroup oldGroup = parentComponent.addGroup(group);
+
+		// Check collision
+		group = checkCollision(oldGroup, group, handler);
+
+		// Set this group as the previous group and decode object
+		handler.getVariables().setPreviousGroup(group);
+		handler.getVariables().setParentDecodeObject(ParentDecodeObject.GROUP);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.trace.dictionary.model.handlers.BaseHandler#processEndElement
+	 * (java.lang.StringBuffer, java.lang.Object,
+	 * com.nokia.trace.dictionary.model.DictionaryContentHandler,
+	 * com.nokia.trace.dictionary.model.DecodeObject)
+	 */
+	@Override
+	public void processEndElement(StringBuffer elementContent,
+			Object unFinishedObject, DictionaryContentHandler handler,
+			DecodeObject parentObject) {
+		// Parent decode object is set back to component
+		handler.getVariables().setParentDecodeObject(
+				ParentDecodeObject.COMPONENT);
+	}
+
+	/**
+	 * Check collision
+	 * 
+	 * @param oldGroup
+	 *            old group
+	 * @param newGroup
+	 *            new group
+	 * @param handler
+	 *            dictionary content handler
+	 * @return old group if there was collision, new group if not
+	 */
+	private TraceGroup checkCollision(TraceGroup oldGroup, TraceGroup newGroup,
+			DictionaryContentHandler handler) {
+		boolean collision = true;
+		// If old group is null, everything is OK. If not, check collision
+		if (oldGroup != null) {
+			// Classes must be same
+			if (oldGroup.getClass() == newGroup.getClass()) {
+				// Names must be same
+				if (oldGroup.getName().equals(newGroup.getName())) {
+					// Prefixes must be same
+					String prefix = oldGroup.getPrefix();
+					String prefix2 = newGroup.getPrefix();
+					if (prefix == null) {
+						prefix = ""; //$NON-NLS-1$
+					}
+					if (prefix2 == null) {
+						prefix2 = ""; //$NON-NLS-1$
+					}
+					if (prefix.equals(prefix2)) {
+						// Suffixes must be same
+						String suffix = oldGroup.getSuffix();
+						String suffix2 = newGroup.getSuffix();
+						if (suffix == null) {
+							suffix = ""; //$NON-NLS-1$
+						}
+						if (suffix2 == null) {
+							suffix2 = ""; //$NON-NLS-1$
+						}
+						if (suffix.equals(suffix2)) {
+							collision = false;
+						}
+					}
+				}
+			}
+			if (collision) {
+				newGroup = oldGroup;
+				TraceEvent event = new TraceEvent(TraceEvent.WARNING, Messages
+						.getString("GroupHandler.CollisionGroupID") //$NON-NLS-1$
+						+ Integer.toHexString(oldGroup.getId()));
+				event.setCategory(EVENT_CATEGORY);
+				event.setSource(Integer.valueOf(handler.getLocator()
+						.getLineNumber()));
+				TraceDictionaryEngine.postEvent(event);
+			}
+		}
+		return newGroup;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/handlers/InstanceHandler.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,181 @@
+/*
+ * 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:
+ *
+ * Instance handler
+ *
+ */
+package com.nokia.trace.dictionary.model.handlers;
+
+import org.xml.sax.Attributes;
+
+import com.nokia.trace.dictionary.TraceDictionaryEngine;
+import com.nokia.trace.dictionary.model.DecodeObject;
+import com.nokia.trace.dictionary.model.DictionaryContentHandler;
+import com.nokia.trace.dictionary.model.DictionaryContentVariables;
+import com.nokia.trace.dictionary.model.DictionaryDecodeModel;
+import com.nokia.trace.dictionary.model.Location;
+import com.nokia.trace.dictionary.model.Trace;
+import com.nokia.trace.dictionary.model.TraceData;
+import com.nokia.trace.dictionary.model.TraceGroup;
+import com.nokia.trace.dictionary.model.DictionaryContentVariables.ParentDecodeObject;
+import com.nokia.trace.eventrouter.TraceEvent;
+
+/**
+ * Instance handler
+ */
+final class InstanceHandler extends BaseHandler {
+
+	/**
+	 * Tag name this handler handles
+	 */
+	private static final String INSTANCE_TAG = "instance"; //$NON-NLS-1$
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            the model
+	 */
+	InstanceHandler(DictionaryDecodeModel model) {
+		super(model, INSTANCE_TAG);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.trace.dictionary.model.handlers.BaseHandler#processStartElement
+	 * (org.xml.sax.Attributes,
+	 * com.nokia.trace.dictionary.model.DictionaryContentHandler)
+	 */
+	@Override
+	public void processStartElement(Attributes atts,
+			DictionaryContentHandler handler) {
+		DictionaryContentVariables variables = handler.getVariables();
+		// Get parent group
+		TraceGroup parentGroup = variables.getPreviousGroup();
+		// Get this traces data-ref value
+		int dataRef = variables.getPreviousTraceDataRef();
+		// Get this traces name
+		String traceName = variables.getPreviousTraceName();
+		// Get trace data for this data-ref value
+		TraceData traceData = model.getTraceData(dataRef);
+		// Get location for this instance
+		Location location = model.getLocation(Integer.parseInt(atts
+				.getValue(LOCREF)));
+
+		// Create new trace instance
+		Trace trace = model.getFactory().createTrace(
+				Integer.parseInt(atts.getValue(ID)), traceName, traceData,
+				location, Integer.parseInt(atts.getValue(LINE)),
+				atts.getValue(METHODNAME), atts.getValue(CLASSNAME),
+				parentGroup);
+
+		// Add trace to the group
+		Trace oldTrace = parentGroup.addTrace(trace);
+
+		// Check collision
+		trace = checkCollision(oldTrace, trace, handler);
+
+		// Set this trace to be the previous trace instance and decode object
+		variables.setPreviousTrace(trace);
+		variables.setParentDecodeObject(ParentDecodeObject.TRACEINSTANCE);
+
+		// Add trace to the trace instance list
+		if (oldTrace != trace) {
+			variables.getTraceInstanceList().addTrace(trace);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.trace.dictionary.model.handlers.BaseHandler#processEndElement
+	 * (java.lang.StringBuffer, java.lang.Object,
+	 * com.nokia.trace.dictionary.model.DictionaryContentHandler,
+	 * com.nokia.trace.dictionary.model.DecodeObject)
+	 */
+	@Override
+	public void processEndElement(StringBuffer elementContent,
+			Object unFinishedObject, DictionaryContentHandler handler,
+			DecodeObject parentObject) {
+		// Parent decode object is set back to trace
+		handler.getVariables().setParentDecodeObject(ParentDecodeObject.TRACE);
+	}
+
+	/**
+	 * Check collision
+	 * 
+	 * @param oldTrace
+	 *            old trace
+	 * @param newTrace
+	 *            new trace
+	 * @param handler
+	 *            dictionary content handler
+	 * @return the trace which caused the collision or null if everything is OK
+	 */
+	private Trace checkCollision(Trace oldTrace, Trace newTrace,
+			DictionaryContentHandler handler) {
+		boolean collision = true;
+		// If old trace is null, everything is ok. If not, check collision
+		if (oldTrace != null) {
+			// Trace data must be the same
+			if (oldTrace.getTraceData() == newTrace.getTraceData()) {
+				// Locations must be same
+				if (oldTrace.getLocation() == newTrace.getLocation()) {
+					// Line numbers must be same
+					if (oldTrace.getLineNumber() == newTrace.getLineNumber()) {
+						// Class names must be same
+						String className = oldTrace.getClassName();
+						String className2 = newTrace.getClassName();
+						if (className == null) {
+							className = ""; //$NON-NLS-1$
+						}
+						if (className2 == null) {
+							className2 = ""; //$NON-NLS-1$
+						}
+						if (className.equals(className2)) {
+							// Method names must be same
+							String methodName = oldTrace.getMethodName();
+							String methodName2 = newTrace.getMethodName();
+							if (methodName == null) {
+								methodName = ""; //$NON-NLS-1$
+							}
+							if (methodName2 == null) {
+								methodName2 = ""; //$NON-NLS-1$
+							}
+							if (methodName.equals(methodName2)) {
+								collision = false;
+							}
+						}
+					}
+				}
+			}
+			if (collision) {
+				newTrace = oldTrace;
+				TraceEvent event = new TraceEvent(TraceEvent.WARNING, Messages
+						.getString("InstanceHandler.CollisionTraceID") //$NON-NLS-1$
+						+ oldTrace.getId());
+				event.setCategory(EVENT_CATEGORY);
+				event.setSource(Integer.valueOf(handler.getLocator()
+						.getLineNumber()));
+				TraceDictionaryEngine.postEvent(event);
+			}
+		}
+		return newTrace;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/handlers/LocationsHandler.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,59 @@
+/*
+ * 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:
+ *
+ * Location handler
+ *
+ */
+package com.nokia.trace.dictionary.model.handlers;
+
+import org.xml.sax.Attributes;
+
+import com.nokia.trace.dictionary.model.DictionaryContentHandler;
+import com.nokia.trace.dictionary.model.DictionaryDecodeModel;
+
+/**
+ * Location handler
+ * 
+ */
+final class LocationsHandler extends BaseHandler {
+
+	/**
+	 * Tag name this handler handles
+	 */
+	private static final String LOCATIONS_TAG = "locations"; //$NON-NLS-1$
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            the model
+	 */
+	LocationsHandler(DictionaryDecodeModel model) {
+		super(model, LOCATIONS_TAG);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.trace.dictionary.model.handlers.DictionaryHandler#
+	 * processElement(org.xml.sax.Attributes)
+	 */
+	@Override
+	public void processStartElement(Attributes atts,
+			DictionaryContentHandler handler) {
+		// Do nothing
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/handlers/Messages.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,63 @@
+/*
+ * 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:
+ *
+ * String localization for model handlers package.
+ *
+ */
+package com.nokia.trace.dictionary.model.handlers;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * String localization for model handlers package.
+ * 
+ */
+class Messages {
+
+	/**
+	 * Bundle name
+	 */
+	private static final String BUNDLE_NAME = "com.nokia.trace.dictionary.model.handlers.messages"; //$NON-NLS-1$
+
+	/**
+	 * Resource bundle
+	 */
+	private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
+			.getBundle(BUNDLE_NAME);
+
+	/**
+	 * Prevents construction.
+	 */
+	private Messages() {
+	}
+
+	/**
+	 * Maps a key to localized string.
+	 * 
+	 * @param key
+	 *            the key for the string
+	 * @return the localized string
+	 */
+	public static String getString(String key) {
+		String value;
+		try {
+			value = RESOURCE_BUNDLE.getString(key);
+		} catch (MissingResourceException e) {
+			value = '!' + key + '!';
+		}
+		return value;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/handlers/MetaDataHandler.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,59 @@
+/*
+ * 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:
+ *
+ * MetaData handler
+ *
+ */
+package com.nokia.trace.dictionary.model.handlers;
+
+import org.xml.sax.Attributes;
+
+import com.nokia.trace.dictionary.model.DictionaryContentHandler;
+import com.nokia.trace.dictionary.model.DictionaryDecodeModel;
+
+/**
+ * MetaData handler
+ * 
+ */
+final class MetaDataHandler extends BaseHandler {
+
+	/**
+	 * Tag name this handler handles
+	 */
+	private static final String METADATA_TAG = "metadata"; //$NON-NLS-1$
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            the model
+	 */
+	MetaDataHandler(DictionaryDecodeModel model) {
+		super(model, METADATA_TAG);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.trace.dictionary.model.handlers.DictionaryHandler#
+	 * processElement(org.xml.sax.Attributes)
+	 */
+	@Override
+	public void processStartElement(Attributes atts,
+			DictionaryContentHandler handler) {
+		// Do nothing
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/handlers/ObjectHandler.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,246 @@
+/*
+ * 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:
+ *
+ * Object handler
+ *
+ */
+package com.nokia.trace.dictionary.model.handlers;
+
+import org.xml.sax.Attributes;
+
+import com.nokia.trace.dictionary.TraceDictionaryEngine;
+import com.nokia.trace.dictionary.model.DictionaryContentHandler;
+import com.nokia.trace.dictionary.model.DictionaryDecodeModel;
+import com.nokia.trace.dictionary.model.decodeparameters.BinaryParameter;
+import com.nokia.trace.dictionary.model.decodeparameters.CompoundParameter;
+import com.nokia.trace.dictionary.model.decodeparameters.DecodeParameter;
+import com.nokia.trace.dictionary.model.decodeparameters.EnumParameter;
+import com.nokia.trace.dictionary.model.decodeparameters.FloatParameter;
+import com.nokia.trace.dictionary.model.decodeparameters.HexParameter;
+import com.nokia.trace.dictionary.model.decodeparameters.IntegerParameter;
+import com.nokia.trace.dictionary.model.decodeparameters.OctalParameter;
+import com.nokia.trace.dictionary.model.decodeparameters.RawParameter;
+import com.nokia.trace.dictionary.model.decodeparameters.StringParameter;
+import com.nokia.trace.eventrouter.TraceEvent;
+
+/**
+ * Object handler
+ */
+final class ObjectHandler extends BaseHandler {
+
+	/**
+	 * Tag name this handler handles
+	 */
+	private static final String OBJECT_TAG = "object"; //$NON-NLS-1$
+
+	/**
+	 * String type
+	 */
+	private static final String STRING = "string"; //$NON-NLS-1$
+
+	/**
+	 * Integer type
+	 */
+	private static final String INTEGER = "integer"; //$NON-NLS-1$
+
+	/**
+	 * Float type
+	 */
+	private static final String FLOAT = "float"; //$NON-NLS-1$
+
+	/**
+	 * Hex type
+	 */
+	private static final String HEX = "hex"; //$NON-NLS-1$
+
+	/**
+	 * Binary type
+	 */
+	private static final String BINARY = "binary"; //$NON-NLS-1$
+
+	/**
+	 * Octal type
+	 */
+	private static final String OCTAL = "octal"; //$NON-NLS-1$
+
+	/**
+	 * Enum type
+	 */
+	private static final String ENUM = "enum"; //$NON-NLS-1$
+
+	/**
+	 * Raw type
+	 */
+	private static final String RAW = "raw"; //$NON-NLS-1$
+
+	/**
+	 * Compound type
+	 */
+	private static final String COMPOUND = "compound"; //$NON-NLS-1$
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            the model
+	 */
+	ObjectHandler(DictionaryDecodeModel model) {
+		super(model, OBJECT_TAG);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.trace.dictionary.model.handlers.BaseHandler#processStartElement
+	 * (org.xml.sax.Attributes,
+	 * com.nokia.trace.dictionary.model.DictionaryContentHandler)
+	 */
+	@Override
+	public void processStartElement(Attributes atts,
+			DictionaryContentHandler handler) {
+		StringBuffer typeString = new StringBuffer();
+		String type = atts.getValue(TYPE);
+		typeString.append(type);
+
+		// Add these brackets around the type
+		typeString.insert(0, START_BRACKET);
+		typeString.append(END_BRACKET);
+
+		DecodeParameter newParameter = null;
+		DecodeParameter newFormatCharParameter = null;
+
+		String classification = atts.getValue(CLASSIFICATION);
+		String formatChar = atts.getValue(FORMATCHAR);
+		int size = Integer.parseInt(atts.getValue(SIZE));
+
+		// String
+		if (classification.equals(STRING)) {
+			newParameter = new StringParameter(typeString.toString(), false,
+					size);
+			if (formatChar != null) {
+				newFormatCharParameter = new StringParameter(formatChar, false,
+						size);
+			}
+			// Integer
+		} else if (classification.equals(INTEGER)) {
+			newParameter = new IntegerParameter(typeString.toString(), false,
+					size, true); // Always signed
+			if (formatChar != null) {
+				newFormatCharParameter = new IntegerParameter(formatChar,
+						false, size, true);
+			}
+			// Float
+		} else if (classification.equals(FLOAT)) {
+			newParameter = new FloatParameter(typeString.toString(), false,
+					size, true); // Always signed
+			if (formatChar != null) {
+				newFormatCharParameter = new FloatParameter(formatChar, false,
+						size, true);
+			}
+			// Hex
+		} else if (classification.equals(HEX)) {
+			newParameter = new HexParameter(typeString.toString(), false, size);
+			if (formatChar != null) {
+				newFormatCharParameter = new HexParameter(formatChar, false,
+						size);
+
+				// Set to be printed in upper case letters
+				if (formatChar.indexOf('X') != -1) {
+					((HexParameter) newFormatCharParameter)
+							.setPrintInUpperCase(true);
+				}
+			}
+			// Binary
+		} else if (classification.equals(BINARY)) {
+			newParameter = new BinaryParameter(typeString.toString(), false,
+					size);
+			if (formatChar != null) {
+				newFormatCharParameter = new BinaryParameter(formatChar, false,
+						size);
+			}
+			// Octal
+		} else if (classification.equals(OCTAL)) {
+			newParameter = new OctalParameter(typeString.toString(), false,
+					size);
+			if (formatChar != null) {
+				newFormatCharParameter = new OctalParameter(formatChar, false,
+						size);
+			}
+			// Enum
+		} else if (classification.equals(ENUM)) {
+			newParameter = new EnumParameter(typeString.toString(), false, size);
+			handler.getVariables().setPreviousEnumParameter(
+					(EnumParameter) newParameter);
+			// Raw
+		} else if (classification.equals(RAW)) {
+			newParameter = new RawParameter(typeString.toString(), false);
+			if (formatChar != null) {
+				newFormatCharParameter = new RawParameter(formatChar, false);
+			}
+			// Compound
+		} else if (classification.equals(COMPOUND)) {
+			newParameter = new CompoundParameter(typeString.toString(), false);
+			handler.getVariables().setPreviousCompoundParameter(
+					(CompoundParameter) newParameter);
+		}
+
+		// Add to the model
+		DecodeParameter oldParameter = model.addDecodeParameter(newParameter);
+		checkCollision(oldParameter, newParameter, handler);
+		if (newFormatCharParameter != null) {
+			DecodeParameter oldParameter2 = model
+					.addDecodeParameter(newFormatCharParameter);
+			checkCollision(oldParameter2, newFormatCharParameter, handler);
+		}
+	}
+
+	/**
+	 * Checks that new decode parameter didn't collide with old one
+	 * 
+	 * @param oldParameter
+	 *            old parameter
+	 * @param newParameter
+	 *            new parameter
+	 * @param handler
+	 *            dictionary content handler
+	 */
+	private void checkCollision(DecodeParameter oldParameter,
+			DecodeParameter newParameter, DictionaryContentHandler handler) {
+		boolean collision = true;
+		// If old parameter is null, everyrything is ok. If not, check collision
+		if (oldParameter != null) {
+			// Classes must be same
+			if (oldParameter.getClass() == newParameter.getClass()) {
+				// Types must be same
+				if (oldParameter.getType().equals(newParameter.getType())) {
+					// Sizes must be same
+					if (oldParameter.getSize() == newParameter.getSize()) {
+						collision = false;
+					}
+				}
+			}
+			if (collision) {
+				TraceEvent event = new TraceEvent(TraceEvent.WARNING, Messages
+						.getString("ObjectHandler.CollisionParameter") //$NON-NLS-1$
+						+ oldParameter.getType());
+				event.setCategory(EVENT_CATEGORY);
+				event.setSource(Integer.valueOf(handler.getLocator()
+						.getLineNumber()));
+				TraceDictionaryEngine.postEvent(event);
+			}
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/handlers/OptionsHandler.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,78 @@
+/*
+ * 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:
+ *
+ * Options handler
+ *
+ */
+package com.nokia.trace.dictionary.model.handlers;
+
+import org.xml.sax.Attributes;
+
+import com.nokia.trace.dictionary.model.DecodeObject;
+import com.nokia.trace.dictionary.model.DictionaryContentHandler;
+import com.nokia.trace.dictionary.model.DictionaryDecodeModel;
+
+/**
+ * Options handler
+ * 
+ */
+final class OptionsHandler extends BaseHandler {
+
+	/**
+	 * Tag name this handler handles
+	 */
+	private static final String OPTIONS_TAG = "options"; //$NON-NLS-1$
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            the model
+	 */
+	OptionsHandler(DictionaryDecodeModel model) {
+		super(model, OPTIONS_TAG);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.trace.dictionary.model.handlers.BaseHandler#processStartElement
+	 * (org.xml.sax.Attributes,
+	 * com.nokia.trace.dictionary.model.DictionaryContentHandler)
+	 */
+	@Override
+	public void processStartElement(Attributes atts,
+			DictionaryContentHandler handler) {
+		handler.getVariables().setInsideMetadataBlock(true);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.trace.dictionary.model.handlers.BaseHandler#processEndElement
+	 * (java.lang.StringBuffer, java.lang.Object,
+	 * com.nokia.trace.dictionary.model.DictionaryContentHandler,
+	 * com.nokia.trace.dictionary.model.DecodeObject)
+	 */
+	@Override
+	public void processEndElement(StringBuffer elementContent,
+			Object unFinishedObject, DictionaryContentHandler handler,
+			DecodeObject parentObject) {
+		handler.getVariables().setInsideMetadataBlock(false);
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/handlers/PathHandler.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,63 @@
+/*
+ * 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:
+ *
+ * Path handler
+ *
+ */
+package com.nokia.trace.dictionary.model.handlers;
+
+import org.xml.sax.Attributes;
+
+import com.nokia.trace.dictionary.model.DictionaryContentHandler;
+import com.nokia.trace.dictionary.model.DictionaryDecodeModel;
+import com.nokia.trace.dictionary.model.Path;
+
+/**
+ * Path handler
+ * 
+ */
+final class PathHandler extends BaseHandler {
+
+	/**
+	 * Tag name this handler handles
+	 */
+	private static final String PATH_TAG = "path"; //$NON-NLS-1$
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            the model
+	 */
+	PathHandler(DictionaryDecodeModel model) {
+		super(model, PATH_TAG);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.trace.dictionary.model.handlers.DictionaryHandler#
+	 * processElement(org.xml.sax.Attributes)
+	 */
+	@Override
+	public void processStartElement(Attributes atts,
+			DictionaryContentHandler handler) {
+		Path path = new Path(atts.getValue(VAL));
+
+		// Set as previous path object so that file objects can refer to it
+		handler.getVariables().setPreviousPath(path);
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/handlers/TraceDictionaryHandler.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,59 @@
+/*
+ * 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:
+ *
+ * TraceDictionary handler
+ *
+ */
+package com.nokia.trace.dictionary.model.handlers;
+
+import org.xml.sax.Attributes;
+
+import com.nokia.trace.dictionary.model.DictionaryContentHandler;
+import com.nokia.trace.dictionary.model.DictionaryDecodeModel;
+
+/**
+ * TraceDictionary handler
+ * 
+ */
+final class TraceDictionaryHandler extends BaseHandler {
+
+	/**
+	 * Tag name this handler handles
+	 */
+	private static final String TRACEDICTIONARY_TAG = "tracedictionary"; //$NON-NLS-1$
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            the model
+	 */
+	TraceDictionaryHandler(DictionaryDecodeModel model) {
+		super(model, TRACEDICTIONARY_TAG);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.trace.dictionary.model.handlers.DictionaryHandler#
+	 * processElement(org.xml.sax.Attributes)
+	 */
+	@Override
+	public void processStartElement(Attributes atts,
+			DictionaryContentHandler handler) {
+		// Do nothing
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/handlers/TraceHandler.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,93 @@
+/*
+ * 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:
+ *
+ * Trace handler
+ *
+ */
+package com.nokia.trace.dictionary.model.handlers;
+
+import org.xml.sax.Attributes;
+
+import com.nokia.trace.dictionary.model.DecodeObject;
+import com.nokia.trace.dictionary.model.DictionaryContentHandler;
+import com.nokia.trace.dictionary.model.DictionaryContentVariables;
+import com.nokia.trace.dictionary.model.DictionaryDecodeModel;
+import com.nokia.trace.dictionary.model.TraceInstanceList;
+import com.nokia.trace.dictionary.model.DictionaryContentVariables.ParentDecodeObject;
+
+/**
+ * Trace handler
+ * 
+ */
+final class TraceHandler extends BaseHandler {
+
+	/**
+	 * Tag name this handler handles
+	 */
+	private static final String TRACE_TAG = "trace"; //$NON-NLS-1$
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            the model
+	 */
+	TraceHandler(DictionaryDecodeModel model) {
+		super(model, TRACE_TAG);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.trace.dictionary.model.handlers.DictionaryHandler#
+	 * processElement(org.xml.sax.Attributes)
+	 */
+	@Override
+	public void processStartElement(Attributes atts,
+			DictionaryContentHandler handler) {
+
+		DictionaryContentVariables variables = handler.getVariables();
+
+		// Save the data-ref value to variables
+		variables.setPreviousTraceDataRef(Integer.parseInt(atts
+				.getValue(DATAREF)));
+		variables.setTraceInstanceList(new TraceInstanceList(0, "allthesame")); //$NON-NLS-1$
+		variables.setParentDecodeObject(ParentDecodeObject.TRACE);
+
+		// Save trace name to variables
+		variables.setPreviousTraceName(atts.getValue(NAME));
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.trace.dictionary.model.handlers.BaseHandler#processEndElement
+	 * (java.lang.StringBuffer, java.lang.Object,
+	 * com.nokia.trace.dictionary.model.DictionaryContentHandler,
+	 * com.nokia.trace.dictionary.model.DecodeObject)
+	 */
+	@Override
+	public void processEndElement(StringBuffer elementContent,
+			Object unFinishedObject, DictionaryContentHandler handler,
+			DecodeObject parentObject) {
+		DictionaryContentVariables variables = handler.getVariables();
+
+		// Set metadata to traces and remove the list afterwards
+		variables.getTraceInstanceList().setMetadataToTraces();
+		variables.setTraceInstanceList(null);
+		variables.setParentDecodeObject(ParentDecodeObject.GROUP);
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/handlers/TypeDefHandler.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,59 @@
+/*
+ * 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:
+ *
+ * TypeDef handler
+ *
+ */
+package com.nokia.trace.dictionary.model.handlers;
+
+import org.xml.sax.Attributes;
+
+import com.nokia.trace.dictionary.model.DictionaryContentHandler;
+import com.nokia.trace.dictionary.model.DictionaryDecodeModel;
+
+/**
+ * TypeDef handler
+ * 
+ */
+final class TypeDefHandler extends BaseHandler {
+
+	/**
+	 * Tag name this handler handles
+	 */
+	private static final String TYPEDEF_TAG = "typedef"; //$NON-NLS-1$
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            the model
+	 */
+	TypeDefHandler(DictionaryDecodeModel model) {
+		super(model, TYPEDEF_TAG);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.trace.dictionary.model.handlers.DictionaryHandler#
+	 * processElement(org.xml.sax.Attributes)
+	 */
+	@Override
+	public void processStartElement(Attributes atts,
+			DictionaryContentHandler handler) {
+		// Do nothing
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/handlers/TypeMemberHandler.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,97 @@
+/*
+ * 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:
+ *
+ * TypeMember handler
+ *
+ */
+package com.nokia.trace.dictionary.model.handlers;
+
+import org.xml.sax.Attributes;
+
+import com.nokia.trace.dictionary.TraceDictionaryEngine;
+import com.nokia.trace.dictionary.model.DictionaryContentHandler;
+import com.nokia.trace.dictionary.model.DictionaryDecodeModel;
+import com.nokia.trace.dictionary.model.decodeparameters.CompoundParameter;
+import com.nokia.trace.dictionary.model.decodeparameters.DecodeParameter;
+import com.nokia.trace.dictionary.model.decodeparameters.EnumMember;
+import com.nokia.trace.dictionary.model.decodeparameters.EnumParameter;
+import com.nokia.trace.eventrouter.TraceEvent;
+
+/**
+ * TypeMember handler
+ */
+final class TypeMemberHandler extends BaseHandler {
+
+	/**
+	 * Tag name this handler handles
+	 */
+	private static final String TYPEMEMBER_TAG = "typemember"; //$NON-NLS-1$
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 *            the model
+	 */
+	TypeMemberHandler(DictionaryDecodeModel model) {
+		super(model, TYPEMEMBER_TAG);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.trace.dictionary.model.handlers.BaseHandler#processStartElement
+	 * (org.xml.sax.Attributes,
+	 * com.nokia.trace.dictionary.model.DictionaryContentHandler)
+	 */
+	@Override
+	public void processStartElement(Attributes atts,
+			DictionaryContentHandler handler) {
+		// Check are we doing enum or compound
+		if (atts.getValue(VALUE) != null) {
+			// Get the previous enum parameter
+			EnumParameter prevEnum = handler.getVariables()
+					.getPreviousEnumParameter();
+
+			// Create new enum member
+			EnumMember enumMember = new EnumMember(atts.getValue(NAME), Integer
+					.parseInt(atts.getValue(VALUE)));
+
+			// Add to enum parameter
+			prevEnum.addMember(enumMember);
+
+		} else if (atts.getValue(TYPE) != null) {
+			// Get the parameter from model
+			DecodeParameter parameter = model.getDecodeParameter(atts
+					.getValue(TYPE));
+
+			// Get the previous compoundParameter
+			CompoundParameter prevCompound = handler.getVariables()
+					.getPreviousCompoundParameter();
+
+			// Add parameter and it's name to compoundParameter
+			prevCompound.addParameter(parameter, atts.getValue(NAME));
+
+		} else {
+			TraceEvent event = new TraceEvent(TraceEvent.ERROR, Messages
+					.getString("TypeMemberHandler.WrongTypeMember")); //$NON-NLS-1$
+			event.setCategory(EVENT_CATEGORY);
+			event.setSource(Integer.valueOf(handler.getLocator()
+					.getLineNumber()));
+			TraceDictionaryEngine.postEvent(event);
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/handlers/messages.properties	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,7 @@
+ComponentHandler.CollisionComponentID=Collision while creating decode model with component ID 0x
+DefHandler.ParameterNotFoundMsg=Couldn't find parameter 
+DictionaryFileConstants.EventCategory=Dictionary Parser
+GroupHandler.CollisionGroupID=Collision while creating decode model with group ID 0x
+InstanceHandler.CollisionTraceID=Collision while creating decode model with trace ID 
+ObjectHandler.CollisionParameter=Collision while creating decode model with parameter 
+TypeMemberHandler.WrongTypeMember=Type member has to be either enum or compound\!
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/handlers/package.html	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,3 @@
+<html><body>
+Handlers for dictionary XML parser
+</body></html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/messages.properties	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,1 @@
+DictionaryModelBuilder.FileSkipped=File extension is not .xml so the file is skipped.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/model/package.html	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,3 @@
+<html><body>
+Dictionary model represents the dictionary XML files
+</body></html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.dictionary/src/com/nokia/trace/dictionary/package.html	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,3 @@
+<html><body>
+Dictionary engine provides access to encoder and decoder
+</body></html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.eventrouter/.classpath	Wed Jun 23 14:49:59 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/traceviewer/com.nokia.trace.eventrouter/.settings/org.eclipse.jdt.core.prefs	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,2 @@
+#Wed Mar 14 17:24:05 EET 2007
+org.eclipse.jdt.core.compiler.source=1.5
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.eventrouter/META-INF/MANIFEST.MF	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Trace Event Router Plug-in
+Bundle-SymbolicName: com.nokia.trace.eventrouter;singleton:=true
+Bundle-Version: 2.6.0
+Bundle-Activator: com.nokia.trace.eventrouter.Activator
+Bundle-Vendor: Nokia
+Require-Bundle: org.eclipse.core.runtime
+Bundle-ActivationPolicy: lazy
+Export-Package: com.nokia.trace.eventrouter
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.eventrouter/about.html	Wed Jun 23 14:49:59 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 &copy; 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/traceviewer/com.nokia.trace.eventrouter/build.properties	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .,\
+               about.html
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.eventrouter/src/com/nokia/trace/eventrouter/Activator.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,79 @@
+/*
+ * 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:
+ *
+ * Plug-in main class
+ *
+ */
+package com.nokia.trace.eventrouter;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ * 
+ */
+public class Activator extends Plugin {
+
+	/**
+	 * The plug-in ID
+	 */
+	public static final String PLUGIN_ID = "com.nokia.trace.eventrouter"; //$NON-NLS-1$
+
+	/**
+	 * The shared instance
+	 */
+	private static Activator plugin;
+
+	/**
+	 * The constructor
+	 */
+	public Activator() {
+		plugin = this;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+	 */
+	@Override
+	public void start(BundleContext context) throws Exception {
+		super.start(context);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+	 */
+	@Override
+	public void stop(BundleContext context) throws Exception {
+		plugin = null;
+		super.stop(context);
+	}
+
+	/**
+	 * Returns the shared instance
+	 * 
+	 * @return the shared instance
+	 */
+	public static Activator getDefault() {
+		return plugin;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.eventrouter/src/com/nokia/trace/eventrouter/PropertyMap.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,135 @@
+/*
+ * 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:
+ *
+ * Property Map class stores multiple string mappings
+ *
+ */
+package com.nokia.trace.eventrouter;
+
+import java.util.ArrayList;
+
+/**
+ * Property Map class stores multiple string mappings
+ * 
+ */
+public class PropertyMap {
+
+	/**
+	 * ArrayList containing keys
+	 */
+	private ArrayList<String> keys;
+
+	/**
+	 * ArrayList containing values
+	 */
+	private ArrayList<String> values;
+
+	/**
+	 * Constructor
+	 */
+	public PropertyMap() {
+		keys = new ArrayList<String>();
+		values = new ArrayList<String>();
+	}
+
+	/**
+	 * Inserts string pair to the map
+	 * 
+	 * @param key
+	 *            key to insert
+	 * @param value
+	 *            value to insert
+	 */
+	public void put(String key, String value) {
+		keys.add(key);
+		values.add(value);
+	}
+
+	/**
+	 * Gets key from index
+	 * 
+	 * @param index
+	 *            index
+	 * @return key if index is valid, null otherwise
+	 */
+	public String getKey(int index) {
+		String key = null;
+		if (index >= 0 && index < keys.size()) {
+			key = keys.get(index);
+		}
+		return key;
+	}
+
+	/**
+	 * Gets value from index
+	 * 
+	 * @param index
+	 *            index
+	 * @return value if index is valid, null otherwise
+	 */
+	public String get(int index) {
+		String value = null;
+		if (index >= 0 && index < values.size()) {
+			value = values.get(index);
+		}
+		return value;
+	}
+
+	/**
+	 * Gets value with key. If there is more than one value with the same key,
+	 * the first one found from the map is returned
+	 * 
+	 * @param key
+	 *            key
+	 * @return value if key found, null otherwise
+	 */
+	public String get(String key) {
+		String value = null;
+		for (int i = 0; i < keys.size(); i++) {
+			if (keys.get(i).equals(key)) {
+				value = values.get(i);
+				break;
+			}
+		}
+		return value;
+	}
+
+	/**
+	 * Returns the size of the map
+	 * 
+	 * @return size of the map
+	 */
+	public int size() {
+		return keys.size();
+	}
+
+	/**
+	 * Removes a String pair from the map with the key. If there is more than
+	 * one occurrence, only the first one if removed
+	 * 
+	 * @param key
+	 *            key to be removed
+	 */
+	public void remove(String key) {
+		for (int i = 0; i < keys.size(); i++) {
+			if (keys.get(i).equals(key)) {
+				keys.remove(i);
+				values.remove(i);
+				break;
+			}
+		}
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.eventrouter/src/com/nokia/trace/eventrouter/PropertySource.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,123 @@
+/*
+ * 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:
+ *
+ * Property Source has a action name, target, source and a map containing string mappings
+ *
+ */
+package com.nokia.trace.eventrouter;
+
+/**
+ * Property Source has a action name, target, source and a map containing string
+ * mappings
+ * 
+ */
+public class PropertySource {
+
+	/**
+	 * Name for the action what this event should execute. Is used to
+	 * distinguish what properties this event should / can contain.
+	 */
+	private String actionName;
+
+	/**
+	 * Target ID string
+	 */
+	private String targetId;
+
+	/**
+	 * Source ID string
+	 */
+	private String sourceId;
+
+	/**
+	 * Properties map
+	 */
+	private PropertyMap properties;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param actionName
+	 *            action name
+	 * @param targetId
+	 *            target ID String
+	 * @param sourceId
+	 *            source ID String
+	 */
+	public PropertySource(String actionName, String targetId, String sourceId) {
+		this.actionName = actionName;
+		this.targetId = targetId;
+		this.sourceId = sourceId;
+		properties = new PropertyMap();
+	}
+
+	/**
+	 * Constructor without action name
+	 * 
+	 * @param targetId
+	 *            target ID String
+	 * @param sourceId
+	 *            source ID String
+	 */
+	public PropertySource(String targetId, String sourceId) {
+		this("unknown", targetId, sourceId); //$NON-NLS-1$
+	}
+
+	/**
+	 * Gets properties
+	 * 
+	 * @return the properties
+	 */
+	public PropertyMap getProperties() {
+		return properties;
+	}
+
+	/**
+	 * Gets the source ID
+	 * 
+	 * @return the sourceId
+	 */
+	public String getSourceId() {
+		return sourceId;
+	}
+
+	/**
+	 * Gets the target ID
+	 * 
+	 * @return the targetId
+	 */
+	public String getTargetId() {
+		return targetId;
+	}
+
+	/**
+	 * Gets the action name
+	 * 
+	 * @return the action name
+	 */
+	public String getActionName() {
+		return actionName;
+	}
+
+	/**
+	 * Sets the action name
+	 * 
+	 * @param actionName
+	 *            the action name to set
+	 */
+	public void setActionName(String actionName) {
+		this.actionName = actionName;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.eventrouter/src/com/nokia/trace/eventrouter/TraceEvent.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,141 @@
+/*
+ * 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:
+ *
+ * Event
+ *
+ */
+package com.nokia.trace.eventrouter;
+
+/**
+ * Event
+ * 
+ */
+public class TraceEvent {
+
+	/**
+	 * Info event type
+	 */
+	public final static int INFO = 1;
+
+	/**
+	 * Warning event type
+	 */
+	public final static int WARNING = 2;
+
+	/**
+	 * Error event type
+	 */
+	public final static int ERROR = 3;
+
+	/**
+	 * Critical assertion failure event type
+	 */
+	public final static int ASSERT_CRITICAL = 4;
+
+	/**
+	 * Non-critical assertion failure event type
+	 */
+	public final static int ASSERT_NORMAL = 5;
+
+	/**
+	 * Event type
+	 */
+	private int type;
+
+	/**
+	 * Event description
+	 */
+	private String description;
+
+	/**
+	 * Event category
+	 */
+	private String category;
+
+	/**
+	 * Event source object
+	 */
+	private Object source;
+
+	/**
+	 * Creates a new event
+	 * 
+	 * @param type
+	 *            the event type
+	 * @param description
+	 *            the event description
+	 */
+	public TraceEvent(int type, String description) {
+		this.type = type;
+		this.description = description;
+	}
+
+	/**
+	 * Gets the event type
+	 * 
+	 * @return event type
+	 */
+	public int getType() {
+		return type;
+	}
+
+	/**
+	 * Gets the event description
+	 * 
+	 * @return the event description
+	 */
+	public String getDescription() {
+		return description;
+	}
+
+	/**
+	 * Sets the source object
+	 * 
+	 * @param source
+	 *            the source object
+	 */
+	public void setSource(Object source) {
+		this.source = source;
+	}
+
+	/**
+	 * Gets the event source
+	 * 
+	 * @return the event source
+	 */
+	public Object getSource() {
+		return source;
+	}
+
+	/**
+	 * Gets the event category
+	 * 
+	 * @return the category
+	 */
+	public String getCategory() {
+		return category;
+	}
+
+	/**
+	 * Sets the event category
+	 * 
+	 * @param category
+	 *            the category to set
+	 */
+	public void setCategory(String category) {
+		this.category = category;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.eventrouter/src/com/nokia/trace/eventrouter/TraceEventListener.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,35 @@
+/*
+ * 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:
+ *
+ * Event listener
+ *
+ */
+package com.nokia.trace.eventrouter;
+
+/**
+ * Event listener
+ * 
+ */
+public interface TraceEventListener {
+
+	/**
+	 * Processes an event
+	 * 
+	 * @param event
+	 *            the event
+	 */
+	public void processEvent(TraceEvent event);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.eventrouter/src/com/nokia/trace/eventrouter/TraceEventRouter.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,89 @@
+/*
+ * 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:
+ *
+ * Event router main class
+ *
+ */
+package com.nokia.trace.eventrouter;
+
+import java.util.ArrayList;
+
+/**
+ * Event router main class
+ * 
+ */
+public class TraceEventRouter {
+
+	/**
+	 * Event router instance
+	 */
+	private static TraceEventRouter instance;
+
+	/**
+	 * List of listeners
+	 */
+	private ArrayList<TraceEventListener> listeners = new ArrayList<TraceEventListener>();
+
+	/**
+	 * Can only be created via getInstance
+	 */
+	private TraceEventRouter() {
+	}
+
+	/**
+	 * Adds an event listener
+	 * 
+	 * @param listener
+	 *            the event listener
+	 */
+	public void addEventListener(TraceEventListener listener) {
+		listeners.add(listener);
+	}
+
+	/**
+	 * Removes an event listener
+	 * 
+	 * @param listener
+	 *            the event listener
+	 */
+	public void removeEventListener(TraceEventListener listener) {
+		listeners.remove(listener);
+	}
+
+	/**
+	 * Posts an event to listeners
+	 * 
+	 * @param event
+	 *            the event
+	 */
+	public void postEvent(TraceEvent event) {
+		for (int i = 0; i < listeners.size(); i++) {
+			listeners.get(i).processEvent(event);
+		}
+	}
+
+	/**
+	 * Gets the event router instance
+	 * 
+	 * @return the event router
+	 */
+	public static TraceEventRouter getInstance() {
+		if (instance == null) {
+			instance = new TraceEventRouter();
+		}
+		return instance;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.eventrouter/src/com/nokia/trace/eventrouter/package.html	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,3 @@
+<html><body>
+Event router
+</body></html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.eventview/.classpath	Wed Jun 23 14:49:59 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/traceviewer/com.nokia.trace.eventview/.settings/org.eclipse.jdt.core.prefs	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,2 @@
+#Wed Mar 14 17:24:05 EET 2007
+org.eclipse.jdt.core.compiler.source=1.5
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.eventview/META-INF/MANIFEST.MF	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Trace Event View Plug-in
+Bundle-SymbolicName: com.nokia.trace.eventview;singleton:=true
+Bundle-Version: 2.6.0
+Bundle-Activator: com.nokia.trace.eventview.Activator
+Bundle-Vendor: Nokia
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.ui,
+ com.nokia.trace.eventrouter
+Bundle-ActivationPolicy: lazy
+Export-Package: com.nokia.trace.eventview
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.eventview/about.html	Wed Jun 23 14:49:59 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 &copy; 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/traceviewer/com.nokia.trace.eventview/build.properties	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,7 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .,\
+               plugin.xml,\
+               plugin.properties,\
+               about.html
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.eventview/plugin.properties	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,21 @@
+#
+# 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:
+#
+#
+# plugin.properties
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# Plugin properties for Event View
+# This file should be translated.
+traceEventView=Trace Events
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.eventview/plugin.xml	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+  <extension
+    point="org.eclipse.ui.views">
+    <category
+      id="com.nokia.s60tools"
+      name="Carbide Extensions"/>
+    <view
+      category="com.nokia.s60tools"
+      class="com.nokia.trace.eventview.TraceEventView"
+      id="com.nokia.trace.eventview.TraceEventView"
+      name="%traceEventView"/>
+  </extension>
+</plugin>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.eventview/src/com/nokia/trace/eventview/Activator.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,89 @@
+/*
+ * 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:
+ *
+ * Event view plug-in
+ *
+ */
+package com.nokia.trace.eventview;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ * 
+ */
+public class Activator extends AbstractUIPlugin {
+
+	/**
+	 * The plug-in ID
+	 */
+	public static final String PLUGIN_ID = "com.nokia.trace.eventview"; //$NON-NLS-1$
+
+	/**
+	 * The shared instance
+	 */
+	private static Activator plugin;
+
+	/**
+	 * Shared event list
+	 */
+	TraceEventList eventList;
+
+	/**
+	 * The constructor
+	 */
+	public Activator() {
+		plugin = this;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
+	 * )
+	 */
+	@Override
+	public void start(BundleContext context) throws Exception {
+		super.start(context);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
+	 * )
+	 */
+	@Override
+	public void stop(BundleContext context) throws Exception {
+		if (eventList != null) {
+			((EventListContentProvider) eventList).removeListener();
+		}
+		plugin = null;
+		super.stop(context);
+	}
+
+	/**
+	 * Returns the shared instance
+	 * 
+	 * @return the shared instance
+	 */
+	public static Activator getDefault() {
+		return plugin;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.eventview/src/com/nokia/trace/eventview/ContentChangeListener.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,30 @@
+/*
+ * 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:
+ *
+ * Content change listener
+ *
+ */
+package com.nokia.trace.eventview;
+
+/**
+ * Content change listener
+ */
+public interface ContentChangeListener {
+
+	/**
+	 * Content changed
+	 */
+	void contentChanged();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.eventview/src/com/nokia/trace/eventview/EventAdder.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,77 @@
+/*
+ * 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:
+ *
+ * Asynchronously adds an event to the events list
+ *
+ */
+package com.nokia.trace.eventview;
+
+import com.nokia.trace.eventrouter.TraceEvent;
+
+/**
+ * Asynchronously adds an event to the events list
+ * 
+ */
+final class EventAdder implements Runnable {
+
+	/**
+	 * Event to be added
+	 */
+	private TraceEvent event;
+
+	/**
+	 * The content provider
+	 */
+	private EventListContentProvider contentProvider;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param contentProvider
+	 *            the content provider
+	 * @param event
+	 *            the event to be added
+	 */
+	public EventAdder(EventListContentProvider contentProvider, TraceEvent event) {
+		this.event = event;
+		this.contentProvider = contentProvider;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Runnable#run()
+	 */
+	public void run() {
+		Object o = event.getSource();
+		EventListEntry entry = null;
+		if (o instanceof Throwable) {
+			entry = new EventListEntryThrowable(event.getType(), event
+					.getDescription(), (Throwable) o);
+		} else if (o instanceof String) {
+			entry = new EventListEntryString(event.getType(), event
+					.getDescription(), (String) o);
+		} else {
+			entry = new EventListEntryString(event.getType(), event
+					.getDescription(), null);
+		}
+		entry.setCategory(event.getCategory());
+		contentProvider.addEntry(entry);
+		if (TraceEventView.contentChangeListener != null) {
+			TraceEventView.contentChangeListener.contentChanged();
+		}
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.eventview/src/com/nokia/trace/eventview/EventListContentProvider.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,364 @@
+/*
+ * 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:
+ *
+ * Content provider for the event view
+ *
+ */
+package com.nokia.trace.eventview;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.trace.eventrouter.TraceEvent;
+import com.nokia.trace.eventrouter.TraceEventListener;
+import com.nokia.trace.eventrouter.TraceEventRouter;
+
+/**
+ * Content provider for the event view
+ * 
+ */
+final class EventListContentProvider implements IStructuredContentProvider,
+		TraceEventListener, TraceEventList {
+
+	/**
+	 * ID of the event view
+	 */
+	private static final String EVENTVIEW_ID = "com.nokia.trace.eventview.TraceEventView"; //$NON-NLS-1$
+
+	/**
+	 * The table view
+	 */
+	private TableViewer viewer;
+
+	/**
+	 * The list of viewer elements
+	 */
+	private ArrayList<EventListEntry> elements = new ArrayList<EventListEntry>();
+
+	/**
+	 * Event handlers
+	 */
+	private ArrayList<TraceEventHandler> eventHandlers = new ArrayList<TraceEventHandler>();
+
+	/**
+	 * Selection listeners
+	 */
+	private ArrayList<ISelectionChangedListener> selectionListeners;
+
+	/**
+	 * Constructor
+	 * 
+	 */
+	EventListContentProvider() {
+		TraceEventRouter router = TraceEventRouter.getInstance();
+		if (router != null) {
+			router.addEventListener(this);
+		}
+	}
+
+	/**
+	 * Removes the event listener from router
+	 */
+	void removeListener() {
+		TraceEventRouter router = TraceEventRouter.getInstance();
+		if (router != null) {
+			router.removeEventListener(this);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.trace.eventview.TraceEventList#
+	 * addEntry(com.nokia.trace.eventview.EventListEntry)
+	 */
+	public void addEntry(EventListEntry entry) {
+		elements.add(entry);
+		if (viewer != null) {
+			viewer.add(entry);
+			viewer.reveal(entry);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.trace.eventview.TraceEventList#
+	 * removeEntry(com.nokia.trace.eventview.EventListEntry)
+	 */
+	public void removeEntry(EventListEntry entry) {
+		boolean removed = elements.remove(entry);
+		if (removed && viewer != null) {
+			viewer.remove(entry);
+		}
+		entry.reset();
+	}
+
+	/**
+	 * Removes all entries
+	 */
+	void removeAllEntries() {
+		if (viewer != null) {
+			viewer.getTable().removeAll();
+		}
+		for (EventListEntry entry : elements) {
+			entry.reset();
+		}
+		elements.clear();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.trace.eventview.TraceEventList#
+	 * updateEntry(com.nokia.trace.eventview.EventListEntry)
+	 */
+	public void updateEntry(EventListEntry entry) {
+		if (viewer != null) {
+			viewer.update(entry, null);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java
+	 * .lang.Object)
+	 */
+	public Object[] getElements(Object inputElement) {
+		return elements.toArray();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+	 */
+	public void dispose() {
+		viewer = null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.viewers.IContentProvider#
+	 * inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object,
+	 * java.lang.Object)
+	 */
+	public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+		boolean changed = false;
+		if (this.viewer != viewer) {
+			changed = true;
+		}
+		if (changed) {
+			this.viewer = (TableViewer) viewer;
+			if (selectionListeners != null) {
+				for (int i = 0; i < selectionListeners.size(); i++) {
+					viewer.addSelectionChangedListener(selectionListeners
+							.get(i));
+				}
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.trace.eventrouter.TraceEventListener#
+	 * processEvent(com.nokia.trace.eventrouter.TraceEvent)
+	 */
+	public void processEvent(TraceEvent event) {
+		boolean handled = false;
+		for (int i = 0; i < eventHandlers.size(); i++) {
+			handled = eventHandlers.get(i).handleEvent(event);
+			if (handled) {
+				i = eventHandlers.size();
+			}
+		}
+		if (handled) {
+			// If event was handled by one of the view extensions, the focus
+			// needs to be switched to the view
+			setFocus();
+		} else {
+			if (event.getSource() == null
+					|| event.getSource() instanceof String
+					|| event.getSource() instanceof Throwable) {
+				setFocus();
+				asyncExec(new EventAdder(this, event));
+			}
+		}
+	}
+
+	/**
+	 * Sets focus to the event view
+	 */
+	private void setFocus() {
+		if (!isViewerEnabled()) {
+			PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+				public void run() {
+					try {
+						PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+								.getActivePage().showView(EVENTVIEW_ID);
+					} catch (Exception e) {
+					}
+				}
+			});
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.trace.eventview.TraceEventList#asyncExec(java.lang.Runnable)
+	 */
+	public void asyncExec(Runnable runnable) {
+		if (viewer != null) {
+			Table table = viewer.getTable();
+			if (!table.isDisposed()) {
+				table.getDisplay().asyncExec(runnable);
+			}
+
+			// EventAdder events can be inserted even when not in UI thread
+		} else if (runnable instanceof EventAdder) {
+			runnable.run();
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.trace.eventview.TraceEventList#
+	 * addEventHandler(com.nokia.trace.eventview.TraceEventHandler)
+	 */
+	public void addEventHandler(TraceEventHandler handler) {
+		eventHandlers.add(handler);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.trace.eventview.TraceEventList#
+	 * removeEventHandler(com.nokia.trace.eventview.TraceEventHandler)
+	 */
+	public void removeEventHandler(TraceEventHandler handler) {
+		eventHandlers.remove(handler);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.trace.eventview.TraceEventList#removeAll(java.lang.Class)
+	 */
+	public void removeAll(Class<?> type) {
+		for (int i = 0; i < elements.size(); i++) {
+			EventListEntry entry = elements.get(i);
+			if (entry.hasSource()
+					&& type.isAssignableFrom(entry.getSource().getClass())) {
+				elements.remove(i);
+				i--;
+			}
+		}
+		if (viewer != null) {
+			viewer.refresh();
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.trace.eventview.TraceEventList#
+	 * addSelectionListener(org.eclipse.jface.viewers.ISelectionChangedListener)
+	 */
+	public void addSelectionListener(ISelectionChangedListener listener) {
+		if (viewer != null) {
+			viewer.addSelectionChangedListener(listener);
+		}
+		if (selectionListeners == null) {
+			selectionListeners = new ArrayList<ISelectionChangedListener>();
+		}
+		selectionListeners.add(listener);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.trace.eventview.TraceEventList#
+	 * removeSelectionListener(org
+	 * .eclipse.jface.viewers.ISelectionChangedListener)
+	 */
+	public void removeSelectionListener(ISelectionChangedListener listener) {
+		if (viewer != null) {
+			viewer.removeSelectionChangedListener(listener);
+		}
+		if (selectionListeners != null) {
+			selectionListeners.remove(listener);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Iterable#iterator()
+	 */
+	public Iterator<EventListEntry> iterator() {
+		return elements.iterator();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.trace.eventview.TraceEventList#getEntries(java.lang.Object)
+	 */
+	public Iterator<EventListEntry> getEntries(Object source) {
+		List<EventListEntry> entries = null;
+		for (EventListEntry entry : elements) {
+			if (entry.getSource() == source) {
+				if (entries == null) {
+					entries = new ArrayList<EventListEntry>();
+				}
+				entries.add(entry);
+			}
+		}
+		if (entries == null) {
+			entries = Collections.emptyList();
+		}
+		return entries.iterator();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.trace.eventview.TraceEventList#isViewerEnabled()
+	 */
+	public boolean isViewerEnabled() {
+		boolean retVal = true;
+		if (viewer == null) {
+			retVal = false;
+		}
+		return retVal;
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.eventview/src/com/nokia/trace/eventview/EventListEntry.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,126 @@
+/*
+ * 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:
+ *
+ * Base class for event list entries
+ *
+ */
+package com.nokia.trace.eventview;
+
+import org.eclipse.jface.action.IMenuManager;
+
+/**
+ * Base class for event list entries
+ * 
+ */
+public abstract class EventListEntry {
+
+	/**
+	 * Event type
+	 */
+	private int type;
+
+	/**
+	 * Event category
+	 */
+	private String category;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param type
+	 *            event type
+	 */
+	protected EventListEntry(int type) {
+		this.type = type;
+	}
+
+	/**
+	 * Gets the event type
+	 * 
+	 * @return event type
+	 */
+	public int getType() {
+		return type;
+	}
+
+	/**
+	 * Gets the event category
+	 * 
+	 * @return the category
+	 */
+	public String getCategory() {
+		return category;
+	}
+
+	/**
+	 * Sets the event category
+	 * 
+	 * @param category
+	 *            the new category
+	 */
+	public void setCategory(String category) {
+		this.category = category;
+	}
+
+	/**
+	 * Resets this entry
+	 */
+	protected void reset() {
+	}
+
+	/**
+	 * Gets the event description
+	 * 
+	 * @return event description
+	 */
+	public abstract String getDescription();
+
+	/**
+	 * Flags which determines if this entry has source
+	 * 
+	 * @return true if this entry has a source
+	 */
+	protected abstract boolean hasSource();
+
+	/**
+	 * Gets the name of source
+	 * 
+	 * @return the name of source
+	 */
+	protected abstract String getSourceName();
+
+	/**
+	 * Gets the source
+	 * 
+	 * @return the source
+	 */
+	protected abstract Object getSource();
+
+	/**
+	 * Flags which determines if this entry has source associated with actions
+	 * 
+	 * @return true if this entry has a source which is associated to actions
+	 */
+	protected abstract boolean hasSourceActions();
+
+	/**
+	 * Adds actions to given menu
+	 * 
+	 * @param manager
+	 *            the menu manager
+	 */
+	protected abstract void addSourceActions(IMenuManager manager);
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.eventview/src/com/nokia/trace/eventview/EventListEntryString.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,128 @@
+/*
+ * 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:
+ *
+ * String event is not associated to anything
+ *
+ */
+package com.nokia.trace.eventview;
+
+import org.eclipse.jface.action.IMenuManager;
+
+/**
+ * String event is created when none of the registered event handlers process an
+ * event. If the event source is instance of String, it is shown in the UI. If
+ * not, the source is left null. This entry does not provide any actions to the
+ * list
+ * 
+ */
+public class EventListEntryString extends EventListEntry {
+
+	/**
+	 * Event description
+	 */
+	private String description;
+
+	/**
+	 * Event source
+	 */
+	private String source;
+
+	/**
+	 * Creates a new string entry
+	 * 
+	 * @param type
+	 *            the event type
+	 * @param description
+	 *            the event description
+	 * @param source
+	 *            the event source
+	 */
+	public EventListEntryString(int type, String description, String source) {
+		super(type);
+		this.description = description;
+		this.source = source;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.eventview.EventListEntry#getDescription()
+	 */
+	@Override
+	public String getDescription() {
+		return description;
+	}
+
+	/**
+	 * Changes the description of this entry
+	 * 
+	 * @param description
+	 *            the new description
+	 */
+	protected void setDescription(String description) {
+		this.description = description;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.eventview.EventListEntry#hasSource()
+	 */
+	@Override
+	protected boolean hasSource() {
+		return source != null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.eventview.EventListEntry#getSourceName()
+	 */
+	@Override
+	protected String getSourceName() {
+		return source;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.trace.eventview.EventListEntry#getSource()
+	 */
+	@Override
+	protected Object getSource() {
+		return source;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.tracebuilder.eventview.EventListEntry#hasSourceActions()
+	 */
+	@Override
+	protected boolean hasSourceActions() {
+		return false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.trace.eventview.EventListEntry#
+	 * addSourceActions(org.eclipse.jface.action.IMenuManager)
+	 */
+	@Override
+	protected void addSourceActions(IMenuManager manager) {
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.eventview/src/com/nokia/trace/eventview/EventListEntryThrowable.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,110 @@
+/*
+ * 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:
+ *
+ * Event list entry, which contains a Throwable
+ *
+ */
+package com.nokia.trace.eventview;
+
+import org.eclipse.jface.action.IMenuManager;
+
+/**
+ * Event list entry, which contains a Throwable
+ * 
+ */
+final class EventListEntryThrowable extends EventListEntryString {
+
+	/**
+	 * Action to show the exception to user
+	 */
+	private ShowExceptionAction action;
+
+	/**
+	 * Source
+	 */
+	private Throwable throwable;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param type
+	 *            event type
+	 * @param description
+	 *            event description
+	 * @param source
+	 *            event source
+	 */
+	EventListEntryThrowable(int type, String description, Throwable source) {
+		super(type, description, null);
+		this.throwable = source;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.trace.eventview.EventListEntryString#addSourceActions(org.eclipse
+	 * .jface.action.IMenuManager)
+	 */
+	@Override
+	protected void addSourceActions(IMenuManager manager) {
+		super.addSourceActions(manager);
+		if (action == null) {
+			action = new ShowExceptionAction((Throwable) getSource());
+		}
+		manager.add(action);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.trace.eventview.EventListEntryString#getSource()
+	 */
+	@Override
+	protected Object getSource() {
+		return throwable;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.trace.eventview.EventListEntryString#getSourceName()
+	 */
+	@Override
+	protected String getSourceName() {
+		return throwable.getMessage();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.trace.eventview.EventListEntryString#hasSource()
+	 */
+	@Override
+	protected boolean hasSource() {
+		return true;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.trace.eventview.EventListEntryString#hasSourceActions()
+	 */
+	@Override
+	protected boolean hasSourceActions() {
+		return true;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.eventview/src/com/nokia/trace/eventview/EventListLabelProvider.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,171 @@
+/*
+ * 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:
+ *
+ * Label provider for the events view
+ *
+ */
+package com.nokia.trace.eventview;
+
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.trace.eventrouter.TraceEvent;
+
+/**
+ * Label provider for the events view
+ * 
+ */
+final class EventListLabelProvider implements ITableLabelProvider {
+
+	/**
+	 * Error icon
+	 */
+	private Image errorImage;
+
+	/**
+	 * Warning icon
+	 */
+	private Image warningImage;
+
+	/**
+	 * Info icon
+	 */
+	private Image infoImage;
+
+	/**
+	 * Constructor
+	 */
+	EventListLabelProvider() {
+
+		// Get the images from the shared images structure
+		errorImage = PlatformUI.getWorkbench().getSharedImages().getImage(
+				ISharedImages.IMG_OBJS_ERROR_TSK);
+		warningImage = PlatformUI.getWorkbench().getSharedImages().getImage(
+				ISharedImages.IMG_OBJS_WARN_TSK);
+		infoImage = PlatformUI.getWorkbench().getSharedImages().getImage(
+				ISharedImages.IMG_OBJS_INFO_TSK);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang
+	 * .Object, int)
+	 */
+	public Image getColumnImage(Object element, int columnIndex) {
+		EventListEntry entry = (EventListEntry) element;
+		Image retval = null;
+		if (columnIndex == 0) {
+			if (entry.getType() == TraceEvent.ERROR) {
+				retval = errorImage;
+			} else if (entry.getType() == TraceEvent.WARNING) {
+				retval = warningImage;
+			} else {
+				retval = infoImage;
+			}
+		}
+		return retval;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang
+	 * .Object, int)
+	 */
+	public String getColumnText(Object element, int columnIndex) {
+		String retval;
+		EventListEntry entry = (EventListEntry) element;
+		if (columnIndex == TraceEventView.TYPE_COLUM_INDEX) {
+			if (entry.getType() == TraceEvent.ERROR) {
+				retval = Messages
+						.getString("EventListLabelProvider.ErrorEventType"); //$NON-NLS-1$
+			} else if (entry.getType() == TraceEvent.WARNING) {
+				retval = Messages
+						.getString("EventListLabelProvider.WarningEventType"); //$NON-NLS-1$
+			} else if (entry.getType() == TraceEvent.ASSERT_CRITICAL
+					|| entry.getType() == TraceEvent.ASSERT_NORMAL) {
+				retval = Messages
+						.getString("EventListLabelProvider.AssertionEventType"); //$NON-NLS-1$
+			} else {
+				retval = Messages
+						.getString("EventListLabelProvider.InfoEventType"); //$NON-NLS-1$
+			}
+		} else if (columnIndex == TraceEventView.CATEGORY_COLUM_INDEX) {
+			retval = entry.getCategory();
+			if (retval == null) {
+				retval = ""; //$NON-NLS-1$
+			}
+		} else if (columnIndex == TraceEventView.SOURCE_COLUM_INDEX) {
+			if (entry.hasSource()) {
+				retval = entry.getSourceName();
+			} else {
+				retval = ""; //$NON-NLS-1$
+			}
+		} else if (columnIndex == TraceEventView.DESCRIPTION_COLUM_INDEX) {
+			retval = entry.getDescription();
+			if (retval == null) {
+				retval = ""; //$NON-NLS-1$
+			}
+		} else {
+			retval = ""; //$NON-NLS-1$
+		}
+		return retval;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.viewers.IBaseLabelProvider#
+	 * addListener(org.eclipse.jface.viewers.ILabelProviderListener)
+	 */
+	public void addListener(ILabelProviderListener listener) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
+	 */
+	public void dispose() {
+		// Shared images must not be disposed
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang
+	 * .Object, java.lang.String)
+	 */
+	public boolean isLabelProperty(Object element, String property) {
+		return false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.viewers.IBaseLabelProvider#
+	 * removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
+	 */
+	public void removeListener(ILabelProviderListener listener) {
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.eventview/src/com/nokia/trace/eventview/Messages.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,63 @@
+/*
+ * 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:
+ *
+ * Localized strings for view package
+ *
+ */
+package com.nokia.trace.eventview;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * Localized strings for event view package
+ * 
+ */
+class Messages {
+
+	/**
+	 * Bundle name
+	 */
+	private static final String BUNDLE_NAME = "com.nokia.trace.eventview.messages"; //$NON-NLS-1$
+
+	/**
+	 * Bundle
+	 */
+	private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
+			.getBundle(BUNDLE_NAME);
+
+	/**
+	 * Prevents construction
+	 */
+	private Messages() {
+	}
+
+	/**
+	 * Gets localized string based on key
+	 * 
+	 * @param key
+	 *            the resource key
+	 * @return the localized resource
+	 */
+	public static String getString(String key) {
+		String value;
+		try {
+			value = RESOURCE_BUNDLE.getString(key);
+		} catch (MissingResourceException e) {
+			value = '!' + key + '!';
+		}
+		return value;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.eventview/src/com/nokia/trace/eventview/RemoveAllEventsAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,62 @@
+/*
+ * 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:
+ *
+ * Action to remove all entries from the list
+ *
+ */
+package com.nokia.trace.eventview;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * Action to remove all entries from the list
+ * 
+ */
+final class RemoveAllEventsAction extends Action {
+
+	/**
+	 * Content provider
+	 */
+	private EventListContentProvider contentProvider;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param provider
+	 *            content provider for entry removal
+	 */
+	RemoveAllEventsAction(EventListContentProvider provider) {
+		this.contentProvider = provider;
+		setText(Messages.getString("RemoveEventAction.DismissAllEventsAction")); //$NON-NLS-1$
+		setToolTipText(Messages
+				.getString("RemoveEventAction.DismissAllEventsActionTooltip")); //$NON-NLS-1$
+		setImageDescriptor(PlatformUI.getWorkbench().getSharedImages()
+				.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
+		setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages()
+				.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_DISABLED));
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.action.Action#run()
+	 */
+	@Override
+	public void run() {
+		contentProvider.removeAllEntries();
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.eventview/src/com/nokia/trace/eventview/RemoveEventAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,80 @@
+/*
+ * 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:
+ *
+ * Action to remove an entry from the list
+ *
+ */
+package com.nokia.trace.eventview;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * Action to remove an entry from the list
+ * 
+ */
+final class RemoveEventAction extends Action {
+
+	/**
+	 * The selected entry
+	 */
+	private EventListEntry entry;
+
+	/**
+	 * Content provider
+	 */
+	private EventListContentProvider contentProvider;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param provider
+	 *            content provider for entry removal
+	 */
+	RemoveEventAction(EventListContentProvider provider) {
+		this.contentProvider = provider;
+		setText(Messages.getString("RemoveEventAction.DismissEventAction")); //$NON-NLS-1$
+		setToolTipText(Messages
+				.getString("RemoveEventAction.DismissEventActionTooltip")); //$NON-NLS-1$
+		setImageDescriptor(PlatformUI.getWorkbench().getSharedImages()
+				.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
+		setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages()
+				.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_DISABLED));
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.action.Action#run()
+	 */
+	@Override
+	public void run() {
+		if (entry != null) {
+			contentProvider.removeEntry(entry);
+			entry = null;
+		}
+	}
+
+	/**
+	 * Sets the entry to be removed
+	 * 
+	 * @param entry
+	 *            the entry
+	 */
+	void setEntry(EventListEntry entry) {
+		this.entry = entry;
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.eventview/src/com/nokia/trace/eventview/ShowExceptionAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,88 @@
+/*
+ * 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:
+ *
+ * Action to display exception contents
+ *
+ */
+package com.nokia.trace.eventview;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * Action to display exception contents
+ * 
+ */
+final class ShowExceptionAction extends Action {
+
+	/**
+	 * Number of elements to be shown
+	 */
+	private static final int MAX_STACK_TRACE_ELEMENTS_TO_DISPLAY = 20;
+
+	/**
+	 * The throwable
+	 */
+	private Throwable throwable;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param throwable
+	 *            the throwable to be shown
+	 */
+	ShowExceptionAction(Throwable throwable) {
+		this.throwable = throwable;
+		setText(Messages.getString("ShowExceptionAction.Title")); //$NON-NLS-1$
+		setToolTipText(Messages.getString("ShowExceptionAction.Description")); //$NON-NLS-1$
+		setImageDescriptor(PlatformUI.getWorkbench().getSharedImages()
+				.getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK));
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.action.Action#run()
+	 */
+	@Override
+	public void run() {
+		if (throwable != null) {
+			StringBuffer sb = new StringBuffer();
+			StackTraceElement[] elements = throwable.getStackTrace();
+			int end = elements.length;
+			boolean max = false;
+			if (end > MAX_STACK_TRACE_ELEMENTS_TO_DISPLAY) {
+				end = MAX_STACK_TRACE_ELEMENTS_TO_DISPLAY;
+				max = true;
+			}
+			sb.append(throwable.toString());
+			sb.append(":\r\n"); //$NON-NLS-1$
+			for (int i = 0; i < end; i++) {
+				sb.append(elements[i].toString());
+				sb.append("\r\n"); //$NON-NLS-1$
+			}
+			if (max) {
+				sb.append(Messages
+						.getString("ShowExceptionAction.ElementsCutOff")); //$NON-NLS-1$
+			}
+			MessageDialog.openInformation(PlatformUI.getWorkbench()
+					.getActiveWorkbenchWindow().getShell(), Messages
+					.getString("ShowExceptionAction.Title"), //$NON-NLS-1$
+					sb.toString());
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.eventview/src/com/nokia/trace/eventview/TableColumnSorter.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,156 @@
+/*
+ * 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:
+ *
+ * Table column sorter
+ *
+ */
+package com.nokia.trace.eventview;
+
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerComparator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.TableColumn;
+
+/**
+ * Table column sorter class
+ * 
+ */
+public abstract class TableColumnSorter extends ViewerComparator {
+
+	/**
+	 * Ascending sorting
+	 */
+	public static final int ASC = 1;
+
+	/**
+	 * No sorting
+	 */
+	public static final int NONE = 0;
+
+	/**
+	 * Descending sorting
+	 */
+	public static final int DESC = -1;
+
+	/**
+	 * Current direction
+	 */
+	private int direction = 0;
+
+	/**
+	 * Column for this sorter
+	 */
+	private TableColumn column;
+
+	/**
+	 * Table viewer for this column
+	 */
+	private TableViewer viewer;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param viewer
+	 *            table viewer
+	 * @param column
+	 *            column
+	 */
+	public TableColumnSorter(final TableViewer viewer, TableColumn column) {
+		this.column = column;
+		this.viewer = viewer;
+		this.column.addSelectionListener(new SelectionAdapter() {
+
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				if (viewer.getComparator() != null) {
+					if (viewer.getComparator() == TableColumnSorter.this) {
+						int tdirection = TableColumnSorter.this.direction;
+
+						if (tdirection == ASC) {
+							setSorter(TableColumnSorter.this, DESC);
+						} else if (tdirection == DESC) {
+							setSorter(TableColumnSorter.this, NONE);
+						}
+					} else {
+						setSorter(TableColumnSorter.this, ASC);
+					}
+				} else {
+					setSorter(TableColumnSorter.this, ASC);
+				}
+			}
+		});
+	}
+
+	/**
+	 * Sets sorter
+	 * 
+	 * @param sorter
+	 *            the sorter
+	 * @param direction
+	 *            direction
+	 */
+	public void setSorter(TableColumnSorter sorter, int direction) {
+		if (direction == NONE) {
+			column.getParent().setSortColumn(null);
+			column.getParent().setSortDirection(SWT.NONE);
+			viewer.setComparator(null);
+		} else {
+			column.getParent().setSortColumn(column);
+			sorter.direction = direction;
+
+			if (direction == ASC) {
+				column.getParent().setSortDirection(SWT.DOWN);
+			} else {
+				column.getParent().setSortDirection(SWT.UP);
+			}
+
+			if (viewer.getComparator() == sorter) {
+				viewer.refresh();
+			} else {
+				viewer.setComparator(sorter);
+			}
+
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.jface.viewers.ViewerComparator#compare(org.eclipse.jface.
+	 * viewers.Viewer, java.lang.Object, java.lang.Object)
+	 */
+	@Override
+	public int compare(Viewer viewer, Object o1, Object o2) {
+		return direction * doCompare(viewer, o1, o2);
+	}
+
+	/**
+	 * Compare method
+	 * 
+	 * @param TableViewer
+	 *            table viewer
+	 * @param o1
+	 *            object 1
+	 * @param o2
+	 *            object 2
+	 * @return less than 0 if o1 is smaller than o2, 0 if equal, more than 0 if
+	 *         o1 is bigger than o2
+	 */
+	protected abstract int doCompare(Viewer TableViewer, Object o1, Object o2);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.eventview/src/com/nokia/trace/eventview/TraceEventHandler.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,40 @@
+/*
+ * 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:
+ *
+ * Event handler
+ *
+ */
+package com.nokia.trace.eventview;
+
+import com.nokia.trace.eventrouter.TraceEvent;
+
+/**
+ * Event handler
+ * 
+ */
+public interface TraceEventHandler {
+
+	/**
+	 * Handles an event. If this returns true, the event is not delegated to
+	 * other handlers. If all registered handlers return false,
+	 * {@link EventListEntryString} is added to the view.
+	 * 
+	 * @param event
+	 *            the event to be handled
+	 * @return true if event was handled, false if not
+	 */
+	public boolean handleEvent(TraceEvent event);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.eventview/src/com/nokia/trace/eventview/TraceEventList.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,120 @@
+/*
+ * 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:
+ *
+ * Interface to the events list of the view
+ *
+ */
+package com.nokia.trace.eventview;
+
+import java.util.Iterator;
+
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+
+/**
+ * Interface to the events list of the view. An instance of this interface is
+ * available via {@link TraceEventView#getEventList()
+ * TraceEventView.getEventList}
+ * 
+ */
+public interface TraceEventList extends Iterable<EventListEntry> {
+
+	/**
+	 * Adds an entry to this list
+	 * 
+	 * @param entry
+	 *            the entry to be added
+	 */
+	public void addEntry(EventListEntry entry);
+
+	/**
+	 * Removes an entry from this list
+	 * 
+	 * @param entry
+	 *            the entry to be removed
+	 */
+	public void removeEntry(EventListEntry entry);
+
+	/**
+	 * Updates an existing entry
+	 * 
+	 * @param entry
+	 *            the entry to be updated
+	 */
+	public void updateEntry(EventListEntry entry);
+
+	/**
+	 * Runs an asynchronous operation using the event view shell
+	 * 
+	 * @param runnable
+	 *            the runnable
+	 */
+	public void asyncExec(Runnable runnable);
+
+	/**
+	 * Adds an event handler, which gets notified when events arrive to view
+	 * 
+	 * @param handler
+	 *            the event handler
+	 */
+	public void addEventHandler(TraceEventHandler handler);
+
+	/**
+	 * Removes an event handler
+	 * 
+	 * @param handler
+	 *            the event handler
+	 */
+	public void removeEventHandler(TraceEventHandler handler);
+
+	/**
+	 * Removes all events which have a source of given type
+	 * 
+	 * @param type
+	 *            the type
+	 */
+	public void removeAll(Class<?> type);
+
+	/**
+	 * Gets all entries which have the given source
+	 * 
+	 * @param source
+	 *            the source
+	 * @return the entries with given source
+	 */
+	public Iterator<EventListEntry> getEntries(Object source);
+
+	/**
+	 * Adds a selection listener to the UI
+	 * 
+	 * @param listener
+	 *            the selection listener
+	 */
+	public void addSelectionListener(ISelectionChangedListener listener);
+
+	/**
+	 * Removes a selection listener
+	 * 
+	 * @param listener
+	 *            the selection listener
+	 */
+	public void removeSelectionListener(ISelectionChangedListener listener);
+
+	/**
+	 * Is viewer enabled
+	 * 
+	 * @return true if viewer is enable, otherwise false
+	 */
+	public boolean isViewerEnabled();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.eventview/src/com/nokia/trace/eventview/TraceEventView.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,451 @@
+/*
+ * 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:
+ *
+ * Event view
+ *
+ */
+package com.nokia.trace.eventview;
+
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.events.ControlListener;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.part.ViewPart;
+import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
+
+/**
+ * Event view. {@link #getEventList() getEventList} method is the access point
+ * for view extensions.
+ */
+public class TraceEventView extends ViewPart implements ContentChangeListener {
+
+	/**
+	 * Type column title
+	 */
+	private static final String TYPE_TITLE = Messages
+			.getString("TraceEventView.TypeColumnTitle"); //$NON-NLS-1$
+
+	/**
+	 * Category column title
+	 */
+	private static final String CATEGORY_TITLE = Messages
+			.getString("TraceEventView.CategoryColumnTitle"); //$NON-NLS-1$
+
+	/**
+	 * Source column title
+	 */
+	private static final String SOURCE_TITLE = Messages
+			.getString("TraceEventView.SourceColumnTitle"); //$NON-NLS-1$
+
+	/**
+	 * Description column title
+	 */
+	private static final String DESCRIPTION_TITLE = Messages
+			.getString("TraceEventView.DescriptionColumnTitle"); //$NON-NLS-1$
+
+	/**
+	 * Type width configuration entry
+	 */
+	private static final String TYPE_WIDTH_CONFIGURATION = "TraceEventView.TypeWidth"; //$NON-NLS-1$
+
+	/**
+	 * Category width configuration entry
+	 */
+	private static final String CATEGORY_WIDTH_CONFIGURATION = "TraceEventView.CategoryWidth"; //$NON-NLS-1$
+
+	/**
+	 * Source width configuration entry
+	 */
+	private static final String SOURCE_WIDTH_CONFIGURATION = "TraceEventView.SourceWidth"; //$NON-NLS-1$
+
+	/**
+	 * Description width configuration entry
+	 */
+	private static final String DESCRIPTION_WIDTH_CONFIGURATION = "TraceEventView.DescriptionsWidth"; //$NON-NLS-1$
+
+	/**
+	 * Default width for type column
+	 */
+	private static final int DEFAULT_TYPE_WIDTH = 75;
+
+	/**
+	 * Default width for category column
+	 */
+	private static final int DEFAULT_CATEGORY_WIDTH = 150;
+
+	/**
+	 * Default width for source column
+	 */
+	private static final int DEFAULT_SOURCE_WIDTH = 150;
+
+	/**
+	 * Default width for description column
+	 */
+	private static final int DEFAULT_DESCRIPTION_WIDTH = 800;
+
+	/**
+	 * Type column index
+	 */
+	static final int TYPE_COLUM_INDEX = 0;
+
+	/**
+	 * Category column index
+	 */
+	static final int CATEGORY_COLUM_INDEX = 1;
+
+	/**
+	 * Source column index
+	 */
+	static final int SOURCE_COLUM_INDEX = 2;
+
+	/**
+	 * Description column index
+	 */
+	static final int DESCRIPTION_COLUM_INDEX = 3;
+
+	/**
+	 * Message list
+	 */
+	private TableViewer table;
+
+	/**
+	 * Remove event action
+	 */
+	private RemoveEventAction removeEventAction;
+
+	/**
+	 * Remove event action
+	 */
+	private RemoveAllEventsAction removeAllEventsAction;
+
+	/**
+	 * Descriptions column
+	 */
+	private TableColumn descriptionColumn;
+
+	/**
+	 * Descriptions column
+	 */
+	private TableColumn categoryColumn;
+
+	/**
+	 * Source column
+	 */
+	private TableColumn sourceColumn;
+
+	/**
+	 * Type column
+	 */
+	private TableColumn typeColumn;
+
+	/**
+	 * Content change listener
+	 */
+	public static ContentChangeListener contentChangeListener;
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets
+	 * .Composite)
+	 */
+	@Override
+	public void createPartControl(Composite parent) {
+		table = new TableViewer(parent, SWT.SINGLE | SWT.H_SCROLL
+				| SWT.V_SCROLL | SWT.FULL_SELECTION);
+		EventListContentProvider contentProvider = (EventListContentProvider) getEventList();
+		EventListLabelProvider labelProvider = new EventListLabelProvider();
+		removeEventAction = new RemoveEventAction(contentProvider);
+		removeAllEventsAction = new RemoveAllEventsAction(contentProvider);
+		table.setContentProvider(contentProvider);
+		table.setLabelProvider(labelProvider);
+
+		// Content provider creates the viewer updater. The updater needs the
+		// display reference in order to create asynchronous callbacks to the UI
+		// thread.
+		Table tableWidget = table.getTable();
+		createTypeColumn(tableWidget);
+		createCategoryColumn(tableWidget);
+		createSourceColumn(tableWidget);
+		createDescriptionColumn(tableWidget);
+		configureWidgets();
+		tableWidget.setHeaderVisible(true);
+		tableWidget.setLinesVisible(true);
+		hookContextMenu();
+		table.setInput(getViewSite().getShell().getDisplay());
+		setContentListener(this);
+	}
+
+	/**
+	 * Sets content listener
+	 * 
+	 * @param listener
+	 *            new content listener
+	 */
+	private void setContentListener(ContentChangeListener listener) {
+		contentChangeListener = listener;
+	}
+
+	/**
+	 * Configures the widgets
+	 */
+	void configureWidgets() {
+
+		// Get preference store from the plugin
+		IPreferenceStore preferences = Activator.getDefault()
+				.getPreferenceStore();
+
+		// Set description column width
+		int value = preferences.getInt(DESCRIPTION_WIDTH_CONFIGURATION);
+		if (value > 0) {
+			descriptionColumn.setWidth(value);
+		} else {
+			descriptionColumn.setWidth(DEFAULT_DESCRIPTION_WIDTH);
+		}
+
+		// Set category column width
+		value = preferences.getInt(CATEGORY_WIDTH_CONFIGURATION);
+		if (value > 0) {
+			categoryColumn.setWidth(value);
+		} else {
+			categoryColumn.setWidth(DEFAULT_CATEGORY_WIDTH);
+		}
+
+		// Set source column width
+		value = preferences.getInt(SOURCE_WIDTH_CONFIGURATION);
+		if (value > 0) {
+			sourceColumn.setWidth(value);
+		} else {
+			sourceColumn.setWidth(DEFAULT_SOURCE_WIDTH);
+		}
+
+		// Set type column width
+		value = preferences.getInt(TYPE_WIDTH_CONFIGURATION);
+		if (value > 0) {
+			typeColumn.setWidth(value);
+		} else {
+			typeColumn.setWidth(DEFAULT_TYPE_WIDTH);
+		}
+	}
+
+	/**
+	 * Creates the descriptions column
+	 * 
+	 * @param tableWidget
+	 *            the table widget
+	 */
+	private void createDescriptionColumn(Table tableWidget) {
+		descriptionColumn = new TableColumn(tableWidget, SWT.NONE);
+		descriptionColumn.setText(DESCRIPTION_TITLE);
+		descriptionColumn.addControlListener(new ControlListener() {
+
+			public void controlMoved(ControlEvent e) {
+			}
+
+			public void controlResized(ControlEvent e) {
+				Activator.getDefault().getPreferenceStore().setValue(
+						DESCRIPTION_WIDTH_CONFIGURATION,
+						descriptionColumn.getWidth());
+			}
+
+		});
+		createColumnSorter(tableWidget, descriptionColumn,
+				DESCRIPTION_COLUM_INDEX);
+	}
+
+	/**
+	 * Creates the category column
+	 * 
+	 * @param tableWidget
+	 *            the table widget
+	 */
+	private void createCategoryColumn(Table tableWidget) {
+		categoryColumn = new TableColumn(tableWidget, SWT.NONE);
+		categoryColumn.setText(CATEGORY_TITLE);
+		categoryColumn.addControlListener(new ControlListener() {
+
+			public void controlMoved(ControlEvent e) {
+			}
+
+			public void controlResized(ControlEvent e) {
+				Activator.getDefault().getPreferenceStore()
+						.setValue(CATEGORY_WIDTH_CONFIGURATION,
+								categoryColumn.getWidth());
+			}
+
+		});
+		createColumnSorter(tableWidget, categoryColumn, CATEGORY_COLUM_INDEX);
+	}
+
+	/**
+	 * Creates the sources column
+	 * 
+	 * @param tableWidget
+	 *            the table widget
+	 */
+	private void createSourceColumn(Table tableWidget) {
+		sourceColumn = new TableColumn(tableWidget, SWT.NONE);
+		sourceColumn.setText(SOURCE_TITLE);
+		sourceColumn.addControlListener(new ControlListener() {
+
+			public void controlMoved(ControlEvent e) {
+			}
+
+			public void controlResized(ControlEvent e) {
+				Activator.getDefault().getPreferenceStore().setValue(
+						SOURCE_WIDTH_CONFIGURATION, sourceColumn.getWidth());
+			}
+
+		});
+		createColumnSorter(tableWidget, sourceColumn, SOURCE_COLUM_INDEX);
+	}
+
+	/**
+	 * Creates the type column
+	 * 
+	 * @param tableWidget
+	 *            the table widget
+	 */
+	private void createTypeColumn(final Table tableWidget) {
+		typeColumn = new TableColumn(tableWidget, SWT.NONE);
+		typeColumn.setText(TYPE_TITLE);
+		typeColumn.addControlListener(new ControlListener() {
+
+			public void controlMoved(ControlEvent e) {
+			}
+
+			public void controlResized(ControlEvent e) {
+				Activator.getDefault().getPreferenceStore().setValue(
+						TYPE_WIDTH_CONFIGURATION, typeColumn.getWidth());
+			}
+
+		});
+		createColumnSorter(tableWidget, typeColumn, TYPE_COLUM_INDEX);
+	}
+
+	/**
+	 * Creates sort listener
+	 * 
+	 * @param tableWidget
+	 *            table widget
+	 * @param column
+	 *            column to create sort listener for
+	 * @param index
+	 *            column index
+	 */
+	private void createColumnSorter(final Table tableWidget,
+			final TableColumn column, final int index) {
+
+		TableColumnSorter cSorter = new TableColumnSorter(table, column) {
+
+			@Override
+			protected int doCompare(Viewer v, Object o1, Object o2) {
+				ITableLabelProvider lp = ((ITableLabelProvider) table
+						.getLabelProvider());
+				String t1 = lp.getColumnText(o1, index);
+				String t2 = lp.getColumnText(o2, index);
+				return t1.compareTo(t2);
+			}
+		};
+
+		// Set no sorter as initial state
+		cSorter.setSorter(cSorter, TableColumnSorter.NONE);
+	}
+
+	/**
+	 * Adds menu listener to popup menu
+	 */
+	private void hookContextMenu() {
+
+		// Create menumanager
+		MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
+		menuMgr.setRemoveAllWhenShown(true);
+
+		// Create the menu when event is received
+		menuMgr.addMenuListener(new IMenuListener() {
+			public void menuAboutToShow(IMenuManager manager) {
+				IStructuredSelection selection = (IStructuredSelection) table
+						.getSelection();
+				if (!selection.isEmpty()) {
+					EventListEntry entry = (EventListEntry) selection
+							.getFirstElement();
+					removeEventAction.setEntry(entry);
+					manager.add(removeAllEventsAction);
+					manager.add(removeEventAction);
+					if (entry.hasSourceActions()) {
+						manager.add(new Separator());
+						entry.addSourceActions(manager);
+					}
+					manager.add(new Separator(
+							IWorkbenchActionConstants.MB_ADDITIONS));
+				}
+			}
+		});
+
+		// Set the menu in to the table
+		Menu menu = menuMgr.createContextMenu(table.getControl());
+		table.getControl().setMenu(menu);
+		getSite().registerContextMenu(menuMgr, table);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
+	 */
+	@Override
+	public void setFocus() {
+		table.getControl().setFocus();
+	}
+
+	/**
+	 * Gets the event list interface
+	 * 
+	 * @return the event list
+	 */
+	public static TraceEventList getEventList() {
+		TraceEventList list = Activator.getDefault().eventList;
+		if (list == null) {
+			list = new EventListContentProvider();
+			Activator.getDefault().eventList = list;
+		}
+		return list;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.trace.eventview.ContentChangeListener#contentChanged()
+	 */
+	public void contentChanged() {
+		IWorkbenchSiteProgressService progressService = (IWorkbenchSiteProgressService) getSite()
+				.getAdapter(IWorkbenchSiteProgressService.class);
+		progressService.warnOfContentChange();
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.eventview/src/com/nokia/trace/eventview/messages.properties	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,15 @@
+RemoveEventAction.DismissEventAction=Dismiss Event
+RemoveEventAction.DismissEventActionTooltip=Removes the event from the list
+TraceEventView.TypeColumnTitle=Type
+TraceEventView.CategoryColumnTitle=Category
+TraceEventView.SourceColumnTitle=Source
+TraceEventView.DescriptionColumnTitle=Description
+EventListLabelProvider.ErrorEventType=Error
+EventListLabelProvider.WarningEventType=Warning
+EventListLabelProvider.AssertionEventType=Assertion
+EventListLabelProvider.InfoEventType=Info
+RemoveEventAction.DismissAllEventsAction=Dismiss All Events
+RemoveEventAction.DismissAllEventsActionTooltip=Removes all events from the list
+ShowExceptionAction.Title=View Stack Trace
+ShowExceptionAction.Description=Shows the stack trace of the exception
+ShowExceptionAction.ElementsCutOff=... other elements cut off ...
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.eventview/src/com/nokia/trace/eventview/package.html	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,3 @@
+<html><body>
+Event view
+</body></html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.help/META-INF/MANIFEST.MF	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 1
+Bundle-Name: Carbide.c++ - Tracing User Guide Help Plug-in
+Bundle-SymbolicName: com.nokia.trace.help;singleton=true
+Bundle-Version: 2.6.0
+Bundle-Vendor: Nokia
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.help/book.css	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,184 @@
+/*	
+	Copyright (c) 2007-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/traceviewer/com.nokia.trace.help/build.properties	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,11 @@
+bin.includes = META-INF/,\
+               html/,\
+               plugin.xml,\
+               book.css,\
+               build.properties
+src.includes = html/,\
+               META-INF/,\
+               plugin.xml,\
+               book.css
+               book.css,\
+               build.properties
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.help/html/concepts/concepts.htm	Wed Jun 23 14:49:59 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>Understanding tracing</title>
+<link href="../../book.css" type="text/css" rel="StyleSheet"></head>
+<body>
+<h2>Understanding tracing</h2>
+<p>Tracing is a way to record debugging information that can be used during 
+software development. With tracing, you can generate detailed, low-level 
+information about an application's execution in the target device.</p>
+<p>Examples of tracing are cases when messages are sent or received from a 
+component, when states change, when a certain function is entered or exited, 
+or anywhere else in the code where it is interesting to know if code has been 
+executed or not.</p>
+<p>The tracing tools support <b>Open System Trace (OST)</b> trace format for 
+data transfer. OST is an open, platform-independent solution that is easily 
+integrated into the software development process.</p>
+
+<p>See the overview graphic below showing the relations of the tools.</p>
+<p><img src="..\images\tracing.png" alt="Overview of the tools in the tracing solution."></p>
+
+<p><b>Click the topics available on the left-hand navigation pane to browse for more information.</b></p>
+
+<div id="footer">Copyright &copy; 2007-2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.</div>
+</body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.help/html/gettingstarted/GS_index.htm	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,54 @@
+<!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>Getting started</title>
+<link href="../../book.css" type="text/css" rel="stylesheet"></head>
+<body><h2>Getting started</h2>
+<p>The topics in this section help you understand
+the basic functionality and workflow in using the Tracing tools. </p>
+
+For a basic walk-through of OST tracing, see <a href="walk_through.htm">Basic walk-through of tracing</a>.</p>
+
+<p><b>Click the topics available on the left-hand navigation pane to find tool-specific
+introductions.</b></p>
+
+<table width="600" border="1" cellspacing="1" cellpadding="2">
+<colgroup>
+<col width="20%">
+<col width="80%">
+</colgroup>
+<tbody>
+<tr>
+<td><img src="..\images\tracebuilder.png" alt="TraceBuilder logo">&nbsp;&nbsp;&nbsp;<a href="../../../com.nokia.tracebuilder.help/html/toc.htm"><b>TraceBuilder</b></a></td>
+<td><p>A tool for adding Open System Traces (OST) to the source
+code. TraceBuilder consists of two components:</p><ul>
+<li>TraceCompiler that parses OST Application Programming Interface (API)
+format from the source files and generates the corresponding decode files. 
+</li>
+<li>TraceBuilder UI that enables you to add and maintain OST traces. </li>
+</ul></td>
+</tr>
+<tr>
+<td><img src="..\images\traceviewer.png" alt="TraceViewer logo">&nbsp;&nbsp;&nbsp;<a href="../../../com.nokia.traceviewer.help/html/toc.htm"><b>TraceViewer</b></a></td>
+<td><p>A tool for activating, viewing and manipulating traces received from
+a target device. </p></td>
+</tr>
+<tr>
+<td><img src="..\images\traceanalyser.png" alt="TraceAnalyser logo">&nbsp;&nbsp;&nbsp;<a href="../../../com.nokia.s60tools.traceanalyser.help/html/toc.htm"><b>TraceAnalyser</b></a></td>
+<td height="23"><p>TraceAnalyser is a tool that enables you to measure the
+time consumption of an application and detect timing violations. It also enables
+you to supervise parameters in Open System Trace (OST) traces. </p></td>
+</tr>
+</tbody>
+</table>
+
+<p>Tracing requires also the following non-Carbide tools:</p>
+<ul>
+<li><b>TraceCompiler</b> &ndash; build time tool used to generate the needed headers and decoding files for traces.</li>
+<li><b>TraceSwitch</b> &ndash; Symbian application used to route traces either to USB or to a file.</li>
+</ul>
+
+<div id="footer">Copyright &copy;2007-2010 Nokia Corporation and/or its subsidiaries. All rights reserved.</div>
+</body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.help/html/gettingstarted/walk_through.htm	Wed Jun 23 14:49:59 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">
+	<title>Basic walk-through</title>
+    <link href="../../book.css" rel="stylesheet" type="text/css">
+</head>
+<body>
+
+<h1>Basic walk-through of tracing</h1>
+<p>This topic explains the high-level steps of using OST tracing all the way from adding traces to the source code up to receiving them to PC software.</p>
+
+<p>Basic steps in OST tracing:</p>
+<ol>
+	<li><a href="../../../com.nokia.tracebuilder.help/html/gettingstarted/basic_steps.htm">Add traces to your application source.</a></li>
+	<li><a href="../../../com.nokia.tracebuilder.help/html/tasks/setprojectandcompile.htm">Compile your source code.</a></li>
+	<li>Install your application containing the traces to the target device.<br>You can add the application either straight to the flash image, or you can install it from a SIS package, or transfer the application by using the TRK debugger.</li>
+	<li><a href="../../../com.nokia.traceviewer.help/html/gettingstarted/basic_steps.htm">Set up and receive traces to TraceViewer from the device using XTI or USB connection.</a></li>
+	<li><a href="../../../com.nokia.traceviewer.help/html/tasks/traceactivation.htm">Activate your traces in TraceViewer.</a></li>
+	<li><a href="../../../com.nokia.s60tools.traceanalyser.help/html/gettingstarted/traceanalyser_basic_walkthrough.htm">Analyse the traces in TraceAnalyser.</a></li>
+</ol>
+
+<div id="footer">Copyright &copy; 2007-2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.</div>
+
+</body>
+</html>
\ No newline at end of file
Binary file trace/traceviewer/com.nokia.trace.help/html/images/about_cpp.png has changed
Binary file trace/traceviewer/com.nokia.trace.help/html/images/background_carbide.jpg has changed
Binary file trace/traceviewer/com.nokia.trace.help/html/images/brandmark_cpp.gif has changed
Binary file trace/traceviewer/com.nokia.trace.help/html/images/gold_header.png has changed
Binary file trace/traceviewer/com.nokia.trace.help/html/images/green_fade_left_68_165_28.png has changed
Binary file trace/traceviewer/com.nokia.trace.help/html/images/traceanalyser.png has changed
Binary file trace/traceviewer/com.nokia.trace.help/html/images/tracebuilder.png has changed
Binary file trace/traceviewer/com.nokia.trace.help/html/images/traceviewer.png has changed
Binary file trace/traceviewer/com.nokia.trace.help/html/images/tracing.png has changed
Binary file trace/traceviewer/com.nokia.trace.help/html/images/tracing.ppt has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.help/html/legal.htm	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,29 @@
+<!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  &copy;
+ 2007-2010 Nokia Corporation and/or its subsidiaries. All rights reserved. Reproduction,
+transfer, distribution or storage of part or all of the contents in this document
+in any form without the prior written permission of Nokia is prohibited.</p><?Pub Caret> <p>
+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.</p> <h5> DISCLAIMER 
+</h5><p>NOKIA CORPORATION ("NOKIA") WILL NOT BE RESPONSIBLE IN ANY EVENT FOR
+ERRORS IN THIS DOCUMENT OR FOR ANY DAMAGES, INCIDENTAL OR CONSEQUENTIAL (INCLUDING
+MONETARY LOSSES), THAT MIGHT ARISE OUT OF THE USE OF THIS DOCUMENT OR THE
+INFORMATION IN IT. UNDER NO CIRCUMSTANCES SHALL NOKIA BE RESPONSIBLE FOR ANY
+LOSS OF USE, DATA, OR INCOME, COST OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
+PROPERTY DAMAGE, PERSONAL INJURY OR ANY SPECIAL, INDIRECT, INCIDENTAL, PUNITIVE
+OR CONSEQUENTIAL DAMAGES HOWSOEVER CAUSED.  </p><p>THE CONTENTS OF THIS DOCUMENT
+ARE PROVIDED "AS IS". EXCEPT AS REQUIRED BY APPLICABLE MANDATORY LAW, NO WARRANTIES
+OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NON-INFRINGEMENT, ARE MADE IN RELATION TO THE ACCURACY, RELIABILITY OR CONTENTS
+OF THIS DOCUMENT. NOKIA RESERVES THE RIGHT TO REVISE THIS DOCUMENT OR WITHDRAW
+IT AT ANY TIME WITHOUT PRIOR NOTICE. </p>  <div id="footer">Copyright &copy;
+2007-2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. 
+</div></body></html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.help/html/plugin.xml	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+
+<plugin
+   id="com.nokia.trace.help"
+   name="Carbide.c++ - Tracing User Guide Help Plug-in"
+   version="1.0.0"
+   provider-name="Nokia">
+
+   <extension
+         point="org.eclipse.help.toc">
+      <toc
+            file="toc.xml"
+            primary="true">
+      </toc>
+      <toc
+            file="tocconcepts.xml">
+      </toc>
+      <toc
+            file="tocgettingstarted.xml">
+      </toc>
+      <toc
+            file="toctasks.xml">
+      </toc>
+
+      <toc
+            file="tocreferences.xml">
+      </toc>
+
+   </extension>
+
+</plugin>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.help/html/reference/references.htm	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,15 @@
+<!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">
+<link href="../../book.css" type="text/css" rel="StyleSheet">
+<title>Tips &amp; Tricks</title>
+</head>
+<body bgcolor="#FFFFFF"><h2>Tips and Tricks</h2> <p>Topics in this section
+give you quick-reference information on: </p>
+<ul><li>the  tools' User Interface items, </li>
+<li>and useful tips and tricks about tracing. </li></ul>
+<p><b>Click the topics available on the left-hand navigation pane to browse for more information. 
+</b></p>      <div id="footer">Copyright &copy;2007-2010 Nokia Corporation and/or
+its subsidiary(-ies). All rights reserved. </div></body></html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.help/html/toc.htm	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,58 @@
+<!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>Tracing User's Guide</title>
+<link href="../book.css" type="text/css" rel="stylesheet">
+<style>
+	table, td, th { border: 0px none #FFF; }
+</style>
+</head>
+<body background="images/background_carbide.jpg">
+
+<table width="530" border="0" align="center" cellpadding="0" cellspacing="5" bgcolor="#FFFFFF" >
+  <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>&nbsp;</p>
+        <p>&nbsp;</p>
+        <p>&nbsp;</p>
+        <p class="titleSmall">Copyright &copy; 2007-2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.</p>		
+    </td>
+  </tr>
+  <tr>
+    <td colspan="2"><h1 align="center">Tracing User Guide </h1>
+      <p align="center" class="titleSmall">Version 1.0.0; November, 2009</p></td>
+  </tr>
+  <tr>
+	<td colspan="2">
+		<p>These topics help you get the most benefit out of tracing in your Carbide.c++ environment.</p>
+
+		<h3>Recommended reading for new users</h3>
+		<ul>
+		<li>If you are new to the tracing concepts and product area in general, start by reading
+		topics in the following category: <a href="concepts/concepts.htm">Understanding
+		tracing</a>.</li>
+		<li>See the <a href="gettingstarted/walk_through.htm">basic walk-through</a> for OST tracing.
+		</li>
+		<li>You also welcome to try out available cheatsheets in: <b>Help > Cheat
+		Sheets > Carbide.c++ Tools</b>. </li>
+		</ul>
+
+		<h3>Recommended reading for returning users</h3>
+		<ul>
+		<li>If you are already familiar with the tracing tools and want to see what
+		is new or changed in this release, browse the tool-specific <i>Release Notes
+		</i> on the left-hand navigation pane, under the category <b>What's New in
+		this release?</b>. </li>
+		<li>Also check the <a href="reference/references.htm">Tips &amp; Tricks</a> section
+		for useful troubleshooting information. </li>
+		</ul>
+
+		<p><a href="legal.htm">Legal</a></p>
+
+	</td>
+  </tr>
+</table>
+</body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.help/html/toolTOC.xml	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?NLS TYPE="org.eclipse.help.toc"?>
+
+<toc label="Tracing User&apos;s Guide" link_to="../com.nokia.carbide.help.common/carbideHelpTOC.xml#anchorCarbideFeature">
+   <topic href="html/toc.htm" label="Tracing User&apos;s Guide">
+      <topic href="html/gettingstarted/GS_index.htm" label="Getting started with tracing tools"></topic>
+	  <topic href="html/gettingstarted/walk_through.htm" label="Basic walk-through of tracing"></topic>
+      <topic href="html/whats_new.htm" label="What&apos;s New in this release?">
+         <topic href="../com.nokia.tracebuilder.help/html/release_notes.htm" label="TraceBuilder"></topic>
+         <topic href="../com.nokia.traceviewer.help/html/release_notes.htm" label="TraceViewer"></topic>
+         <topic href="../com.nokia.s60tools.traceanalyser.help/html/release_notes.htm" label="TraceAnalyser"></topic>
+      </topic>
+      <topic href="html/concepts/concepts.htm" label="Understanding tracing">
+         <link toc="../com.nokia.traceviewer.help/html/tocConcepts.xml"/>
+      </topic>
+      <topic href="../com.nokia.tracebuilder.help/html/gettingstarted/basic_steps.htm" label="Adding traces to the code (TraceBuilder)">
+         <link toc="../com.nokia.tracebuilder.help/html/tocTasks.xml"/>
+      </topic>
+      <topic href="../com.nokia.traceviewer.help/html/gettingstarted/basic_steps.htm" label="Setting up and receiving traces (TraceViewer)">
+         <link toc="../com.nokia.traceviewer.help/html/tocTasks.xml"/>
+      </topic>
+      <topic href="../com.nokia.s60tools.traceanalyser.help/html/gettingstarted/traceanalyser_basic_walkthrough.htm" label="Analysing traces (TraceAnalyser)">
+         <link toc="../com.nokia.s60tools.traceanalyser.help/html/tocTasks.xml"/>
+      </topic>
+      <topic href="html/reference/references.htm" label="Tips &amp; Tricks">
+         <link toc="../com.nokia.tracebuilder.help/html/tocReference.xml"/>
+         <link toc="../com.nokia.traceviewer.help/html/tocReference.xml"/>
+      </topic>
+      <topic href="html/legal.htm" label="Legal" >
+      </topic>
+   </topic>		
+</toc>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.help/html/whats_new.htm	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,18 @@
+<!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>Getting started</title>
+<link href="../book.css" type="text/css" rel="stylesheet"></head>
+<body>
+<h2>What's new in this release?</h2>
+<p>This section combines the Release Notes of the Carbide.c++ Extensions related to tracing:</p>
+<ul>
+	<li><a href="../../com.nokia.tracebuilder.help/html/release_notes.htm">TraceBuilder</a></li>
+	<li><a href="../../com.nokia.traceviewer.help/html/release_notes.htm">TraceViewer</a></li>
+	<li><a href="../../com.nokia.s60tools.traceanalyser.help/html/release_notes.htm">TraceAnalyser</a></li>
+</ul>
+
+<div id="footer">Copyright &copy;2007-2010 Nokia Corporation and/or its subsidiaries. All rights reserved.</div>
+</body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.trace.help/plugin.xml	Wed Jun 23 14:49:59 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="primary"/>
+	<!-- 
+		<toc
+        file="html/tocConcepts.xml"
+        primary="false"/>
+  <toc
+        file="html/tocReference.xml"
+        primary="false"/>
+  <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.ide.cheatsheets"
+			name="Carbide.c++" />
+		<cheatsheet
+			category="com.nokia.carbide.ide.cheatsheets"
+			contentFile="html/cheatsheets/getStarted_cs.xml"
+			id="com.nokia.cdt.debug.help.getStarted"
+			name="HelloCarbide Project Example"/>
+	</extension>
+    -->
+	
+	<!-- CONTEXT IDs for CONTEXTUAL HELP in windows, dialogs, and views -->
+	<!--
+	<extension point="org.eclipse.help.contexts" >
+
+       <contexts file="html/context_help/org_eclipse_debug_ui.xml"
+       		plugin="org.eclipse.debug.ui" />
+
+	</extension>
+	-->
+	
+	<!-- <extension point="org.eclipse.help.index" >
+        <index file="html/index.xml"/>
+    </extension> --> 
+
+	
+</plugin>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.dictionary/.classpath	Wed Jun 23 14:49:59 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/traceviewer/com.nokia.traceviewer.dictionary/.settings/org.eclipse.jdt.core.prefs	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,8 @@
+#Wed Sep 30 15:01:05 EEST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+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/traceviewer/com.nokia.traceviewer.dictionary/META-INF/MANIFEST.MF	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: TraceViewer Dictionary Plug-in
+Bundle-SymbolicName: com.nokia.traceviewer.dictionary;singleton:=true
+Bundle-Version: 2.6.0
+Bundle-Activator: com.nokia.traceviewer.dictionary.TraceViewerDictionaryPlugin
+Bundle-Vendor: Nokia
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ com.nokia.traceviewer,
+ com.nokia.trace.dictionary
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.dictionary/about.html	Wed Jun 23 14:49:59 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 &copy; 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/traceviewer/com.nokia.traceviewer.dictionary/build.properties	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,8 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .,\
+               plugin.xml,\
+               about.html
+javacSource=1.5
+javacTarget=1.5
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.dictionary/plugin.xml	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+   <extension
+         point="com.nokia.traceviewer.decodeprovider">
+      <client
+            class="com.nokia.traceviewer.dictionary.TraceViewerDictionaryEngine">
+      </client>
+   </extension>
+</plugin>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.dictionary/src/com/nokia/traceviewer/dictionary/ActivationHandler.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,129 @@
+/*
+ * 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:
+ *
+ * ActivationHandler handles all activation related things
+ *
+ */
+package com.nokia.traceviewer.dictionary;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import com.nokia.trace.dictionary.model.DictionaryDecodeModel;
+import com.nokia.trace.dictionary.model.Trace;
+import com.nokia.trace.dictionary.model.TraceComponent;
+import com.nokia.trace.dictionary.model.TraceData;
+import com.nokia.trace.dictionary.model.TraceGroup;
+import com.nokia.trace.dictionary.model.decodeparameters.DecodeParameter;
+import com.nokia.traceviewer.engine.activation.TraceActivationComponentItem;
+import com.nokia.traceviewer.engine.activation.TraceActivationGroupItem;
+import com.nokia.traceviewer.engine.activation.TraceActivationTraceItem;
+
+/**
+ * ActivationHandler handles all activation related things like returning
+ * activation information
+ */
+public class ActivationHandler {
+
+	/**
+	 * DecodeFile Model
+	 */
+	private final DictionaryDecodeModel model;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param model
+	 */
+	public ActivationHandler(DictionaryDecodeModel model) {
+		this.model = model;
+	}
+
+	/**
+	 * Gets activation information
+	 * 
+	 * @param getAlsoTraces
+	 *            if true, also traces are added to the activation model. If
+	 *            false, traces arrays in groups are empty.
+	 * @return component list
+	 */
+	public ArrayList<TraceActivationComponentItem> getActivationInformation(
+			boolean getAlsoTraces) {
+		ArrayList<TraceComponent> modelComponents = model
+				.getActivationInformation();
+		ArrayList<TraceActivationComponentItem> activationComponents = new ArrayList<TraceActivationComponentItem>();
+
+		// Go trough components
+		Iterator<TraceComponent> i = modelComponents.iterator();
+		while (i != null && i.hasNext()) {
+			// Get model component
+			TraceComponent modelComponent = i.next();
+
+			// Create new activation component
+			TraceActivationComponentItem componentItem = new TraceActivationComponentItem(
+					modelComponent.getId(), modelComponent.getName());
+			componentItem.setFilePath(modelComponent.getDefinedInFilePath());
+
+			// Go through groups
+			Iterator<TraceGroup> j = modelComponent.getGroups().iterator();
+			while (j != null && j.hasNext()) {
+				// Get model groups
+				TraceGroup modelGroup = j.next();
+
+				// Create new activation group
+				TraceActivationGroupItem groupItem = new TraceActivationGroupItem(
+						componentItem, modelGroup.getId(), modelGroup.getName());
+
+				// Check if also traces are wanted
+				if (getAlsoTraces) {
+
+					// Go through traces
+					Iterator<Trace> k = modelGroup.getTraces().iterator();
+					while (k != null && k.hasNext()) {
+						// Get model traces
+						Trace modelTrace = k.next();
+
+						// Create new activation trace
+						TraceActivationTraceItem traceItem = new TraceActivationTraceItem(
+								groupItem, modelTrace.getId(), modelTrace
+										.getName());
+
+						TraceData traceData = modelTrace.getTraceData();
+
+						if (traceData != null) {
+							ArrayList<DecodeParameter> parameters = traceData
+									.getDecodeParameters();
+
+							// Calculate parameter count
+							int paramCount = 0;
+							for (int l = 0; l < parameters.size(); l++) {
+								if (parameters.get(l).getSize() != 0) {
+									paramCount++;
+								}
+							}
+
+							traceItem.setParameterCount(paramCount);
+						}
+					}
+				}
+			}
+
+			// Add this component to activationInformation list
+			activationComponents.add(componentItem);
+		}
+
+		return activationComponents;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.dictionary/src/com/nokia/traceviewer/dictionary/DecodeHandler.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,140 @@
+/*
+ * 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:
+ *
+ * DecodeHandler handles decoding
+ *
+ */
+package com.nokia.traceviewer.dictionary;
+
+import java.nio.ByteBuffer;
+import java.util.HashMap;
+
+import com.nokia.trace.dictionary.TraceDictionaryEngine;
+import com.nokia.trace.dictionary.decoder.TraceDictionaryDecoder;
+import com.nokia.trace.dictionary.model.Location;
+import com.nokia.traceviewer.engine.TraceInformation;
+import com.nokia.traceviewer.engine.TraceMetaData;
+import com.nokia.traceviewer.engine.TraceProperties;
+
+/**
+ * DecodeHandler handles decoding
+ */
+public class DecodeHandler {
+
+	/**
+	 * Trace Dictionary Engine
+	 */
+	private final TraceDictionaryEngine dictionaryEngine;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param dictionaryEngine
+	 *            engine
+	 */
+	public DecodeHandler(TraceDictionaryEngine dictionaryEngine) {
+		this.dictionaryEngine = dictionaryEngine;
+	}
+
+	/**
+	 * Decode this trace
+	 * 
+	 * @param dataBuffer
+	 *            dataBuffer where trace is
+	 * @param properties
+	 *            trace properties
+	 * @param addClassMethodPrefix
+	 *            if true, add class and function name to the trace text if they
+	 *            exist
+	 * @param addComponentGroupPrefix
+	 *            if true, add component and group name to the trace text if
+	 *            they exist
+	 * @return traceProperties having decoded traceString
+	 */
+	public TraceProperties decode(ByteBuffer dataBuffer,
+			TraceProperties properties, boolean addClassMethodPrefix,
+			boolean addComponentGroupPrefix) {
+		if (dictionaryEngine.getModel() != null
+				&& dictionaryEngine.getModel().isValid()) {
+
+			// Decode trace
+			StringBuffer traceData = dictionaryEngine.getDecoder().decode(
+					dataBuffer, properties.dataStart, properties.dataLength,
+					properties.information.getComponentId(),
+					properties.information.getGroupId(),
+					properties.information.getTraceId(), addClassMethodPrefix,
+					addComponentGroupPrefix, properties.parameters);
+
+			if (traceData != null) {
+
+				// Set traceString property from this stringBuffer
+				properties.traceString = traceData.toString();
+				properties.binaryTrace = false;
+			} else {
+				// If couldn't decode traceString, it's still a binary trace
+				properties.binaryTrace = true;
+			}
+		}
+
+		return properties;
+	}
+
+	/**
+	 * Gets trace metadata
+	 * 
+	 * @param information
+	 *            trace information
+	 * @return trace metadata
+	 */
+	public TraceMetaData getTraceMetaData(TraceInformation information) {
+		TraceMetaData metaData = new TraceMetaData();
+		TraceDictionaryDecoder decoder = dictionaryEngine.getDecoder();
+
+		// Set trace where to get MetaData from
+		decoder.setTraceWhereToGetMetaData(information.getComponentId(),
+				information.getGroupId(), information.getTraceId());
+
+		// Get line number
+		int lineNumber = decoder.getLineNumber();
+		metaData.setLineNumber(lineNumber);
+
+		// Get location
+		Location location = decoder.getLocation();
+		if (location != null && location.getPath() != null) {
+			metaData.setPath(location.getPath().getFilePath()
+					+ location.getFilename());
+		}
+
+		// Get classname
+		String className = decoder.getClassName();
+		if (className != null) {
+			metaData.setClassName(className);
+		}
+
+		// Get function name
+		String methodName = decoder.getMethodName();
+		if (methodName != null) {
+			metaData.setMethodName(methodName);
+		}
+
+		// Get metadata array
+		HashMap<String, HashMap<String, Object>> map = decoder.getMetadata();
+		if (map != null) {
+			metaData.setMetaData(map);
+		}
+
+		return metaData;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.dictionary/src/com/nokia/traceviewer/dictionary/TraceViewerDictionaryEngine.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,317 @@
+/*
+ * 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:
+ *
+ * TraceViewer Dictionary Plugin Engine
+ *
+ */
+package com.nokia.traceviewer.dictionary;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+import com.nokia.trace.dictionary.TraceDictionaryEngine;
+import com.nokia.trace.dictionary.model.Trace;
+import com.nokia.trace.dictionary.model.TraceComponent;
+import com.nokia.trace.dictionary.model.TraceGroup;
+import com.nokia.traceviewer.engine.DecodeProvider;
+import com.nokia.traceviewer.engine.TraceInformation;
+import com.nokia.traceviewer.engine.TraceMetaData;
+import com.nokia.traceviewer.engine.TraceProperties;
+import com.nokia.traceviewer.engine.activation.TraceActivationComponentItem;
+
+/**
+ * TraceViewer Dictionary Plugin Engine
+ * 
+ */
+public class TraceViewerDictionaryEngine implements DecodeProvider {
+
+	/**
+	 * Dictionary Engine from com.nokia.trace.dictionary
+	 */
+	private final TraceDictionaryEngine dictionaryEngine;
+
+	/**
+	 * TraceViewer Dictionary Activation handler
+	 */
+	private final ActivationHandler activationHandler;
+
+	/**
+	 * TraceViewer Dictionary Decode handler
+	 */
+	private final DecodeHandler decodeHandler;
+
+	/**
+	 * Building model
+	 */
+	private boolean buildingModel;
+
+	/**
+	 * Boolean indicating if class and method names should be added to the trace
+	 * when decoded
+	 */
+	private boolean addClassMethodPrefix = true;
+
+	/**
+	 * Boolean indicating if component and group names should be added to the
+	 * trace when decoded
+	 */
+	private boolean addComponentGroupPrefix = true;
+
+	/**
+	 * Constructor
+	 */
+	public TraceViewerDictionaryEngine() {
+		// Create New com.nokia.trace.dictionary Engine
+		dictionaryEngine = new TraceDictionaryEngine();
+		activationHandler = new ActivationHandler(dictionaryEngine.getModel());
+		decodeHandler = new DecodeHandler(dictionaryEngine);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.DecodeProvider#decodeTrace(java.nio.ByteBuffer
+	 * , com.nokia.traceviewer.engine.TraceProperties)
+	 */
+	public TraceProperties decodeTrace(ByteBuffer dataBuffer,
+			TraceProperties properties) {
+		properties = decodeHandler.decode(dataBuffer, properties,
+				addClassMethodPrefix, addComponentGroupPrefix);
+		return properties;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.DecodeProvider#getActivationInformation(
+	 * boolean)
+	 */
+	public ArrayList<TraceActivationComponentItem> getActivationInformation(
+			boolean getAlsoTraces) {
+		ArrayList<TraceActivationComponentItem> activationComponents = activationHandler
+				.getActivationInformation(getAlsoTraces);
+
+		return activationComponents;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.DecodeProvider#getComponentGroupTraceName
+	 * (int, int, int)
+	 */
+	public String[] getComponentGroupTraceName(int componentId, int groupId,
+			int traceId) {
+		String[] names = new String[3];
+
+		// Component name
+		TraceComponent component = dictionaryEngine.getModel().getComponent(
+				componentId);
+		if (component != null) {
+			String componentName = component.getName();
+			names[0] = componentName;
+
+			// Group name
+			TraceGroup group = component.getGroup(groupId);
+			if (group != null) {
+				String groupName = group.getName();
+				names[1] = groupName;
+
+				// Trace name
+				Trace trace = group.getTrace(traceId);
+				if (trace != null) {
+					String traceName = trace.getName();
+					names[2] = traceName;
+				}
+			}
+		}
+
+		return names;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.DecodeProvider#getComponentName(int)
+	 */
+	public String getComponentName(int componentId) {
+		String componentName = null;
+		TraceComponent component = dictionaryEngine.getModel().getComponent(
+				componentId);
+		if (component != null) {
+			componentName = component.getName();
+		}
+
+		return componentName;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.DecodeProvider#getGroupName(int, int)
+	 */
+	public String getGroupName(int componentId, int groupId) {
+		String groupName = null;
+		TraceComponent component = dictionaryEngine.getModel().getComponent(
+				componentId);
+		if (component != null) {
+			TraceGroup group = component.getGroup(groupId);
+			if (group != null) {
+				groupName = group.getName();
+			}
+		}
+
+		return groupName;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.DecodeProvider#getGroupId(int,
+	 * java.lang.String)
+	 */
+	public int getGroupId(int componentId, String groupName) {
+		int groupId = dictionaryEngine.getModel().getGroupIdWithName(
+				componentId, groupName);
+		return groupId;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.DecodeProvider#getTraceMetaData(com.nokia
+	 * .traceviewer.engine.TraceInformation)
+	 */
+	public TraceMetaData getTraceMetaData(TraceInformation information) {
+		TraceMetaData metaData = decodeHandler.getTraceMetaData(information);
+		return metaData;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.DecodeProvider#getTraceName(int, int,
+	 * int)
+	 */
+	public String getTraceName(int componentId, int groupId, int traceId) {
+		String traceName = null;
+		TraceComponent component = dictionaryEngine.getModel().getComponent(
+				componentId);
+		if (component != null) {
+			TraceGroup group = component.getGroup(groupId);
+			if (group != null) {
+				Trace trace = group.getTrace(traceId);
+				if (trace != null) {
+					traceName = trace.getName();
+				}
+			}
+		}
+		return traceName;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.DecodeProvider#isModelLoadedAndValid()
+	 */
+	public boolean isModelLoadedAndValid() {
+		boolean loadedAndValid = false;
+		boolean valid = dictionaryEngine.getModel().isValid();
+		int nrOfComponents = dictionaryEngine.getModel()
+				.getActivationInformation().size();
+		if (valid && nrOfComponents > 0 && !buildingModel) {
+			loadedAndValid = true;
+		}
+		return loadedAndValid;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.DecodeProvider#openDecodeFile(java.lang.
+	 * String, java.io.InputStream, boolean)
+	 */
+	public void openDecodeFile(String filePath, InputStream inputStream,
+			boolean createNew) {
+		buildingModel = true;
+		File file = new File(filePath);
+
+		// Check if the file is a ZIP file
+		try {
+			ZipFile zipFile = new ZipFile(file);
+			Enumeration<? extends ZipEntry> entries = zipFile.entries();
+
+			// Loop through elements
+			while (entries.hasMoreElements()) {
+				ZipEntry entry = entries.nextElement();
+
+				if (!entry.isDirectory()) {
+					inputStream = zipFile.getInputStream(entry);
+
+					// Open the decode file entry from the ZIP
+					dictionaryEngine.getModelBuilder().openDecodeFile(
+							entry.getName(), inputStream, createNew);
+
+					createNew = false;
+				}
+			}
+
+		} catch (IOException e) {
+
+			// Not a ZIP file, open as normal decode file
+			dictionaryEngine.getModelBuilder().openDecodeFile(filePath,
+					inputStream, createNew);
+		} finally {
+			buildingModel = false;
+		}
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.DecodeProvider#removeComponentFromModel(int)
+	 */
+	public boolean removeComponentFromModel(int componentId) {
+		boolean removed = dictionaryEngine.getModel().removeComponent(
+				componentId);
+		return removed;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.DecodeProvider#setAddPrefixesToTrace(boolean
+	 * , boolean)
+	 */
+	public void setAddPrefixesToTrace(boolean addClassAndFunctionName,
+			boolean addComponentAndGroupName) {
+		addClassMethodPrefix = addClassAndFunctionName;
+		addComponentGroupPrefix = addComponentAndGroupName;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.dictionary/src/com/nokia/traceviewer/dictionary/TraceViewerDictionaryPlugin.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,79 @@
+/*
+ * 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:
+ *
+ * TraceViewer Dictionary Plugin
+ *
+ */
+package com.nokia.traceviewer.dictionary;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ * 
+ */
+public class TraceViewerDictionaryPlugin extends Plugin {
+
+	/**
+	 * The plug-in ID
+	 */
+	public static final String PLUGIN_ID = "com.nokia.traceviewer.dictionary"; //$NON-NLS-1$
+
+	/**
+	 * The shared instance
+	 */
+	private static TraceViewerDictionaryPlugin plugin;
+
+	/**
+	 * The constructor
+	 */
+	public TraceViewerDictionaryPlugin() {
+		plugin = this;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+	 */
+	@Override
+	public void start(BundleContext context) throws Exception {
+		super.start(context);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+	 */
+	@Override
+	public void stop(BundleContext context) throws Exception {
+		plugin = null;
+		super.stop(context);
+	}
+
+	/**
+	 * Returns the shared instance
+	 * 
+	 * @return the shared instance
+	 */
+	public static TraceViewerDictionaryPlugin getDefault() {
+		return plugin;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.eventhandler/.classpath	Wed Jun 23 14:49:59 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/traceviewer/com.nokia.traceviewer.eventhandler/.settings/org.eclipse.jdt.core.prefs	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,8 @@
+#Wed Sep 30 15:01:31 EEST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+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/traceviewer/com.nokia.traceviewer.eventhandler/META-INF/MANIFEST.MF	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: TraceViewer Event Handler Plug-in
+Bundle-SymbolicName: com.nokia.traceviewer.eventhandler;singleton:=true
+Bundle-Version: 2.6.0
+Bundle-Activator: com.nokia.traceviewer.eventhandler.Activator
+Bundle-Vendor: Nokia
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.ui,
+ com.nokia.trace.eventview,
+ com.nokia.carbide.trk.support,
+ com.nokia.traceviewer
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.eventhandler/about.html	Wed Jun 23 14:49:59 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 &copy; 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/traceviewer/com.nokia.traceviewer.eventhandler/build.properties	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,8 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .,\
+               plugin.xml,\
+               about.html
+javacSource=1.5
+javacTarget=1.5
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.eventhandler/plugin.xml	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+   <extension
+         point="org.eclipse.ui.startup">
+      <startup class="com.nokia.traceviewer.eventhandler.EventHandlerStartup"/>
+   </extension>
+   
+  <extension point="org.eclipse.ui.menus">
+    <menuContribution
+      locationURI="toolbar:org.eclipse.ui.trim.status?after=additions">
+      <toolbar
+        id="com.nokia.traceviewer.eventhandler.contributions.contributedTrim">
+        <control
+          class="com.nokia.traceviewer.eventhandler.TrimInformation"
+          id="com.nokia.traceviewer.eventhandler.trimInformation">
+        </control>
+      </toolbar>
+    </menuContribution>
+  </extension>
+  
+   <extension
+         point="com.nokia.traceviewer.trimprovider">
+      <client
+            class="com.nokia.traceviewer.eventhandler.TrimUpdater">
+      </client>
+   </extension>
+  
+</plugin>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.eventhandler/src/com/nokia/traceviewer/eventhandler/Activator.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,80 @@
+/*
+ * 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:
+ *
+ * The activator class controls the plug-in life cycle
+ *
+ */
+package com.nokia.traceviewer.eventhandler;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends Plugin {
+
+	/**
+	 * The plug-in ID
+	 */
+	public static final String PLUGIN_ID = "com.nokia.traceviewer.eventhandler"; //$NON-NLS-1$
+
+	/**
+	 * The shared instance
+	 */
+	private static Activator plugin;
+
+	/**
+	 * The constructor
+	 */
+	public Activator() {
+		plugin = this;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
+	 * )
+	 */
+	@Override
+	public void start(BundleContext context) throws Exception {
+		super.start(context);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
+	 * )
+	 */
+	@Override
+	public void stop(BundleContext context) throws Exception {
+		plugin = null;
+		super.stop(context);
+	}
+
+	/**
+	 * Returns the shared instance
+	 * 
+	 * @return the shared instance
+	 */
+	public static Activator getDefault() {
+		return plugin;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.eventhandler/src/com/nokia/traceviewer/eventhandler/EventHandlerStartup.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,41 @@
+/*
+ * 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:
+ *
+ * Plugin startup class
+ *
+ */
+package com.nokia.traceviewer.eventhandler;
+
+import org.eclipse.ui.IStartup;
+
+import com.nokia.trace.eventview.TraceEventView;
+
+/**
+ * Plugin startup class
+ */
+public final class EventHandlerStartup implements IStartup {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ui.IStartup#earlyStartup()
+	 */
+	public void earlyStartup() {
+
+		// By calling getEventList, we get EventView to register to
+		// EventRouter so the messages will go through to it.
+		TraceEventView.getEventList();
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.eventhandler/src/com/nokia/traceviewer/eventhandler/TrimInformation.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,126 @@
+/*
+ * 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:
+ *
+ * Trim Information
+ *
+ */
+package com.nokia.traceviewer.eventhandler;
+
+import org.eclipse.jface.action.IContributionManager;
+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.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.menus.WorkbenchWindowControlContribution;
+
+/**
+ * Trim Information
+ */
+public final class TrimInformation extends WorkbenchWindowControlContribution {
+	/**
+	 * Composite of the trim
+	 */
+	private static Composite composite;
+
+	/**
+	 * Text of the trim
+	 */
+	private static Label textLabel;
+
+	/**
+	 * Text inside the trim
+	 */
+	private static String textInTheTrim = ""; //$NON-NLS-1$
+
+	/**
+	 * Trim parent
+	 */
+	private static IContributionManager trimParent;
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.menus.AbstractTrimWidget#dispose()
+	 */
+	@Override
+	public void dispose() {
+		if (composite != null && !composite.isDisposed()) {
+			composite.dispose();
+		}
+		if (textLabel != null && !textLabel.isDisposed()) {
+			textLabel.dispose();
+		}
+		composite = null;
+		textLabel = null;
+	}
+
+	/**
+	 * Sets text to label
+	 * 
+	 * @param labelText
+	 *            text to insert
+	 */
+	public static void setTextToLabel(String labelText) {
+		textInTheTrim = labelText;
+
+		// Only update the trim parent when there's something in our trim
+		if (!textInTheTrim.equals("")) { //$NON-NLS-1$
+			trimParent.update(true);
+
+			// Empty, let's not resize the trim parent but only update the text
+		} else {
+			textLabel.setText(textInTheTrim);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.jface.action.ControlContribution#createControl(org.eclipse
+	 * .swt.widgets.Composite)
+	 */
+	@Override
+	protected Control createControl(Composite parent) {
+		trimParent = getParent();
+
+		// Create a composite to place the label in
+		composite = new Composite(parent, SWT.NULL);
+
+		// Give some room around the control
+		GridLayout layout = new GridLayout();
+		layout.marginHeight = 0;
+		composite.setLayout(layout);
+
+		// Create a label for the trim.
+		textLabel = new Label(composite, SWT.NULL);
+		textLabel
+				.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, true));
+		textLabel.setText(textInTheTrim);
+		return composite;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.action.ContributionItem#isDynamic()
+	 */
+	@Override
+	public boolean isDynamic() {
+		return true;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.eventhandler/src/com/nokia/traceviewer/eventhandler/TrimUpdater.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,37 @@
+/*
+ * 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:
+ *
+ * Trim Updater
+ *
+ */
+package com.nokia.traceviewer.eventhandler;
+
+import com.nokia.traceviewer.engine.TrimProvider;
+
+/**
+ * Trim Updater
+ */
+public final class TrimUpdater implements TrimProvider {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.TrimProvider#updateText(java.lang.String)
+	 */
+	public void updateText(String text) {
+		TrimInformation.setTextToLabel(text);
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.help/.classpath	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,6 @@
+<?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="output" path="bin"/>
+</classpath>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.help/.settings/org.eclipse.jdt.core.prefs	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,8 @@
+#Wed Sep 30 15:01:08 EEST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+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/traceviewer/com.nokia.traceviewer.help/META-INF/MANIFEST.MF	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,8 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: TraceViewer Help Plug-in
+Bundle-SymbolicName: com.nokia.traceviewer.help;singleton:=true
+Bundle-Version: 2.6.0
+Bundle-Vendor: Nokia
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.help/about.html	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,22 @@
+<!DOCTYPE HTML PUBLIC "“-//W3C//DTD" "HTML">
+<html>
+<head>
+  <title>About This Content</title>
+  <meta http-equiv="content-type"
+  content="application/xhtml+xml; charset=iso-8859-1">
+</head>
+
+<body lang="en-us">
+<h2>About This Content</h2>
+
+<p>June 20, 2010</p>
+
+<h3>Copyright</h3>
+
+
+<p>Copyright &copy; 2007-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>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.help/book.css	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,183 @@
+/*	
+	Copyright (c) 2007-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/traceviewer/com.nokia.traceviewer.help/build.properties	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,6 @@
+bin.includes = META-INF/,\
+               html/,\
+               plugin.xml,\
+               html/,\
+               about.html,\
+               book.css
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.help/html/concepts/concepts.htm	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,26 @@
+<!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" />
+<meta name="LASTUPDATED" content="06/17/05 11:09:43" />
+<title>Understanding tracing</title>
+<link rel="StyleSheet" href="../../book.css" type="text/css"/>
+</head>
+<body bgcolor="#FFFFFF">
+
+<h2>Concepts</h2>
+<p>The following concepts provide information on basic tracing-related terminology and processes:</p>
+<ul>
+	<li><a href="tracing.htm">Tracing</a></li>
+	<li><a href="trace_format.htm">Open System Trace (OST)</a></li>
+	<li><a href="when_to_use_ost.htm">When to use OST traces</a></li>
+	<li><a href="decode_file.htm">Dictionary file and trace activation</a></li>
+	<li><a href="filter.htm">Rules and filtering</a></li>
+	<li><a href="tracecompiler.htm">Trace Compiler</a></li>
+</ul>
+
+<div id="footer">Copyright &copy; 2007-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>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.help/html/concepts/decode_file.htm	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,41 @@
+<!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>Dictionary file and trace activation</title>
+<link href="../../book.css" type="text/css" rel="stylesheet"></head>
+<body>
+
+<h2>Dictionary file and trace activation</h2>
+<p>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.</p>
+<p>All the traces that come from various components on the device are
+first passed onto a trace handler, called TraceCore. TraceCore then determines
+which traces should be handed over to the PC and which ones should not. TraceCore
+only passes on those traces that have been activated and ignores the rest. 
+</p>
+<p>To activate and deactivate traces that are in the Open System Trace
+(OST) format, you must first define the used <i>Dictionary file</i>. </p>
+<p>Dictionary files are XML files that are usually available in your development
+environment. They are automatically re-generated every time Trace Compiler
+is run. This usually happens when you compile a component that contains Open
+System Trace (OST) traces. Dictionary files can normally be found from the <i>
+\epoc32\ost_dictionaries</i> directory under your Software Development Kit
+(SDK).</p>
+
+<h5>Related tasks</h5>
+<ul>
+	<li><a href="../tasks/traceactivation.htm">Activating traces</a></li>
+	<li><a href="../tasks/decoding_traces.htm">Decoding binary traces with a Dictionary file</a></li>
+</ul>
+
+<h5>Related concepts</h5>
+<ul>
+	<li><a href="trace_format.htm">Trace formats</a></li>
+</ul>
+
+<div id="footer">Copyright &copy; 2007-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>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.help/html/concepts/filter.htm	Wed Jun 23 14:49:59 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>Rules and filtering</title>
+<link href="../../book.css" type="text/css" rel="stylesheet"></head>
+<body>
+
+<h2>Rules and filtering</h2>
+<p>In order to manipulate the generated trace data, you can specify various 
+types of rules and filters, depending on what you want to find out.</p>
+<p>Usually, the criteria for the rules is defined to match the trace with 
+any of the following prerequisites:</p>
+<ul>
+	<li>a certain component ID</li>
+	<li>a component from a certain group</li>
+	<li>a pre-defined text string.</li>
+</ul>
+
+<p>You can specify the following types of rules in TraceViewer:
+<ul>
+<li><b>Color:</b> identifies traces that meet the specific criteria with a
+certain color.</li>
+<li><b>Line count:</b> counts the number of occurrences for a certain type
+of trace (for example, used to indicate how many times a function has been
+called during a test case).</li>
+<li><b>Variable tracing:</b> shows the values of certain variables and the
+history of their occurrences.</li>
+<li><b>Filter:</b> filters specific traces by allowing the creation of complex
+statements, which include certain traces and exclude others.</li>
+<li><b>Trigger:</b> used for setting up start and stop triggers that define
+specifically when traces should be received. </li>
+</ul>
+
+</p><p><b>Note:</b> Compared to trace <i>activation</i>, filters are not as 
+strict about the type of data they pass on from the device.
+For more information,  see <a href="decode_file.htm">Dictionary file and trace
+activation</a>.</p>
+
+<h5>Related tasks</h5>
+<ul>
+	<li><a href="../tasks/advancedfilter.htm">Setting filtering options</a></li>
+</ul>
+
+<div id="footer">Copyright &copy; 2007-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/traceviewer/com.nokia.traceviewer.help/html/concepts/trace_format.htm	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,34 @@
+<!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>Open System Trace (OST)</title>
+<link href="../../book.css" type="text/css" rel="stylesheet"></head>
+<body>
+
+<h2>Open System Trace (OST)</h2>
+<p>TraceViewer supports the Open System Trace (OST) trace format
+for data transfer. OST is an open, platform-independent solution that is easily
+integrated into the software development process.</p>
+<p>The OST Application Programming Interface (API) defines a set of macros 
+to instrument traces to the source code. The underlying OST Framework then sends 
+the instrumented traces out of the device. Before code compilation, traces are compiled by
+a <i>trace compiler</i>. The trace compiler assigns each trace a unique identifier,
+which is sent together with trace parameters. The trace compiler also generates
+decode file for decoding traces (the decoding process can be seen to translate
+identifier back to text).</p>
+<p>The benefits of using OST include: </p>
+<ul>
+<li>Use of standard interfaces and file formats for, for example, instrumentation
+macros, log file format, and trace format definition. </li>
+<li>Data packages transferred are significantly smaller in size than with
+other data formats. </li>
+<li>Traces can be activated or deactivated in group during runtime: image
+does not have to be recompiled or rebuilt after adding or removing traces.
+</li>
+</ul>
+
+<div id="footer">Copyright &copy; 2007-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>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.help/html/concepts/tracecompiler.htm	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,41 @@
+<!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>Trace Compiler</title>
+<link href="../../book.css" type="text/css" rel="stylesheet"></head>
+<body>
+
+<h2>Trace Compiler</h2>
+<p>The Trace Compiler is a tool that is attached
+to the Symbian OS Build System. It is run before the actual C++ compiler.
+The purpose of Trace Compiler is to generate the needed headers for Open System
+Traces (OST) traces to compile. Trace Compiler is run when you normally compile
+your component that has OST traces.</p>
+<p>When Trace Compiler is run and the project contains OST traces, 
+you should find the following text printed on the <b>Console</b> tab, 
+as in the following example for the <i>HelloWorld</i> component:</p>
+
+<pre>perl C:/Symbian/9.3/S60_3rd_FP2/epoc32/tools/tracecompiler.pl WINSCW
+******************* TRACECOMPILER STARTS *******************
+Building traces for component HelloWorld. Component UID: 0xEAAEC036.
+******************* TRACECOMPILER ENDS *********************</pre>
+
+<p>After Trace Compiler is run, the needed headers are generated to the <b>traces</b> 
+folder of your component. If you have OST traces in <i>HelloWorld.cpp</i>, 
+the header to be generated is <i>HelloWorldTraces.h</i>, which is included
+from <i>HelloWorld.cpp</i>.</p>
+<p><b>Note:</b> If you cannot find the following line or similar when compiling 
+your component, it might be that your SDK does not  have Trace Compiler installed:</p>
+
+<pre>perl C:/Symbian/9.3/S60_3rd_FP2/epoc32/tools/tracecompiler.pl WINSCW</pre>
+
+<h5>Related concepts</h5>
+<ul>
+	<li><a href="trace_format.htm">Open System Trace (OST)</a></li>
+</ul>
+
+<div id="footer">Copyright &copy; 2007-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>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.help/html/concepts/tracing.htm	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,52 @@
+<!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>Tracing</title>
+<link href="../../book.css" type="text/css" rel="stylesheet"></head>
+<body>
+
+<h2>Tracing</h2>
+<p>Tracing is a way to record debugging information
+that can be used during software development. With tracing, you can generate
+detailed, low-level information about an application's execution in the target
+device.</p>
+<p>Examples of tracing are cases when messages are sent or received
+from a component, when states change, when a certain function is entered or
+exited, or anywhere else in the code where it is interesting to know if code
+has been executed or not.</p>
+<p>System level performance analysis and problem-solving
+are often based on tracing. In your development team, a standard way to instrument
+traces to your code (for example, using the same trace group for fatal error
+tracing) can help in determining which level of traces should be activated. 
+</p>
+<p>TraceViewer collects traces as follows:</p>
+<ol>
+<li>TraceViewer connects to the device according to the connection parameters
+that can be defined on the <b>Preferences</b> page. </li>
+<li>The tool then collects the traces for a specified purpose (for example,
+during the testing of a certain component at the device side). </li>
+<li>The traces are displayed on the Carbide IDE user interface.</li>
+</ol>
+
+<p><b>Note:</b> there is a distinction between <i>tracing</i> and <i>
+logging</i> as general terms. Tracing is primarily for debugging and diagnostic
+purposes, whereas logging writes records of program usage and is often a functional
+requirement of a program.</p>
+
+<h5>Related concepts</h5>
+<ul>
+	<li><a href="trace_format.htm">Trace formats</a></li>
+</ul>
+
+<h5>Related tasks</h5>
+<ul>
+	<li><a href="../tasks/connect.htm">Connecting to the trace source</a></li>
+	<li><a href="../tasks/decoding_traces.htm">Decoding binary traces with a Dictionary file</a></li>
+	<li><a href="../tasks/traceactivation.htm">Activating traces</a></li>
+</ul>
+
+<div id="footer">Copyright &copy; 2007-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>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.help/html/concepts/when_to_use_ost.htm	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,50 @@
+<!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>When to use OST traces</title>
+<link href="../../book.css" type="text/css" rel="stylesheet"></head>
+<body>
+
+<h2>When to use OST traces</h2>
+<p>In general, it is not good idea to trace &ldquo;just in case&rdquo;, 
+or to see that everything works OK. Consider these points: </p>
+<ul>
+<li>Use traces to find the rough location of the problem and then use a debugger
+for the rest of the job. You save time as you are able to see registers, call-stacks
+and program variables. Do not debug using traces, it is very slow.  </li>
+<li>Some good cases to use tracing are:  
+	<ul>
+		<li>in code that manages error situations,  </li>
+		<li>initialization or stopping of operation,  </li>
+		<li>control operations that happen rarely (user input, for example). </li>
+	</ul>
+</li>
+<li>It is not recommended to add traces to code that is called very often,
+as each software tracepoint causes performance overhead. When tracepoint is
+not activated, some time is spent for checking if the trace is activated or
+not. When tracepoint is activated, additional time is taken when sending it
+to the trace port.</li>
+<li>If you get error reports after your code has been submitted to the release,
+well-planned traces can help you find out what went wrong and where to start
+looking for the problem. You can even instruct the problem reporter to take
+additional trace log with certain tracepoints enabled: <i>&ldquo;Send us a
+log where tracegroups X and Y from component Z are activated.&rdquo; </i></li>
+</ul>
+
+<h5>Related concepts</h5>
+<ul>
+	<li><a href="trace_format.htm">Trace formats</a></li>
+</ul>
+
+<h5>Related tasks</h5>
+<ul>
+	<li><a href="../tasks/connect.htm">Connecting to the trace source</a></li>
+	<li><a href="../tasks/decoding_traces.htm">Decoding binary traces with a Dictionary file</a></li>
+	<li><a href="../tasks/traceactivation.htm">Activating traces</a></li>
+</ul>
+
+<div id="footer">Copyright &copy; 2007-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>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.help/html/contexts.xml	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?NLS TYPE="org.eclipse.help.contexts"?>
+<contexts>
+
+<context id="TRACEVIEWER_HELP_MAIN_VIEW">
+ 	<description>Help on the TraceViewer main view</description>	   
+ 	<topic label="Toolbar" href="html/reference/toolbar.htm"/>
+	<topic label="Basic steps" href="html/gettingstarted/basic_steps.htm"/>
+ 	<topic label="Connecting to the trace source" href="html/tasks/connect.htm"/>
+ 	<topic label="Searching for traces" href="html/tasks/search.htm"/>
+ 	<topic label="Activating traces" href="html/tasks/traceactivation.htm"/>
+ 	<topic label="Using an external filter application" href="html/tasks/externalfilter.htm"/>
+ 	<topic label="Decoding binary traces with a Dictionary file" href="html/tasks/decoding_traces.htm"/>
+ 	<topic label="Setting up rules and filters" href="html/tasks/setup_rules.htm"/>
+</context>
+
+<context id="TRACEVIEWER_HELP_ACTIONS">
+ 	<description>Rules, filters and definitions for rules for various items can be set up in separate dialogs.</description>	   
+ 	<topic label="Setting up rules and filters" href="html/tasks/setup_rules.htm"/>
+ 	<topic label="Setting filtering options" href="html/tasks/advancedfilter.htm"/>
+</context>
+
+<context id="TRACEVIEWER_HELP_ACTIVATION_CONFIGURATIONS">
+ 	<description>Loading a saved activation configuration in the Load Configuration dialog</description>	   
+ 	<topic label="Loading a saved activation configuration" href="html/tasks/traceactivation.htm#act_conf"/>
+</context>
+
+<context id="TRACEVIEWER_HELP_ACTIVATION_DIALOG">
+ 	<description>Loading Dictionary files and activating traces in the Trace Activation dialog</description>	   
+ 	<topic label="Decoding binary traces with a Dictionary file" href="html/tasks/decoding_traces.htm"/>
+ 	<topic label="Activating traces" href="html/tasks/traceactivation.htm"/>
+</context>
+
+
+<context id="TRACEVIEWER_HELP_LOGGING">
+ 	<description>Logging dialog</description>	   
+ 	<topic label="Configuring logging for traces" href="html/tasks/log.htm"/>
+</context>
+
+<context id="TRACEVIEWER_HELP_PROPERTY_VIEW">
+ 	<description>TraceViewer Property View</description>	   
+ 	<topic label="Viewing line count and variable tracing items" href="html/tasks/viewing_traces.htm"/>
+</context>
+
+<context id="TRACEVIEWER_HELP_VARIABLE_TRACING_HISTORY">
+ 	<description>Variable Tracing History dialog</description>	   
+ 	<topic label="Viewing variable tracing history" href="html/tasks/viewing_traces.htm#varhist"/>
+</context>
+
+<context id="TRACEVIEWER_HELP_TRIGGERING">
+ 	<description>Trigger Rules dialog</description>	   
+ 	<topic label="Configuring triggers" href="html/tasks/trigger.htm"/>
+</context>
+
+<context id="TRACEVIEWER_HELP_SEARCHING">
+ 	<description>Search dialog</description>	   
+ 	<topic label="Searching traces" href="html/tasks/search.htm"/>
+</context>
+
+<context id="TRACEVIEWER_HELP_GENERAL_PREFERENCES">
+ 	<description>TraceViewer General Settings</description>	   
+ 	<topic label="General settings" href="html/reference/preferencesgeneral.htm"/>
+</context> 
+
+<context id="TRACEVIEWER_HELP_ADVANCED_PREFERENCES">
+ 	<description>TraceViewer Advanced Settings</description>	   
+ 	<topic label="Advanced settings" href="html/reference/preferencesadvanced.htm"/>
+</context> 
+
+<context id="TRACEVIEWER_HELP_CONNECTION_PREFERENCES">
+ 	<description>TraceViewer Connection Settings</description>	   
+ 	<topic label="Connection settings" href="html/reference/preferencesconnection.htm"/>
+</context> 
+
+<context id="TRACEVIEWER_HELP_PLUGINS_PREFERENCES">
+ 	<description>TraceViewer Plugins Settings</description>	   
+ 	<topic label="TraceViewer Plugins settings" href="html/reference/preferencesplugins.htm"/>
+</context> 
+
+<context id="TRACEVIEWER_HELP_TRACE_INFO_DIALOG" title="Trace information dialog">
+	<description>In trace information dialog you can see more detailed information about the selected trace. This information include trace number in the view and the trace in hex string. Also, if trace is decoded, there can be information such as method name, class name, file name and line number where the trace is defined.
+	</description>
+	</context>
+</contexts>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.help/html/gettingstarted/basic_steps.htm	Wed Jun 23 14:49:59 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>TraceViewer basic steps</title>
+<link href="../../book.css" type="text/css" rel="stylesheet"></head>
+<body>
+
+<h2>TraceViewer basic steps</h2>
+<p>Open the TraceViewer tool in either of the following ways: </p>
+<ul>
+	<li>From the <b>Carbide > TraceViewer</b> menu. </li>
+	<li>From the  <b>Window > Show view > Other > Carbide extensions</b> menu.</li>
+</ul>
+<p>Tracing a target device involves the following stages, some of which are optional. </p>
+<ol>
+	<li>Set up tracing for your development goals.
+	<ul>
+		<li><a href="../tasks/preferences.htm">Setting TraceViewer preferences</a> 
+			(Connection settings are mandatory to define)</li>
+		<li><a href="../tasks/trigger.htm">Configuring triggers</a> (optional)</li>
+		<li><a href="../tasks/log.htm">Configuring logging for traces</a> (optional)</li>
+		<li><a href="../tasks/setup_rules.htm">Setting up rules and filters</a> (optional)</li>
+		<li><a href="../tasks/decoding_traces.htm">Decoding binary traces with a Dictionary 
+			file</a>(mandatory for OST traces)</li>
+		<li><a href="../tasks/traceactivation.htm">Activating traces</a>(mandatory for OST traces)</li>
+	</ul>
+	</li>
+	<li>Connect to the device to start receiving traces.
+	<ul>
+		<li><a href="../tasks/connect.htm">Connecting to the trace source</a>.</li>
+	</ul>
+	</li>
+	<li>Start the device, the application or the test case you are working on. <p>
+		The received traces should be visible in the TraceViewer main view, as shown
+		below in an example.</p>
+		<p><img src="images/mainview2.png" alt="Sample of trace listing on the user interface"></p>
+	</li>
+	<li>Analyse the data to get more information of the trace itself or open the
+		trace location in a text editor (only for OST traces). </li>
+	<li>(Optional) You can also copy the trace information to the clipboard or 
+		<a href="../tasks/search.htm">search for traces</a>. </li>
+</ol>
+
+<div id="footer">Copyright &copy; 2007-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>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.help/html/gettingstarted/gs_index.htm	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,23 @@
+<!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>Getting started</title>
+    <link href="../../book.css" rel="stylesheet" type="text/css">
+</head>
+
+<body>
+<h2>Getting started</h2>
+<p>This section provides an overview to what you can do with TraceViewer.</p>
+
+<P>Topics in this section include:</p>
+<ul>
+  <li><a href="overview.htm">Overview</a></li>
+  <li><a href="basic_steps.htm">Basic steps</a></li>
+</ul>
+
+<div id="footer">Copyright &copy; 2007-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>
\ No newline at end of file
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/gettingstarted/images/mainview2.png has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/gettingstarted/images/ost_standard.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.help/html/gettingstarted/overview.htm	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,39 @@
+<!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>TraceViewer overview</title>
+<link href="../../book.css" type="text/css" rel="stylesheet"></head>
+<body>
+
+<h2>TraceViewer overview</h2>
+<p>TraceViewer is a tool for tracing a target device in the Carbide.c++ 
+Integrated Development Environment (IDE). The target device can be 
+connected to the PC through USB.</p>
+<p>TraceViewer is useful for developers or testers in obtaining and analyzing, for example,
+component-specific data during a test case. With this tool, you can manipulate
+and filter the received traces in various ways to pin-point the relevant information
+that affects your components. In addition, the tool enables you to define
+exactly what type of trace data you want to activate and receive.</p>
+<p>TraceViewer supports the Open System Trace (OST) trace format for data transfer. 
+The OST solution includes the following features: </p>
+<ul>
+	<li>Sending traces from device to tool</li>
+	<li>Activating traces from tool</li>
+	<li>Standardized AND custom trace formats</li>
+	<li>Decoding and analyzing of traces in tools</li>
+	<li>Recording traces in log files</li>
+</ul>
+<p><img src="images/ost_standard.png" alt="An overview of OST standard"></p>
+
+<h5>Related concepts</h5>
+<ul>
+	<li><a href="../concepts/tracing.htm">Tracing</a></li>
+	<li><a href="../concepts/trace_format.htm">Open System Trace (OST)</a></li>
+	<li><a href="../concepts/decode_file.htm">Dictionary file and trace activation</a></li>
+</ul>
+
+<div id="footer">Copyright &copy; 2007-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>
\ No newline at end of file
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/images/about_cpp.png has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/images/background_carbide.jpg has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/images/brandmark_cpp.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/images/gold_header.png has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/images/green_fade_left_68_165_28.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.help/html/index.xml	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,58 @@
+<?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.
+	
+	-->
+
+<index>
+
+	<entry keyword="Open System Trace" >
+		<topic href="html/concepts/trace_format.htm" />
+	</entry> 
+
+	<entry keyword="OST" >
+		<topic href="html/concepts/trace_format.htm" />
+	</entry> 
+
+	<entry keyword="when to use OST" >
+		<topic href="html/concepts/when_to_use_ost.htm" />
+	</entry> 
+
+	<entry keyword="tracing" >
+		<topic href="html/concepts/tracing.htm" />
+	</entry> 
+	
+	<entry keyword="dictionary file" >
+		<topic href="html/concepts/decode_file.htm" />
+	</entry>
+
+	<entry keyword="activating traces" >
+		<topic href="html/tasks/traceactivation.htm" />
+	</entry> 
+
+	<entry keyword="TraceViewer preferences" >
+		<topic href="html/tasks/preferences.htm" />
+	</entry> 
+
+	<entry keyword="decoding traces" >
+		<topic href="html/tasks/decoding_traces.htm" />
+	</entry> 
+
+	<entry keyword="connecting to trace source" >
+		<topic href="html/tasks/connect.htm" />
+	</entry> 
+
+</index>
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.help/html/legal.htm	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,55 @@
+<!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 &copy; 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 <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>
+
+<h5>TRADEMARKS</h5>
+
+<p>Nokia and Nokia Connecting People are registered trademarks of the Nokia
+Corporation. Symbian OS is a trademark of Symbian Ltd. All other tradenames and
+trademarks are the property of their respective owners.</p>
+
+<h5>DISCLAIMER </h5>
+
+<p>NOKIA CORPORATION ("NOKIA") WILL NOT BE RESPONSIBLE IN ANY EVENT FOR ERRORS
+IN THIS DOCUMENT OR FOR ANY DAMAGES, INCIDENTAL OR CONSEQUENTIAL (INCLUDING
+MONETARY LOSSES), THAT MIGHT ARISE OUT OF THE USE OF THIS DOCUMENT OR THE
+INFORMATION IN IT. UNDER NO CIRCUMSTANCES SHALL NOKIA BE RESPONSIBLE FOR ANY
+LOSS OF USE, DATA, OR INCOME, COST OF PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES, PROPERTY DAMAGE, PERSONAL INJURY OR ANY SPECIAL, INDIRECT,
+INCIDENTAL, PUNITIVE OR CONSEQUENTIAL DAMAGES HOWSOEVER CAUSED. </p>
+
+<p>THE CONTENTS OF THIS DOCUMENT ARE PROVIDED "AS IS". EXCEPT AS REQUIRED BY
+APPLICABLE MANDATORY LAW, NO WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT, ARE MADE IN RELATION TO
+THE ACCURACY, RELIABILITY OR CONTENTS OF THIS DOCUMENT. NOKIA RESERVES THE
+RIGHT TO REVISE THIS DOCUMENT OR WITHDRAW IT AT ANY TIME WITHOUT PRIOR NOTICE.
+</p>
+
+<div id="footer">Copyright &copy; 2007-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/traceviewer/com.nokia.traceviewer.help/html/reference/images/connection_01.png has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/reference/images/connection_musti.png has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/reference/images/connection_platsim.png has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/reference/images/connection_usb.png has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/reference/images/iconclear.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/reference/images/iconcolor.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/reference/images/iconconnect.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/reference/images/iconconnectionsettings.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/reference/images/iconcount.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/reference/images/iconexternalfilter.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/reference/images/iconfilter.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/reference/images/iconlog.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/reference/images/iconpause.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/reference/images/iconsearch.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/reference/images/icontraceactivation.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/reference/images/icontracevariable.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/reference/images/icontrigger.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/reference/images/preferencesAdvanced.png has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/reference/images/preferencesConnection.png has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/reference/images/toolbar.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.help/html/reference/preferencesadvanced.htm	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,39 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title>Advanced settings</title>
+<link href="../../book.css" type="text/css" rel="stylesheet"></head>
+<body>
+
+<h2>Advanced settings</h2>  <p>These preferences can be found from <b>
+Window > Preferences > Carbide Extensions > TraceViewer > Advanced</b>.</p>  <table
+border="1" cellspacing="1" cellpadding="2">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<tbody>
+<tr>
+<td height="92"><b>Using external stdin/stdout filter command</b> </td>
+<td height="92"><p>You can use the external <i>stdin/stdout</i> filter command
+to filter or modify traces. The command can be, for example, a Perl script
+that reads <i>stdin</i> and writes back to <i>stdout</i>.</p><p><b>NOTE:</b> If
+the path to the command or to the arguments contains spaces, place the whole
+command or argument inside quotation marks, for example: <i>"C:\Program files\perl.exe"
+"C:\Program files\myScript.pl"</i>. </p></td>
+</tr>
+</tbody>
+</table>
+
+<p>See the following example of this field: </p><img src="images/preferencesAdvanced.png"
+alt="Advanced settings dialog"><p></p>
+
+<h5>Related tasks</h5>
+<ul>
+<li><a href="../tasks/externalfilter.htm">Using an external filter application</a></li>
+</ul>
+
+<div id="footer">Copyright &copy; 2007-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>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.help/html/reference/preferencesconnection.htm	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,94 @@
+<!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>Connection settings</title>
+  <link href="../../book.css" type="text/css" rel="stylesheet">
+</head>
+
+<body>
+<h2>Connection settings</h2>
+
+<p>The connection preferences can be accessed from: <b>Window &gt;
+Preferences.</b> In the Preferences dialog list, select <b>Carbide Extensions
+&gt; TraceViewer &gt; Connection</b>. The <b>Connection</b> page opens to right
+side of the dialog.</p>
+
+<p><img src="images/preferencesConnection.png"
+alt="Connection settings dialog"></p>
+<ol>
+  <li>In <b>Use connection</b>, select an existing connection to use and click
+    <b>OK</b>, or click <b>New...</b> to create a new connection or
+    <b>Edit...</b> to edit an existing one. Follow the next steps if you
+    selected to create a new connection or to edit an existing one.
+    <p class="note">NOTE For USB tracing connection, you must have the
+    TraceSwitch application installed in your device. You must also have
+    connectivity software such as Nokia PC Suite installed in your PC.</p>
+  </li>
+  <li>In <b>Connection type</b>, select a connection method: 
+    <ul>
+      <li><b>PlatSim</b> if you are using a PlatSim connection between the PC
+        and the target device.</li>
+      <li><b>TCP/IP Musti</b> if you are using an XTI connection between the PC
+        and the target device.</li>
+      <li><b>USB</b> if you are using a USB cable connection between the PC and
+        the target device. 
+        <p><img src="images\connection_01.png" alt=""></p>
+      </li>
+    </ul>
+  </li>
+  <li>In <b>Connection name</b>, enter a unique name for this connection. </li>
+  <li><p>Modify the connection settings:</p>
+    <ul>
+      <li>For <b>PlatSim</b>: Define Platsim location and Instance 
+        <p><img src="images\connection_platsim.png" alt=""></p>
+      </li>
+      <li>For<strong>TCP/IP Musti</strong>: define the IP address, Musti
+        channel and Port. 
+        <p><img src="images/connection_musti.png" alt=""></p>
+      </li>
+      <li><p>For <b>USB</b>: define the serial port used for USB connection on
+        your PC. To find out the port:</p>
+        <ol type="1">
+          <li>Connect your phone to the PC using a USB cable and the Nokia PC
+            Suite application.</li>
+          <li>(Optional) If you connect for the first time, install the
+            necessary drivers to your phone.</li>
+          <li>In <b>Windows</b>, check the correct serial port from the
+            <b>Device Manager </b> in the <b>Control Panel</b>. Select <b>Ports
+            (COM &amp; LPT)</b>, and locate an item similar to <b>Series 60
+            Nokia S60 Phone USB (COMX)</b>, where X means the port to connect
+            to.</li>
+        </ol>
+        <p><img src="images\connection_usb.png"></p>
+      </li>
+    </ul>
+  </li>
+  <li>Click <b>Finish</b> to save and exit.</li>
+  <li>(Optional) A connections can be set as the "Current connection" from
+    either the Remote Connection view or the "Current connection" Trim widget.
+    When you connect a device through USB, dynamic connections are created
+    automatically. If you want to automatically connect to the dynamic
+    connection that is set as &ldquo;Current connection&rdquo;, you should
+    check the <b>Auto connect to dynamic connections</b> checkbox in the
+    Connection page of the Preferences dialog. For auto connect, you also need
+    to have "Current connection" selected as the main connection for
+    TraceViewer in the Preferences dialog.</li>
+  <li>(Optional) Use the <strong>Test Connection</strong> tab of the New
+    Connection dialog to make sure that the connection works. For more
+    information, see <a
+    href="../../../com.nokia.carbide.cpp.doc.user/html/reference/trk/wnd_on_device_check_tab.htm">Test
+    Connection</a>.  </li>
+</ol>
+
+<h5>Related tasks</h5>
+<ul>
+  <li><a href="../tasks/connect.htm">Connecting to the trace source</a></li>
+  <li><a href="../tasks/preferences.htm">Setting TraceViewer
+  preferences</a></li>
+</ul>
+
+<div id="footer">Copyright &copy; 2007-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/traceviewer/com.nokia.traceviewer.help/html/reference/preferencesgeneral.htm	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,57 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title>General settings</title>
+<link href="../../book.css" type="text/css" rel="stylesheet"></head>
+<body>
+
+<h2>General settings</h2>
+<p>These preferences can be accessed from: <b>Window > Preferences > Carbide Extensions > TraceViewer</b>.</p>
+<p></p>
+<table border="1" cellspacing="1" cellpadding="2">
+<colgroup>
+	<col>
+	<col>
+</colgroup>
+<tbody>
+<tr>
+<td><b>General settings</b></td>
+<td><ul>
+<li>You can select whether there should be a number of milliseconds after
+the previous traces after the timestamp of the current traces. If selected,
+the amount of milliseconds from the previous trace is shown in brackets [
+] after the normal timestamp.</li>
+<li>You can select if component and group names are shown before the trace text, if
+those are available. </li>
+<li>You can also view the class and function name before the trace text, if
+those are available. </li>
+<li>It's possible to select if changed Dictionaries are automatically reloaded.</li>
+<li>You can select if you want BTrace variables to be shown after the trace text in OST traces. These contain possible CPU ID and Thread ID.</li>
+</ul></td>
+</tr>
+<tr>
+<td><b>Timestamp accuracy</b></td>
+<td><ul>
+<li>Timestamp accuracy can be shown in milliseconds or microseconds. </li>
+</ul></td>
+</tr>
+<tr>
+<td><b>Displaying undecoded traces</b></td>
+<td><p>You can choose how undecoded traces are shown in the TraceViewer view.
+Choices are:</p><ul>
+<li><b>&ldquo;BINARY TRACE&rdquo; text</b>: displays a text indicating that
+the trace is binary and the decode file may not be loaded.</li>
+<li><b>HEX</b>: traces received are shown as a hexadecimal string. Each byte
+is converted into a hex string and bytes are separated by spaces.</li>
+<li><b>Identification numbers and data</b>: TraceViewer will display component,
+group and trace ID of the received trace. Also the data contained in the trace
+is displayed as a hex string.</li>
+</ul></td>
+</tr>
+</tbody>
+</table>
+
+<div id="footer">Copyright &copy; 2007-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>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.help/html/reference/preferencesplugins.htm	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,18 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title>TraceViewer Plugins settings</title>
+<link href="../../book.css" type="text/css" rel="stylesheet"></head>
+<body>
+
+<h2>TraceViewer Plugins settings</h2>
+<p>This preference page can be accessed from: <b>Window > Preferences > Carbide Extensions > TraceViewer > Plugins</b>.</p> 
+
+<p>This page is reserved for TraceViewer plugins to put settings to a common place. To get your
+preference page under this placeholder, define a category "<b>com.nokia.traceviewer.preferences.PluginsPreferences</b>"
+to your preference page in the <i>plugin.xml</i> file.</p>
+
+<div id="footer">Copyright &copy; 2007-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>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.help/html/reference/references.htm	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,24 @@
+<!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" />
+<meta name="LASTUPDATED" content="06/17/05 11:09:43" />
+<title>References</title>
+<link rel="StyleSheet" href="../../book.css" type="text/css"/>
+</head>
+<body bgcolor="#FFFFFF">
+
+<h2>References</h2>
+<p>The following references are available for this tool:</p>
+<ul>  
+	<li><a href="toolbar.htm">Toolbar</a></li>
+	<li><a href="preferencesgeneral.htm">General settings</a></li>
+	<li><a href="preferencesconnection.htm">Connection settings</a></li>
+	<li><a href="preferencesadvanced.htm">Advanced settings</a></li>
+ </ul>
+ 
+<div id="footer">Copyright &copy; 2007-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>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.help/html/reference/toolbar.htm	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,91 @@
+<!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>Toolbar</title>
+<link href="../../book.css" type="text/css" rel="stylesheet"></head>
+<body>
+
+<h2>Toolbar</h2>
+<p>The TraceViewer toolbar and menus contain the following buttons: </p> <p><img src="images\toolbar.png"></p>
+<table width="500" border="1" cellspacing="1" cellpadding="2">
+<colgroup>
+	<col width="25*">
+	<col width="170*">
+</colgroup>
+<thead>
+<tr>
+<td><p><b>Button</b></p></td>
+<td><p><b>When to use? </b></p></td>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td><img src="images\iconconnect.gif"></td>
+<td><p>To connect to the target device. Will change to disconnect button after
+clicked.</p></td>
+</tr>
+<tr>
+<td><img src="images\iconpause.gif"></td>
+<td><p>To pause the view update. Will change to un-pause button when clicked.
+</p></td>
+</tr>
+<tr>
+<td><img src="images\iconfilter.gif"></td>
+<td><p>To maintain (add, remove, edit) current filter settings.</p></td>
+</tr>
+<tr>
+<td><img src="images\iconexternalfilter.gif"></td>
+<td><p>To start an external filter application. Will change to <b>Stop external
+filter application</b> button when clicked.</p></td>
+</tr>
+<tr>
+<td><img src="images\iconsearch.gif"></td>
+<td><p>To open the search dialog that can be used to find interesting traces.
+</p></td>
+</tr>
+<tr>
+<td><img src="images\iconcolor.gif"></td>
+<td><p>To maintain (add, remove, edit) current trace coloring settings.</p></td>
+</tr>
+<tr>
+<td><img src="images\iconcount.gif"></td>
+<td><p>To maintain (add, remove, edit) current trace counting settings.</p></td>
+</tr>
+<tr>
+<td><img src="images\icontracevariable.gif"></td>
+<td><p>To maintain (add, remove, edit) current variable value tracing settings.
+</p></td>
+</tr>
+<tr>
+<td><img src="images\iconclear.gif"></td>
+<td><p>To clear the current view and the trace file.</p></td>
+</tr>
+<tr>
+<td><img src="images\icontraceactivation.gif"></td>
+<td><p>To activate Open System Trace components or groups.</p></td>
+</tr>
+<tr>
+<td><img src="images\iconlog.gif"></td>
+<td><p>To write or open a log file.</p></td>
+</tr>
+<tr>
+<td><img src="images\icontrigger.gif"></td>
+<td><p>To maintain (add, remove, edit) current start / stop trigger settings.
+</p></td>
+</tr>
+<tr>
+<td><img src="images\iconconnectionsettings.gif"></td>
+<td><p>To change connection settings.</p></td>
+</tr>
+</tbody>
+</table>
+
+<h5>TraceViewer extensions</h5>
+<p>There is also an item on the menubar called <b>TerminalKeyboard Shell</b>,  which an extension of the TraceViewer
+tool. </p>
+
+<div id="footer">Copyright &copy; 2007-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>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.help/html/release_notes.htm	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,348 @@
+<!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" rel="stylesheet" type="text/css">
+</head>
+
+<body bgcolor="#FFFFFF">
+<h2>Release Notes</h2>
+
+<h4>TraceViewer &ndash; Version 2.6.0</h4>
+
+<p>Released 20th June 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>TraceViewer is a tool for tracing a target device. The device can be
+connected to a PC via USB connection. TraceViewer gathers the trace data
+directly to the host side for further manipulation.</p>
+
+<p>The TraceViewer tool can be started either by selecting the <b>Carbide &gt;
+TraceViewer</b> menu item or via <b>Window &gt; Show View &gt; Other...</b>
+under <b>Carbide Extensions</b> category. </p>
+
+<h3><a name="features"></a>Main features</h3>
+<ul>
+  <li>UI for displaying traces received from the connected device. </li>
+  <li>Search and filter traces from the view. </li>
+  <li>Write traces to an ASCII or binary log file.</li>
+  <li>Color and count the traces.</li>
+  <li>Trace variable values shown in the traces.</li>
+  <li>Activate Open System Traces (OST) from the device during run-time.</li>
+  <li>Saving trace configurations in a file. </li>
+</ul>
+
+<h3><a name="newfeatures"></a>What's new</h3>
+<ul>
+  <li>New: Added max ASCII line length (10000 characters) check to prevent
+    possible freeze up in case of too much data.</li>
+  <li>New: Opened log file name is shown in the TraceViewer name tab.</li>
+  <li>Bug fix: Sometimes, other DataReader was left alive to background when
+    changing Data Format.</li>
+  <li>Bug fix: TraceViewer didn't save connection settings over Carbide.c++
+    reboot.</li>
+  <li>Bug fix: Reloading of the Dictionaries were not always reliable.</li>
+  <li>Changed: Fixed some FindBugs warnings.</li>
+  <li>Changed: TraceViewer is now released under EPL license.</li>
+</ul>
+
+<h3><a name="installation"></a>Installation notes</h3>
+
+<p>To install the tool, do the following:</p>
+<ul>
+  <li>The tool already comes in SymSEE installation of Carbide.c++</li>
+  <li>To upgrade to newer version:</li>
+  <li>Unzip everything inside the zip into Carbide "dropins" folder. If you
+    already had old TraceViewer go to "Help - About Carbide.c++ - Installation
+    details - TraceViewer" and click "Update...</li>
+</ul>
+
+<h3><a name="requirements"></a>System requirements</h3>
+
+<p>Basic requirements:</p>
+<ul>
+  <li>Windows XP</li>
+  <li>Carbide.c++ 2.5.0 or newer.</li>
+</ul>
+
+<p>Additional requirements:</p>
+<ul>
+  <li>Connection to a target device using USB.</li>
+</ul>
+<!--
+<h5>How to upgrade from older versions</h5>
+
+<p>The new version of the extension comes with updated versions of common utility plug-ins. Once
+you have installed the new set of plug-ins, do the following: </p><ol>
+<li>Open the command prompt. </li>
+<li>Go to the Carbide.c++ installation directory on your PC (for example, <code>C:\Program Files\Nokia\Carbide.c++ v1.2</code>).</li>
+<li>Enter the following command to start Carbide.c++: <code>"Carbide.c++.exe"-clean</code></li>
+</ol>
+<p>Starting up Carbide.c++ with the <code>clean</code> option ensures that the latest versions of the plug-ins are loaded. </p>
+-->
+
+<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 2.5.3 &ndash; 9th April 2010</h5>
+<ul>
+  <li>New: Dropped traces notification is now added before the timestamp of the
+    trace.</li>
+  <li>New: Support for formatting to length in trace parameters (e.g. "My var =
+    %02x").</li>
+  <li>New: Added possibility to create shortcut keys to some TraceViewer
+    actions. This can be done from "Keys" preference page in Carbide.c++.</li>
+  <li>New: Possibility to create Activation trigger so that when a specific
+    trace is received, activation is sent to the device.</li>
+</ul>
+
+<h5>Version 2.4.12 &ndash; 16th February 2010</h5>
+<ul>
+  <li>Requires Carbide.c++ 2.5.0 or newer to work!</li>
+  <li>New: New connection preference option called "Current connection". If
+    this is selected, user can change the currently active connection easily
+    either from Remote Connection view or from a new Trim widget showing the
+    current connection.</li>
+  <li>New: Support for some XTIv3 tracebox control messages.</li>
+  <li>New: Possibility to add comments to traces when taking log file. This
+    will result in a separate .meta file when the log file is closed. Both
+    files are needed to see the comments when opening the log file again.</li>
+  <li>New: Added "Deactivate rule" actions for line count and variable tracing
+    rules in Property View.</li>
+  <li>New: Support for Ctrl+Home and Ctrl+End keys. Ctrl+Home jumps to the
+    first trace and Ctrl+End to the last one.</li>
+  <li>New: Support for searching again with F3.</li>
+  <li>Changed: Cleaned up the code.</li>
+  <li>Bug fix: Setting trigger when in pause state sets wrong pause mode icon
+    to toolbar.</li>
+  <li>Bug fix: Line count and variable tracing rules were count again even no
+    changes were done.</li>
+  <li>Bug fix: Triggering didn't work with filtering on.</li>
+  <li>Bug fix: Regression: Copying data from the view didn't work.</li>
+  <li>Bug fix: One trace too much was copied to clipboard in some cases.</li>
+  <li>Bug fix: Regression: Trace text was missing when there is Thread ID but
+    no CPU ID.</li>
+  <li>Bug fix: Sometimes, trace offset went wrong by one which caused view to
+    look weird and coloring not to work properly.</li>
+  <li>Bug fix: Sometimes, the "Traces selected X. Time difference: X" text
+    could not fit in to the Trim.</li>
+</ul>
+
+<h5>Version 2.3.8 &ndash; 8th December 2009</h5>
+<ul>
+  <li>New: Option to not to show component and group name in OST traces.</li>
+  <li>New: API function to get trace name with component, group and trace
+  ID.</li>
+  <li>New: Line count and variable tracing rules can now be added and edited
+    with right mouse button from Trace Property View.</li>
+  <li>New: Option to save currently visible traces to a ASCII log file.</li>
+  <li>New: Combined option to hide Thread ID to option to hide CPU ID from the
+    OST traces.</li>
+  <li>New: Support for XTIv3 messages containing multipart OST messages inside
+    them.</li>
+  <li>Changed: TraceProperties.timeFromPreviousTrace now contains milliseconds
+    passed from previous trace. TraceProperties.timestampString doesn't contain
+    that information anymore but only the actual timestamp.</li>
+  <li>Bug fix: Drag and Drop of rules in various dialogs didn't work.</li>
+  <li>Bug fix: Progressbar didn't advance from 0% when saving current traces to
+    ASCII log.</li>
+  <li>Bug fix: CPU ID was not shown correctly on real SMP HW if it was
+    something else than CPU 0.</li>
+</ul>
+
+<h5>Version 2.2.17 &ndash; 13th October 2009</h5>
+<ul>
+  <li>Requires Carbide.c++ 2.0.4 or newer to work!</li>
+  <li>New: Option to turn off displaying Thread ID in OST traces.</li>
+  <li>New: Added BTrace variables into info dialog.</li>
+  <li>New: Added new alternative client API (TraceViewerAPI2 class). The client
+    of the API gets notifications when connection status or connection
+    preferences are changed.</li>
+  <li>New: Support for multipart BTrace traces.</li>
+  <li>New: Color headers and data parts of multipart BTraces in info dialog.
+  </li>
+  <li>Changed: Reworked some help files.</li>
+  <li>Changed: When using OST protocol, OST TraceCore protocol header is added
+    to outgoing messages.</li>
+  <li>Changed: Modified older client API implementation (TraceViewerAPI class)
+    to not disconnect active connection in case there are currently registered
+    TraceViewerAPI2 using the connection.</li>
+  <li>Bug fix: Copy to clipboard didn't always work as it should.</li>
+  <li>Bug fix: Retake machine readable log button didn't disappear
+  correctly.</li>
+  <li>Bug fix: More than one ZIP was offered for reload in certain
+    circumstances.</li>
+  <li>Bug fix: It was possible to crash Filter dialog so that it didn't open
+    anymore.</li>
+  <li>Bug fix: It was possible to freeze TraceViewer by opening specific ASCII
+    log.</li>
+  <li>Bug fix: When connection settings are set through the API, empty selected
+    connection from UI.</li>
+  <li>Bug fix: Possible extended length bytes were not read properly.</li>
+  <li>Bug fix: Double-clicking group table in Activation dialog removed group
+    filtering.</li>
+  <li>Bug fix: Connecting with no Remote Connection set will now pop up a
+    preferences dialog.</li>
+  <li>Bug fix: Opening a trace information dialog when another trace
+    information dialog was open caused coloring of the hex string not to
+  work.</li>
+</ul>
+
+<h5>Version 2.1.12</h5>
+<ul>
+  <li>Requires Carbide.c++ 2.0.2 to work!</li>
+  <li>New: Double-clicking a trace opens the trace location in source file
+    (only for OST traces).</li>
+  <li>New: syncToTrace() and syncToTimestamp() methods open the trace location
+    in source file.</li>
+  <li>New: New button to easily close and retake machine readable ASCII
+  log.</li>
+  <li>New: Support for OST v0.5.</li>
+  <li>Changed everything to Symbian Foundation compatible.</li>
+  <li>Changed: Send deactivation message of visible component if group states
+    were not changed at all.</li>
+  <li>Changed: Add event to Trace Events view when reloading changed
+    Dictionaries.</li>
+  <li>Changed: Send activation messages of all selected components in
+    Activation dialog.</li>
+  <li>Changed: In trace information dialog, header and data parts is now
+    colored with different colors.</li>
+  <li>Bug fix: Dictionary ZIP could not be reloaded when restarting
+  TraceViewer.</li>
+  <li>Bug fix: Double- or triple-clicking did not show Trim information.</li>
+  <li>Bug fix: Canceling filtering could make view pause to wrong position.</li>
+</ul>
+
+<h5>Version 2.0.27</h5>
+<ul>
+  <li>Switched to own branch for Carbide 2.0.</li>
+  <li>New: Use Remote Connections UI from Carbide.</li>
+  <li>New: Connection Settings button in Menu bar.</li>
+  <li>New: TraceViewer now requires Carbide.c++ Trace license to work.</li>
+  <li>New: Use OVERWRITE activation messages. Will now only send one activation
+    message per component.</li>
+  <li>New: Uses EPOCroot drive path from active project when trying to jump to
+    source code line.</li>
+  <li>New: Option to write machine readable ASCII log.</li>
+  <li>New: Trace number is now a member variable of TraceProperties class.</li>
+  <li>New: New API functions: syncToTraceNumber, syncToTimestamp.</li>
+  <li>New: New API functions: saveCurrentTracesToLog, openLogFile,
+    getDictionaryComponents.</li>
+  <li>New: Automatically reload changed Dictionaries option.</li>
+  <li>New: API function getDictionaryComponents() now also returns trace
+  list.</li>
+  <li>Changed: Speed up clearing the view.</li>
+  <li>Changed: TraceViewerAPI.getDictionaryComponents() doesn't return null
+    anymore.</li>
+  <li>Updated: Help files.</li>
+  <li>Bug fix: Sometimes, the view contained one trace too much.</li>
+  <li>Bug fix: Remote Connections UI was not updated when connecting.</li>
+  <li>Bug fix: Color rules were lost if there was Groups defined.</li>
+  <li>Bug fix: Log dialog gave access to plain log options even when not
+    writing plain log.</li>
+  <li>Bug fix: It was possible to freeze TraceViewer with simultaneous async
+    commands.</li>
+  <li>Bug fix: Canceling filtering didn't work very well.</li>
+  <li>Bug fix: Filters were not marked after switching to advanced filter
+  view.</li>
+  <li>Bug fix: Thread ID was not written separately to machine readable ASCII
+    log.</li>
+  <li>Bug fix: Added coprocessors went to wrong offset if TraceViewer view was
+    not yet initialized.</li>
+  <li>Bug fix: TraceViewer didn't ask about changing Data Format with USB in
+    certain case.</li>
+  <li>Bug fix: Variable tracing history didn't always show up correctly.</li>
+  <li>Bug fix: API function connect() should not pop up error message.</li>
+  <li>Bug fix: Open previously opened Dictionaries dialog offered also removed
+    Dictionaries.</li>
+  <li>Bug fix: Traces are not decoded after closing and reopening
+  TraceViewer.</li>
+  <li>Bug fix: Missed notification about number of selected traces if using
+    CTRL + A.</li>
+</ul>
+
+<h5>Version 1.0.21</h5>
+<ul>
+  <li>Made changes for releasing to Carbide 2.0.</li>
+  <li>Made changes to be able to release into SymSEE.</li>
+  <li>Made to work with TraceCommon feature.</li>
+  <li>New: TraceViewer API functions: getTraceComponentName and
+    getTraceGroupName.</li>
+  <li>New: TraceViewer can now open ZIP files containing Dictionary decode
+    files.</li>
+  <li>New: TraceViewer will now show a warning icon in a toolbar if decode file
+    is changed after loading.</li>
+  <li>Updated: TraceViewer help files to follow Carbide help guidelines.</li>
+  <li>Updated: Loading of Dictionary files is now much faster.</li>
+  <li>Updated: Added preference option to show class name and function name
+    before the trace text.</li>
+  <li>Changed: Don't disable apply button from activation dialog when apply is
+    clicked.</li>
+  <li>Changed: Activation dialog now shows components sorted by the name.</li>
+  <li>Changed: Removed Configurations preference page. Importing and exporting
+    configuration can bow be done from File - Import / Export in Eclipse
+  menu.</li>
+  <li>Changed: Changed default binary log extension from .log to .bin.</li>
+  <li>Bug fix: Saving and loading configuration XML files did not work if
+    workspace path contains spaces.</li>
+  <li>Bug fix: If loaded lots of Dictionaries, "open previous files" dialog was
+    too big.</li>
+  <li>Bug fix: Confusing text "defaultActivations.xml" under the configurations
+    tag.</li>
+  <li>Bug fix: Trace EventView doesn't open if there is error when loading
+    Dictionary.</li>
+  <li>Bug fix: Parameters were not correctly decoded when using OST traces with
+    USB connection.</li>
+  <li>Bug fix: Activation information of groups doesn't anymore disappear when
+    appending more decode files.</li>
+  <li>Bug fix: Configurations in Activation dialog now shows the file path and
+    only allows file to be changed using the "Change file" button.</li>
+  <li>Bug fix: Rule text was replicated from rule name when editing a old
+  rule.</li>
+  <li>Bug fix: Wrong text copied to search window after clicking twice on
+  trace.</li>
+  <li>Bug fix: Wrong help in search dialog.</li>
+  <li>Bug fix: When using loadDecodeFile API function, Trace Activation dialog
+    was not updated.</li>
+</ul>
+
+<div id="footer">
+<p>Copyright © 2007-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/traceviewer/com.nokia.traceviewer.help/html/tasks/advancedfilter.htm	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,95 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title>Setting filtering options</title>
+<link href="../../book.css" type="text/css" rel="stylesheet"></head>
+<body>
+
+<h2>Setting filtering options</h2>
+<p>TraceViewer provides various options for setting up filtering. 
+In some cases, it may also be necessary to use an external filter 
+application to modify the results. For instructions, 
+see <a href="externalfilter.htm">Using an external filter application</a>.</p>
+
+<h3><a name="basic"></a>Basic options</h3>
+<p>You can create new filter rules in the basic <b>Rules</b> dialog, as for 
+other items. For instructions, see <a href="setup_rules.htm">Setting up rules 
+and filters</a>.</p>
+
+<p>To set filtering-specific options: </p>
+<ol>
+<li>After the rules are defined, select one or more of them from the tree.</li>
+<li>Select either <b>Hide</b> or <b>Show</b>, to make the selected rules visible
+on the tree. <p><img src="images\filterDialog.png" alt="Special fields in Filter Rules dialog"></p></li>
+<li>Select either the <b>OR</b> or <b>AND</b> operator:
+<ul>
+<li>OR means that if a trace hits just one rule, it is applied. </li>
+<li>AND means that the trace must hit all the selected rules for it to be
+applied. </li>
+</ul>
+</li>
+<li>To take the selected rules to use, click <b>Apply</b>.</li>
+</ol>
+
+<h3><a name="advanced"></a>Creating rule statements</h3>
+<p>You can make also more complicated filtering rules by setting advanced options. The point
+is to make an effective and reasonable filter rule set, which will then be
+used when filtering traces.</p>
+<p>A rule set is written the form of a statement such as this: </p>
+<p><i>(rule AND rule2) OR (smallRule AND NOT filterRule)</i></p>
+<p>where traces are included or excluded based on this criterion. </p>
+<p><b>Tip:</b> You can also type the rule set statement manually into
+the text field. </p>
+<p>To set advanced options: </p>
+<ol>
+<li>In the <b>Filter Rules</b> dialog, click <b>Advanced</b>. <p>The <b>Advanced
+Filter Rules</b> dialog is displayed, showing the basic rules already created. 
+</p></li>
+<li>To start creating a new rule set, click <b>Start Set</b>. <p>An opening
+parenthesis ( is inserted into the text field to indicate the beginning.</p></li>
+<li>To edit the rule set, select rules from the tree and combine them with
+each other by clicking any of the following buttons: 
+<ul>
+<li><b>AND:</b> Indicates logical AND. Is used between two rules or rule sets
+and means that both rules / sets will have to hit the rule for it to be true.
+</li>
+<li><b>OR:</b> Indicates logical OR. Is used between two rules or rule sets
+and means that either rule / set will have to hit the rule for it to be true.
+</li>
+<li><b>NOT:</b> Indicates logical NOT. Is used before a rule or rule set.
+Indicates that the rule / rule set after the NOT can not hit the rule for
+it to be true.</li>
+</ul>
+<p>The <b>Back</b> button removes the last word from the text field,
+starting from the caret position. </p></li>
+<li>(Optional) To quickly add all the rules from a group to the set, click
+the group name on the tree. <p>From the pop-up, select OR or AND. After choosing,
+all the rules from this group are added to the text field, separated by the
+selected logical operation. </p><p><img src="images/advancedFilterDialogGroup.png"
+alt="Selecting all rules from a group"></p></li>
+<li>Click <b>End Set</b> to insert a closing parenthesis ) into the field. <p><b>
+Note:</b> TraceViewer automatically checks that the rule is reasonable and
+well-formed, that is, contains as many start brackets as end brackets. The
+following is an example of a reasonable filter rule set that is correct and
+ready to be applied: </p><p><img src="images/advancedFilterDialogReady.png"
+alt="Filter rule ready to be applied"></p></li>
+<li>(Optional) To hide or show a trace that hits this filter rule, change
+the value of <b>Show</b> and <b>Hide</b> selection as needed.</li>
+<li>Click <b>OK</b> to save the rule set. </li>
+</ol>
+
+<ul>
+<li>To clear the rule text field and start creating a new one, click <b>Clear
+</b>. </li>
+<li>To return to the <b>Basic</b> dialog, click <b>Simple</b>.</li>
+</ul>
+
+<h5>Related tasks</h5>
+<ul>
+<li><a href="setup_rules.htm">Setting up rules and filters</a></li>
+<li><a href="externalfilter.htm">Using an external filter application</a></li>
+</ul>
+
+<div id="footer">Copyright &copy; 2007-2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.</div>
+</body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.help/html/tasks/connect.htm	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,39 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title>Connecting to the trace source</title>
+<link href="../../book.css" type="text/css" rel="stylesheet"></head>
+<body>
+
+<h2>Connecting to the trace source</h2>
+<h5>Before you start</h5>
+<p>Before you can connect to the trace source and start receiving traces, the
+connection options must be defined in TraceViewer preferences. The connection
+method is <b>USB</b>. For more information on
+the options, see <a href="../reference/preferencesconnection.htm">Connection
+settings</a>.</p>
+<p>In addition, you can specify various types of rules and
+filters to receive just the information you need for your specific components
+and groups, and the level of tracing that is relevant for your development
+team's purposes. For more information, see the overview in <a
+href="../gettingstarted/basic_steps.htm">Basic steps</a>. </p>
+<ul>
+<li>When the preferences are set, simply click <b>Connect</b> to connect to
+the trace source: <p><img src="images/connectBar1.png" alt="Connect button"></p></li>
+<li>When the green connect button changes to red <b>Disconnect</b> button,
+the connection is successfully established:<p><img src="images/connectBar2.png"
+alt="Disconnect button"></p></li>
+<li><p>You can pause receiving traces by clicking the <b>Pause</b> button: 
+</p><img src="images/pauseBar.png" alt="Pause button location in TraceViewer main window"><br>
+<p><b>Note:</b> There are also situations where the view is automatically paused.
+These include, for example, triggering an action which will open a dialog.
+When the dialog is closed, the view is then released. </p></li>
+<li>When you are done working with the received traces, you can clear the
+view with the <b>Clear view</b> button.<p><img src="images/clearviewBar.png"
+alt="Clear view button"></p>
+<p>All the data received before clicking this button will be lost.</p></li>
+</ul>
+
+<div id="footer">Copyright &copy; 2007-2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.</div>
+</body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.help/html/tasks/decoding_traces.htm	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,41 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title>Decoding binary traces with a Dictionary file</title>
+<link href="../../book.css" type="text/css" rel="stylesheet"></head>
+<body>
+
+<h2>Decoding binary traces with a Dictionary file</h2>
+<p>To activate and deactivate binary traces that are in the Open
+System Trace (OST) format, you must first define the used <i>Dictionary file
+</i> for the component that is outputting the traces. Dictionary files are
+in XML and are usually available in your development environment. They are
+automatically re-generated everytime you compile a component that contains
+OST traces.</p>
+<p>You can open a Dictionary file to be used for decoding
+binary traces, based on a decode model.</p>
+<p>To open a Dictionary file: </p>
+<ol>
+<li>On the TraceViewer menu, select <b>Trace Activation</b>. </li>
+<li>In the <b>Activation</b> dialog, click <b>Add Dictionary</b>.</li>
+<li>In the <b>Open file</b> dialog, choose one or more decode files from the
+file system. <p>By default, these files are located in the <i>\epoc32\ost_dictionaries</i> directory, and named <i>[componentname]_uid_dictionary.xml</i><br>
+<b>Note</b>: You can also load a ZIP file containing one or more Dictionary files.
+</li>
+<li>Click <b>OK</b>. <p>TraceViewer will load the chosen files to the decoding
+model and decode the traces currently in the view.</p> </li>
+</ol>
+
+<h5>Related tasks</h5>
+<ul>
+	<li><a href="traceactivation.htm">Activating traces</a></li>
+</ul>
+
+<h5>Related concepts</h5>
+<ul>
+	<li><a href="../concepts/decode_file.htm">Dictionary file and trace activation</a></li>
+</ul>
+
+<div id="footer">Copyright &copy; 2007-2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.</div>
+</body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.help/html/tasks/externalfilter.htm	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,72 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title>Using an external filter application</title>
+<link href="../../book.css" type="text/css" rel="stylesheet"></head>
+<body>
+
+<h2>Using an external filter application</h2>
+<p>You can specify an external filter application used while tracing. 
+Every trace is then pushed to the <b>stdin</b> of the specified application. 
+The application can handle the trace in various ways (write it to file, 
+modify it, and so on), or write it back to the <b>stdout</b>, where 
+TraceViewer will catch it and write it to the view.</p> <p>To use an 
+external filter application, do the following:</p>
+<ol>
+<li>Define the external filter application in TraceViewer's preferences. For
+more information, see <a href="../reference/preferencesadvanced.htm">Advanced
+settings</a>.</li>
+<li>To launch the application, click the <b>Start external Filter command
+</b> button on the TraceViewer toolbar.
+<p></p><img src="images/externalFilterToolbar.png"alt="Start external Filter button"></li>
+<li>To stop the application, click the <b>Stop external Filter</b> button.</li>
+</ol>
+
+<h3>Dealing with rules</h3>
+<p>If there are normal filter rules defined in TraceViewer, they are 
+applied <b>after</b> traces have been processed through the external 
+filter application. This means that only Text rules are applied
+because the format is changed to text. </p>
+<ul>
+<li>If there are Text rules defined, all traces coming from the external filter
+application are run through those rules, and if a line does not hit a rule,
+it will not be shown in the view.</li>
+<li>If no Text rules are defined, all traces coming from the external application
+are shown. </li>
+</ul>
+<p>For more information, see <a href="setup_rules.htm">Setting up
+rules and filters</a>.</p>
+
+<h3>Example of script and trace output</h3>
+<p>The following Perl script uses automatic flushing because otherwise some traces
+can be left in a buffer and never get back to TraceViewer. The script reads
+from the <b>sdtin</b>, gets a line, adds the text "Prefix: " in front of the
+line and prints it back to the <b>stdout</b> for TraceViewer to catch.</p> 
+
+<pre>#!perl -w
+
+use English;
+use Strict;
+
+$OUTPUT_AUTOFLUSH = 1;
+
+while (&lt;>) {
+  print "Prefix: " . $_;
+}</pre>
+<p></p>
+<p>As a result, the following traces are displayed:</p>
+<img src="images/externalFilterView.png" alt="TraceViewer view with the above Perl script"><br>
+<p><b>Note:</b> If the external filter application does not print traces back to
+the <b>stdout</b>, no traces will be visible in the TraceViewer view. Also,
+the external filter application does not have to be a Perl script as in this
+example, it can be anything, as long it gets data from <b>stdin</b> and writes
+it back to <b>stdout</b>.</p>
+
+<h5>Related tasks</h5>
+<ul>
+	<li><a href="advancedfilter.htm">Setting filtering options</a></li>
+</ul>
+
+<div id="footer">Copyright &copy; 2007-2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.</div>
+</body>
+</html>
\ No newline at end of file
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/LoadConfiguration_dialog.png has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/advancedFilterDialogGroup.png has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/advancedFilterDialogReady.png has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/browse_button.png has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/clearviewBar.png has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/colorPropertyDialog.png has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/connectBar1.png has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/connectBar2.png has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/externalFilterToolbar.png has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/externalFilterView.png has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/filterDialog.png has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/icon_menu_open.png has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/iconcolor.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/iconcount.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/iconexternalfilter.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/iconfilter.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/icontracevariable.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/icontrigger.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/pauseBar.png has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/preferencesAdvanced.png has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/sample_start_trigger.png has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/searchView.png has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/selected_rules.png has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/traceactivationConf.png has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/traceactivationDialog.png has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/triggerDialog.png has changed
Binary file trace/traceviewer/com.nokia.traceviewer.help/html/tasks/images/variabletracingHistoryDialog.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.help/html/tasks/log.htm	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,88 @@
+<!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>Configuring logging for traces</title>
+  <link href="../../book.css" type="text/css" rel="stylesheet">
+</head>
+
+<body>
+<h2>Configuring logging for traces</h2>
+
+<p>You can create a log out of the received traces. The log can be either a
+plain text (ASCII) log file that can be opened in a normal text editor, or a
+binary log file that will contain all the data in the same form as coming from
+the trace source. Note that the binary file can only be opened in TraceViewer.
+</p>
+
+<p>Some typical cases for logging could be: </p>
+<ul>
+  <li>To work the with trace data independently of the device (uses binary
+    logs).</li>
+  <li>To compare two logs taken from the same test case, run at different times
+    (uses ASCII logs).</li>
+  <li>To analyse the log in other applications (uses ASCII logs). </li>
+</ul>
+
+<p>To start logging, do the following: </p>
+<ol>
+  <li>From the TraceViewer menu, select <b>Log...</b>. 
+    <p>A submenu containing options is displayed. You have multiple choices:</p>
+  </li>
+  <li><p>To open a previously written ASCII or Binary log file, select <b>Open
+    log</b>. A file selection dialog is displayed where you can select your log
+    file.</p>
+  </li>
+  <li><p>To write a new Binary log, select <b>New Binary log</b>. A file
+    selection dialog is displayed where you can select where to create your log
+    file.</p>
+  </li>
+  <li><p>To save currently shown traces to a Binary log file, select <b>Save
+    current traces to Binary log</b>. A file selection dialog is displayed
+    where you can select where to create your log file.</p>
+  </li>
+  <li><p>To stop currently ongoing Binary logging, select <b>Close Binary
+    log</b>. This option is not selectable if Binary logging is not ongoing.
+    </p>
+  </li>
+  <li><p>To write a new ASCII log, select <b>New ASCII log</b>. A file
+    selection dialog is displayed where you can select where to create your log
+    file. After file selection, a dialog is displayed where you can select few
+    options:</p>
+    <ul>
+      <li><p>(Optional) To omit timestamps from the plain text log files for a
+        better comparability between the log files, select <b>Omit timestamps
+        from the log</b>.</p>
+        <p>This option is useful for situations where the timestamp information
+        does not bring additional value to the analysis of data.</p>
+      </li>
+      <li><p>(Optional) To write a machine readable plain text log file, select
+        <b>Write machine readable ASCII log</b>.</p>
+        <p>This log file format is easy to read using automatic scripts.</p>
+      </li>
+    </ul>
+  </li>
+  <li><p>To save currently shown traces to a ASCII log file, select <b>Save
+    current traces to ASCII log</b>. A file selection dialog is displayed where
+    you can select where to create your log file.</p>
+  </li>
+  <li><p>To stop the currently ongoing ASCII logging, select <b>Close ASCII
+    log</b>. This option is not selectable if ASCII logging is not ongoing. </p>
+  </li>
+</ol>
+
+<p><b>Note:</b> If you have added comments to the traces, they will get written
+to a separate file called &lt;log_file_name&gt;.meta. To see the comments when
+you open the log file to TraceViewer, the .meta file must be in the same
+directory as the log file itself.</p>
+
+<h5>Related concepts</h5>
+<ul>
+  <li><a href="../concepts/tracing.htm">Tracing</a></li>
+</ul>
+
+<div id="footer">
+Copyright &copy; 2007-2010 Nokia Corporation and/or its subsidiary(-ies). All rights
+reserved.</div>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.help/html/tasks/preferences.htm	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,36 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title>Setting TraceViewer preferences</title>
+<link href="../../book.css" type="text/css" rel="stylesheet"></head>
+<body>
+
+<h2>Setting TraceViewer preferences</h2>
+<p>To set the preferences, do the following: </p>
+<ol>
+<li>Go to <b>Window > Preferences > Carbide Extensions > TraceViewer</b>. <p>
+The <b>General</b> settings are displayed. </p></li>
+<li>(Optional) Modify the timestamp, undecoded trace values and data format
+options as needed. See <a href="../reference/preferencesgeneral.htm">General
+settings</a>. </li>
+<li>From the left-hand navigation pane, select further preferences to modify:
+<ul>
+<li><b>Advanced (optional):</b> Define which external filter application to
+use to filter or modify traces. See <a href="../reference/preferencesadvanced.htm">
+Advanced settings</a>. </li>
+<li><b>Connection (mandatory):</b> Define the connection method used. See <a href="../reference/preferencesconnection.htm">Connection
+settings</a>. </li>
+</ul>
+</li>
+<li><p>Click <b>OK</b> to exit the dialog and apply the settings. </p></li>
+</ol>
+
+<h5>Related tasks</h5>
+<ul>
+	<li><a href="../tasks/connect.htm">Connecting to the trace source</a></li>
+	<li><a href="../tasks/externalfilter.htm">Using an external filter application</a></li>
+</ul>
+
+<div id="footer">Copyright &copy; 2007-2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.</div>
+</body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.help/html/tasks/search.htm	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,42 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title>Searching for traces</title>
+<link href="../../book.css" type="text/css" rel="stylesheet"></head>
+<body>
+
+<h2>Searching for traces</h2>
+<p>To find a specific trace, do the following: </p>
+<ol>
+<li>On the TraceViewer toolbar, click <b>Search</b>. <p>The standard <b>Search
+</b> dialog is opened. </p> </li>
+<li>In the <b>Find what</b> field, type your search criterion. </li>
+<li>Specify the following options as needed:
+<ul>
+<li><b>Match whole word only:</b> the searchable text must be found from the
+text separated with white space in both sides. For example, finding <i>ell
+</i> with this option will not find, for example, a line containing the word <i>
+hello</i>. If this option is off, the line will be found.</li>
+<li><b>Match case:</b> the search is case-sensitive. For example, finding <i>
+Hello</i> will not find a line <i>hello world</i> because the case of the <i>
+h</i> letter is different.</li>
+<li><b>Regular expression search:</b> to find traces with a specific search
+pattern. The syntax of the regular expressions can be found from <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html">
+java.util.regex.Pattern</a>.</li>
+</ul>
+</li>
+<li>To start the search, click <b>Find next</b>. <p>Traces that match the
+criteria are high-lighted on the view.</p></li>
+</ol>
+
+<img src="images/searchView.png" alt="Search dialog">
+<p><b>Tip</b>: There are few shortcuts you can use:</p>  
+<ul>
+	<li><b>ALT + w</b> - Enables / Disables the "Match whole word only" option</li>
+	<li><b>ALT + c</b> - Enables / Disables the "Match case" option</li>
+	<li><b>ALT + d</b> - Changes the search direction</li>
+</ul>
+
+<div id="footer">Copyright &copy; 2007-2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.</div>
+</body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.help/html/tasks/setup_rules.htm	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,106 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title>Setting up rules and filters</title>
+<link href="../../book.css" type="text/css" rel="stylesheet"></head>
+<body>
+
+<h2>Setting up rules and filters</h2>
+<h5>Before you start</h5>
+<p>You can work with generated traces in various ways, by setting rules and filters
+for them. The settings are saved into a configuration file named <i>userConf.xml
+</i>, and can be exported from TraceViewer or imported back in by using Carbide's
+import and export functions available under the <b>File</b> menu. </p>
+<p>You can configure rules and filters in a separate dialog that lists its contents
+like a tree. </p>
+
+<p>To set up rules for traces, do the following:</p>
+<ol>
+<li>On the TraceViewer toolbar, click the item for which you want to create
+a rule or a rule definition:
+<p></p>
+<table width="456" border="1" cellspacing="1" cellpadding="2">
+<colgroup>
+	<col width="26*">
+	<col span="1" width="167*">
+</colgroup>
+<thead>
+<tr>
+<td><p><b>Button</b></p></td>
+<td><p><b>Use it to open:</b></p></td>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td><img src="images\iconfilter.gif"></td>
+<td><p>Basic filter settings. </p></td>
+</tr>
+<tr>
+<td><img src="images\iconcolor.gif"></td>
+<td><p>Trace coloring settings, including definitions for foreground and background
+colors.</p></td>
+</tr>
+<tr>
+<td><img src="images\iconcount.gif"></td>
+<td><p>Trace counting settings</p></td>
+</tr>
+<tr>
+<td><img src="images\icontracevariable.gif"></td>
+<td><p>Variable value tracing settings, including definitions for the number
+of steps stored in variable tracing history. </p></td>
+</tr>
+<tr>
+<td><img src="images\icontrigger.gif"></td>
+<td><p>Trigger settings, including definitions for start and stop triggers.
+For instructions, see <a href="trigger.htm">Configuring triggers</a>. </p></td>
+</tr>
+</tbody>
+</table>
+
+<p>The <b>Rules</b> dialog for the selected item is displayed. </p></li>
+<li>To manage the rules, do any of the following:
+<ul>
+<li>To create a new rule, click <b>Add</b>. The <b>Definition</b> dialog is
+opened. </li>
+<li>To edit an existing rule, select it and click <b>Edit</b>. The <b>Definition
+</b> dialog is opened. </li>
+<li>To delete a rule, select it and click <b>Remove</b>.</li>
+<li>To clear the whole tree, click <b>Clear</b>. </li>
+<li>To create groups for rules, click <b>Group</b>. </li>
+<li><b>Note:</b> For filtering, there are more configuration settings available.
+See <a href="advancedfilter.htm">Setting filtering options</a>.</li>
+</ul></li>
+<li>(Optional) In the <b>Definition</b> dialog, do any of the following modifications
+and click <b>OK</b> to return to the <b>Rules</b> dialog.
+<ol>
+<li>Enter a name for the rule.</li>
+<li>Select rule type, either <b>Text rule</b> and <b>Component / Group rule
+</b>. <ul>
+<li><b>Text rule:</b> type in the text to be matched with each trace. </li>
+<li><b>Component / Group rule:</b> type in the component name and/or group
+IDs from where you want traces to be found. You can use the asterisk * as
+a wildcard character for any component or group. </li>
+<li>For text rules, select <b>Match case</b> to make the trace text be in
+the same case as with the rule.</li>
+</ul></li>
+</ol>
+<p><b>Example:</b> The following figure shows the <b>Color Definition</b> dialog.</p>
+<p><img src="images/colorPropertyDialog.png" alt="Color Definitions"></p></li>
+<li>When rules are created and they are listed in the dialog, select the ones
+you want to enable. <p><img src="images\selected_rules.png" alt="Sample of rules selected in the dialog."></p></li>
+<li>To save your changes, click <b>OK</b>. </li>
+</ol>
+
+<p><b>Tip</b>: If you close TraceViewer when you have any
+of the rules (color, filter, line count, variable tracing) enabled, they will
+get automatically enabled the next time you start TraceViewer.</p>
+
+<h5>Related tasks</h5>
+<ul>
+	<li><a href="advancedfilter.htm">Setting filtering options</a></li>
+	<li><a href="viewing_traces.htm#varhist">Viewing variable tracing history</a></li>
+</ul>
+
+<div id="footer">Copyright &copy; 2007-2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.</div>
+</body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.help/html/tasks/tasks.htm	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,31 @@
+<!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" />
+<meta name="LASTUPDATED" content="06/17/05 11:09:43" />
+<title>Setting up and handling traces</title>
+<link rel="StyleSheet" href="../../book.css" type="text/css"/>
+</head>
+<body bgcolor="#FFFFFF">
+
+<h2>Setting up and handling traces</h2>
+<p>Entries in this section tell you how to perform the tasks available in TraceViewer.</p>
+<p>Topics in this section include:</p>
+<ul>
+	<li><a href="preferences.htm">Setting TraceViewer preferences</a></li>
+	<li><a href="trigger.htm">Configuring triggers</a></li>
+	<li><a href="log.htm">Configuring logging for traces</a></li>
+	<li><a href="setup_rules.htm">Setting up rules and filters</a></li>
+	<li><a href="externalfilter.htm">Using an external filter application</a></li>
+	<li><a href="advancedfilter.htm">Setting filtering options</a></li>
+	<li><a href="decoding_traces.htm">Decoding binary traces with a Dictionary file</a></li>
+	<li><a href="traceactivation.htm">Activating traces</a></li>
+	<li><a href="connect.htm">Connecting to the trace source</a></li>
+	<li><a href="search.htm">Searching for traces</a></li>
+	<li><a href="viewing_traces.htm">Viewing line count and variable tracing items</a></li>
+</ul>
+
+<div id="footer">Copyright &copy; 2007-2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.</div>
+</body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.help/html/tasks/traceactivation.htm	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,52 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title>Activating traces</title>
+<link href="../../book.css" type="text/css" rel="stylesheet"></head>
+<body>
+
+<h2>Activating traces</h2>
+<h5>Before you start</h5>
+<p>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. For more information, see <a href="../concepts/decode_file.htm">
+Dictionary file and trace activation</a>.</p>
+<p>Before you can activate trace components and groups, open the Dictionary file 
+(.xml) that contains the necessary component and group information. 
+See <a href="decoding_traces.htm">Decoding binary traces with a Dictionary file</a>.</p>
+<p>To activate traces: </p>
+<ol>
+<li>From the TraceViewer menu, select <b>Trace Activation</b>. <p>
+The <b>Trace activation</b> dialog is displayed, showing the components and
+groups loaded from the Dictionary file. </p></li>
+<li><a name="act_conf"></a>(Optional) Activation configurations can be saved
+and loaded from an XML file.
+To load a saved activation configuration file:
+<ol>
+<li>Select <b>Load Configuration...</b> </li>
+<li>Select the correct configuration from the list. </li>
+<li>Click <b>OK</b>. </li>
+</ol>
+<p><img src="images\traceactivationConf.png"></p><p><b>Tip:</b> To save
+a configuration after making changes to it, click <b>Save Current...</b>.
+Then select a file, type the configuration name and click <b>OK</b>. One file
+can contain several configurations. </p></li>
+<li>To activate components and groups, do any of the following:
+<ul>
+<li>Select one or more components or groups from the list, right-click and
+select <b>Activate</b>. </li>
+<li>Select one or more components from the list, and double-click groups to
+change the activation state or click <b>Activate</b>. </li>
+<li>In the <b>Filter</b> field, type in the component or group name (or an
+asterisk for a wildcard), right-click and select <b>Activate</b>.</li>
+</ul>
+<p>See the following example:</p>
+<p><img src="images/traceactivationDialog.png" alt="Trace Activation Dialog"></p></li>
+<li>If the connection to a trace source is established, click <b>Send Activation
+</b>  to send the activation message. </li>
+</ol>
+<p>The trace groups you selected are activated and traces are received from the device.</p>
+
+<div id="footer">Copyright &copy; 2007-2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.</div>
+</body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.help/html/tasks/trigger.htm	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,80 @@
+<!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>Configuring triggers </title>
+  <link href="../../book.css" type="text/css" rel="stylesheet">
+</head>
+
+<body>
+<h2>Configuring triggers</h2>
+
+<p>You can create start, stop, and activation triggers to TraceViewer. </p>
+<ul>
+  <li>A start trigger means that receiving traces starts only when the start
+    trigger is met. </li>
+  <li>A stop trigger means that the view will be paused when the stop trigger
+    is met. </li>
+  <li>An activation trigger means that when trace with the given trigger text
+    is received, a given activation configuration is loaded from the defined
+    activation configuration file, and sent to the device.</li>
+</ul>
+
+<p>To configure the triggers: </p>
+<ol>
+  <li>Open the TraceViewer menu by clicking <img
+    src="images/icon_menu_open.png">, and select <b>Triggers</b>. 
+    <p>The <b>Trigger Rules </b> dialog is displayed. </p>
+  </li>
+  <li>To manage the rules, do any of the following: 
+    <ul>
+      <li>To create a new start or stop rule, click <b>Add</b>. The <b>Trigger
+        Rule Definition</b> dialog is opened. </li>
+      <li>To edit an existing start or stop rule, select it and click
+        <b>Edit</b>. The <b>Trigger Rule Definition</b> dialog is opened. </li>
+      <li>To delete a rule, select it and click <b>Remove</b>.</li>
+      <li>To clear the whole tree, click <b>Clear</b>. </li>
+      <li>To create groups for rules, click <b>Group</b>. </li>
+    </ul>
+    <p>See the following figure for an example: </p>
+    <p></p>
+    <p><img src="images/triggerDialog.png" alt="Trigger dialog"></p>
+  </li>
+  <li>In the <b>Trigger Rule Definition</b> dialog, enter a name for the
+    trigger and the text to be matched with each trace. </li>
+  <li>From the <strong>Type</strong> listbox, select the trigger type: <b>Start
+    trigger</b>, <b>Stop trigger</b>, or <strong>Activation trigger</strong>.
+    See following example: 
+    <p><img src="images\sample_start_trigger.png"></p>
+    <p>If you selected Activation trigger, continue to step 5, otherwise skip
+    to <a name="step" id="step" href="#Click">step 8</a>.</p>
+  </li>
+  <li>Click the <img alt="nn" src="images/browse_button.png" width="28"
+    height="23"> button next to the <strong>Conf</strong> field to select the
+    configuration file to be used for the Activation trigger. The Load
+    Configuration dialog opens: 
+    <p><img src="images/LoadConfiguration_dialog.png"></p>
+  </li>
+  <li>Browse to the desired activation file and select the configuration from
+    the <strong>Load configuration</strong> listbox. 
+    <p>Activation files and configurations are created by using the
+    <strong>Trace Activation</strong> dialog. For more information, see <a
+    href="traceactivation.htm">Activating traces</a>.</p>
+  </li>
+  <li>Click OK in the <strong>Load Configuration</strong> dialog.</li>
+  <li><a name="Click" id="Click">Click <b>OK</b> in the <strong>Trigger Rule
+    Definition</strong> dialog to either create a new rule or update an
+    existing rule.</a></li>
+</ol>
+
+<h5>Related tasks</h5>
+<ul>
+  <li><a href="traceactivation.htm">Activating traces</a></li>
+  <li><a href="setup_rules.htm">Setting up rules and filters</a></li>
+</ul>
+
+<div id="footer">
+Copyright © 2007-2010 Nokia Corporation and/or its subsidiary(-ies). All rights
+reserved.</div>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.help/html/tasks/viewing_traces.htm	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title>Viewing line count and variable tracing items</title>
+<link href="../../book.css" type="text/css" rel="stylesheet"></head>
+<body>
+
+<h2>Viewing line count and variable tracing items</h2>
+<h5>Before you start</h5>
+<p>On the <b>TraceViewerPropertyView</b>, you can check the properties
+of traces the based on the rules that were defined for line count and variable
+tracing.</p>
+<ul>
+<li><b>Line count</b> can be used to calculate the number of occurrences for
+a certain type of trace. This may mean, for example, a trace from a specific
+component, from a certain group of a certain component, or traces that contain
+a certain text. </li>
+<li><b>Variable tracing</b> means that you can follow up or monitor certain
+values that occur in traces. <p>For example, to monitor RAM consumption in
+the Kernel, there can be the following kind of trace: <br><br><i>00:11:31:624
+[0] Kernel Memory:Initial free RAM;Bytes:127598592</i><br><br>When you create
+a variable tracing rule that contains the text <i>Kernel Memory:Initial free
+RAM;Bytes</i>, you can view what the latest value of this variable was, as
+well as a number of its previous values.</p></li>
+</ul>
+
+<p>For generic instructions on how to create rules and definitions, see
+instructions in <a href="setup_rules.htm">Setting up rules and filters</a>. 
+</p>
+
+<h3><a name="varhist"></a>Viewing variable tracing history</h3>
+<p>To open the history: </p>
+<ol>
+<li>Select one or more items from the list. </li>
+<li>Right-click and select <b>Open history</b> from the menu.
+<p>The <b>Variable tracing history</b> dialog is displayed.</p>
+<p><img src="images/variabletracingHistoryDialog.png"
+alt="Variable Tracing History Dialog"></p>
+<p>In the history, you can see the last <i>n</i> number of events of 
+the variable changing. There is a timestamp (and time from the previous event), 
+new value and the line number where the change happened. The <b>Has codeline</b> 
+column indicates whether or not this item has location metadata available.</p></li>
+<li>(Optional) To open the source code of a line that has had changes:
+<ol>
+<li>Select the <b>Activate corresponding codeline</b> box.</li>
+<li>Double-click a line that shows <b>Yes</b> in the <b>Has codeline</b> column. </li>
+</ol>
+</li>
+<li>(Optional) To view the line number where changes happened:
+<ol>
+<li>Select the <b>Activate corresponding trace</b> box, if not selected already. </li>
+<li>Double-click a line in the dialog and TraceViewer jumps to that line in the code. </li>
+</ol>
+</li>
+</ol>
+<p><b>Tip</b>: If you close TraceViewer when you have any of the variable
+tracing rules enabled, they will get automatically enabled the next time you start TraceViewer.</p>
+
+<h5>Related tasks</h5>
+<ul>
+<li><a href="setup_rules.htm">Setting up rules and filters</a></li>
+</ul>
+
+<div id="footer">Copyright &copy; 2007-2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.</div>
+</body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.help/html/tocConcepts.xml	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?NLS TYPE="org.eclipse.help.toc"?>
+
+<toc label="Concepts" link_to="toolTOC.xml#concepts" topic="html/concepts/concepts.htm">
+	
+	<!-- Enter topic entries here for Concepts section of help -->
+	
+		<topic label="Tracing" href="html/concepts/tracing.htm" />
+		<topic href="html/concepts/trace_format.htm" label="Open System Trace (OST)">
+  </topic>
+  <topic href="html/concepts/when_to_use_ost.htm" label="When to use OST">
+  </topic>
+		<topic label="Dictionary file and trace activation" href="html/concepts/decode_file.htm" />
+		<topic label="Rules and filtering" href="html/concepts/filter.htm" />
+  <topic href="html/concepts/tracecompiler.htm" label="Trace Compiler">
+  </topic>
+</toc>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.help/html/tocGettingStarted.xml	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?NLS TYPE="org.eclipse.help.toc"?>
+
+<toc label="Getting Started" link_to="toolTOC.xml#gettingstarted" topic="html/gettingstarted/gs_index.htm">
+	
+	<!-- Enter topic entries here for Gettingstarted section of help -->
+	
+	<topic label="TraceViewer overview" href="html/gettingstarted/overview.htm" />
+	<topic label="TraceViewer basic steps" href="html/gettingstarted/basic_steps.htm" />	
+
+	
+</toc>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.help/html/tocReference.xml	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?NLS TYPE="org.eclipse.help.toc"?>
+
+<toc label="References" link_to="toolTOC.xml#references" topic="html/reference/references.htm">
+	
+	<!-- Enter topic entries here for References section of help -->
+	
+	<topic label="TraceViewer toolbar" href="html/reference/toolbar.htm" />
+	<topic label="TraceViewer General settings" href="html/reference/preferencesgeneral.htm" />
+	<topic label="TraceViewer Connection settings" href="html/reference/preferencesconnection.htm" />
+	<topic label="TraceViewer Advanced settings" href="html/reference/preferencesadvanced.htm" />
+	
+</toc>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.help/html/tocTasks.xml	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?NLS TYPE="org.eclipse.help.toc"?>
+
+<toc label="Tasks" link_to="toolTOC.xml#tasks" topic="html/tasks/tasks.htm">
+	
+	<!-- Enter topic entries here for Tasks section of help -->
+	
+	<topic label="Setting TraceViewer preferences" href="html/tasks/preferences.htm" />	
+	<topic label="Configuring triggers" href="html/tasks/trigger.htm" />
+	<topic label="Configuring logging for traces" href="html/tasks/log.htm" />
+	<topic label="Setting up rules and filters" href="html/tasks/setup_rules.htm" />
+	<topic label="Using an external filter application" href="html/tasks/externalfilter.htm" />
+	<topic label="Setting filtering options" href="html/tasks/advancedfilter.htm" />
+	<topic label="Decoding binary traces with a Dictionary file" href="html/tasks/decoding_traces.htm" />
+	<topic label="Activating traces" href="html/tasks/traceactivation.htm" />
+	<topic label="Connecting to the trace source" href="html/tasks/connect.htm" />	
+	<topic label="Searching for traces" href="html/tasks/search.htm" />
+	<topic label="Viewing line count and variable tracing items" href="html/tasks/viewing_traces.htm" />
+	
+</toc>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.help/html/tool.htm	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,46 @@
+<!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">Copyright © 2007-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>
+      </td>
+    </tr>
+    <tr>
+      <td colspan="2"><h1 align="center">TraceViewer User Guide </h1>
+
+        <p align="center" class="titleSmall">Version 2.6.0; June, 2010</p>
+      </td>
+    </tr>
+  </tbody>
+</table>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.help/html/toolTOC.xml	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,50 @@
+<?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.
+-->
+
+<toc label="TraceViewer" link_to="../com.nokia.carbide.help.common/carbideHelpTOC.xml#anchorCarbideFeature" topic="html/toc.htm">
+
+	<!--
+		Define the TOOL NAME as it should appear in the TOC. The tool.htm page
+		is the cover page for the tool help.
+	-->
+	<topic label="TraceViewer" href="html/tool.htm" >
+		
+	   <!--
+		   Following the Eclipse guidelines, the tool help is arranged as Concepts,
+		   References, and Tasks. Each has their own associated XML file to make it
+		   easy to edit each section as well as an overview page.
+	   -->
+	   	   <topic label="Release notes" 
+		   href="html/release_notes.htm" >
+	   </topic>
+	   		   
+	   <topic label="Getting Started" href="html/gettingstarted/gs_index.htm" >
+       <link toc="html/tocGettingStarted.xml"/>
+		   <!-- <link toc="html/tocGettingStarted.xml" /> -->
+	   </topic>
+	   
+	   <topic label="Concepts" href="html/concepts/concepts.htm" >
+       <link toc="html/tocConcepts.xml"/>
+		   <!-- <link toc="html/tocConcepts.xml" /> -->
+	   </topic>
+	   		   
+	   <topic label="Tasks" href="html/tasks/tasks.htm" >
+       <link toc="html/tocTasks.xml"/>
+	   </topic>
+
+	   <topic label="References" href="html/reference/references.htm" >
+     		   <link toc="html/tocReference.xml" />
+	   </topic>
+
+ 	   <topic label="Legal" href="html/legal.htm" >
+	   </topic>
+		
+	</topic>
+		
+</toc>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.help/plugin.xml	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+
+<plugin>
+    <extension point="org.eclipse.help.toc">
+        <toc
+            file="html/toolTOC.xml"
+            primary="true"/>     
+   
+        <toc
+            file="html/tocConcepts.xml"
+            primary="false"/>
+      <toc
+            file="html/tocGettingStarted.xml"
+            primary="false"/>
+      <toc
+            file="html/tocTasks.xml"
+            primary="false"/>
+      <toc
+            file="html/tocReference.xml"
+            primary="false"/>
+   
+   </extension>
+     
+    <extension point="org.eclipse.help.contexts">
+        <contexts
+            file="html/contexts.xml"
+            plugin="com.nokia.traceviewer.help" />
+    </extension>
+</plugin>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.ost/.classpath	Wed Jun 23 14:49:59 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/traceviewer/com.nokia.traceviewer.ost/.settings/org.eclipse.jdt.core.prefs	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,8 @@
+#Wed Sep 30 15:01:28 EEST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+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/traceviewer/com.nokia.traceviewer.ost/META-INF/MANIFEST.MF	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: TraceViewer OST Plug-in
+Bundle-SymbolicName: com.nokia.traceviewer.ost;singleton:=true
+Bundle-Version: 2.6.0
+Bundle-Activator: com.nokia.traceviewer.ost.OstPlugin
+Bundle-Vendor: Nokia
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ com.nokia.traceviewer,
+ com.nokia.tcf
+Bundle-ActivationPolicy: lazy
+Export-Package: com.nokia.traceviewer.ost
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.ost/about.html	Wed Jun 23 14:49:59 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 &copy; 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/traceviewer/com.nokia.traceviewer.ost/build.properties	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,8 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .,\
+               plugin.xml,\
+               about.html
+javacSource=1.5
+javacTarget=1.5
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.ost/plugin.xml	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+   <extension
+         point="com.nokia.traceviewer.traceprovider">
+      <client
+            class="com.nokia.traceviewer.ost.OstEngine">
+      </client>
+   </extension>
+
+</plugin>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.ost/src/com/nokia/traceviewer/ost/Messages.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,62 @@
+/*
+ * 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:
+ *
+ * String localization for OST package.
+ *
+ */
+package com.nokia.traceviewer.ost;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * String localization for OST package.
+ */
+final class Messages {
+
+	/**
+	 * Bundle name
+	 */
+	private static final String BUNDLE_NAME = "com.nokia.traceviewer.ost.messages"; //$NON-NLS-1$
+
+	/**
+	 * Resource bundle
+	 */
+	private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
+			.getBundle(BUNDLE_NAME);
+
+	/**
+	 * Prevents construction.
+	 */
+	private Messages() {
+	}
+
+	/**
+	 * Maps a key to localized string.
+	 * 
+	 * @param key
+	 *            the key for the string
+	 * @return the localized string
+	 */
+	public static String getString(String key) {
+		String value;
+		try {
+			value = RESOURCE_BUNDLE.getString(key);
+		} catch (MissingResourceException e) {
+			value = '!' + key + '!';
+		}
+		return value;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.ost/src/com/nokia/traceviewer/ost/OstBaseReader.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,260 @@
+/*
+ * 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:
+ *
+ * Base class for OST Readers
+ *
+ */
+package com.nokia.traceviewer.ost;
+
+import java.io.IOException;
+
+import com.nokia.traceviewer.engine.BaseDataReader;
+import com.nokia.traceviewer.engine.TraceProperties;
+
+/**
+ * Base class for OST Readers
+ * 
+ */
+public abstract class OstBaseReader extends BaseDataReader implements OstConsts {
+
+	/**
+	 * Splits data from byte buffer into messages
+	 */
+	protected OstMessageProcessor messageProcessor;
+
+	/**
+	 * Tells if this reader is paused or not
+	 */
+	protected boolean paused;
+
+	/**
+	 * Main loop running boolean
+	 */
+	protected boolean running;
+
+	/**
+	 * Byte array to store trace data get from buffer
+	 */
+	private byte[] traceData;
+
+	/**
+	 * Constructor
+	 */
+	OstBaseReader() {
+		// BaseDataReader constructor
+		super();
+		traceData = new byte[MAX_MESSAGE_SIZE];
+	}
+
+	/**
+	 * Parses a OST Simple Trace
+	 * 
+	 * @param msgStart
+	 *            start of message
+	 * @param headerLen
+	 *            length of header
+	 */
+	boolean processOstSimpleTrace(int msgStart, int headerLen) {
+		boolean valid = true;
+		int componentId = 0;
+		int groupId = 0;
+		int traceId = 0;
+
+		// Get component id
+		componentId |= receiveBuffer.getInt(msgStart + headerLen
+				+ OST_SIMPLE_TRACE_COMPONENTID_OFFSET);
+
+		// Get group id
+		groupId |= receiveBuffer.getShort(msgStart + headerLen
+				+ OST_SIMPLE_TRACE_GROUPID_OFFSET)
+				& SHORT_MASK;
+
+		// Get trace id
+		traceId |= receiveBuffer.getShort(msgStart + headerLen
+				+ OST_SIMPLE_TRACE_TRACEID_OFFSET)
+				& SHORT_MASK;
+
+		trace.binaryTrace = true;
+		trace.traceString = null;
+
+		// Set trace information
+		trace.information.setComponentId(componentId);
+		trace.information.setGroupId(groupId);
+		trace.information.setTraceId(traceId);
+
+		int bTraceHeaderStart = msgStart + headerLen
+				+ OST_SIMPLE_TRACE_TRACEID_OFFSET + TRACE_ID_LENGTH;
+
+		// Parse BTrace variables
+		parseBTraceVariables(receiveBuffer, bTraceHeaderStart, trace);
+
+		// Handle possible multipart trace
+		if (trace.bTraceInformation.getMultiPart() != 0) {
+			valid = handleMultiPart(trace, trace.bTraceInformation
+					.getMultiPart(), bTraceHeaderStart);
+		}
+
+		return valid;
+	}
+
+	/**
+	 * Parses a OST Ascii Trace
+	 * 
+	 * @param msgStart
+	 *            start of message
+	 * @param msgLen
+	 *            length of message
+	 * @param headerLen
+	 *            length of OST header
+	 */
+	void processOstAsciiTrace(int msgStart, int msgLen, int headerLen) {
+
+		// Data length
+		int dataLength = msgLen - headerLen - OST_ASCII_TRACE_TIMESTAMP_LENGTH;
+		if (dataLength < 0) {
+			dataLength = 0;
+		}
+		int position = receiveBuffer.position();
+		int limit = receiveBuffer.limit();
+		receiveBuffer.position(msgStart + headerLen
+				+ OST_ASCII_TRACE_TIMESTAMP_LENGTH);
+		receiveBuffer.limit(msgStart + headerLen
+				+ OST_ASCII_TRACE_TIMESTAMP_LENGTH + dataLength);
+
+		receiveBuffer.get(traceData, 0, dataLength);
+
+		// Remove line breaks and ASCII end characters from the buffer
+		boolean stringEndsRemoved = false;
+		for (int i = dataLength - 1; i >= 0; i--) {
+			byte b = traceData[i];
+			if (!stringEndsRemoved && b == '\0') {
+				dataLength--;
+			} else if (b == '\n' || b == '\r' || b == '\0') {
+				traceData[i] = ' ';
+			} else {
+				stringEndsRemoved = true;
+			}
+		}
+
+		trace.traceString = new String(traceData, 0, dataLength);
+		trace.dataStart = msgStart + headerLen
+				+ OST_ASCII_TRACE_TIMESTAMP_LENGTH;
+
+		receiveBuffer.limit(limit);
+		receiveBuffer.position(position);
+
+		trace.binaryTrace = false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @seecom.nokia.traceviewer.engine.BaseDataReader#
+	 * setProtocolSpecificStuffToMultiPartTrace(byte[],
+	 * com.nokia.traceviewer.engine.TraceProperties)
+	 */
+	@Override
+	protected byte[] setProtocolSpecificStuffToMultiPartTrace(byte[] byteArr,
+			TraceProperties trace) {
+		int totalMessageLength = byteArr.length;
+		int versionNr = byteArr[OST_VERSION_OFFSET];
+
+		// OST version 0.1 or 0.0
+		if (versionNr == OST_V01 || versionNr == OST_V00) {
+			totalMessageLength -= OST_V01_HEADER_LENGTH;
+			byteArr[OST_V01_LENGTH_OFFSET_2] = (byte) (totalMessageLength & BYTE_MASK);
+			byteArr[OST_V01_LENGTH_OFFSET_1] = (byte) ((totalMessageLength >> 8) & BYTE_MASK);
+
+			// OST version 0.5 or 1.0
+		} else if (versionNr == OST_V05 || versionNr == OST_V10) {
+			int messageLengthWithoutHeader = totalMessageLength
+					- OST_V05_HEADER_LENGTH;
+
+			// Length can fit to one byte
+			if (messageLengthWithoutHeader <= 0xFF) {
+				byteArr[OST_V05_LENGTH_OFFSET] = (byte) messageLengthWithoutHeader;
+
+				// Use extended length
+			} else {
+				byteArr[OST_V05_LENGTH_OFFSET] = 0;
+				totalMessageLength += OST_V05_EXT_LENGTH_LENGTH;
+
+				// Array needs to be extended by 4 bytes
+				byte[] newArray = new byte[totalMessageLength];
+				System.arraycopy(byteArr, 0, newArray, 0,
+						OST_V05_EXT_LENGTH_LENGTH);
+
+				newArray[OST_V05_EXT_LENGTH_OFFSET] = (byte) (messageLengthWithoutHeader & BYTE_MASK);
+				newArray[OST_V05_EXT_LENGTH_OFFSET + 1] = (byte) ((messageLengthWithoutHeader >> 8) & BYTE_MASK);
+				newArray[OST_V05_EXT_LENGTH_OFFSET + 2] = (byte) ((messageLengthWithoutHeader >> 16) & BYTE_MASK);
+				newArray[OST_V05_EXT_LENGTH_OFFSET + 3] = (byte) ((messageLengthWithoutHeader >> 24) & BYTE_MASK);
+
+				// Copy rest of the array to offset 8
+				System.arraycopy(byteArr, OST_V05_EXT_LENGTH_LENGTH, newArray,
+						OST_V05_EXT_LENGTH_OFFSET + OST_V05_EXT_LENGTH_LENGTH,
+						totalMessageLength - OST_V05_EXT_LENGTH_OFFSET
+								- OST_V05_EXT_LENGTH_LENGTH);
+
+				byteArr = newArray;
+
+				// Data start must be moved by 4 bytes
+				trace.dataStart += OST_V05_EXT_LENGTH_LENGTH;
+				trace.messageLength += OST_V05_EXT_LENGTH_LENGTH;
+			}
+		}
+		return byteArr;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.DataReader#isPaused()
+	 */
+	public boolean isPaused() {
+		return paused;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.DataReader#pause(boolean)
+	 */
+	public void pause(boolean pause) {
+		// Default implementation
+		paused = pause;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.DataReader#shutdown()
+	 */
+	public void shutdown() {
+		running = false;
+
+		// Close the message processor
+		if (messageProcessor != null) {
+			messageProcessor.close();
+		}
+
+		try {
+			if (sourceChannel != null) {
+				sourceChannel.close();
+				sourceChannel = null;
+			}
+		} catch (IOException e) {
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.ost/src/com/nokia/traceviewer/ost/OstConnectionHandler.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,252 @@
+/*
+ * 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:
+ *
+ * OST connection handler
+ *
+ */
+package com.nokia.traceviewer.ost;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+
+import com.nokia.tcf.api.ITCAPIConnection;
+import com.nokia.tcf.api.ITCConnection;
+import com.nokia.tcf.api.ITCMessage;
+import com.nokia.tcf.api.ITCMessageIds;
+import com.nokia.tcf.api.ITCMessageOptions;
+import com.nokia.tcf.api.TCFClassFactory;
+import com.nokia.traceviewer.engine.Connection;
+import com.nokia.traceviewer.engine.TraceFileHandler;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.preferences.PreferenceConstants;
+
+/**
+ * OST connection handler
+ */
+public class OstConnectionHandler implements Connection, TraceFileHandler,
+		OstConsts {
+
+	/**
+	 * Trace activation category
+	 */
+	private static final String TRACE_ACTIVATION_CATEGORY = Messages
+			.getString("OstConnectionHandler.TraceActivationCategory"); //$NON-NLS-1$
+
+	/**
+	 * API to Target Connection Framework
+	 */
+	protected ITCAPIConnection mapi;
+
+	/**
+	 * Connection
+	 */
+	protected ITCConnection inConnection;
+
+	/**
+	 * Message options
+	 */
+	protected ITCMessageOptions inMessageOptions;
+
+	/**
+	 * Message IDs
+	 */
+	protected ITCMessageIds inMessageIds;
+
+	/**
+	 * Connected boolean
+	 */
+	protected boolean connected;
+
+	/**
+	 * Status of the connection
+	 */
+	protected IStatus connStatus;
+
+	/**
+	 * File path
+	 */
+	private String filePath;
+
+	/**
+	 * Constructor
+	 */
+	OstConnectionHandler() {
+
+		// Create API connection
+		mapi = TCFClassFactory.createITCAPIConnection();
+		inMessageIds = TCFClassFactory.createITCMessageIds();
+
+		// Get message IDs
+		byte messageIds[] = new byte[] { OST_ASCII_TRACE_ID,
+				OST_SIMPLE_TRACE_ID };
+
+		// Add message IDs
+		for (int i = 0; i < messageIds.length; i++) {
+			inMessageIds.addMessageId(Byte.valueOf(messageIds[i]));
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.Connection#connect()
+	 */
+	public boolean connect() {
+		if (inConnection != null) {
+
+			// Try the connection
+			IPath path = new Path(filePath);
+			inMessageOptions = TCFClassFactory.createITCMessageOptions(path);
+			inMessageOptions
+					.setMessageDestination(ITCMessageOptions.DESTINATION_CLIENTFILE);
+			connStatus = mapi.connect(inConnection, inMessageOptions,
+					inMessageIds);
+
+			if (connStatus.isOK()) {
+				connected = true;
+			} else {
+				connected = false;
+				mapi.disconnect();
+			}
+		} else {
+			connected = false;
+			mapi.disconnect();
+		}
+
+		return connected;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.Connection#createConnection(java.lang.String
+	 * , java.lang.String[], java.lang.String)
+	 */
+	public boolean createConnection(String connectionType, String[] parameters,
+			String filePath) {
+		this.filePath = filePath;
+		boolean success = false;
+
+		// TCP / IP
+		if (connectionType.equals(PreferenceConstants.CONNECTION_TYPE_TCPIP)) {
+
+			String address = parameters[0];
+			String port = parameters[1];
+
+			// Create Real TCP connection
+			inConnection = TCFClassFactory.createITCRealTCPConnection(address,
+					port);
+			success = true;
+
+			// USB Serial
+		} else if (connectionType
+				.equals(PreferenceConstants.CONNECTION_TYPE_USB_SERIAL)) {
+
+			String comPort = parameters[0];
+
+			// Create Virtual serial connection
+			inConnection = TCFClassFactory
+					.createITCVirtualSerialConnection(comPort);
+			success = true;
+		}
+		return success;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.Connection#disconnect()
+	 */
+	public boolean disconnect() {
+		boolean succeeded = false;
+		IStatus status = mapi.disconnect();
+		if (status.isOK()) {
+			connected = false;
+			succeeded = true;
+		}
+		return succeeded;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.Connection#isConnected()
+	 */
+	public boolean isConnected() {
+		return connected;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.Connection#write(byte[])
+	 */
+	public boolean write(byte[] byteArray) {
+		boolean succeeded = false;
+		if (connStatus.isOK() && connected) {
+
+			// Try to send the data to the media
+			ITCMessage msg = TCFClassFactory.createITCMessage(byteArray);
+			IStatus status = mapi.sendMessage(msg);
+
+			// Post error message
+			if (status.getCode() != IStatus.OK) {
+				TraceViewerGlobals.postErrorEvent(Messages
+						.getString("OstConnectionHandler.CannotSendMsg") //$NON-NLS-1$
+						+ status.getMessage(), TRACE_ACTIVATION_CATEGORY, null);
+			} else {
+				succeeded = true;
+			}
+
+			// Not connected, post error message
+		} else {
+			TraceViewerGlobals
+					.postErrorEvent(
+							Messages
+									.getString("OstConnectionHandler.CannotSendMsgNotConnected"), //$NON-NLS-1$
+							TRACE_ACTIVATION_CATEGORY, null);
+		}
+		return succeeded;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.TraceFileHandler#clearFile()
+	 */
+	public void clearFile() {
+		if (mapi != null) {
+			mapi.clearMessageFile();
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.TraceFileHandler#closeFile()
+	 */
+	public void closeFile() {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.TraceFileHandler#openFile()
+	 */
+	public void openFile() {
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.ost/src/com/nokia/traceviewer/ost/OstConsts.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,301 @@
+/*
+ * 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:
+ *
+ * OST Constants
+ *
+ */
+package com.nokia.traceviewer.ost;
+
+/**
+ * OST Constants
+ */
+interface OstConsts {
+
+	// -----OST-----------
+	// -----HEADER--------
+	// -----SPECIFIC------
+	// -----CONSTANTS-----
+
+	/**
+	 * OST Version 0.0 indication
+	 */
+	final byte OST_V00 = 0x00;
+
+	/**
+	 * OST Version 0.1 indication
+	 */
+	final byte OST_V01 = 0x01;
+
+	/**
+	 * OST Version 0.5 indication
+	 */
+	final byte OST_V05 = 0x05;
+
+	/**
+	 * OST Version 1.0 indication
+	 */
+	final byte OST_V10 = 0x10;
+
+	/**
+	 * OST Version indication offset in OST message
+	 */
+	final int OST_VERSION_OFFSET = 0;
+
+	/**
+	 * OST Protocol ID offset in OST message
+	 */
+	final int OST_V00_PROTOCOLID_OFFSET = 1;
+
+	/**
+	 * OST Protocol ID offset in OST message
+	 */
+	final int OST_V01_PROTOCOLID_OFFSET = 1;
+
+	/**
+	 * OST Protocol ID offset in OST message
+	 */
+	final int OST_V05_PROTOCOLID_OFFSET = 2;
+
+	/**
+	 * OST Protocol ID offset in OST message
+	 */
+	final int OST_V10_PROTOCOLID_OFFSET = 2;
+
+	/**
+	 * Offset to length byte 1 in OSTV0.1
+	 */
+	final int OST_V01_LENGTH_OFFSET_1 = 2;
+
+	/**
+	 * Offset to length byte 2 in OSTV0.1
+	 */
+	final int OST_V01_LENGTH_OFFSET_2 = 3;
+
+	/**
+	 * Offset to length byte in OSTV0.5
+	 */
+	final int OST_V05_LENGTH_OFFSET = 3;
+
+	/**
+	 * Offset to extended length in OSTV0.5
+	 */
+	final int OST_V05_EXT_LENGTH_OFFSET = 4;
+
+	/**
+	 * OST header V0.0 length
+	 */
+	final int OST_V00_HEADER_LENGTH = 4;
+
+	/**
+	 * OST header V0.1 length
+	 */
+	final int OST_V01_HEADER_LENGTH = 4;
+
+	/**
+	 * OST header V0.5 length
+	 */
+	final int OST_V05_HEADER_LENGTH = 4;
+
+	/**
+	 * OST header V0.5 extended length length
+	 */
+	final int OST_V05_EXT_LENGTH_LENGTH = 4;
+
+	// -----OST-----------
+	// -----TRACE---------
+	// -----ACTIVATION----
+	// -----SPECIFIC------
+	// -----CONSTANTS-----
+
+	/**
+	 * OST Trace Activation protocol ID
+	 */
+	final byte OST_TRACE_ACTIVATION_ID = 0x01;
+
+	/**
+	 * OST Trace Activation header length
+	 */
+	final int OST_TRACE_ACTIVATION_HEADER_LENGTH = 2;
+
+	/**
+	 * OST Trace Activation transaction ID offset. Offset starts after the base
+	 * header.
+	 */
+	final int OST_TRACE_ACTIVATION_TRANSID_OFFSET = 0;
+
+	/**
+	 * OST Trace Activation message ID offset. Offset starts after the base
+	 * header.
+	 */
+	final int OST_TRACE_ACTIVATION_MESSAGEID_OFFSET = 1;
+
+	/**
+	 * OST Trace Activation set activation status request
+	 */
+	final byte OST_TRACE_ACTIVATION_SET_STATUS_REQUEST = 0x06;
+
+	/**
+	 * OST Trace Activation component ID offset. Offset starts after the base
+	 * header.
+	 */
+	final int OST_TRACE_ACTIVATION_COMPONENTID_OFFSET = 2;
+
+	/**
+	 * OST Trace Activation set activation status offset. Offset starts after
+	 * the base header.
+	 */
+	final int OST_TRACE_ACTIVATION_STATUS_OFFSET = 6;
+
+	/**
+	 * OST Trace Activation set filler offset. Offset starts after the header.
+	 */
+	final int OST_TRACE_ACTIVATION_FILLER_OFFSET = 7;
+
+	/**
+	 * OST Trace Activation group start offset. Offset starts after the header.
+	 */
+	final int OST_TRACE_ACTIVATION_GROUPID_START_OFFSET = 8;
+
+	/**
+	 * Activation indicator
+	 */
+	final byte OST_TRACE_ACTIVATION_ACTIVATE_INDICATOR = 0x01;
+
+	/**
+	 * Deactivation indicator
+	 */
+	final byte OST_TRACE_ACTIVATION_DEACTIVATE_INDICATOR = 0x00;
+
+	// -----OST-----------
+	// -----ASCII---------
+	// -----TRACE---------
+	// -----SPECIFIC------
+	// -----CONSTANTS-----
+
+	/**
+	 * OST ASCII TRACE protocol ID
+	 */
+	final byte OST_ASCII_TRACE_ID = 0x02;
+
+	/**
+	 * Offset to timestamp in OST Ascii Trace. Offset starts after the base
+	 * header.
+	 */
+	final int OST_ASCII_TRACE_TIMESTAMP_OFFSET = 0;
+
+	/**
+	 * OST ASCII timestamp length in bytes
+	 */
+	final int OST_ASCII_TRACE_TIMESTAMP_LENGTH = 8;
+
+	/**
+	 * Offset to data in OST Ascii Trace. Offset starts after the base header.
+	 */
+	final int OST_ASCII_TRACE_DATA_OFFSET = 8;
+
+	// -----OST-----------
+	// -----SIMPLE--------
+	// -----TRACE---------
+	// -----SPECIFIC------
+	// -----CONSTANTS-----
+
+	/**
+	 * OST SIMPLE TRACE protocol ID
+	 */
+	final byte OST_SIMPLE_TRACE_ID = 0x03;
+
+	/**
+	 * Offset to timestamp in OST Simple Trace. Offset starts after the base
+	 * header.
+	 */
+	final int OST_SIMPLE_TRACE_TIMESTAMP_OFFSET = 0;
+
+	/**
+	 * Offset to application (component) ID in OST Simple Trace. Offset starts
+	 * after the base header.
+	 */
+	final int OST_SIMPLE_TRACE_COMPONENTID_OFFSET = 8;
+
+	/**
+	 * Offset to group ID in OST Simple Trace. Offset starts after the base
+	 * header.
+	 */
+	final int OST_SIMPLE_TRACE_GROUPID_OFFSET = 12;
+
+	/**
+	 * Offset to trace ID in OST Simple Trace. Offset starts after the base
+	 * header.
+	 */
+	final int OST_SIMPLE_TRACE_TRACEID_OFFSET = 14;
+
+	// -----OST-----------
+	// -----TRACECORE--------
+	// -----PROTOCOL---------
+	// -----SPECIFIC------
+	// -----CONSTANTS-----
+
+	/**
+	 * OST TraceCore protocol header length
+	 */
+	final int OST_TRACECORE_PROTOCOL_HEADER_LENGTH = 4;
+
+	/**
+	 * Protocol ID offset in TraceCore protocol
+	 */
+	final int OST_TRACECORE_PROTOCOL_ID_OFFSET = 0;
+
+	/**
+	 * TraceCore Subscriber message ID offset in header if
+	 * OST_TRACECORE_PROTOCOL_ID is OST_TRACECORE_SUBSCRIBER_PROTOCOL_ID
+	 */
+	final int OST_TRACECORE_SUBSCRIBER_ID_OFFSET = 1;
+
+	/**
+	 * OST TraceCore Protocol Subscriber Protocol ID
+	 */
+	final int OST_TRACECORE_SUBSCRIBER_PROTOCOL_ID = 0x01;
+
+	/**
+	 * OST TraceCore protocol ID
+	 */
+	final byte OST_TRACECORE_PROTOCOL_ID = (byte) 0x91;
+
+	// -----OTHER---------
+	// -----NON-----------
+	// -----OST-----------
+	// -----SPECIFIC------
+	// -----CONSTANTS-----
+
+	/**
+	 * Timestamp mask
+	 */
+	final long TIMESTAMP_MASK = 0x3FFFFFFFFFFFFFFFL;
+
+	/**
+	 * Component ID length in bytes
+	 */
+	final int COMPONENT_ID_LENGTH = 4;
+
+	/**
+	 * Group ID length in bytes
+	 */
+	final int GROUP_ID_LENGTH = 2;
+
+	/**
+	 * Trace ID length in bytes
+	 */
+	final int TRACE_ID_LENGTH = 2;
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.ost/src/com/nokia/traceviewer/ost/OstDataMatcherChecker.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,81 @@
+/*
+ * 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:
+ *
+ * OST Data Matcher Checker
+ *
+ */
+package com.nokia.traceviewer.ost;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+
+import com.nokia.traceviewer.engine.TraceViewerConst;
+
+/**
+ * OST Data Matcher Checker
+ * 
+ */
+public class OstDataMatcherChecker implements OstConsts, TraceViewerConst {
+
+	/**
+	 * Checks if file format seems to match
+	 * 
+	 * @param filePath
+	 *            file path
+	 * @return true if file format seems to match, false if not
+	 */
+	boolean checkIfFileFormatMatches(String filePath) {
+		boolean matches = false;
+		FileInputStream is = null;
+		try {
+			is = new FileInputStream(filePath);
+			if (is.available() > 0) {
+				byte[] arr = new byte[OST_V05_PROTOCOLID_OFFSET + 1];
+				is.read(arr);
+				int versionNumber = 0;
+				int msgId = 0;
+
+				// Get version number and message ID
+				versionNumber |= arr[OST_VERSION_OFFSET] & BYTE_MASK;
+
+				// Version must be 0.0, 0.1, 0.5 or 1.0
+				if (versionNumber == OST_V00 || versionNumber == OST_V01) {
+					msgId |= arr[OST_V01_PROTOCOLID_OFFSET] & BYTE_MASK;
+				} else if (versionNumber == OST_V05 || versionNumber == OST_V10) {
+					msgId |= arr[OST_V05_PROTOCOLID_OFFSET] & BYTE_MASK;
+				}
+
+				// Message ID must be Simple Trace or ASCII
+				if (msgId == OST_SIMPLE_TRACE_ID || msgId == OST_ASCII_TRACE_ID) {
+					matches = true;
+				}
+			}
+
+		} catch (IOException e) {
+
+			// Close the stream
+		} finally {
+			if (is != null) {
+				try {
+					is.close();
+				} catch (IOException e) {
+				}
+			}
+
+		}
+
+		return matches;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.ost/src/com/nokia/traceviewer/ost/OstEngine.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,135 @@
+/*
+ * 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:
+ *
+ * Engine of the OST Trace Provider
+ *
+ */
+package com.nokia.traceviewer.ost;
+
+import java.nio.channels.ByteChannel;
+
+import com.nokia.traceviewer.engine.Connection;
+import com.nokia.traceviewer.engine.DataReader;
+import com.nokia.traceviewer.engine.DataWriter;
+import com.nokia.traceviewer.engine.MediaCallback;
+import com.nokia.traceviewer.engine.TraceConfiguration;
+import com.nokia.traceviewer.engine.TraceProvider;
+
+/**
+ * OST engine
+ */
+public class OstEngine implements TraceProvider, OstConsts {
+
+	/**
+	 * Connection handler
+	 */
+	private OstConnectionHandler connectionHandler;
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.TraceProvider#activate(boolean,
+	 * boolean, int, int[])
+	 */
+	public void activate(boolean activate, boolean overWrite, int componentId,
+			int[] groupIds) {
+		OstMessageSender sender = new OstMessageSender();
+		sender.sendActivationMessage(activate, componentId, groupIds);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.TraceProvider#checkIfFileFormatMatches(java
+	 * .lang.String)
+	 */
+	public boolean checkIfFileFormatMatches(String filePath) {
+		OstDataMatcherChecker checker = new OstDataMatcherChecker();
+		boolean matches = checker.checkIfFileFormatMatches(filePath);
+		return matches;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.TraceProvider#createDataReader(com.nokia
+	 * .traceviewer.engine.MediaCallback,
+	 * com.nokia.traceviewer.engine.TraceConfiguration)
+	 */
+	public DataReader createDataReader(MediaCallback callback,
+			TraceConfiguration conf) {
+
+		DataReader dataReader = new OstReader(callback, conf);
+		return dataReader;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.TraceProvider#createDataWriter(java.nio.
+	 * channels.ByteChannel)
+	 */
+	public DataWriter createDataWriter(ByteChannel writeChannel) {
+		DataWriter newWriter = new OstWriter(writeChannel);
+		return newWriter;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.TraceProvider#getConnectionHandler()
+	 */
+	public Connection getConnectionHandler() {
+		if (connectionHandler == null) {
+			connectionHandler = new OstConnectionHandler();
+		}
+		return connectionHandler;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.TraceProvider#getName()
+	 */
+	public String getName() {
+		return "OST - Open System Trace"; //$NON-NLS-1$
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.TraceProvider#getPreferredConnectionType()
+	 */
+	public String getPreferredConnectionType() {
+		return com.nokia.traceviewer.engine.preferences.PreferenceConstants.CONNECTION_TYPE_USB_SERIAL;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.TraceProvider#sendActivationmessage(byte[],
+	 * byte)
+	 */
+	public void sendMessage(byte[] message, boolean addHeader, byte messageId,
+			boolean changeMediaType) {
+		OstMessageSender sender = new OstMessageSender();
+		sender.sendMessage(message, addHeader, messageId);
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.ost/src/com/nokia/traceviewer/ost/OstMessageCallback.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,46 @@
+/*
+ * 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:
+ *
+ * OST message callback interface
+ *
+ */
+package com.nokia.traceviewer.ost;
+
+import java.io.IOException;
+
+/**
+ * OST message callback interface
+ * 
+ */
+public interface OstMessageCallback {
+
+	/**
+	 * Processes message
+	 * 
+	 * @param msgStart
+	 *            start offset of message
+	 * @param msgLength
+	 *            message length
+	 * @param headerLength
+	 *            header length
+	 * @param headerVersion
+	 *            header version
+	 * @return true if processing should be continued, false otherwise
+	 * @throws IOException
+	 */
+	boolean processMessage(int msgStart, int msgLength, int headerLength,
+			int headerVersion) throws IOException;
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.ost/src/com/nokia/traceviewer/ost/OstMessageProcessor.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,200 @@
+/*
+ * 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:
+ *
+ * OST Message Processor 
+ *
+ */
+package com.nokia.traceviewer.ost;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
+import com.nokia.traceviewer.engine.TraceViewerConst;
+
+/**
+ * OST Message Processor
+ * 
+ */
+public class OstMessageProcessor implements OstConsts, TraceViewerConst {
+
+	/**
+	 * Buffer where data is located
+	 */
+	private final ByteBuffer receiveBuffer;
+
+	/**
+	 * Temporary buffer for data
+	 */
+	private final ByteBuffer tempBuffer;
+
+	/**
+	 * Callback class
+	 */
+	private final OstMessageCallback callback;
+
+	/**
+	 * If true, stop processing the messages
+	 */
+	private boolean stopped;
+
+	/**
+	 * @param callback
+	 *            callback where messages are returned
+	 * @param receiveBuffer
+	 *            buffer where data is located
+	 */
+	public OstMessageProcessor(OstMessageCallback callback,
+			ByteBuffer receiveBuffer) {
+		this.callback = callback;
+		this.receiveBuffer = receiveBuffer;
+		tempBuffer = ByteBuffer.allocateDirect(MAX_MESSAGE_SIZE);
+	}
+
+	/**
+	 * Processes buffer to messages
+	 * 
+	 * @throws IOException
+	 */
+	public void processBuffer() throws IOException {
+
+		boolean messageFound = false;
+		boolean processorResult = false;
+		int msgLength = 0;
+		int versionNr = 0;
+		int msgStart = 0;
+		// Parses all complete messages
+		int position = receiveBuffer.position();
+		do {
+			messageFound = false;
+			// Reads next message length if there is enough data
+			if (position - msgStart > OST_V01_HEADER_LENGTH) {
+				versionNr = 0;
+				msgLength = 0;
+
+				// Get OST version and check the base header length
+				versionNr |= (receiveBuffer.get(msgStart + OST_VERSION_OFFSET) & BYTE_MASK);
+
+				int headerLength = 0;
+
+				// OST version 0.1
+				if (versionNr == OST_V01) {
+					headerLength = OST_V01_HEADER_LENGTH;
+
+					// Get message length
+					msgLength |= (receiveBuffer.getShort(msgStart
+							+ OST_V01_LENGTH_OFFSET_1) & SHORT_MASK)
+							+ headerLength;
+
+					// OST version 0.0
+				} else if (versionNr == OST_V00) {
+					headerLength = OST_V00_HEADER_LENGTH;
+
+					// Get message length
+					msgLength |= (receiveBuffer.getShort(msgStart
+							+ OST_V01_LENGTH_OFFSET_1) & SHORT_MASK)
+							+ headerLength;
+
+					// OST version 0.5 or 1.0
+				} else if (versionNr == OST_V05 || versionNr == OST_V10) {
+					headerLength = OST_V05_HEADER_LENGTH;
+
+					// Get message length
+					msgLength |= (receiveBuffer.get(msgStart
+							+ OST_V05_LENGTH_OFFSET) & BYTE_MASK)
+							+ headerLength;
+
+					// If length is only the header length, there are 4 bytes
+					// extended length in Little Endian (LE)
+					if (msgLength == headerLength) {
+						headerLength += OST_V05_EXT_LENGTH_LENGTH;
+						msgLength = receiveBuffer.getInt(msgStart
+								+ OST_V05_EXT_LENGTH_OFFSET);
+
+						// Reverse because of Little Endian
+						msgLength = Integer.reverseBytes(msgLength);
+						msgLength += headerLength;
+					}
+				} else {
+					// Unsupported OST version.
+					System.out
+							.println("Unsupported OST version: 0x" + Integer.toHexString(versionNr)); //$NON-NLS-1$
+				}
+
+				// Parses message if it is completely in buffer
+				if (position >= msgStart + msgLength) {
+					processorResult = callback.processMessage(msgStart,
+							msgLength, headerLength, versionNr);
+					msgStart += msgLength;
+					messageFound = true;
+				}
+			}
+		} while (messageFound && processorResult && !stopped);
+
+		if (!stopped) {
+			// Writes the remaining data into beginning of receive
+			// buffer. The next socket read operation will append data
+			// into buffer
+			int remainderLength = position - msgStart;
+			if (remainderLength > 0 && processorResult) {
+				receiveBuffer.position(msgStart);
+				receiveBuffer.limit(msgStart + remainderLength);
+				tempBuffer.position(0);
+				tempBuffer.limit(MAX_MESSAGE_SIZE);
+				tempBuffer.put(receiveBuffer);
+
+				receiveBuffer.position(0);
+				receiveBuffer.limit(RECEIVE_BUFFER_SIZE);
+				tempBuffer.position(0);
+				tempBuffer.limit(remainderLength);
+
+				receiveBuffer.put(tempBuffer);
+				receiveBuffer.position(remainderLength);
+			} else {
+				receiveBuffer.position(0);
+				receiveBuffer.limit(RECEIVE_BUFFER_SIZE);
+			}
+		}
+	}
+
+	/**
+	 * Reads the 8 byte timestamp from the data buffer
+	 * 
+	 * @param msgStart
+	 *            message start offset
+	 * @param timestampOffset
+	 *            offset to the timestamp in the message
+	 * @return the timestamp
+	 */
+	public long parseTimeStampToNanosecs(int msgStart, int timestampOffset) {
+		long timestamp = 0;
+		try {
+			timestamp = receiveBuffer.getLong(msgStart + timestampOffset)
+					& TIMESTAMP_MASK;
+		} catch (Throwable t) {
+			t.printStackTrace();
+			// Couldn't get timestamp, return MIN_VALUE to set trace as non
+			// valid
+			timestamp = Long.MIN_VALUE;
+		}
+		return timestamp;
+	}
+
+	/**
+	 * Close the processor
+	 */
+	void close() {
+		stopped = true;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.ost/src/com/nokia/traceviewer/ost/OstMessageSender.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,241 @@
+/*
+ * 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:
+ *
+ * OST message sender class
+ *
+ */
+package com.nokia.traceviewer.ost;
+
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * OST message sender class
+ * 
+ */
+public class OstMessageSender implements OstConsts {
+
+	/**
+	 * Sends message to the device
+	 * 
+	 * @param message
+	 *            the message
+	 * @param addHeader
+	 *            if true, adds header to the message before sending
+	 * @param messageId
+	 *            message ID to be used in message
+	 */
+	public void sendMessage(byte[] message, boolean addHeader, byte messageId) {
+		byte[] ostMessage;
+		if (addHeader) {
+			// Add TraceCore protocol subscriber header
+			ostMessage = addTraceCoreProtocolHeader(message, messageId);
+			messageId = OST_TRACECORE_PROTOCOL_ID;
+
+			// Wrap the message to OST message
+			ostMessage = wrapInOstMessage(ostMessage, messageId);
+		} else {
+			ostMessage = message;
+		}
+
+		// Write message to connection
+		if (TraceViewerGlobals.getTraceViewer().getConnection() != null) {
+			TraceViewerGlobals.getTraceViewer().getConnection().write(
+					ostMessage);
+		}
+	}
+
+	/**
+	 * Sends activation message to the device
+	 * 
+	 * @param activate
+	 *            if true, activate, otherwise deactivate
+	 * @param componentId
+	 *            component ID
+	 * @param groupIds
+	 *            array of group IDs
+	 */
+	public void sendActivationMessage(boolean activate, int componentId,
+			int[] groupIds) {
+
+		// Don't send anything if activating zero groups
+		if (groupIds.length > 0) {
+
+			// Create activation message
+			byte[] activationMessage = createActivationMessage(activate,
+					componentId, groupIds);
+
+			// Wrap the message to OST message
+			byte[] ostMessage = wrapInOstMessage(activationMessage,
+					OST_TRACE_ACTIVATION_ID);
+
+			// Write message to connection
+			if (TraceViewerGlobals.getTraceViewer().getConnection() != null) {
+				TraceViewerGlobals.getTraceViewer().getConnection().write(
+						ostMessage);
+			}
+		}
+	}
+
+	/**
+	 * Creates activation message
+	 * 
+	 * @param activate
+	 *            if true, message is activation message. If false, message is
+	 *            deactivation message.
+	 * @param componentId
+	 *            component ID
+	 * @param groupIds
+	 *            array of group ID's
+	 * @return the activation message
+	 */
+	private byte[] createActivationMessage(boolean activate, int componentId,
+			int[] groupIds) {
+		int j = 0;
+		byte[] message = null;
+
+		// Calculate length of the message. The last "2" is from activation
+		// status + filler
+		int length = OST_TRACE_ACTIVATION_HEADER_LENGTH + COMPONENT_ID_LENGTH
+				+ GROUP_ID_LENGTH * groupIds.length + 2;
+
+		message = new byte[length];
+
+		// Transaction ID
+		message[OST_TRACE_ACTIVATION_TRANSID_OFFSET] = 0x01;
+
+		// Message ID is set application status request
+		message[OST_TRACE_ACTIVATION_MESSAGEID_OFFSET] = OST_TRACE_ACTIVATION_SET_STATUS_REQUEST;
+
+		// Set next four bytes to be component id
+		byte[] componentIdBytes = getIntAsFourBytesBigEndian(componentId);
+		for (int k = 0; k < componentIdBytes.length; k++) {
+			message[OST_TRACE_ACTIVATION_COMPONENTID_OFFSET + k] = componentIdBytes[k];
+		}
+
+		// Activate or deactivate
+		if (activate) {
+			message[OST_TRACE_ACTIVATION_STATUS_OFFSET] = OST_TRACE_ACTIVATION_ACTIVATE_INDICATOR;
+		} else {
+			message[OST_TRACE_ACTIVATION_STATUS_OFFSET] = OST_TRACE_ACTIVATION_DEACTIVATE_INDICATOR;
+		}
+
+		message[OST_TRACE_ACTIVATION_FILLER_OFFSET] = 0x00;
+
+		// Iterate through groups
+		for (j = 0; j < groupIds.length; j++) {
+
+			// Set next 2 bytes to be group id
+			byte[] groupIdBytes = getIntAsTwoBytesBigEndian(groupIds[j]);
+			for (int k = 0; k < groupIdBytes.length; k++) {
+				int offset = OST_TRACE_ACTIVATION_GROUPID_START_OFFSET + k
+						+ (j * 2);
+				message[offset] = groupIdBytes[k];
+			}
+		}
+
+		return message;
+	}
+
+	/**
+	 * Adds TraceCore protocol header to the message
+	 * 
+	 * @param message
+	 *            message
+	 * @param messageId
+	 *            message (subscriber) ID to be used
+	 * @return message with TraceCore protocol header added
+	 */
+	private byte[] addTraceCoreProtocolHeader(byte[] message, byte messageId) {
+		byte[] ostMessage = new byte[message.length
+				+ OST_TRACECORE_PROTOCOL_HEADER_LENGTH];
+
+		// TraceCore protocol ID to be Subscriber ID
+		ostMessage[OST_TRACECORE_PROTOCOL_ID_OFFSET] = OST_TRACECORE_SUBSCRIBER_PROTOCOL_ID;
+
+		// Add original message ID as a subscriber ID
+		ostMessage[OST_TRACECORE_SUBSCRIBER_ID_OFFSET] = messageId;
+
+		// Two next bytes are reserved for future use
+		ostMessage[OST_TRACECORE_SUBSCRIBER_ID_OFFSET + 1] = 0x00;
+		ostMessage[OST_TRACECORE_SUBSCRIBER_ID_OFFSET + 2] = 0x00;
+
+		// Copy the rest of the bytes to the new array
+		System.arraycopy(message, 0, ostMessage,
+				OST_TRACECORE_PROTOCOL_HEADER_LENGTH, message.length);
+
+		return ostMessage;
+	}
+
+	/**
+	 * Wraps given byte array to OST message. Header to be used is OST header
+	 * version 0.1
+	 * 
+	 * @param message
+	 *            message to wrap
+	 * @param protocolId
+	 *            protocol ID to be used in message
+	 * @return message wrapped in OST message
+	 */
+	public byte[] wrapInOstMessage(byte[] message, byte protocolId) {
+		byte[] ostMessage = new byte[message.length + OST_V01_HEADER_LENGTH];
+
+		// Version
+		ostMessage[OST_VERSION_OFFSET] = 0x01;
+
+		// Protocol ID
+		ostMessage[OST_V01_PROTOCOLID_OFFSET] = protocolId;
+
+		// Length bytes
+		byte[] length = getIntAsTwoBytesBigEndian(message.length);
+		ostMessage[OST_V01_LENGTH_OFFSET_1] = length[0];
+		ostMessage[OST_V01_LENGTH_OFFSET_2] = length[1];
+
+		// Copy the rest of the bytes to the new array
+		System.arraycopy(message, 0, ostMessage, OST_V01_HEADER_LENGTH,
+				message.length);
+
+		return ostMessage;
+	}
+
+	/**
+	 * Gets int as two bytes in big endian
+	 * 
+	 * @param integer
+	 *            integer to get as bytes
+	 * @return byte array[2] containing given integer in big endian
+	 */
+	private byte[] getIntAsTwoBytesBigEndian(int integer) {
+		byte[] byteArr = new byte[2];
+		byteArr[0] = (byte) ((integer >> 8) & 0xFF);
+		byteArr[1] = (byte) (integer & 0xFF);
+		return byteArr;
+	}
+
+	/**
+	 * Gets int as four bytes in big endian
+	 * 
+	 * @param integer
+	 *            int
+	 * @return four byte array in big endian
+	 */
+	private byte[] getIntAsFourBytesBigEndian(int integer) {
+		byte[] byteArr = new byte[4];
+		byteArr[0] = (byte) (integer >> 24);
+		byteArr[1] = (byte) ((integer << 8) >> 24);
+		byteArr[2] = (byte) ((integer << 16) >> 24);
+		byteArr[3] = (byte) ((integer << 24) >> 24);
+		return byteArr;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.ost/src/com/nokia/traceviewer/ost/OstPlugin.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,80 @@
+/*
+ * 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:
+ *
+ * OST Plugin
+ *
+ */
+package com.nokia.traceviewer.ost;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ * 
+ */
+public class OstPlugin extends AbstractUIPlugin {
+
+	/**
+	 * The plug-in ID
+	 */
+	public static final String PLUGIN_ID = "com.nokia.traceviewer.ost"; //$NON-NLS-1$
+
+	/**
+	 * The shared instance
+	 */
+	private static OstPlugin plugin;
+
+	/**
+	 * The constructor
+	 */
+	public OstPlugin() {
+		plugin = this;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
+	 * )
+	 */
+	@Override
+	public void start(BundleContext context) throws Exception {
+		super.start(context);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
+	 * )
+	 */
+	@Override
+	public void stop(BundleContext context) throws Exception {
+		plugin = null;
+		super.stop(context);
+	}
+
+	/**
+	 * Returns the shared instance
+	 * 
+	 * @return the shared instance
+	 */
+	public static OstPlugin getDefault() {
+		return plugin;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.ost/src/com/nokia/traceviewer/ost/OstReader.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,350 @@
+/*
+ * 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:
+ *
+ * OST Reader class
+ *
+ */
+package com.nokia.traceviewer.ost;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
+import com.nokia.traceviewer.engine.DataScrollReader;
+import com.nokia.traceviewer.engine.MediaCallback;
+import com.nokia.traceviewer.engine.TraceConfiguration;
+import com.nokia.traceviewer.engine.TraceProperties;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * OST Reader class
+ */
+public class OstReader extends OstBaseReader implements OstMessageCallback {
+
+	/**
+	 * Indicates not found
+	 */
+	private static final int NOT_DEFINED = -1;
+
+	/**
+	 * Number of bytes received
+	 */
+	private int bytesRead;
+
+	/**
+	 * Number of bytes in previous message
+	 */
+	private int previousMessageBytes;
+
+	/**
+	 * Trace number where pause was pressed
+	 */
+	private int pauseStopPoint = NOT_DEFINED;
+
+	/**
+	 * File position where pause is invoked
+	 */
+	private long pauseFilePosition;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param mediaCallback
+	 *            callback
+	 * @param configuration
+	 *            trace configuration used in this reader
+	 */
+	public OstReader(MediaCallback mediaCallback,
+			TraceConfiguration configuration) {
+		// OstBaseReader constructor
+		super();
+
+		this.mediaCallback = mediaCallback;
+		receiveBuffer = ByteBuffer.allocateDirect(RECEIVE_BUFFER_SIZE);
+		messageProcessor = new OstMessageProcessor(this, receiveBuffer);
+		traceConfiguration = configuration;
+		trace = new TraceProperties(configuration);
+		trace.byteBuffer = receiveBuffer;
+
+		running = true;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Thread#run()
+	 */
+	@Override
+	public void run() {
+		// Create the file channel
+		createFileChannel();
+		setFilePosition(0);
+		try {
+			receiveBuffer.position(0);
+			while (running) {
+				// Read data if not paused or pause point is not reached
+				if (!paused || pauseStopPoint > traceCount) {
+					// Get bytes in buffer before read operation
+					if (receiveBuffer.position() != 0) {
+						previousMessageBytes = receiveBuffer.position();
+					} else {
+						previousMessageBytes = 0;
+					}
+
+					// Reads data to buffer
+					bytesRead = sourceChannel.read(receiveBuffer);
+					if (bytesRead < 0) {
+						// If no data is found inform
+						// callback for EOF, update view and sleep
+						mediaCallback.endOfFile(this);
+						Thread.sleep(SLEEP_TIME);
+					} else {
+						// If data is found, the processor is used to split the
+						// data into OST messages. processMessage is called for
+						// each message found from the buffer and the buffer is
+						// re-positioned for next read operation
+						messageProcessor.processBuffer();
+					}
+					// Paused, sleep
+				} else {
+					// Update view when pausing
+					mediaCallback.endOfFile(this);
+					Thread.sleep(PAUSE_TIME);
+				}
+			}
+		} catch (Throwable t) {
+			t.printStackTrace();
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.ost.OstMessageCallback#processMessage(int,
+	 * int, int, int)
+	 */
+	public boolean processMessage(int msgStart, int msgLen, int headerLen,
+			int headerVersion) {
+
+		boolean valid = true;
+		try {
+			int protocolId = 0;
+
+			// Create new TraceProperties
+			trace = new TraceProperties(traceConfiguration);
+
+			// Save buffer and message and data offsets
+			trace.byteBuffer = receiveBuffer;
+			trace.messageStart = msgStart;
+			trace.messageLength = msgLen;
+
+			// Get protocol ID offset
+			int protocolIdOffset = 0;
+			if (headerVersion == OST_V01) {
+				protocolIdOffset = OST_V01_PROTOCOLID_OFFSET;
+			} else if (headerVersion == OST_V05) {
+				protocolIdOffset = OST_V05_PROTOCOLID_OFFSET;
+			} else if (headerVersion == OST_V10) {
+				protocolIdOffset = OST_V10_PROTOCOLID_OFFSET;
+			} else if (headerVersion == OST_V00) {
+				protocolIdOffset = OST_V00_PROTOCOLID_OFFSET;
+			} else {
+				// Unsupported header version
+				System.out
+						.println("Unsupported header version: " + headerVersion); //$NON-NLS-1$
+			}
+
+			// Read protocol ID
+			protocolId |= receiveBuffer.get(msgStart + protocolIdOffset)
+					& BYTE_MASK;
+
+			// OST Ascii Trace (0x02)
+			if (protocolId == OST_ASCII_TRACE_ID && msgLen >= headerLen) {
+
+				// Get the timestamp
+				trace.timestamp = messageProcessor.parseTimeStampToNanosecs(
+						msgStart, headerLen + OST_ASCII_TRACE_TIMESTAMP_OFFSET);
+
+				// Process the trace
+				processOstAsciiTrace(msgStart, msgLen, headerLen);
+
+				// OST Simple Application Trace Protocol (0x03)
+			} else if (protocolId == OST_SIMPLE_TRACE_ID) {
+
+				// Get the timestamp
+				trace.timestamp = messageProcessor
+						.parseTimeStampToNanosecs(msgStart, headerLen
+								+ OST_SIMPLE_TRACE_TIMESTAMP_OFFSET);
+
+				// Process the trace
+				valid = processOstSimpleTrace(msgStart, headerLen);
+
+				// Unknown protocol ID
+			} else {
+				trace.binaryTrace = true;
+				valid = false;
+			}
+
+			// Trace is valid, process it
+			if (valid) {
+				processNormalTrace();
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+
+		// Always return true to continue from the next message
+		return true;
+	}
+
+	/**
+	 * Processes normal trace (not scrolled)
+	 */
+	private void processNormalTrace() {
+		try {
+			if (sourceChannel != null && sourceChannel.isOpen()) {
+				if ((!paused || pauseStopPoint > traceCount)) {
+					traceCount++;
+					trace.traceNumber = traceCount;
+
+					// Update file map if first trace of trace block
+					if (traceCount % TraceViewerGlobals.blockSize == 1) {
+						long filePos = getTracePositionInFile();
+
+						fileMap.insert(Long.valueOf(filePos));
+					}
+
+					// Check if last trace
+					checkLastTrace();
+
+					// In case of multi part trace, set trace properties now so
+					// that DataProcessor can use it properly
+					if (trace.bTraceInformation.getMultiPart() != 0) {
+						int initialHeaderSize = trace.dataStart
+								- trace.messageStart;
+						trace.messageStart = 0;
+						trace.messageLength = trace.byteBuffer.capacity();
+						trace.dataStart = initialHeaderSize;
+						trace.dataLength = trace.messageLength
+								- initialHeaderSize;
+					}
+
+					// Process this trace
+					mediaCallback.processTrace(trace);
+
+					// Save file position when pausing
+				} else if (pauseFilePosition == 0) {
+					pauseFilePosition = getTracePositionInFile();
+				}
+			}
+		} catch (IOException e) {
+			// e.printStackTrace();
+		}
+
+	}
+
+	/**
+	 * Checks if last trace
+	 * 
+	 * @throws IOException
+	 */
+	private void checkLastTrace() throws IOException {
+		long pos = getTracePositionInFile() + trace.messageLength;
+		if (pos >= sourceChannel.size()) {
+			trace.lastTrace = true;
+		} else {
+			trace.lastTrace = false;
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.DataReader#pause(boolean)
+	 */
+	@Override
+	public void pause(boolean pause) {
+		if (pause) {
+			paused = true;
+			pauseStopPoint = traceCount;
+		} else {
+			if (pauseFilePosition != 0) {
+				setFilePosition(pauseFilePosition);
+				pauseFilePosition = 0;
+			}
+			pauseStopPoint = NOT_DEFINED;
+			paused = false;
+
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.DataReader#setFilePosition(long)
+	 */
+	@Override
+	public void setFilePosition(long filePos) {
+		try {
+			receiveBuffer.position(0);
+			if (sourceChannel != null) {
+				if (filePos == 0) {
+					sourceChannel.position(fileStartOffset);
+				} else {
+					sourceChannel.position(filePos);
+				}
+			}
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+
+		// If set to start, null everything
+		if (filePos == 0) {
+			pauseFilePosition = 0;
+			traceCount = 0;
+			fileMap.clearMap();
+			bytesRead = 0;
+			previousMessageBytes = 0;
+		}
+	}
+
+	/**
+	 * Gets trace position in file
+	 * 
+	 * @return trace position in file
+	 */
+	public long getTracePositionInFile() {
+		long filePos = 0;
+		try {
+			filePos = sourceChannel.position() - bytesRead + trace.messageStart
+					- previousMessageBytes;
+		} catch (IOException e) {
+		}
+		return filePos;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.BaseDataReader#createScrollReader(com.nokia
+	 * .traceviewer.engine.MediaCallback,
+	 * com.nokia.traceviewer.engine.TraceConfiguration)
+	 */
+	@Override
+	public DataScrollReader createScrollReader(MediaCallback mediaCallback,
+			TraceConfiguration conf) {
+		return new OstScrollReader(mediaCallback, conf);
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.ost/src/com/nokia/traceviewer/ost/OstScrollReader.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,346 @@
+/*
+ * 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:
+ *
+ * OST ScrollReader class
+ *
+ */
+package com.nokia.traceviewer.ost;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
+import com.nokia.traceviewer.engine.DataScrollReader;
+import com.nokia.traceviewer.engine.MediaCallback;
+import com.nokia.traceviewer.engine.TraceConfiguration;
+import com.nokia.traceviewer.engine.TraceProperties;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * OST ScrollReader class
+ */
+public class OstScrollReader extends OstBaseReader implements DataScrollReader,
+		OstMessageCallback {
+
+	/**
+	 * Number of blocks to process when reader is block-reader
+	 */
+	private int numberOfBlocks = 1;
+
+	/**
+	 * Starting offset when reader is block-reader
+	 */
+	private int startReadingTracesFrom;
+
+	/**
+	 * Number of traces read when reader is block-reader
+	 */
+	private int numberOfTracesRead;
+
+	/**
+	 * Number of bytes received
+	 */
+	private int bytesRead;
+
+	/**
+	 * Number of bytes in previous message
+	 */
+	private int previousMessageBytes;
+
+	/**
+	 * Is this reader blocking
+	 */
+	private boolean blocking;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param mediaCallback
+	 *            callback
+	 * @param configuration
+	 *            Trace Configuration
+	 */
+	public OstScrollReader(MediaCallback mediaCallback,
+			TraceConfiguration configuration) {
+		// OstBaseReader constructor
+		super();
+
+		filePath = TraceViewerGlobals.getTraceViewer().getDataReaderAccess()
+				.getCurrentDataReader().getFilePath();
+		createFileChannel();
+
+		this.mediaCallback = mediaCallback;
+		receiveBuffer = ByteBuffer.allocateDirect(RECEIVE_BUFFER_SIZE);
+		messageProcessor = new OstMessageProcessor(this, receiveBuffer);
+		traceConfiguration = configuration;
+		trace = new TraceProperties(configuration);
+		trace.byteBuffer = receiveBuffer;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Thread#run()
+	 */
+	@Override
+	public synchronized void run() {
+		try {
+			running = true;
+			receiveBuffer.position(0);
+			while (running) {
+				// Get bytes in buffer before read operation
+				if (receiveBuffer.position() != 0) {
+					previousMessageBytes = receiveBuffer.position();
+				} else {
+					previousMessageBytes = 0;
+				}
+
+				// Reads data to buffer
+				bytesRead = sourceChannel.read(receiveBuffer);
+				if (bytesRead > 0) {
+
+					// If data is found, the processor is used to split
+					// thedata into OST messages. processMessage is
+					// called for each message found from the buffer and
+					// the buffer is re-positioned for next read
+					// operation
+					messageProcessor.processBuffer();
+				} else {
+					putToSleep();
+				}
+			}
+		} catch (Throwable t) {
+			t.printStackTrace();
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.ost.OstMessageCallback#processMessage(int,
+	 * int, int)
+	 */
+	public boolean processMessage(int msgStart, int msgLen, int headerLen,
+			int headerVersion) throws IOException {
+		boolean valid = true;
+		boolean returnValue = true;
+		int protocolId = 0;
+
+		// Create new TraceProperties
+		trace = new TraceProperties(traceConfiguration);
+
+		// Save buffer and message and data offsets
+		trace.byteBuffer = receiveBuffer;
+		trace.messageStart = msgStart;
+		trace.messageLength = msgLen;
+
+		// Get protocol ID offset
+		int protocolIdOffset = 0;
+		if (headerVersion == OST_V01) {
+			protocolIdOffset = OST_V01_PROTOCOLID_OFFSET;
+		} else if (headerVersion == OST_V05) {
+			protocolIdOffset = OST_V05_PROTOCOLID_OFFSET;
+		} else if (headerVersion == OST_V10) {
+			protocolIdOffset = OST_V10_PROTOCOLID_OFFSET;
+		} else if (headerVersion == OST_V00) {
+			protocolIdOffset = OST_V00_PROTOCOLID_OFFSET;
+		} else {
+			// Unsupported header version
+			System.out.println("Unsupported header version: " + headerVersion); //$NON-NLS-1$
+		}
+
+		// Read protocol ID
+		protocolId |= receiveBuffer.get(msgStart + protocolIdOffset)
+				& BYTE_MASK;
+
+		// OST Ascii Trace (0x02)
+		if (protocolId == OST_ASCII_TRACE_ID && msgLen >= headerLen) {
+
+			// Get the timestamp
+			trace.timestamp = messageProcessor.parseTimeStampToNanosecs(
+					msgStart, headerLen + OST_ASCII_TRACE_TIMESTAMP_OFFSET);
+
+			// Process the trace
+			processOstAsciiTrace(msgStart, msgLen, headerLen);
+
+			// OST Simple Application Trace Protocol (0x03)
+		} else if (protocolId == OST_SIMPLE_TRACE_ID) {
+
+			// Get the timestamp
+			trace.timestamp = messageProcessor.parseTimeStampToNanosecs(
+					msgStart, headerLen + OST_SIMPLE_TRACE_TIMESTAMP_OFFSET);
+
+			// Process the trace
+			valid = processOstSimpleTrace(msgStart, headerLen);
+
+			// Unknown protocol ID
+		} else {
+			trace.binaryTrace = true;
+			valid = false;
+		}
+
+		// Trace is valid
+		if (valid) {
+			returnValue = processScrolledTrace(msgStart, msgLen, returnValue);
+
+		}
+		return returnValue;
+	}
+
+	/**
+	 * Processes scrolled trace
+	 * 
+	 * @param msgStart
+	 *            message start offset
+	 * @param msgLen
+	 *            message length
+	 * @param returnValue
+	 *            implication of success of processing trace
+	 * @return implication of success of processing trace
+	 * @throws IOException
+	 */
+	public boolean processScrolledTrace(int msgStart, int msgLen,
+			boolean returnValue) throws IOException {
+
+		// In case of multi part trace, set trace properties now so
+		// that DataProcessor can use it properly
+		if (trace.bTraceInformation.getMultiPart() != 0) {
+			int initialHeaderSize = trace.dataStart - trace.messageStart;
+			trace.messageStart = 0;
+			trace.messageLength = trace.byteBuffer.capacity();
+			trace.dataStart = initialHeaderSize;
+			trace.dataLength = trace.messageLength - initialHeaderSize;
+		}
+
+		numberOfTracesRead++;
+		trace.traceNumber = startReadingTracesFrom + numberOfTracesRead;
+
+		// Not processed full block of traces yet, keep processing
+		if (!lastTrace(msgStart, msgLen)) {
+
+			trace.lastTrace = false;
+			mediaCallback.processTrace(trace);
+
+			// Last trace
+		} else {
+			trace.lastTrace = true;
+			blocking = true;
+			numberOfTracesRead = 0;
+			mediaCallback.processTrace(trace);
+
+			putToSleep();
+			returnValue = false;
+		}
+		return returnValue;
+	}
+
+	/**
+	 * Tells if this trace is the last one to process
+	 * 
+	 * @param msgStart
+	 *            message start offset
+	 * @param msgLen
+	 *            message length
+	 * @return true if this is the last trace
+	 * @throws IOException
+	 */
+	public boolean lastTrace(int msgStart, int msgLen) throws IOException {
+		return sourceChannelPosition(msgStart, msgLen) >= sourceChannel.size()
+				|| lastTraceToShow() || isBlockSizeRead();
+	}
+
+	/**
+	 * Checks if we are now read the whole block what we want
+	 * 
+	 * @return true if block is fully read
+	 */
+	private boolean isBlockSizeRead() {
+		boolean isBlockRead = false;
+		if (numberOfTracesRead == TraceViewerGlobals.blockSize * numberOfBlocks) {
+			isBlockRead = true;
+		}
+		return isBlockRead;
+	}
+
+	/**
+	 * Tells if this is the last trace we want to show during pause because
+	 * there propably is more traces in the file
+	 * 
+	 * @return true if this is the last trace to show during pause
+	 */
+	public boolean lastTraceToShow() {
+		boolean lastTraceToShow = (startReadingTracesFrom + numberOfTracesRead
+				+ 1 > TraceViewerGlobals.getTraceViewer().getDataReaderAccess()
+				.getCurrentDataReader().getTraceCount());
+
+		return lastTraceToShow;
+	}
+
+	/**
+	 * Gets position of source channel after this trace
+	 * 
+	 * @param msgStart
+	 *            message start offset
+	 * @param msgLen
+	 *            message length
+	 * @return source channel position after this trace
+	 * @throws IOException
+	 */
+	public long sourceChannelPosition(int msgStart, int msgLen)
+			throws IOException {
+		return sourceChannel.position() - bytesRead + msgStart + msgLen
+				- previousMessageBytes;
+	}
+
+	/**
+	 * Puts this thread to sleep
+	 */
+	public void putToSleep() {
+		try {
+			// Null variables if this reader is only for blocks
+			if (TraceViewerGlobals.getTraceViewer().getStateHolder()
+					.isScrolling()) {
+				receiveBuffer.position(receiveBuffer.capacity());
+				numberOfTracesRead = 0;
+			}
+			if (blocking) {
+				this.notifyAll();
+				this.wait();
+			}
+		} catch (InterruptedException e) {
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.DataScrollReader#setBlockReader(int,
+	 * int, boolean)
+	 */
+	public void setBlockReader(int numberOfBlocks, int startingTrace,
+			boolean blocking) {
+		this.numberOfBlocks = numberOfBlocks;
+		this.startReadingTracesFrom = startingTrace;
+		this.blocking = blocking;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.DataReader#getTracePositionInFile()
+	 */
+	public long getTracePositionInFile() {
+		return 0;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.ost/src/com/nokia/traceviewer/ost/OstWriter.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,87 @@
+/*
+ * 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:
+ *
+ * OST Writer
+ *
+ */
+package com.nokia.traceviewer.ost;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.channels.ByteChannel;
+
+import com.nokia.traceviewer.engine.DataWriter;
+
+/**
+ * OST Writer
+ * 
+ */
+public class OstWriter implements DataWriter {
+
+	/**
+	 * Target channel for write operations
+	 */
+	private ByteChannel writeChannel;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param writeChannel
+	 *            write channel
+	 */
+	public OstWriter(ByteChannel writeChannel) {
+		this.writeChannel = writeChannel;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.DataWriter#writeMessage(java.nio.ByteBuffer,
+	 * int, int)
+	 */
+	public void writeMessage(ByteBuffer sourceBuffer, int msgStart, int msgLen) {
+		try {
+			// Write the message to file
+			if (sourceBuffer != null && writeChannel != null) {
+				int position = sourceBuffer.position();
+				int limit = sourceBuffer.limit();
+				sourceBuffer.limit(msgStart + msgLen);
+				sourceBuffer.position(msgStart);
+				writeChannel.write(sourceBuffer);
+				sourceBuffer.limit(limit);
+				sourceBuffer.position(position);
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.DataWriter#close()
+	 */
+	public void closeChannel() {
+		try {
+			if (writeChannel != null) {
+				writeChannel.close();
+				writeChannel = null;
+			}
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer.ost/src/com/nokia/traceviewer/ost/messages.properties	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,3 @@
+OstConnectionHandler.CannotSendMsg=Cannot send activation message: 
+OstConnectionHandler.CannotSendMsgNotConnected=Cannot send activation message\! Connection is not established\!
+OstConnectionHandler.TraceActivationCategory=Trace Activation
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/.classpath	Wed Jun 23 14:49:59 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/traceviewer/com.nokia.traceviewer/.settings/org.eclipse.jdt.core.prefs	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,8 @@
+#Wed Sep 30 12:44:13 EEST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+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/traceviewer/com.nokia.traceviewer/META-INF/MANIFEST.MF	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,29 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Carbide.c++ Extensions - TraceViewer
+Bundle-SymbolicName: com.nokia.traceviewer;singleton:=true
+Bundle-Version: 2.6.0
+Bundle-Activator: com.nokia.traceviewer.TraceViewerPlugin
+Bundle-Vendor: Nokia
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.ui,
+ org.eclipse.ui.console,
+ org.eclipse.jface.text,
+ org.eclipse.ui.ide,
+ org.eclipse.core.resources,
+ com.nokia.trace.eventrouter,
+ com.nokia.carbide.remoteConnections,
+ com.nokia.carbide.trk.support,
+ com.nokia.carbide.cdt.builder,
+ com.nokia.carbide.cpp.sdk.core,
+ com.nokia.carbide.cpp.featureTracker
+Bundle-ActivationPolicy: lazy
+Export-Package: com.nokia.traceviewer,
+ com.nokia.traceviewer.api,
+ com.nokia.traceviewer.engine,
+ com.nokia.traceviewer.engine.activation,
+ com.nokia.traceviewer.engine.dataprocessor,
+ com.nokia.traceviewer.engine.preferences,
+ com.nokia.traceviewer.internal.api;x-friends:="com.nokia.traceviewer.tests"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/about.html	Wed Jun 23 14:49:59 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 &copy; 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/traceviewer/com.nokia.traceviewer/about.ini	Wed Jun 23 14:49:59 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/traceviewer/com.nokia.traceviewer/about.mappings	Wed Jun 23 14:49:59 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=0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/about.properties	Wed Jun 23 14:49:59 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 - TraceViewer \n\
+\n\
+Version: 2.6\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/traceviewer/com.nokia.traceviewer/build.properties	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,13 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .,\
+               plugin.xml,\
+               icons/,\
+               about.html,\
+               about.ini,\
+               about.mappings,\
+               about.properties,\
+               plugin.properties
+javacSource=1.5
+javacTarget=1.5
Binary file trace/traceviewer/com.nokia.traceviewer/icons/activationtrigger.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/advancedfilter.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/backarrow.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/clear.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/color.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/coloradd.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/coloredit.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/colorremove.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/connect.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/connectionsettings.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/count.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/disconnect.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/empty.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/endset.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/exclamation.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/filter.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/filteradd.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/filteredit.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/filteritem.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/filterremove.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/folder.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/folderadd.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/gotolocation.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/listcomponentitem.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/listitem.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/log.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/logclose.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/logicaland.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/logicalnot.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/logicalor.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/logopen.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/logsaveascii.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/logsavebinary.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/opendecodefile.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/pause.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/resume.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/sample.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/search.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/simplefilter.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/startexternal.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/startset.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/state.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/stopexternal.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/stoptrigger.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/traceactivation.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/traceproperty.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/tracevariable.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/traceviewer.gif has changed
Binary file trace/traceviewer/com.nokia.traceviewer/icons/trigger.gif has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/plugin.properties	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,59 @@
+#
+# 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:
+#
+#
+# plugin.properties
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# Plugin properties for TraceViewer
+# This file should be translated.
+view.Label=TraceViewer
+view.Tooltip=TraceViewer
+CategoryName=TraceViewer
+WizardName=TraceViewer configurations
+ExportDescription=Exports TraceViewer configurations like filter, color, line counting and variable tracing rules.
+ImportDescription=Imports TraceViewer configurations like filter, color, line counting and variable tracing rules.
+commandCategoryName=TraceViewer
+commandCategoryDescription=TraceViewer commands
+closeAsciiLogCommand=Close ASCII log
+closeAsciiLogDescription=Stops ASCII logging and closes the file
+closeBinaryLogCommand=Close binary log
+closeBinaryLogDescription=Stops binary logging and closes the file
+newAsciiLogCommand=New ASCII log
+newAsciiLogDescription=Starts logging to a new ASCII log file
+newBinaryLogCommand=New binary log
+newBinaryLogDescription=Starts logging to a new binary log file
+openLogCommand=Open a log file
+openLogDescription=Opens a TraceViewer log file
+saveAsciiLogCommand=Save current traces to a ASCII log
+saveAsciiLogDescription=Saves currently visible traces to a ASCII log file
+saveBinaryLogCommand=Save current traces to a binary log
+saveBinaryLogDescription=Saves currently visible traces to a binary log file
+traceActivationCommand=Open trace activation dialog
+traceActivationDescription=Opens a trace activation dialog
+appendDecodeFileCommand=Load new Dictionary file(s) to TraceViewer
+appendDecodeFileDescription=Loads new Dictionary file(s) to TraceViewer
+triggerCommand=Open trigger dialog
+triggerDescription=Opens trigger dialog
+productBlurb=Carbide.c++ Extensions - TraceViewer \n\
+\n\
+Version: 2.6\n\
+Build id: {0}\n\
+\n\
+\n\
+Copyright (c)2007-2010 Nokia Corporation. All rights reserved.\n\
+(http://www.forum.nokia.com)\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/traceviewer/com.nokia.traceviewer/plugin.xml	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,206 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+   <extension-point id="com.nokia.traceviewer.traceprovider" name="TraceViewer Trace Provider" schema="schema/com.nokia.traceviewer.traceprovider.exsd"/>
+   <extension-point id="com.nokia.traceviewer.decodeprovider" name="TraceViewer Decode Provider" schema="schema/com.nokia.traceviewer.decodeprovider.exsd"/>
+   <extension-point id="com.nokia.traceviewer.trimprovider" name="TraceViewer Trim Provider" schema="schema/com.nokia.traceviewer.trimprovider.exsd"/>
+
+  <extension
+    point="org.eclipse.core.runtime.products"
+    id="product">      
+      <product name="TraceViewer" application="org.eclipse.ui.ide.workbench"> 
+        <property name="appName" value="Carbide.c++ Extensions - TraceViewer"/> 
+      </product> 
+  </extension>
+
+  <extension point="org.eclipse.ui.views">
+    <category
+      id="com.nokia.s60tools"
+      name="Carbide Extensions"/>
+   
+    <view
+      category="com.nokia.s60tools"
+      class="com.nokia.traceviewer.view.TraceViewerView"
+      icon="icons/traceviewer.gif"
+      id="com.nokia.traceviewer.view.TraceViewerView"
+      name="TraceViewer"/>
+    <view
+      category="com.nokia.s60tools"
+      class="com.nokia.traceviewer.view.TracePropertyView"
+      icon="icons/traceproperty.gif"
+      id="com.nokia.traceviewer.view.TracePropertyView"
+      name="TraceViewerPropertyView"/>
+  </extension>
+     
+   <extension point="org.eclipse.core.runtime.preferences">
+        <initializer class="com.nokia.traceviewer.engine.preferences.PreferenceInitializer"/>
+   </extension>
+   
+   <extension point="org.eclipse.ui.preferencePages">
+     <page
+       class="com.nokia.traceviewer.engine.preferences.TraceViewerPreferencesPage"
+       category="com.nokia.carbide.cpp.preferences.ExtensionsPreferencesPage"
+       id="com.nokia.traceviewer.preferences.TraceViewerPreferences"
+       name="TraceViewer"/>
+     <page
+       category="com.nokia.traceviewer.preferences.TraceViewerPreferences"
+       class="com.nokia.traceviewer.engine.preferences.TraceViewerAdvancedPreferencesPage"
+       id="com.nokia.traceviewer.preferences.AdvancedPreferences"
+       name="Advanced"/>
+     <page
+       category="com.nokia.traceviewer.preferences.TraceViewerPreferences"
+       class="com.nokia.traceviewer.engine.preferences.TraceViewerConnectionPreferencesPage"
+       id="com.nokia.traceviewer.preferences.ConnectionPreferences"
+       name="Connection"/>
+     <page
+       category="com.nokia.traceviewer.preferences.TraceViewerPreferences"
+       class="com.nokia.traceviewer.engine.preferences.TraceViewerPluginsPreferencesPage"
+       id="com.nokia.traceviewer.preferences.PluginsPreferences"
+       name="Plugins"/>       
+  </extension>
+  
+  <extension point="org.eclipse.ui.exportWizards">
+    <category
+      id="com.nokia.traceviewer.category"
+      name="%CategoryName">
+    </category>
+    <wizard
+      category="com.nokia.traceviewer.category"
+      class="com.nokia.traceviewer.engine.preferences.wizard.ExportWizard"
+      icon="icons/traceviewer.gif"
+      id="com.nokia.traceviewer.exportWizard"
+      name="%WizardName">
+      <description>
+        %ExportDescription  
+      </description>      
+    </wizard>
+  </extension>
+  <extension point="org.eclipse.ui.importWizards">
+    <category
+      id="com.nokia.traceviewer.category"
+      name="%CategoryName">
+    </category>
+    <wizard
+      category="com.nokia.traceviewer.category"
+      class="com.nokia.traceviewer.engine.preferences.wizard.ImportWizard"
+      icon="icons/traceviewer.gif"
+      id="com.nokia.traceviewer.importWizard"
+      name="%WizardName">
+      <description>
+        %ImportDescription  
+      </description>
+    </wizard>
+  </extension>
+
+  <extension point="org.eclipse.ui.actionSets">
+    <actionSet
+      description="TraceViewer&apos;s Actions"
+      id="com.nokia.traceviewer.ui.actionSet"
+      label="TraceViewer"
+      visible="true">
+      <action                
+        class="com.nokia.traceviewer.action.ToolbarShortcutAction"
+        icon="icons/traceviewer.gif"
+        id="com.nokia.traceviewer.action.ToolbarShortcutAction"
+        label="&amp;TraceViewer"               
+        menubarPath="com.nokia.carbide.cpp.ui.CarbideMenu/CarbideExtensions"
+        tooltip="TraceViewer">
+      </action>
+      <menu
+        id="com.nokia.carbide.cpp.ui.CarbideMenu"
+        label=" &amp;Carbide"
+        path="additions">
+        <groupMarker name="additions"/>
+      </menu>
+    </actionSet>
+  </extension>
+
+  <extension point="org.eclipse.ui.commands">
+    <category
+      description="%commandCategoryDescription"
+      id="com.nokia.traceviewer.category.commands"
+      name="%commandCategoryName"/>
+      
+    <command
+      categoryId="com.nokia.traceviewer.category.commands"
+      defaultHandler="com.nokia.traceviewer.action.LogCloseAsciiGlobalAction"
+      description="%closeAsciiLogDescription"
+      helpContextId="com.nokia.traceviewer.help.TRACEVIEWER_HELP_LOGGING"
+      id="com.nokia.traceviewer.command.close_ascii_log"
+      name="%closeAsciiLogCommand"/>
+      
+    <command
+      categoryId="com.nokia.traceviewer.category.commands"
+      defaultHandler="com.nokia.traceviewer.action.LogCloseBinaryGlobalAction"
+      description="%closeBinaryLogDescription"
+      helpContextId="com.nokia.traceviewer.help.TRACEVIEWER_HELP_LOGGING"
+      id="com.nokia.traceviewer.command.close_binary_log"
+      name="%closeBinaryLogCommand"/>      
+      
+    <command
+      categoryId="com.nokia.traceviewer.category.commands"
+      defaultHandler="com.nokia.traceviewer.action.LogNewAsciiGlobalAction"
+      description="%newAsciiLogDescription"
+      helpContextId="com.nokia.traceviewer.help.TRACEVIEWER_HELP_LOGGING"
+      id="com.nokia.traceviewer.command.new_ascii_log"
+      name="%newAsciiLogCommand"/>         
+      
+    <command
+      categoryId="com.nokia.traceviewer.category.commands"
+      defaultHandler="com.nokia.traceviewer.action.LogNewBinaryGlobalAction"
+      description="%newBinaryLogDescription"
+      helpContextId="com.nokia.traceviewer.help.TRACEVIEWER_HELP_LOGGING"
+      id="com.nokia.traceviewer.command.new_binary_log"
+      name="%newBinaryLogCommand"/>     
+      
+    <command
+      categoryId="com.nokia.traceviewer.category.commands"
+      defaultHandler="com.nokia.traceviewer.action.LogOpenLogGlobalAction"
+      description="%openLogDescription"
+      helpContextId="com.nokia.traceviewer.help.TRACEVIEWER_HELP_LOGGING"
+      id="com.nokia.traceviewer.command.open_log"
+      name="%openLogCommand"/>             
+      
+    <command
+      categoryId="com.nokia.traceviewer.category.commands"
+      defaultHandler="com.nokia.traceviewer.action.LogSaveAsciiGlobalAction"
+      description="%saveAsciiLogDescription"
+      helpContextId="com.nokia.traceviewer.help.TRACEVIEWER_HELP_LOGGING"
+      id="com.nokia.traceviewer.command.save_ascii_log"
+      name="%saveAsciiLogCommand"/>        
+      
+    <command
+      categoryId="com.nokia.traceviewer.category.commands"
+      defaultHandler="com.nokia.traceviewer.action.LogSaveBinaryGlobalAction"
+      description="%saveBinaryLogDescription"
+      helpContextId="com.nokia.traceviewer.help.TRACEVIEWER_HELP_LOGGING"
+      id="com.nokia.traceviewer.command.save_binary_log"
+      name="%saveBinaryLogCommand"/>         
+      
+    <command
+      categoryId="com.nokia.traceviewer.category.commands"
+      defaultHandler="com.nokia.traceviewer.action.TraceActivationGlobalAction"
+      description="%traceActivationDescription"
+      helpContextId="com.nokia.traceviewer.help.TRACEVIEWER_HELP_ACTIVATION_DIALOG"
+      id="com.nokia.traceviewer.command.trace_activation"
+      name="%traceActivationCommand"/>           
+      
+    <command
+      categoryId="com.nokia.traceviewer.category.commands"
+      defaultHandler="com.nokia.traceviewer.action.AppendDecodeFileGlobalAction"
+      description="%appendDecodeFileDescription"
+      helpContextId="com.nokia.traceviewer.help.TRACEVIEWER_HELP_ACTIVATION_DIALOG"
+      id="com.nokia.traceviewer.command.append_decode_file"
+      name="%appendDecodeFileCommand"/>              
+      
+    <command
+      categoryId="com.nokia.traceviewer.category.commands"
+      defaultHandler="com.nokia.traceviewer.action.TriggerGlobalAction"
+      description="%triggerDescription"
+      helpContextId="com.nokia.traceviewer.help.TRACEVIEWER_HELP_TRIGGERING"
+      id="com.nokia.traceviewer.command.trigger"
+      name="%triggerCommand"/>
+            
+  </extension>
+
+</plugin>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/schema/com.nokia.traceviewer.decodeprovider.exsd	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,102 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="com.nokia.traceviewer" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+      <appinfo>
+         <meta.schema plugin="com.nokia.traceviewer" id="com.nokia.traceviewer.decodeprovider" name="TraceViewer Decode Provider"/>
+      </appinfo>
+      <documentation>
+         Decode Provider for TraceViewer.
+      </documentation>
+   </annotation>
+
+   <element name="extension">
+      <annotation>
+         <appinfo>
+            <meta.element />
+         </appinfo>
+      </annotation>
+      <complexType>
+         <choice>
+            <element ref="client"/>
+         </choice>
+         <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="client">
+      <complexType>
+         <attribute name="class" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+               <appinfo>
+                  <meta.attribute kind="java" basedOn=":com.nokia.traceviewer.engine.DecodeProvider"/>
+               </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/traceviewer/com.nokia.traceviewer/schema/com.nokia.traceviewer.traceprovider.exsd	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,102 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="com.nokia.traceviewer" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+      <appinfo>
+         <meta.schema plugin="com.nokia.traceviewer" id="com.nokia.traceviewer.traceprovider" name="TraceViewer Trace Provider"/>
+      </appinfo>
+      <documentation>
+         Trace Provider for TraceViewer.
+      </documentation>
+   </annotation>
+
+   <element name="extension">
+      <annotation>
+         <appinfo>
+            <meta.element />
+         </appinfo>
+      </annotation>
+      <complexType>
+         <choice minOccurs="1" maxOccurs="unbounded">
+            <element ref="client" minOccurs="1" maxOccurs="unbounded"/>
+         </choice>
+         <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="client">
+      <complexType>
+         <attribute name="class" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+               <appinfo>
+                  <meta.attribute kind="java" basedOn=":com.nokia.traceviewer.engine.TraceProvider"/>
+               </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/traceviewer/com.nokia.traceviewer/schema/com.nokia.traceviewer.trimprovider.exsd	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,102 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="com.nokia.traceviewer" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+      <appinfo>
+         <meta.schema plugin="com.nokia.traceviewer" id="com.nokia.traceviewer.trimprovider" name="TraceViewer Trim Provider"/>
+      </appinfo>
+      <documentation>
+         Trim Provider for TraceViewer.
+      </documentation>
+   </annotation>
+
+   <element name="extension">
+      <annotation>
+         <appinfo>
+            <meta.element />
+         </appinfo>
+      </annotation>
+      <complexType>
+         <choice>
+            <element ref="client"/>
+         </choice>
+         <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="client">
+      <complexType>
+         <attribute name="class" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+               <appinfo>
+                  <meta.attribute kind="java" basedOn=":com.nokia.traceviewer.engine.TrimProvider"/>
+               </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/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/Messages.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,65 @@
+/*
+ * 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:
+ *
+ * String localization for traceviewer package.
+ *
+ */
+package com.nokia.traceviewer;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * String localization for traceviewer package.
+ * 
+ */
+final class Messages {
+
+	/**
+	 * Bundle name
+	 */
+	private static final String BUNDLE_NAME = "com.nokia.traceviewer.messages"; //$NON-NLS-1$
+
+	/**
+	 * Resource bundle
+	 */
+	private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
+			.getBundle(BUNDLE_NAME);
+
+	/**
+	 * Prevents construction.
+	 */
+	private Messages() {
+		// Empty constructor
+	}
+
+	/**
+	 * Maps a key to localized string.
+	 * 
+	 * @param key
+	 *            the key for the string
+	 * @return the localized string
+	 */
+	public static String getString(String key) {
+		String value;
+		// Maps a key to localized string
+		try {
+			value = RESOURCE_BUNDLE.getString(key);
+		} catch (MissingResourceException e) {
+			value = '!' + key + '!';
+		}
+		return value;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/TraceViewerHelpContextIDs.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,116 @@
+/*
+ * 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:
+ *
+ * IDs for context sensitive help
+ *
+ */
+package com.nokia.traceviewer;
+
+/**
+ * IDs for context sensitive help
+ * 
+ */
+public class TraceViewerHelpContextIDs {
+
+	/**
+	 * The plug-in ID. Copied here to avoid runtime dependency to help project
+	 */
+	public static final String PROJECT_PLUGIN_ID = "com.nokia.traceviewer.help"; //$NON-NLS-1$
+
+	/**
+	 * Main view help context ID
+	 */
+	public static final String MAIN_VIEW = PROJECT_PLUGIN_ID
+			+ ".TRACEVIEWER_HELP_MAIN_VIEW"; //$NON-NLS-1$
+
+	/**
+	 * Property view help context ID
+	 */
+	public static final String PROPERTY_VIEW = PROJECT_PLUGIN_ID
+			+ ".TRACEVIEWER_HELP_PROPERTY_VIEW"; //$NON-NLS-1$
+
+	/**
+	 * Actions help context ID
+	 */
+	public static final String ACTIONS = PROJECT_PLUGIN_ID
+			+ ".TRACEVIEWER_HELP_ACTIONS"; //$NON-NLS-1$
+
+	/**
+	 * General Preferences help context ID
+	 */
+	public static final String GENERAL_PREFERENCES = PROJECT_PLUGIN_ID
+			+ ".TRACEVIEWER_HELP_GENERAL_PREFERENCES"; //$NON-NLS-1$
+
+	/**
+	 * Advanced Preferences help context ID
+	 */
+	public static final String ADVANCED_PREFERENCES = PROJECT_PLUGIN_ID
+			+ ".TRACEVIEWER_HELP_ADVANCED_PREFERENCES"; //$NON-NLS-1$
+
+	/**
+	 * Connection Preferences help context ID
+	 */
+	public static final String CONNECTION_PREFERENCES = PROJECT_PLUGIN_ID
+			+ ".TRACEVIEWER_HELP_CONNECTION_PREFERENCES"; //$NON-NLS-1$
+
+	/**
+	 * Plugins Preferences help context ID
+	 */
+	public static final String PLUGINS_PREFERENCES = PROJECT_PLUGIN_ID
+			+ ".TRACEVIEWER_HELP_PLUGINS_PREFERENCES"; //$NON-NLS-1$
+
+	/**
+	 * Trace information dialog help context ID
+	 */
+	public static final String TRACE_INFO_DIALOG = PROJECT_PLUGIN_ID
+			+ ".TRACEVIEWER_HELP_TRACE_INFO_DIALOG"; //$NON-NLS-1$
+
+	/**
+	 * Logging help context ID
+	 */
+	public static final String LOGGING = PROJECT_PLUGIN_ID
+			+ ".TRACEVIEWER_HELP_LOGGING"; //$NON-NLS-1$
+
+	/**
+	 * Variable tracing history help context ID
+	 */
+	public static final String VARIABLE_TRACING_HISTORY = PROJECT_PLUGIN_ID
+			+ ".TRACEVIEWER_HELP_VARIABLE_TRACING_HISTORY"; //$NON-NLS-1$
+
+	/**
+	 * Triggering help context ID
+	 */
+	public static final String TRIGGERING = PROJECT_PLUGIN_ID
+			+ ".TRACEVIEWER_HELP_TRIGGERING"; //$NON-NLS-1$
+
+	/**
+	 * Searching help context ID
+	 */
+	public static final String SEARCHING = PROJECT_PLUGIN_ID
+			+ ".TRACEVIEWER_HELP_SEARCHING"; //$NON-NLS-1$
+
+	/**
+	 * Activation configuration context ID
+	 */
+	public static final String ACTIVATION_CONFIGURATIONS = PROJECT_PLUGIN_ID
+			+ ".TRACEVIEWER_HELP_ACTIVATION_CONFIGURATIONS"; //$NON-NLS-1$
+
+	/**
+	 * Activation dialog context ID
+	 */
+	public static final String ACTIVATION_DIALOG = PROJECT_PLUGIN_ID
+			+ ".TRACEVIEWER_HELP_ACTIVATION_DIALOG"; //$NON-NLS-1$
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/TraceViewerPlugin.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,178 @@
+/*
+ * 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:
+ *
+ * TraceViewer Plugin
+ *
+ */
+package com.nokia.traceviewer;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+import com.nokia.traceviewer.engine.DecodeProvider;
+import com.nokia.traceviewer.engine.TraceProvider;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.TrimProvider;
+import com.nokia.traceviewer.engine.preferences.PreferenceConstants;
+
+/**
+ * The activator class controls the plug-in life cycle
+ * 
+ */
+public class TraceViewerPlugin extends AbstractUIPlugin {
+
+	/**
+	 * The plug-in ID
+	 */
+	public static final String PLUGIN_ID = "com.nokia.traceviewer"; //$NON-NLS-1$
+
+	/**
+	 * Trim Provider extension point ID
+	 */
+	private static final String TRIMPROVIDER_EXTENSION_POINT_ID = "com.nokia.traceviewer.trimprovider"; //$NON-NLS-1$
+
+	/**
+	 * Decode Provider extension point ID
+	 */
+	private static final String DECODEPROVIDER_EXTENSION_POINT_ID = "com.nokia.traceviewer.decodeprovider"; //$NON-NLS-1$
+
+	/**
+	 * Trace Provider extension point ID
+	 */
+	private static final String TRACEPROVIDER_EXTENSION_POINT_ID = "com.nokia.traceviewer.traceprovider"; //$NON-NLS-1$
+
+	/**
+	 * The shared instance
+	 */
+	private static TraceViewerPlugin plugin;
+
+	/**
+	 * The constructor
+	 */
+	public TraceViewerPlugin() {
+		// Set this as a plugin
+		plugin = this;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
+	 * )
+	 */
+	@Override
+	public void start(BundleContext context) throws Exception {
+		super.start(context);
+
+		TraceViewerGlobals.start();
+
+		// Insert providers
+		insertProviders();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
+	 * )
+	 */
+	@Override
+	public void stop(BundleContext context) throws Exception {
+		// Run shutdown
+		TraceViewerGlobals.getTraceViewer().shutdown();
+
+		plugin = null;
+		super.stop(context);
+	}
+
+	/**
+	 * Returns the shared instance
+	 * 
+	 * @return the shared instance
+	 */
+	public static TraceViewerPlugin getDefault() {
+		// Returns this plugin
+		return plugin;
+	}
+
+	/**
+	 * Inserts trace and decode providers to the main engine
+	 */
+	private void insertProviders() {
+		try {
+			// Trim provider
+			IConfigurationElement[] config = Platform.getExtensionRegistry()
+					.getConfigurationElementsFor(
+							TRIMPROVIDER_EXTENSION_POINT_ID);
+			for (IConfigurationElement e : config) {
+				Object o = e.createExecutableExtension("class"); //$NON-NLS-1$
+				if (o instanceof TrimProvider) {
+					TraceViewerGlobals.setTrimProvider((TrimProvider) o);
+				}
+			}
+
+			// Decode provider
+			config = Platform.getExtensionRegistry()
+					.getConfigurationElementsFor(
+							DECODEPROVIDER_EXTENSION_POINT_ID);
+			for (IConfigurationElement e : config) {
+				Object o = e.createExecutableExtension("class"); //$NON-NLS-1$
+				if (o instanceof DecodeProvider) {
+					TraceViewerGlobals.setDecodeProvider((DecodeProvider) o);
+				}
+			}
+
+			// Trace providers
+			config = Platform.getExtensionRegistry()
+					.getConfigurationElementsFor(
+							TRACEPROVIDER_EXTENSION_POINT_ID);
+
+			// Put providers to ArrayList
+			ArrayList<TraceProvider> providers = new ArrayList<TraceProvider>();
+			for (int i = 0; i < config.length; i++) {
+				Object o = config[i].createExecutableExtension("class"); //$NON-NLS-1$
+				if (o instanceof TraceProvider) {
+					providers.add((TraceProvider) o);
+				}
+			}
+
+			// First check if selected is found and select that
+			String selectedDataFormat = plugin.getPreferenceStore().getString(
+					PreferenceConstants.DATA_FORMAT);
+			for (int j = 0; j < providers.size(); j++) {
+				TraceProvider provider = providers.get(j);
+				if (provider.getName().equals(selectedDataFormat)) {
+					TraceViewerGlobals.setTraceProvider(provider, true);
+					providers.remove(j);
+					break;
+				}
+			}
+
+			// Then set rest of the providers
+			for (int j = 0; j < providers.size(); j++) {
+				TraceViewerGlobals.setTraceProvider(providers.get(j), true);
+			}
+		} catch (Exception ex) {
+			System.out.println(ex.getMessage());
+		}
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/ActionFactory.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,582 @@
+/*
+ * 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:
+ *
+ * ActionFactory class
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import java.net.URL;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.IWorkbenchActionConstants;
+
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.dataprocessor.Logger;
+
+/**
+ * ActionFactory
+ * 
+ */
+public final class ActionFactory {
+
+	/**
+	 * Clear view action
+	 */
+	private Action clearViewAction;
+
+	/**
+	 * Color action
+	 */
+	private Action colorAction;
+
+	/**
+	 * Connect action
+	 */
+	private Action connectAction;
+
+	/**
+	 * Count lines action
+	 */
+	private Action countLinesAction;
+
+	/**
+	 * Filter action
+	 */
+	private Action filterAction;
+
+	/**
+	 * Close ASCII log action
+	 */
+	private Action logCloseAsciiAction;
+
+	/**
+	 * Close Binary log action
+	 */
+	private Action logCloseBinaryAction;
+
+	/**
+	 * New ASCII log action
+	 */
+	private Action logNewAsciiAction;
+
+	/**
+	 * New Binary log action
+	 */
+	private Action logNewBinaryAction;
+
+	/**
+	 * Open log action
+	 */
+	private Action logOpenLogAction;
+
+	/**
+	 * Save Binary log action
+	 */
+	private Action logSaveBinaryAction;
+
+	/**
+	 * Save Ascii log action
+	 */
+	private Action logSaveAsciiAction;
+
+	/**
+	 * Open Decode file action
+	 */
+	private Action openDecodeFileAction;
+
+	/**
+	 * Append decode file action
+	 */
+	private Action appendDecodeFileAction;
+
+	/**
+	 * Reload decode files actions
+	 */
+	private Action reloadDecodeFilesAction;
+
+	/**
+	 * Pause action
+	 */
+	private Action pauseAction;
+
+	/**
+	 * Search action
+	 */
+	private Action searchAction;
+
+	/**
+	 * Trace Activation action
+	 */
+	private Action traceActivationAction;
+
+	/**
+	 * Trace Variables action
+	 */
+	private Action traceVariablesAction;
+
+	/**
+	 * Trigger action
+	 */
+	private Action triggerAction;
+
+	/**
+	 * Show trace info action
+	 */
+	private Action showTraceInfoAction;
+
+	/**
+	 * Open trace location action
+	 */
+	private Action openTraceLocationAction;
+
+	/**
+	 * Copy selection action
+	 */
+	private Action copySelectionAction;
+
+	/**
+	 * Open variable tracing history dialog
+	 */
+	private Action openVariableTracingHistoryAction;
+
+	/**
+	 * Start external filter program action
+	 */
+	private Action startExternalFilterAction;
+
+	/**
+	 * Select all action
+	 */
+	private Action selectAllAction;
+
+	/**
+	 * Open Connection Settings action
+	 */
+	private Action openConnectionSettingsAction;
+
+	/**
+	 * Close and restart logging action
+	 */
+	private Action closeAndRestartLoggingAction;
+
+	/**
+	 * Toolbar manager
+	 */
+	private IToolBarManager manager;
+
+	/**
+	 * List of normal items in toolbar
+	 */
+	private IContributionItem[] normalToolbarItems;
+
+	/**
+	 * Image for the log submenu
+	 */
+	private static ImageDescriptor logSubMenuImage;
+
+	static {
+		URL url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				"/icons/log.gif"); //$NON-NLS-1$
+		logSubMenuImage = ImageDescriptor.createFromURL(url);
+	}
+
+	/**
+	 * Constructor
+	 * 
+	 */
+	public ActionFactory() {
+		createActions();
+	}
+
+	/**
+	 * Creates all the action items
+	 */
+	private void createActions() {
+
+		// Toolbar actions
+		reloadDecodeFilesAction = new ReloadDecodeFilesAction();
+		connectAction = new ConnectAction();
+		pauseAction = new PauseAction();
+		filterAction = new FilterAction();
+		startExternalFilterAction = new StartExternalFilterAction();
+		searchAction = new SearchAction();
+		colorAction = new ColorAction();
+		countLinesAction = new CountLinesAction();
+		traceVariablesAction = new TraceVariablesAction();
+		clearViewAction = new ClearViewAction();
+
+		// Menubar actions
+		traceActivationAction = new TraceActivationAction();
+		triggerAction = new TriggerAction();
+		openConnectionSettingsAction = new OpenConnectionSettingsAction();
+
+		// Log actions are in own submenu
+		logCloseAsciiAction = new LogCloseAsciiAction();
+		logCloseBinaryAction = new LogCloseBinaryAction();
+		logNewAsciiAction = new LogNewAsciiAction();
+		logNewBinaryAction = new LogNewBinaryAction();
+		logOpenLogAction = new LogOpenLogAction();
+		logSaveBinaryAction = new LogSaveBinaryAction();
+		logSaveAsciiAction = new LogSaveAsciiAction();
+
+		// Other, non-visible, actions
+		openDecodeFileAction = new OpenDecodeFileAction();
+		showTraceInfoAction = new ShowTraceInfoAction();
+		openTraceLocationAction = new OpenTraceLocationAction();
+		appendDecodeFileAction = new AppendDecodeFileAction();
+		openVariableTracingHistoryAction = new OpenVariableTracingHistoryAction();
+		closeAndRestartLoggingAction = new CloseAndRestartLoggingAction();
+
+		// System action overrides
+		copySelectionAction = new CopySelectionAction();
+		selectAllAction = new SelectAllAction();
+	}
+
+	/**
+	 * Fills the view menu with the actions
+	 * 
+	 * @param manager
+	 *            the menu manager
+	 */
+	public void fillMenu(IMenuManager manager) {
+		manager.add(traceActivationAction);
+		manager.add(new Separator());
+		IMenuManager subMgr = new MenuManager(
+				Messages.getString("ActionFactory.LogSubMenuTitle"), logSubMenuImage, null); //$NON-NLS-1$
+		subMgr.setRemoveAllWhenShown(true);
+		subMgr.setVisible(true);
+		subMgr.addMenuListener(new IMenuListener() {
+			public void menuAboutToShow(IMenuManager mgr) {
+				mgr.add(logOpenLogAction);
+				mgr.add(new Separator());
+				mgr.add(logNewBinaryAction);
+				mgr.add(logSaveBinaryAction);
+				mgr.add(logCloseBinaryAction);
+
+				mgr.add(new Separator());
+				mgr.add(logNewAsciiAction);
+				mgr.add(logSaveAsciiAction);
+				mgr.add(logCloseAsciiAction);
+
+				// Get the logger DataProcessor
+				Logger logger = TraceViewerGlobals.getTraceViewer()
+						.getDataProcessorAccess().getLogger();
+
+				boolean asciiLogging = logger.isPlainLogging();
+				boolean binaryLogging = logger.isBinLogging();
+				boolean logFileOpened = logger.isLogFileOpened();
+
+				// Check if Binary logging is on
+				logNewBinaryAction.setEnabled(!binaryLogging);
+				logCloseBinaryAction.setEnabled(binaryLogging);
+
+				// Check if ASCII logging is on
+				logNewAsciiAction.setEnabled(!asciiLogging);
+				logCloseAsciiAction.setEnabled(asciiLogging);
+
+				logOpenLogAction.setEnabled(!asciiLogging && !binaryLogging);
+
+				// Check if log file is opened
+				if (logFileOpened) {
+					logNewBinaryAction.setEnabled(false);
+					logCloseBinaryAction.setEnabled(false);
+					logNewAsciiAction.setEnabled(false);
+					logCloseAsciiAction.setEnabled(false);
+				}
+
+			}
+		});
+
+		manager.add(subMgr);
+		manager.add(new Separator());
+		manager.add(triggerAction);
+		manager.add(new Separator());
+		manager.add(openConnectionSettingsAction);
+		manager.add(new Separator());
+		manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+	}
+
+	/**
+	 * Fills the toolbar
+	 * 
+	 * @param manager
+	 *            the toolbar manager
+	 */
+	public void fillToolBar(IToolBarManager manager) {
+		this.manager = manager;
+		manager.add(reloadDecodeFilesAction);
+		manager.add(connectAction);
+		manager.add(new Separator());
+		manager.add(pauseAction);
+		manager.add(filterAction);
+		manager.add(startExternalFilterAction);
+		manager.add(searchAction);
+		manager.add(colorAction);
+		manager.add(new Separator());
+		manager.add(countLinesAction);
+		manager.add(traceVariablesAction);
+		manager.add(new Separator());
+		manager.add(clearViewAction);
+		manager.add(new Separator());
+		manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+	}
+
+	/**
+	 * Adds close and restart logging button
+	 * 
+	 * @param filePath
+	 *            file path of the log file
+	 */
+	public void addCloseAndRestartLoggingButton(String filePath) {
+		((CloseAndRestartLoggingAction) closeAndRestartLoggingAction)
+				.changeToStopLoggingAction();
+
+		if (normalToolbarItems == null) {
+			normalToolbarItems = manager.getItems();
+			manager.removeAll();
+
+			// First add reload Dictionary files action
+			manager.add(reloadDecodeFilesAction);
+
+			((CloseAndRestartLoggingAction) closeAndRestartLoggingAction)
+					.setFilePath(filePath);
+			manager.add(closeAndRestartLoggingAction);
+
+			// Add old items back. Start from index 1 because in index 0 there
+			// is reload Dictionary file action which is already added to the
+			// manager
+			for (int i = 1; i < normalToolbarItems.length; i++) {
+				manager.add(normalToolbarItems[i]);
+			}
+
+			manager.update(true);
+		}
+	}
+
+	/**
+	 * Removes close and restart logging button
+	 */
+	public void removeCloseAndRestartLoggingButton() {
+		if (normalToolbarItems != null) {
+			manager.removeAll();
+
+			// Add old items back
+			for (int i = 0; i < normalToolbarItems.length; i++) {
+				manager.add(normalToolbarItems[i]);
+			}
+			normalToolbarItems = null;
+
+			manager.update(true);
+		}
+	}
+
+	/**
+	 * Gets connect action
+	 * 
+	 * @return connect action
+	 */
+	public Action getConnectAction() {
+		return connectAction;
+	}
+
+	/**
+	 * Gets pause action
+	 * 
+	 * @return pause action
+	 */
+	public Action getPauseAction() {
+		return pauseAction;
+	}
+
+	/**
+	 * Gets search action
+	 * 
+	 * @return search action
+	 */
+	public Action getSearchAction() {
+		return searchAction;
+	}
+
+	/**
+	 * Gets show trace info action
+	 * 
+	 * @return show trace info action
+	 */
+	public Action getShowTraceInfoAction() {
+		return showTraceInfoAction;
+	}
+
+	/**
+	 * Gets open trace location action
+	 * 
+	 * @return open trace location action
+	 */
+	public Action getOpenTraceLocationAction() {
+		return openTraceLocationAction;
+	}
+
+	/**
+	 * Gets trace activation action
+	 * 
+	 * @return trace activation action
+	 */
+	public Action getTraceActivationAction() {
+		return traceActivationAction;
+	}
+
+	/**
+	 * Gets coloring action
+	 * 
+	 * @return coloring action
+	 */
+	public Action getColorAction() {
+		return colorAction;
+	}
+
+	/**
+	 * Gets open decode file action
+	 * 
+	 * @return open decode file action
+	 */
+	public Action getOpenDecodeFileAction() {
+		return openDecodeFileAction;
+	}
+
+	/**
+	 * Gets append decode file action
+	 * 
+	 * @return append decode file action
+	 */
+	public Action getAppendDecodeFileAction() {
+		return appendDecodeFileAction;
+	}
+
+	/**
+	 * Gets copy selection action
+	 * 
+	 * @return copy selection action
+	 */
+	public Action getCopySelectionAction() {
+		return copySelectionAction;
+	}
+
+	/**
+	 * Gets select all action
+	 * 
+	 * @return select all action
+	 */
+	public Action getSelectAllAction() {
+		return selectAllAction;
+	}
+
+	/**
+	 * Gets open variableTracing details action
+	 * 
+	 * @return the open variable tracing details action
+	 */
+	public Action getOpenVariableTracingHistoryAction() {
+		return openVariableTracingHistoryAction;
+	}
+
+	/**
+	 * Gets reload decode files action
+	 * 
+	 * @return the reload decode files action
+	 */
+	public Action getReloadDecodeFilesAction() {
+		return reloadDecodeFilesAction;
+	}
+
+	/**
+	 * Gets open log action
+	 * 
+	 * @return open log action
+	 */
+	public Action getLogOpenLogAction() {
+		return logOpenLogAction;
+	}
+
+	/**
+	 * Gets close ascii log action
+	 * 
+	 * @return close ascii log action
+	 */
+	public Action getLogCloseAsciiAction() {
+		return logCloseAsciiAction;
+	}
+
+	/**
+	 * Gets close binary log action
+	 * 
+	 * @return close binary log action
+	 */
+	public Action getLogCloseBinaryAction() {
+		return logCloseBinaryAction;
+	}
+
+	/**
+	 * Gets new ascii log action
+	 * 
+	 * @return new ascii log action
+	 */
+	public Action getLogNewAsciiAction() {
+		return logNewAsciiAction;
+	}
+
+	/**
+	 * Gets new binary log action
+	 * 
+	 * @return new binary log action
+	 */
+	public Action getLogNewBinaryAction() {
+		return logNewBinaryAction;
+	}
+
+	/**
+	 * Gets save binary log action
+	 * 
+	 * @return save binary log action
+	 */
+	public Action getLogSaveBinaryAction() {
+		return logSaveBinaryAction;
+	}
+
+	/**
+	 * Gets save ascii log action
+	 * 
+	 * @return save ascii log action
+	 */
+	public Action getLogSaveAsciiAction() {
+		return logSaveAsciiAction;
+	}
+
+	/**
+	 * Gets trigger action
+	 * 
+	 * @return trigger action
+	 */
+	public Action getTriggerAction() {
+		return triggerAction;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/AddCommentToTraceAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,103 @@
+/*
+ * 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:
+ *
+ * Handler for add comment to trace command
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import java.net.URL;
+
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.view.listener.SelectionProperties;
+
+/**
+ * Handler for add comment to trace command
+ */
+public final class AddCommentToTraceAction extends TraceViewerAction {
+
+	/**
+	 * Image for this Action
+	 */
+	private static ImageDescriptor image;
+
+	/**
+	 * Trace number
+	 */
+	private final int traceNumber;
+
+	static {
+		URL url = null;
+		url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				"/icons/count.gif"); //$NON-NLS-1$
+		image = ImageDescriptor.createFromURL(url);
+	}
+
+	/**
+	 * Constructor
+	 * 
+	 * @param traceNumber
+	 *            trace number
+	 */
+	public AddCommentToTraceAction(int traceNumber) {
+		this.traceNumber = traceNumber;
+		setText(Messages
+				.getString("AddCommentToTraceAction.AddCommentToTraceText")); //$NON-NLS-1$
+		setToolTipText(Messages
+				.getString("AddCommentToTraceAction.AddCommentToTraceToolTip")); //$NON-NLS-1$
+		setImageDescriptor(image);
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
+				TraceViewerHelpContextIDs.ACTIONS);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		// Show dialog
+		InputDialog dialog = new InputDialog(
+				Display.getCurrent().getActiveShell(),
+				Messages
+						.getString("AddCommentToTraceAction.AddCommentShellTitle"), //$NON-NLS-1$
+				Messages.getString("AddCommentToTraceAction.AddCommentTipText"), null, new TraceCommentValidator()); //$NON-NLS-1$
+
+		if (dialog.open() == Window.OK) {
+			String traceComment = dialog.getValue();
+
+			// First clear selections as it looks stupid when comment is added
+			// after the trace
+			SelectionProperties.clear();
+
+			// Add to the list
+			TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+					.getTraceCommentHandler().insertComment(traceNumber,
+							traceComment);
+		}
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/AddLineCountRuleAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,75 @@
+/*
+ * 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:
+ *
+ * Handler for add new line count rule command
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import java.net.URL;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.dialog.LineCountDialog;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Handler for add new line count rule command
+ */
+public final class AddLineCountRuleAction extends TraceViewerAction {
+
+	/**
+	 * Image for this Action
+	 */
+	private static ImageDescriptor image;
+
+	static {
+		URL url = null;
+		url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				"/icons/count.gif"); //$NON-NLS-1$
+		image = ImageDescriptor.createFromURL(url);
+	}
+
+	/**
+	 * Constructor
+	 */
+	public AddLineCountRuleAction() {
+		setText(Messages.getString("AddLineCountRuleAction.Title")); //$NON-NLS-1$
+		setToolTipText(Messages.getString("AddLineCountRuleAction.Tooltip")); //$NON-NLS-1$
+		setImageDescriptor(image);
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
+				TraceViewerHelpContextIDs.ACTIONS);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		LineCountDialog dialog = TraceViewerGlobals.getTraceViewer()
+				.getDataProcessorAccess().getLineCountProcessor()
+				.getLineCountDialog();
+		if (dialog != null) {
+			dialog.editOrAddItem(-1);
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/AddVariableTracingRuleAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,77 @@
+/*
+ * 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:
+ *
+ * Handler for add new variable tracing rule command
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import java.net.URL;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.dialog.VariableTracingDialog;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Handler for add new variable tracing rule command
+ * 
+ */
+public final class AddVariableTracingRuleAction extends TraceViewerAction {
+
+	/**
+	 * Image for this Action
+	 */
+	private static ImageDescriptor image;
+
+	static {
+		URL url = null;
+		url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				"/icons/tracevariable.gif"); //$NON-NLS-1$
+		image = ImageDescriptor.createFromURL(url);
+	}
+
+	/**
+	 * Constructor
+	 */
+	public AddVariableTracingRuleAction() {
+		setText(Messages.getString("AddVariableTracingRuleAction.Title")); //$NON-NLS-1$
+		setToolTipText(Messages
+				.getString("AddVariableTracingRuleAction.Tooltip")); //$NON-NLS-1$
+		setImageDescriptor(image);
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
+				TraceViewerHelpContextIDs.ACTIONS);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		VariableTracingDialog dialog = TraceViewerGlobals.getTraceViewer()
+				.getDataProcessorAccess().getVariableTracingProcessor()
+				.getVariableTracingDialog();
+		if (dialog != null) {
+			dialog.editOrAddItem(-1);
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/AppendDecodeFileAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,90 @@
+/*
+ * 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:
+ *
+ * Handler for append decode file command
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import java.net.URL;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Handler for append decode file command
+ * 
+ */
+public final class AppendDecodeFileAction extends TraceViewerAction {
+
+	/**
+	 * Image for this action
+	 */
+	private static ImageDescriptor image;
+	static {
+		URL url = null;
+		url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				"/icons/opendecodefile.gif"); //$NON-NLS-1$
+		image = ImageDescriptor.createFromURL(url);
+	}
+
+	/**
+	 * Constructor
+	 */
+	AppendDecodeFileAction() {
+		setText(Messages.getString("AppendDecodeFileAction.Title")); //$NON-NLS-1$
+		setToolTipText(Messages.getString("AppendDecodeFileAction.Tooltip")); //$NON-NLS-1$
+		setImageDescriptor(image);
+		setActionDefinitionId("com.nokia.traceviewer.command.append_decode_file"); //$NON-NLS-1$
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		// Pause the datareader if it's not paused already
+		boolean wasPausedWhenEntered = TraceViewerGlobals.getTraceViewer()
+				.getDataReaderAccess().getMainDataReader().isPaused();
+
+		if (!wasPausedWhenEntered) {
+			TraceViewerGlobals.getTraceViewer().getView().getActionFactory()
+					.getPauseAction().run();
+		}
+
+		// Get files
+		String[] files = TraceViewerActionUtils.openFileDialog(
+				OpenDecodeFileAction.FILTER_NAMES,
+				OpenDecodeFileAction.FILTER_EXTS, null, null, true, true);
+
+		// Get open decode file action
+		OpenDecodeFileAction openDecodeFileAction = (OpenDecodeFileAction) TraceViewerGlobals
+				.getTraceViewer().getView().getActionFactory()
+				.getOpenDecodeFileAction();
+
+		// Load files to model, don't create new model
+		openDecodeFileAction.loadFilesToModel(files, false);
+
+		// Unpause
+		if (!wasPausedWhenEntered) {
+			TraceViewerGlobals.getTraceViewer().getView().getActionFactory()
+					.getPauseAction().run();
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/AppendDecodeFileGlobalAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,39 @@
+/*
+ * 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:
+ *
+ * Handler for append decode file global command
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Handler for append decode file global command
+ */
+public final class AppendDecodeFileGlobalAction extends TraceViewerGlobalAction {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerGlobalAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		TraceViewerGlobals.getTraceViewer().getView().getActionFactory()
+				.getAppendDecodeFileAction().run();
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/ClearViewAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,74 @@
+/*
+ * 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:
+ *
+ * Handler for clear view command
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import java.net.URL;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Handler for clear view command
+ * 
+ */
+final class ClearViewAction extends TraceViewerAction {
+
+	/**
+	 * Image for this Action
+	 */
+	private static ImageDescriptor image;
+
+	static {
+		URL url = null;
+		url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				"/icons/clear.gif"); //$NON-NLS-1$
+		image = ImageDescriptor.createFromURL(url);
+	}
+
+	/**
+	 * Constructor
+	 */
+	ClearViewAction() {
+		setText(Messages.getString("ClearViewAction.Title")); //$NON-NLS-1$
+		setToolTipText(Messages.getString("ClearViewAction.Tooltip")); //$NON-NLS-1$
+		setImageDescriptor(image);
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
+				TraceViewerHelpContextIDs.ACTIONS);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		TraceViewerGlobals.postUiEvent("ClearViewButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+		BusyIndicator.showWhile(PlatformUI.getWorkbench().getDisplay(),
+				new ClearViewRunnable());
+		TraceViewerGlobals.postUiEvent("ClearViewButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/ClearViewRunnable.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,59 @@
+/*
+ * 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:
+ *
+ * Executes clear view
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Executes clear view
+ * 
+ */
+public class ClearViewRunnable implements Runnable {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Runnable#run()
+	 */
+	public void run() {
+
+		// Pause connection and datareader
+		TraceViewerGlobals.getTraceViewer().getDataReaderAccess()
+				.getCurrentDataReader().shutdown();
+
+		boolean logFileOpened = TraceViewerGlobals.getTraceViewer()
+				.getDataProcessorAccess().getLogger().isLogFileOpened();
+
+		// Clear everything
+		TraceViewerGlobals.getTraceViewer().clearAllData();
+
+		// Create new main reader
+		if (!logFileOpened) {
+			TraceViewerGlobals.getTraceViewer().getDataReaderAccess()
+					.createMainDataReader();
+		}
+
+		// Set pause image to pause action
+		((PauseAction) TraceViewerGlobals.getTraceViewer().getView()
+				.getActionFactory().getPauseAction()).setPauseImage(true);
+
+		// Update view name
+		TraceViewerGlobals.getTraceViewer().getView().updateViewName();
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/CloseAndRestartLoggingAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,153 @@
+/*
+ * 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:
+ *
+ * Handler for close and restart logging command
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import java.net.URL;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.widgets.Display;
+
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.dataprocessor.Logger;
+
+/**
+ * Handler for close and restart logging command
+ */
+public final class CloseAndRestartLoggingAction extends TraceViewerAction {
+
+	/**
+	 * Close log image
+	 */
+	private static ImageDescriptor closeLogImage;
+
+	/**
+	 * Restart logging image
+	 */
+	private static ImageDescriptor restartLoggingImage;
+
+	/**
+	 * File path of the log file
+	 */
+	private String filePath;
+
+	static {
+		URL url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				"/icons/logclose.gif"); //$NON-NLS-1$
+		closeLogImage = ImageDescriptor.createFromURL(url);
+		url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				"/icons/log.gif"); //$NON-NLS-1$
+		restartLoggingImage = ImageDescriptor.createFromURL(url);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		TraceViewerGlobals.postUiEvent("CloseAndRestartLoggingButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+		Logger logger = TraceViewerGlobals.getTraceViewer()
+				.getDataProcessorAccess().getLogger();
+
+		// If logging, close it
+		if (logger.isPlainLogging()) {
+			logger.stopPlainTextLogging();
+			changeToRestartLoggingAction();
+
+			// Start new machine readable logging
+		} else {
+			logger.startPlainTextLogging(filePath, false, true);
+			changeToStopLoggingAction();
+		}
+		TraceViewerGlobals.postUiEvent("CloseAndRestartLoggingButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+
+	/**
+	 * Changes action to stop logging
+	 */
+	public void changeToStopLoggingAction() {
+		if (Display.getCurrent() != null) {
+			setImageDescriptor(closeLogImage);
+			setText(Messages
+					.getString("CloseAndRestartLoggingAction.CloseLogText")); //$NON-NLS-1$
+			setToolTipText(Messages
+					.getString("CloseAndRestartLoggingAction.CloseLogToolTip")); //$NON-NLS-1$
+		} else {
+			Display.getDefault().syncExec(new Runnable() {
+
+				/*
+				 * (non-Javadoc)
+				 * 
+				 * @see java.lang.Runnable#run()
+				 */
+				public void run() {
+					setImageDescriptor(closeLogImage);
+					setText(Messages
+							.getString("CloseAndRestartLoggingAction.CloseLogText")); //$NON-NLS-1$
+					setToolTipText(Messages
+							.getString("CloseAndRestartLoggingAction.CloseLogToolTip")); //$NON-NLS-1$
+				}
+
+			});
+		}
+	}
+
+	/**
+	 * Changes action to restart logging
+	 */
+	public void changeToRestartLoggingAction() {
+		if (Display.getCurrent() != null) {
+			setImageDescriptor(restartLoggingImage);
+			setText(Messages
+					.getString("CloseAndRestartLoggingAction.RetakeLogText")); //$NON-NLS-1$
+			setToolTipText(Messages
+					.getString("CloseAndRestartLoggingAction.RetakeLogToolTip")); //$NON-NLS-1$
+		} else {
+			Display.getDefault().syncExec(new Runnable() {
+
+				/*
+				 * (non-Javadoc)
+				 * 
+				 * @see java.lang.Runnable#run()
+				 */
+				public void run() {
+					setImageDescriptor(restartLoggingImage);
+					setText(Messages
+							.getString("CloseAndRestartLoggingAction.RetakeLogText")); //$NON-NLS-1$
+					setToolTipText(Messages
+							.getString("CloseAndRestartLoggingAction.RetakeLogToolTip"));//$NON-NLS-1$
+				}
+
+			});
+		}
+	}
+
+	/**
+	 * Sets file path
+	 * 
+	 * @param filePath
+	 *            file path
+	 */
+	public void setFilePath(String filePath) {
+		this.filePath = filePath;
+
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/ColorAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,77 @@
+/*
+ * 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:
+ *
+ * Handler for color command
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import java.net.URL;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.engine.TraceViewerDialog;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Handler for color command
+ * 
+ */
+public final class ColorAction extends TraceViewerAction {
+
+	/**
+	 * Image for the action
+	 */
+	private static ImageDescriptor image;
+
+	static {
+		URL url = null;
+		url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				"/icons/color.gif"); //$NON-NLS-1$
+		image = ImageDescriptor.createFromURL(url);
+	}
+
+	/**
+	 * Constructor
+	 */
+	ColorAction() {
+		setText(Messages.getString("ColorAction.Title")); //$NON-NLS-1$
+		setToolTipText(Messages.getString("ColorAction.Tooltip")); //$NON-NLS-1$
+		setImageDescriptor(image);
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
+				TraceViewerHelpContextIDs.ACTIONS);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		TraceViewerGlobals.postUiEvent("ColorButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+		TraceViewerDialog dialog = TraceViewerGlobals.getTraceViewer()
+				.getDataProcessorAccess().getColorer().getColorDialog();
+		if (dialog != null) {
+			dialog.openDialog();
+		}
+		TraceViewerGlobals.postUiEvent("ColorButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/ConnectAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,573 @@
+/*
+ * 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:
+ *
+ * Handler for connect command
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import java.net.URL;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator;
+import com.nokia.carbide.remoteconnections.interfaces.IConnection;
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.api.TraceViewerAPI.TVAPIError;
+import com.nokia.traceviewer.engine.ConnectionHelper;
+import com.nokia.traceviewer.engine.TraceProvider;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.TraceViewerDialogInterface.TVPreferencePage;
+import com.nokia.traceviewer.engine.preferences.PreferenceConstants;
+
+/**
+ * Handler for connect command
+ */
+public final class ConnectAction extends TraceViewerAction {
+
+	/**
+	 * Connect image
+	 */
+	private static ImageDescriptor connectImage;
+
+	/**
+	 * Disconnect image
+	 */
+	private static ImageDescriptor disConnectImage;
+
+	/**
+	 * When set to false, don't show protocol change dialog anymore
+	 */
+	private boolean showProtocolChangeDialog = true;
+
+	/**
+	 * Last operation's error code
+	 */
+	private TVAPIError operationErrorCode;
+
+	/**
+	 * Show errors when connecting
+	 */
+	private boolean showErrors = true;
+
+	/**
+	 * When set to false, don't check if given preferences match the one's in
+	 * Remote connections
+	 */
+	private boolean checkPreferences = true;
+
+	/**
+	 * Check preferences error
+	 */
+	private static final String CHECK_PREFERENCES_ERROR = com.nokia.traceviewer.action.Messages
+			.getString("ConnectAction.ConnectionPreferencesError"); //$NON-NLS-1$
+
+	/**
+	 * Connection not supported error
+	 */
+	private static final String CONNECTION_NOT_SUPPORTED_ERROR = Messages
+			.getString("ConnectAction.ConnectionNotSupported"); //$NON-NLS-1$
+
+	static {
+		URL url = null;
+		URL url2 = null;
+		url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				"/icons/connect.gif"); //$NON-NLS-1$
+		connectImage = ImageDescriptor.createFromURL(url);
+		url2 = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				"/icons/disconnect.gif"); //$NON-NLS-1$
+		disConnectImage = ImageDescriptor.createFromURL(url2);
+	}
+
+	/**
+	 * Constructor
+	 */
+	ConnectAction() {
+
+		// Check which action to create
+		if (TraceViewerGlobals.getTraceViewer().getConnection() != null
+				&& TraceViewerGlobals.getTraceViewer().getConnection()
+						.isConnected()) {
+			changeToDisconnectAction();
+		} else {
+			changeToConnectAction();
+		}
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
+				TraceViewerHelpContextIDs.ACTIONS);
+	}
+
+	/**
+	 * Connects to the target
+	 * 
+	 * @param showErrors
+	 *            if true, show errors if there are any
+	 * @param checkPreferences
+	 *            if true, check if preferences match the ones in the selected
+	 *            Remote Connection
+	 * @return TVAPI error code
+	 */
+	public TVAPIError connect(boolean showErrors, boolean checkPreferences) {
+		this.showErrors = showErrors;
+		this.checkPreferences = checkPreferences;
+
+		// Call doRun instead of run() to not care if TraceProvider is
+		// registered yet or not.
+		doRun();
+		this.showErrors = true;
+		this.checkPreferences = true;
+
+		return operationErrorCode;
+	}
+
+	/**
+	 * Disconnects from the target
+	 * 
+	 * @return true if disconnection succeeded, false otherwise
+	 */
+	public boolean disconnect() {
+
+		// Call doRun instead of run() to not care if TraceProvider is
+		// registered yet or not
+		doRun();
+		boolean succeed = false;
+		if (operationErrorCode == TVAPIError.NONE) {
+			succeed = true;
+		}
+		return succeed;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		TraceViewerGlobals.postUiEvent("ConnectButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+		TVAPIError errorCode;
+
+		boolean connected = (TraceViewerGlobals.getTraceViewer()
+				.getConnection() != null && TraceViewerGlobals.getTraceViewer()
+				.getConnection().isConnected());
+		// Connect
+		if (!connected) {
+			errorCode = doConnect();
+			// Disconnect
+		} else {
+			errorCode = doDisconnect();
+		}
+		operationErrorCode = errorCode;
+		TraceViewerGlobals.postUiEvent("ConnectButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+
+	/**
+	 * Do connect. Must be called from an UI thread!
+	 * 
+	 * @return TVAPI error code
+	 */
+	private TVAPIError doConnect() {
+		TVAPIError errorCode = TVAPIError.INVALID_CONNECTION_PARAMETERS;
+
+		boolean canConnect = true;
+
+		// Check that a connection preferences are set. If not, open preferences
+		// page. Doesn't open preferences page if "current connection" is
+		// selected.
+		canConnect = checkConnectionPreferences();
+
+		// Ensure connection before connecting
+		ConnectionHelper.saveConnectionSettingsToPreferenceStore(true);
+
+		// Check used protocol if user want's to change it
+		if (canConnect) {
+			canConnect = checkUsedProtocol();
+
+			// If the main DataReader isn't active, ask to create it again
+			// and erase old data
+			if (canConnect
+					&& TraceViewerGlobals.getTraceViewer()
+							.getDataProcessorAccess().getLogger()
+							.isLogFileOpened()) {
+				canConnect = handleCreatingNewDataReader();
+			}
+		}
+
+		// Try to connect
+		if (canConnect) {
+			boolean success = TraceViewerGlobals.getTraceViewer().connect();
+			if (success) {
+				changeToDisconnectAction();
+				errorCode = TVAPIError.NONE;
+
+			} else if (!success && showErrors) {
+				TraceViewerGlobals.getTraceViewer().getDialogs()
+						.showErrorMessage(CHECK_PREFERENCES_ERROR);
+			}
+
+			// User canceled the connection
+		} else {
+			errorCode = TVAPIError.USER_CANCELED;
+		}
+		return errorCode;
+	}
+
+	/**
+	 * Checks connection preferences
+	 * 
+	 * @return true if connection is selected, false otherwise
+	 */
+	private boolean checkConnectionPreferences() {
+		boolean connectionSettingsDefined = true;
+		IPreferenceStore store = TraceViewerPlugin.getDefault()
+				.getPreferenceStore();
+
+		// Open preferences page
+		if (store.getString(PreferenceConstants.CONNECTION_TYPE).equals("") || !preferencesMatchSelectedConnection(store)) { //$NON-NLS-1$
+			connectionSettingsDefined = TraceViewerGlobals.getTraceViewer()
+					.getDialogs().openPreferencePage(
+							TVPreferencePage.CONNECTION);
+
+			// If user clicked OK, check that some connection is selected
+			if (connectionSettingsDefined) {
+				if (store.getString(PreferenceConstants.CONNECTION_TYPE)
+						.equals("")) { //$NON-NLS-1$
+					connectionSettingsDefined = false;
+				}
+			}
+		}
+		return connectionSettingsDefined;
+	}
+
+	/**
+	 * Checks that set preferences match selected connections preferences
+	 * 
+	 * @param store
+	 *            preference store
+	 * @return true if set preferences match the parameters in selected Remote
+	 *         Connection
+	 */
+	private boolean preferencesMatchSelectedConnection(IPreferenceStore store) {
+		boolean matches = false;
+		if (!checkPreferences || ConnectionHelper.isCurrentConnectionSelected) {
+			matches = true;
+		} else {
+			String selectedIdentifier = store
+					.getString(PreferenceConstants.SELECTED_CONNECTION_ID);
+
+			// Get and compare the parameters from currently selected connection
+			Iterator<IConnection> connections = RemoteConnectionsActivator
+					.getConnectionsManager().getConnections().iterator();
+			while (connections.hasNext()) {
+				IConnection conn = connections.next();
+
+				// First find the right connection with the identifier
+				if (conn.getIdentifier().equals(selectedIdentifier)) {
+					String connectionTypeId = conn.getConnectionType()
+							.getIdentifier();
+					String connectionType = store
+							.getString(PreferenceConstants.CONNECTION_TYPE);
+					boolean isMusti = connectionTypeId
+							.equals("com.nokia.carbide.trk.support.connection.TCPIPConnectionType"); //$NON-NLS-1$
+
+					boolean isPlatsim = connectionTypeId
+							.equals("com.nokia.carbide.trk.support.connection.PlatSimConnectionType"); //$NON-NLS-1$
+
+					// TCP / IP connection
+					if (isMusti || isPlatsim) {
+						String address = conn.getSettings().get("ipAddress"); //$NON-NLS-1$
+						String port = conn.getSettings().get("port"); //$NON-NLS-1$
+
+						// Check that connection type, address and port match
+						if (connectionType
+								.equals(PreferenceConstants.CONNECTION_TYPE_TCPIP)
+								&& address
+										.equals(store
+												.getString(PreferenceConstants.IP_ADDRESS))
+								&& port
+										.equals(store
+												.getString(PreferenceConstants.TCPIP_PORT))) {
+							matches = true;
+							break;
+						}
+
+						// USB connection
+					} else if (connectionTypeId
+							.equals("com.nokia.carbide.trk.support.connection.USBConnectionType")) { //$NON-NLS-1$
+						String portNumStr = conn.getSettings().get("port"); //$NON-NLS-1$
+						if (connectionType
+								.equals(PreferenceConstants.CONNECTION_TYPE_USB_SERIAL)
+								&& portNumStr
+										.equals(store
+												.getString(PreferenceConstants.USB_SERIAL_COM_PORT))) {
+							matches = true;
+							break;
+						}
+					}
+				}
+			}
+		}
+		return matches;
+	}
+
+	/**
+	 * Do disconnect
+	 * 
+	 * @return TVAPI error code
+	 */
+	private TVAPIError doDisconnect() {
+		TVAPIError errorCode;
+		boolean success = TraceViewerGlobals.getTraceViewer().disconnect();
+		if (success) {
+			errorCode = TVAPIError.NONE;
+			changeToConnectAction();
+
+		} else {
+			// Disconnecting failed error
+			errorCode = TVAPIError.DISCONNECTING_FAILED;
+		}
+		return errorCode;
+	}
+
+	/**
+	 * Checks used media protocol
+	 * 
+	 * @return true if TraceViewer can still continue connecting. False if
+	 *         currently selected TraceProvider doesn't support connecting.
+	 */
+	private boolean checkUsedProtocol() {
+		boolean canConnect = true;
+
+		// First check there are more than one TraceProviders
+		if (TraceViewerGlobals.getListOfTraceProviders().size() > 1
+				&& showProtocolChangeDialog) {
+
+			IPreferenceStore store = TraceViewerPlugin.getDefault()
+					.getPreferenceStore();
+			String selectedConnectionType = store
+					.getString(PreferenceConstants.CONNECTION_TYPE);
+
+			// Check if current TraceProvider has selected connection type as
+			// preferred
+			String preferredConnectionType = TraceViewerGlobals
+					.getTraceProvider().getPreferredConnectionType();
+
+			// If current TraceProvider returns not supported as preferred
+			// connection type,
+			if (preferredConnectionType
+					.equals(PreferenceConstants.CONNECTION_TYPE_NOT_SUPPORTED)) {
+				canConnect = false;
+			}
+
+			// Connection type doesn't match, find other TraceProvider which has
+			// the selected connection type as preferred
+			if (!preferredConnectionType.equals(selectedConnectionType)) {
+				List<TraceProvider> traceProviders = TraceViewerGlobals
+						.getListOfTraceProviders();
+
+				// Go through list of TraceProviders
+				for (int i = 0; i < traceProviders.size(); i++) {
+					TraceProvider newProvider = traceProviders.get(i);
+					if (newProvider.getPreferredConnectionType().equals(
+							selectedConnectionType)) {
+
+						// Create human readable change message
+						String selectedConnectionHuman = Messages
+								.getString("ConnectAction.USBSerialMsg"); //$NON-NLS-1$
+						if (selectedConnectionType
+								.equals(PreferenceConstants.CONNECTION_TYPE_TCPIP)) {
+							selectedConnectionHuman = Messages
+									.getString("ConnectAction.TCPIPMsg"); //$NON-NLS-1$
+						}
+						String changeMsgStart = Messages
+								.getString("ConnectAction.ChangeDataFormatMsg1"); //$NON-NLS-1$
+						String changeMsgEnd = Messages
+								.getString("ConnectAction.ChangeDataFormatMsg2"); //$NON-NLS-1$
+
+						String confirmationMsg = selectedConnectionHuman
+								+ changeMsgStart + newProvider.getName()
+								+ changeMsgEnd;
+
+						// Ask the user if the TraceProvider should be changed
+						boolean ret = TraceViewerGlobals.getTraceViewer()
+								.getDialogs().showConfirmationDialog(
+										confirmationMsg);
+
+						// Change TraceProvider
+						if (ret) {
+							store.setValue(PreferenceConstants.DATA_FORMAT,
+									newProvider.getName());
+							TraceViewerGlobals.getTraceViewer().clearAllData();
+							TraceViewerGlobals.setTraceProvider(newProvider,
+									true);
+							canConnect = true;
+						} else {
+							showProtocolChangeDialog = false;
+						}
+						break;
+					}
+				}
+			}
+		}
+
+		// Current TraceProvider doesn't support connecting
+		if (!canConnect && showErrors) {
+			TraceViewerGlobals.getTraceViewer().getDialogs().showErrorMessage(
+					TraceViewerGlobals.getTraceProvider().getName()
+							+ CONNECTION_NOT_SUPPORTED_ERROR);
+		}
+
+		return canConnect;
+	}
+
+	/**
+	 * Handles creation of new main DataReader
+	 * 
+	 * @return true if new main DataReader was created
+	 */
+	private boolean handleCreatingNewDataReader() {
+		boolean canConnect;
+		String confirmationMsg = Messages
+				.getString("ConnectAction.EraseLogConfirmation"); //$NON-NLS-1$;
+
+		boolean ret = TraceViewerGlobals.getTraceViewer().getDialogs()
+				.showConfirmationDialog(confirmationMsg);
+
+		// Ok
+		if (ret) {
+			// Create new main DataReader
+			// Unpause if paused
+			if (TraceViewerGlobals.getTraceViewer().getDataReaderAccess()
+					.getMainDataReader().isPaused()) {
+				TraceViewerGlobals.getTraceViewer().getView()
+						.getActionFactory().getPauseAction().run();
+			}
+			TraceViewerGlobals.getTraceViewer().clearAllData();
+			TraceViewerGlobals.getTraceViewer().getView().updateViewName();
+			canConnect = true;
+		} else {
+			canConnect = false;
+		}
+		return canConnect;
+	}
+
+	/**
+	 * Changes action to connect action
+	 */
+	public void changeToConnectAction() {
+
+		if (Display.getCurrent() != null) {
+			setImageDescriptor(connectImage);
+			setText(Messages.getString("ConnectAction.Title")); //$NON-NLS-1$
+			changeConnectToolTip();
+		} else {
+			Display.getDefault().syncExec(new Runnable() {
+
+				/*
+				 * (non-Javadoc)
+				 * 
+				 * @see java.lang.Runnable#run()
+				 */
+				public void run() {
+					setImageDescriptor(connectImage);
+					setText(Messages.getString("ConnectAction.Title")); //$NON-NLS-1$
+					changeConnectToolTip();
+				}
+
+			});
+		}
+	}
+
+	/**
+	 * Changes action to disconnect action
+	 */
+	public void changeToDisconnectAction() {
+		if (Display.getCurrent() != null) {
+			setImageDescriptor(disConnectImage);
+			setText(Messages.getString("DisconnectAction.Title")); //$NON-NLS-1$
+			changeConnectToolTip();
+		} else {
+			Display.getDefault().syncExec(new Runnable() {
+
+				/*
+				 * (non-Javadoc)
+				 * 
+				 * @see java.lang.Runnable#run()
+				 */
+				public void run() {
+					setImageDescriptor(disConnectImage);
+					setText(Messages.getString("DisconnectAction.Title")); //$NON-NLS-1$
+					changeConnectToolTip();
+				}
+
+			});
+		}
+	}
+
+	/**
+	 * Changes connect button tooltip if needed
+	 */
+	public void changeConnectToolTip() {
+		IPreferenceStore store = TraceViewerPlugin.getDefault()
+				.getPreferenceStore();
+
+		boolean connected = (TraceViewerGlobals.getTraceViewer()
+				.getConnection() != null && TraceViewerGlobals.getTraceViewer()
+				.getConnection().isConnected());
+
+		// Start with either connect or disconnect
+		String toolTipText;
+		if (!connected) {
+			toolTipText = Messages.getString("ConnectAction.Tooltip"); //$NON-NLS-1$ 
+		} else {
+			toolTipText = Messages.getString("DisconnectAction.Tooltip"); //$NON-NLS-1$ 
+		}
+
+		// Construct the tooltip for connect action
+		String connName = store
+				.getString(PreferenceConstants.SELECTED_CONNECTION_NAME);
+
+		// "Current connection" selected or already connected
+		if (ConnectionHelper.isCurrentConnectionSelected || connected) {
+			String curText = Messages.getString("ConnectAction.TooltipCurr"); //$NON-NLS-1$
+			IConnection currentConnection = RemoteConnectionsActivator
+					.getConnectionsManager().getCurrentConnection();
+			if (currentConnection != null) {
+				curText = currentConnection.getDisplayName();
+			} else if (connected) {
+				curText = connName;
+			}
+			toolTipText = toolTipText + curText;
+		}
+
+		// No connection selected
+		else if (connName.equals("")) { //$NON-NLS-1$
+			toolTipText = toolTipText
+					+ Messages.getString("ConnectAction.Tooltip2"); //$NON-NLS-1$
+
+			// Static connection selected
+		} else {
+			toolTipText = toolTipText + connName;
+		}
+		setToolTipText(toolTipText);
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/CopyFileProgressCallback.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,47 @@
+/*
+ * 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:
+ *
+ * Notifies about copy file progress in bytes
+ *
+ */
+package com.nokia.traceviewer.action;
+
+/**
+ * Notifies about copy file progress in bytes
+ * 
+ */
+public interface CopyFileProgressCallback {
+
+	/**
+	 * Notifies about file position when copying
+	 * 
+	 * @param filePosition
+	 *            file position in bytes
+	 */
+	void notifyFilePosition(long filePosition);
+
+	/**
+	 * If true, copying should be canceled
+	 * 
+	 * @return true if copying should be canceled
+	 */
+	boolean cancelCopying();
+
+	/**
+	 * Inform callback that copying is finished
+	 */
+	void copyingFinished();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/CopySelectionAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,101 @@
+/*
+ * 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:
+ *
+ * Copy selection command
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.view.listener.SelectionProperties;
+
+/**
+ * Copy selection command
+ * 
+ */
+final class CopySelectionAction extends TraceViewerAction {
+
+	/**
+	 * Data Fetcher class
+	 */
+	private CopySelectionDataFetcher dataFetcher;
+
+	/**
+	 * Image for this action
+	 */
+	private static ImageDescriptor image;
+
+	/**
+	 * Constructor
+	 */
+	CopySelectionAction() {
+		image = PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(
+				ISharedImages.IMG_TOOL_COPY);
+		setText(Messages.getString("CopySelectionAction.Title")); //$NON-NLS-1$
+		setToolTipText(Messages.getString("CopySelectionAction.Tooltip")); //$NON-NLS-1$
+		setImageDescriptor(image);
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
+				TraceViewerHelpContextIDs.ACTIONS);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		int showingFrom = TraceViewerGlobals.getTraceViewer().getView()
+				.getShowingTracesFrom();
+		StyledText widget = TraceViewerGlobals.getTraceViewer().getView()
+				.getViewer().getTextWidget();
+
+		// If the whole selection is in current view, just use widget copy. Also
+		// if selected lines are below two blocks, widget copy can be used in
+		// any case
+		int first = SelectionProperties.firstClickedLine;
+		int last = SelectionProperties.lastClickedLine;
+		int lineInEnd = showingFrom + widget.getLineCount();
+
+		// If First click and Last click are between current view, use Text
+		// Widget Copy
+		if (first > showingFrom && first < lineInEnd && last > showingFrom
+				&& last < lineInEnd) {
+			widget.copy();
+
+			// If we are in the very first block of traces and the first click
+			// is in the first row OR the last click hasn't been done at all,
+			// use Text Widget Copy
+		} else if ((showingFrom == 0 && first == 0 && last < lineInEnd)
+				|| (last == -1)) {
+			widget.copy();
+
+			// Otherwise, go get the data from the file
+		} else {
+			if (dataFetcher == null) {
+				dataFetcher = new CopySelectionDataFetcher();
+			}
+			dataFetcher.startGatheringData();
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/CopySelectionDataFetcher.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,332 @@
+/*
+ * 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:
+ *
+ * Copy Selection Data Fetcher gets data from file to the clipboard
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.swt.dnd.TextTransfer;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.engine.DataReader;
+import com.nokia.traceviewer.engine.DataScrollReader;
+import com.nokia.traceviewer.engine.MediaCallback;
+import com.nokia.traceviewer.engine.TraceProperties;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.view.listener.SelectionProperties;
+
+/**
+ * Copies selected data to the clipboard
+ * 
+ */
+public final class CopySelectionDataFetcher implements MediaCallback {
+
+	/**
+	 * Max number of traces to copy to clipboard
+	 */
+	private static int MAX_TRACES_TO_COPY = 10000;
+
+	/**
+	 * String to attach to end of the clipboard if tried to copy more than
+	 * MAX_TRACES_TO_COPY traces
+	 */
+	private static String MAX_STRING = Messages
+			.getString("CopySelectionDataFetcher.MaxTracesLine1") //$NON-NLS-1$
+			+ " " //$NON-NLS-1$
+			+ MAX_TRACES_TO_COPY + " " //$NON-NLS-1$
+			+ Messages.getString("CopySelectionDataFetcher.MaxTracesLine2"); //$NON-NLS-1$
+
+	/**
+	 * Buffer to gather data to
+	 */
+	private final StringBuffer dataBuffer;
+
+	/**
+	 * Tells how many traces to drop from the beginning
+	 */
+	private int tracesToDrop;
+
+	/**
+	 * Tells how many traces to get totally
+	 */
+	private int tracesToGet;
+
+	/**
+	 * Trace count by this far
+	 */
+	private int traceCount;
+
+	/**
+	 * System Clipboard
+	 */
+	private final Clipboard clipboard;
+
+	/**
+	 * Own data reader reading the file
+	 */
+	private DataScrollReader dataReader;
+
+	/**
+	 * If already processing, don't start new process
+	 */
+	private boolean processing;
+
+	/**
+	 * Constructor
+	 */
+	public CopySelectionDataFetcher() {
+		traceCount = 0;
+		dataBuffer = new StringBuffer();
+		clipboard = new Clipboard(PlatformUI.getWorkbench().getDisplay());
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.MediaCallback#processTrace(com.nokia.traceviewer
+	 * .engine.TraceProperties)
+	 */
+	public void processTrace(TraceProperties properties) {
+		traceCount++;
+
+		// Process traces we want to clipboard
+		if (traceCount > tracesToDrop
+				&& traceCount - tracesToDrop <= tracesToGet) {
+
+			// Null timestamp from first trace
+			if (traceCount == tracesToDrop + 1) {
+				TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+						.getTimestampParser().nullPreviousTimestamp();
+			}
+
+			// Parse timestamp
+			TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+					.getTimestampParser().processData(properties);
+
+			// If binary trace, decode it
+			if (properties.binaryTrace) {
+				TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+						.getDecoder().processData(properties);
+			}
+
+			// Append trace to buffer
+			appendTraceToBuffer(properties);
+		}
+
+		// Last trace
+		if (properties.lastTrace) {
+			// Lines has been received, if there are MAX_TRACES_TO_COPY
+			// Also add a note to user in the end of the data
+			if (tracesToGet == MAX_TRACES_TO_COPY) {
+				dataBuffer.append(MAX_STRING);
+			}
+
+			// Copy data to clipboard
+			copyBufferToClipboard();
+		}
+	}
+
+	/**
+	 * Appends trace to buffer
+	 * 
+	 * @param trace
+	 *            trace properties
+	 */
+	private void appendTraceToBuffer(TraceProperties trace) {
+
+		// Check how many characters to skip and take before starting the first
+		// and last trace
+		int skip = 0;
+		int take = 0;
+		if (SelectionProperties.firstClickedLine <= SelectionProperties.lastClickedLine) {
+			skip = SelectionProperties.firstClickedLineCaretOffset;
+			take = SelectionProperties.lastClickedLineCaretOffset;
+		} else {
+			skip = SelectionProperties.lastClickedLineCaretOffset;
+			take = SelectionProperties.firstClickedLineCaretOffset;
+		}
+
+		// First trace
+		if (traceCount == tracesToDrop + 1) {
+
+			StringBuffer str = new StringBuffer();
+			addTraceTextToBuffer(trace, str);
+
+			if (str.length() > skip) {
+				str.delete(0, skip);
+			} else {
+				str.setLength(0);
+			}
+
+			dataBuffer.append(str);
+			dataBuffer.append('\r');
+			dataBuffer.append('\n');
+
+			// Last trace
+		} else if (traceCount - tracesToDrop == tracesToGet) {
+
+			StringBuffer str = new StringBuffer();
+			addTraceTextToBuffer(trace, str);
+
+			if (str.length() > take) {
+				str.setLength(take);
+			}
+			dataBuffer.append(str);
+			if (traceCount - tracesToDrop == MAX_TRACES_TO_COPY) {
+				dataBuffer.append('\r');
+				dataBuffer.append('\n');
+			}
+
+			// Middle trace
+		} else {
+			addTraceTextToBuffer(trace, dataBuffer);
+			dataBuffer.append('\r');
+			dataBuffer.append('\n');
+		}
+	}
+
+	/**
+	 * Adds trace text to string buffer
+	 * 
+	 * @param trace
+	 *            trace to be added
+	 * @param str
+	 *            string buffer
+	 */
+	private void addTraceTextToBuffer(TraceProperties trace, StringBuffer str) {
+
+		// Traces missing
+		if (trace.bTraceInformation.isTraceMissing()) {
+			str.append(TraceViewerActionUtils.TRACES_DROPPED_MSG);
+		}
+
+		// Insert timestamp
+		if (trace.timestampString != null) {
+			str.append(trace.timestampString);
+			str.append(TraceViewerGlobals.getTraceViewer()
+					.getDataProcessorAccess().getTimestampParser()
+					.getTimeFromPreviousString(trace.timeFromPreviousTrace));
+			str.append('\t');
+		}
+
+		// Insert trace string
+		if (trace.traceString != null) {
+			str.append(trace.traceString);
+			if (trace.traceComment != null) {
+				str.append(TraceViewerActionUtils.COMMENT_PREFIX);
+				str.append(trace.traceComment);
+			}
+		}
+	}
+
+	/**
+	 * Copies dataBuffer to clipboard
+	 */
+	private void copyBufferToClipboard() {
+		// Copy text to clipboard
+		PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+			public void run() {
+				try {
+					String data = dataBuffer.toString();
+					clipboard.setContents(new Object[] { data },
+							new Transfer[] { TextTransfer.getInstance() });
+				} finally {
+					// Free the memory
+					dataBuffer.setLength(0);
+
+					processing = false;
+				}
+			}
+		});
+
+	}
+
+	/**
+	 * Starts gathering data
+	 */
+	public void startGatheringData() {
+		if (!processing) {
+			processing = true;
+			dataBuffer.setLength(0);
+			traceCount = 0;
+
+			int fromTrace;
+			int toTrace;
+
+			if (SelectionProperties.firstClickedLine < SelectionProperties.lastClickedLine) {
+				fromTrace = SelectionProperties.firstClickedLine;
+				toTrace = SelectionProperties.lastClickedLine;
+			} else {
+				fromTrace = SelectionProperties.lastClickedLine;
+				toTrace = SelectionProperties.firstClickedLine;
+			}
+
+			// Get the file position having given offset
+			int index = TraceViewerGlobals.getTraceViewer()
+					.getDataReaderAccess().getCurrentDataReader().getFileMap()
+					.getIndexFromOffset(fromTrace);
+
+			long pos = TraceViewerGlobals.getTraceViewer()
+					.getDataReaderAccess().getCurrentDataReader().getFileMap()
+					.getItem(index).longValue();
+			int startTrace = index * TraceViewerGlobals.blockSize;
+
+			// Calculate how many traces to drop from start
+			tracesToDrop = fromTrace - startTrace;
+			tracesToGet = toTrace - fromTrace + 1;
+			if (tracesToGet > MAX_TRACES_TO_COPY) {
+				tracesToGet = MAX_TRACES_TO_COPY;
+			}
+
+			// Number of blocks
+			int numberOfBlocks = (tracesToGet / TraceViewerGlobals.blockSize) + 1;
+			if (numberOfBlocks * TraceViewerGlobals.blockSize - tracesToDrop < tracesToGet) {
+				numberOfBlocks++;
+			}
+
+			// Create own data reader if it doesn't exist and start it
+			dataReader = TraceViewerGlobals.getTraceViewer()
+					.getDataReaderAccess().startOwnDataReader(dataReader, this,
+							numberOfBlocks, pos, startTrace, false);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.MediaCallback#endOfFile(com.nokia.traceviewer
+	 * .engine.DataReader)
+	 */
+	public void endOfFile(DataReader reader) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.MediaCallback#dataHandleChanged()
+	 */
+	public void dataHandleChanged() {
+		if (dataReader != null) {
+			dataReader.shutdown();
+			dataReader = null;
+		}
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/CountLinesAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,78 @@
+/*
+ * 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:
+ *
+ * Handler for count lines command
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import java.net.URL;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.engine.TraceViewerDialog;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Handler for count lines command
+ * 
+ */
+final class CountLinesAction extends TraceViewerAction {
+
+	/**
+	 * Image for the action
+	 */
+	private static ImageDescriptor image;
+
+	static {
+		URL url = null;
+		url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				"/icons/count.gif"); //$NON-NLS-1$
+		image = ImageDescriptor.createFromURL(url);
+	}
+
+	/**
+	 * Constructor
+	 */
+	CountLinesAction() {
+		setText(Messages.getString("CountLinesAction.Title")); //$NON-NLS-1$
+		setToolTipText(Messages.getString("CountLinesAction.Tooltip")); //$NON-NLS-1$
+		setImageDescriptor(image);
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
+				TraceViewerHelpContextIDs.ACTIONS);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		TraceViewerGlobals.postUiEvent("CountLinesButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+		TraceViewerDialog dialog = TraceViewerGlobals.getTraceViewer()
+				.getDataProcessorAccess().getLineCountProcessor()
+				.getLineCountDialog();
+		if (dialog != null) {
+			dialog.openDialog();
+		}
+		TraceViewerGlobals.postUiEvent("CountLinesButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/DeactivateLineCountRuleAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,116 @@
+/*
+ * 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:
+ *
+ * Handler for deactivating line count rule command
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import java.net.URL;
+import java.util.List;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.dialog.treeitem.LineCountTreeComponentItem;
+import com.nokia.traceviewer.dialog.treeitem.LineCountTreeTextItem;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.dataprocessor.LineCountItem;
+
+/**
+ * Handler for deactivating line count rule command
+ */
+public final class DeactivateLineCountRuleAction extends TraceViewerAction {
+
+	/**
+	 * Image for this Action
+	 */
+	private static ImageDescriptor image;
+
+	/**
+	 * Item index in TracePropertyView to be deactivated
+	 */
+	private int itemIndex;
+
+	/**
+	 * Line counting table
+	 */
+	private final Table lineCountingTable;
+
+	static {
+		URL url = null;
+		url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				"/icons/count.gif"); //$NON-NLS-1$
+		image = ImageDescriptor.createFromURL(url);
+	}
+
+	/**
+	 * Constructor
+	 * 
+	 * @param itemIndex
+	 *            item index to be edited
+	 * @param lineCountingTable
+	 */
+	public DeactivateLineCountRuleAction(int itemIndex, Table lineCountingTable) {
+		setText(Messages
+				.getString("DeactivateLineCountRuleAction.DeactivateRuleText")); //$NON-NLS-1$
+		setToolTipText(Messages
+				.getString("DeactivateLineCountRuleAction.DeactivateRuleToolTip")); //$NON-NLS-1$
+		setImageDescriptor(image);
+
+		this.itemIndex = itemIndex;
+		this.lineCountingTable = lineCountingTable;
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
+				TraceViewerHelpContextIDs.ACTIONS);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		// Remove the item from the property view items
+		List<LineCountItem> items = TraceViewerGlobals.getTraceViewer()
+				.getDataProcessorAccess().getLineCountProcessor()
+				.getLineCountItems();
+		items.remove(itemIndex);
+
+		// Remove from the actual table
+		lineCountingTable.remove(itemIndex);
+
+		// Get rule arrays
+		List<LineCountTreeTextItem> textRules = TraceViewerGlobals
+				.getTraceViewer().getDataProcessorAccess()
+				.getLineCountProcessor().getTextRules();
+		List<LineCountTreeComponentItem> componentRules = TraceViewerGlobals
+				.getTraceViewer().getDataProcessorAccess()
+				.getLineCountProcessor().getComponentRules();
+
+		// Remove from the rule lists
+		if (itemIndex < componentRules.size()) {
+			componentRules.remove(itemIndex);
+		} else {
+			itemIndex -= componentRules.size();
+			textRules.remove(itemIndex);
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/DeactivateVariableTracingRuleAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,109 @@
+/*
+ * 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:
+ *
+ * Handler for deactivating variable tracing rule command
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import java.net.URL;
+import java.util.List;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.dialog.treeitem.VariableTracingTreeTextItem;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.dataprocessor.VariableTracingItem;
+
+/**
+ * Handler for deactivating variable tracing rule command
+ */
+public final class DeactivateVariableTracingRuleAction extends
+		TraceViewerAction {
+
+	/**
+	 * Image for this Action
+	 */
+	private static ImageDescriptor image;
+
+	/**
+	 * Item index in TracePropertyView to be deactivated
+	 */
+	private final int itemIndex;
+
+	/**
+	 * Variable tracing table
+	 */
+	private final Table variableTracingTable;
+
+	static {
+		URL url = null;
+		url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				"/icons/tracevariable.gif"); //$NON-NLS-1$
+		image = ImageDescriptor.createFromURL(url);
+	}
+
+	/**
+	 * Constructor
+	 * 
+	 * @param itemIndex
+	 *            item index to be edited
+	 * @param variableTracingTable
+	 *            table
+	 */
+	public DeactivateVariableTracingRuleAction(int itemIndex,
+			Table variableTracingTable) {
+		setText(Messages
+				.getString("DeactivateVariableTracingRuleAction.DeactivateRuleText")); //$NON-NLS-1$
+		setToolTipText(Messages
+				.getString("DeactivateVariableTracingRuleAction.DeactivateRuleToolTip")); //$NON-NLS-1$
+		setImageDescriptor(image);
+
+		this.itemIndex = itemIndex;
+		this.variableTracingTable = variableTracingTable;
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
+				TraceViewerHelpContextIDs.ACTIONS);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		// Remove the item from the property view items
+		List<VariableTracingItem> items = TraceViewerGlobals.getTraceViewer()
+				.getDataProcessorAccess().getVariableTracingProcessor()
+				.getVariableTracingItems();
+		items.remove(itemIndex);
+
+		// Remove from the actual table
+		variableTracingTable.remove(itemIndex);
+
+		// Remove from the rule list
+		List<VariableTracingTreeTextItem> textRules = TraceViewerGlobals
+				.getTraceViewer().getDataProcessorAccess()
+				.getVariableTracingProcessor().getTextRules();
+
+		textRules.remove(itemIndex);
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/EditLineCountRuleAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,85 @@
+/*
+ * 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:
+ *
+ * Handler for edit line count rule command
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import java.net.URL;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.dialog.LineCountDialog;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Handler for edit line count rule command
+ */
+public final class EditLineCountRuleAction extends TraceViewerAction {
+
+	/**
+	 * Image for this Action
+	 */
+	private static ImageDescriptor image;
+
+	/**
+	 * Item index in TracePropertyView to be edited
+	 */
+	private final int itemIndex;
+
+	static {
+		URL url = null;
+		url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				"/icons/count.gif"); //$NON-NLS-1$
+		image = ImageDescriptor.createFromURL(url);
+	}
+
+	/**
+	 * Constructor
+	 * 
+	 * @param itemIndex
+	 *            item index to be edited
+	 */
+	public EditLineCountRuleAction(int itemIndex) {
+		setText(Messages.getString("EditLineCountRuleAction.Title")); //$NON-NLS-1$
+		setToolTipText(Messages.getString("EditLineCountRuleAction.Tooltip")); //$NON-NLS-1$
+		setImageDescriptor(image);
+
+		this.itemIndex = itemIndex;
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
+				TraceViewerHelpContextIDs.ACTIONS);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		LineCountDialog dialog = TraceViewerGlobals.getTraceViewer()
+				.getDataProcessorAccess().getLineCountProcessor()
+				.getLineCountDialog();
+		if (dialog != null) {
+			dialog.editOrAddItem(itemIndex);
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/EditTraceCommentAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,106 @@
+/*
+ * 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:
+ *
+ * Handler for edit trace comment command
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import java.net.URL;
+
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.view.listener.SelectionProperties;
+
+/**
+ * Handler for edit trace comment command
+ */
+public final class EditTraceCommentAction extends TraceViewerAction {
+
+	/**
+	 * Image for this Action
+	 */
+	private static ImageDescriptor image;
+
+	/**
+	 * Trace which comment is to be edited
+	 */
+	private final int traceNumber;
+
+	static {
+		URL url = null;
+		url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				"/icons/count.gif"); //$NON-NLS-1$
+		image = ImageDescriptor.createFromURL(url);
+	}
+
+	/**
+	 * Constructor
+	 * 
+	 * @param traceNumber
+	 *            trace number
+	 */
+	public EditTraceCommentAction(int traceNumber) {
+		this.traceNumber = traceNumber;
+		setText(Messages.getString("EditTraceCommentAction.EditCommentText")); //$NON-NLS-1$
+		setToolTipText(Messages
+				.getString("EditTraceCommentAction.EditCommentToolTip")); //$NON-NLS-1$
+		setImageDescriptor(image);
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
+				TraceViewerHelpContextIDs.ACTIONS);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+
+		String traceComment = TraceViewerGlobals.getTraceViewer()
+				.getDataProcessorAccess().getTraceCommentHandler().getComment(
+						traceNumber);
+
+		// Show dialog
+		InputDialog dialog = new InputDialog(
+				Display.getCurrent().getActiveShell(),
+				Messages
+						.getString("EditTraceCommentAction.EditCommentShellTitle"), //$NON-NLS-1$
+				Messages.getString("EditTraceCommentAction.EditCommentTipText"), traceComment, new TraceCommentValidator()); //$NON-NLS-1$
+
+		if (dialog.open() == Window.OK) {
+			traceComment = dialog.getValue();
+
+			// First clear selections as they might get crazy when some text is
+			// taken out from the text widget
+			SelectionProperties.clear();
+
+			TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+					.getTraceCommentHandler().updateComment(traceNumber,
+							traceComment);
+		}
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/EditVariableTracingRuleAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,86 @@
+/*
+ * 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:
+ *
+ * Handler for edit variable tracing rule command
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import java.net.URL;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.dialog.VariableTracingDialog;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Handler for edit variable tracing rule command
+ */
+public final class EditVariableTracingRuleAction extends TraceViewerAction {
+
+	/**
+	 * Image for this Action
+	 */
+	private static ImageDescriptor image;
+
+	/**
+	 * Item index in TracePropertyView to be edited
+	 */
+	private final int itemIndex;
+
+	static {
+		URL url = null;
+		url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				"/icons/tracevariable.gif"); //$NON-NLS-1$
+		image = ImageDescriptor.createFromURL(url);
+	}
+
+	/**
+	 * Constructor
+	 * 
+	 * @param itemIndex
+	 *            item index to be edited
+	 */
+	public EditVariableTracingRuleAction(int itemIndex) {
+		setText(Messages.getString("EditVariableTracingRuleAction.Title")); //$NON-NLS-1$
+		setToolTipText(Messages
+				.getString("EditVariableTracingRuleAction.Tooltip")); //$NON-NLS-1$
+		setImageDescriptor(image);
+
+		this.itemIndex = itemIndex;
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
+				TraceViewerHelpContextIDs.ACTIONS);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		VariableTracingDialog dialog = TraceViewerGlobals.getTraceViewer()
+				.getDataProcessorAccess().getVariableTracingProcessor()
+				.getVariableTracingDialog();
+		if (dialog != null) {
+			dialog.editOrAddItem(itemIndex);
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/FilterAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,78 @@
+/*
+ * 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:
+ *
+ * Handler for filter command
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import java.net.URL;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.engine.TraceViewerDialog;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Handler for filter command
+ * 
+ */
+final class FilterAction extends TraceViewerAction {
+
+	/**
+	 * Image for the action
+	 */
+	private static ImageDescriptor image;
+
+	static {
+		URL url = null;
+		url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				"/icons/filter.gif"); //$NON-NLS-1$
+		image = ImageDescriptor.createFromURL(url);
+	}
+
+	/**
+	 * Constructor
+	 */
+	FilterAction() {
+		setText(Messages.getString("FilterAction.Title")); //$NON-NLS-1$
+		setToolTipText(Messages.getString("FilterAction.Tooltip")); //$NON-NLS-1$
+		setImageDescriptor(image);
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
+				TraceViewerHelpContextIDs.ACTIONS);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		TraceViewerGlobals.postUiEvent("FilterButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+		TraceViewerDialog dialog = TraceViewerGlobals.getTraceViewer()
+				.getDataProcessorAccess().getFilterProcessor()
+				.getFilterDialog();
+		if (dialog != null) {
+			dialog.openDialog();
+		}
+		TraceViewerGlobals.postUiEvent("FilterButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/JumpToTraceAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,80 @@
+/*
+ * 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:
+ *
+ * Handler for jump to trace command
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import java.net.URL;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.api.TraceViewerAPI;
+
+/**
+ * Handler for jump to trace command
+ */
+public final class JumpToTraceAction extends TraceViewerAction {
+
+	/**
+	 * Image for this Action
+	 */
+	private static ImageDescriptor image;
+
+	/**
+	 * Trace which comment is to be jumped to
+	 */
+	private final int traceNumber;
+
+	static {
+		URL url = null;
+		url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				"/icons/gotolocation.gif"); //$NON-NLS-1$
+		image = ImageDescriptor.createFromURL(url);
+	}
+
+	/**
+	 * Constructor
+	 * 
+	 * @param traceNumber
+	 *            trace number
+	 */
+	public JumpToTraceAction(int traceNumber) {
+		this.traceNumber = traceNumber;
+		setText(Messages.getString("JumpToTraceAction.JumpToTraceText")); //$NON-NLS-1$
+		setToolTipText(Messages
+				.getString("JumpToTraceAction.JumpToTraceToolTip")); //$NON-NLS-1$
+		setImageDescriptor(image);
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
+				TraceViewerHelpContextIDs.ACTIONS);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		TraceViewerAPI.syncToTrace(traceNumber, traceNumber);
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/LogCloseAsciiAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,79 @@
+/*
+ * 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:
+ *
+ * Handler for close ascii log command
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import java.net.URL;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Handler for close ascii log command
+ * 
+ */
+final class LogCloseAsciiAction extends TraceViewerAction {
+
+	/**
+	 * Image for the action
+	 */
+	private static ImageDescriptor image;
+
+	static {
+		URL url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				"/icons/logclose.gif"); //$NON-NLS-1$
+		image = ImageDescriptor.createFromURL(url);
+	}
+
+	/**
+	 * Constructor
+	 */
+	LogCloseAsciiAction() {
+		setText(Messages.getString("LogCloseAsciiAction.Title")); //$NON-NLS-1$
+		setToolTipText(Messages.getString("LogCloseAsciiAction.Tooltip")); //$NON-NLS-1$
+		setImageDescriptor(image);
+		setActionDefinitionId("com.nokia.traceviewer.command.close_ascii_log"); //$NON-NLS-1$
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
+				TraceViewerHelpContextIDs.LOGGING);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		TraceViewerGlobals.postUiEvent("LogCloseAsciiAction", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+		TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+				.getLogger().stopPlainTextLogging();
+
+		// Remove possible CloseAndRestartLogging button
+		TraceViewerGlobals.getTraceViewer().getView().getActionFactory()
+				.removeCloseAndRestartLoggingButton();
+
+		TraceViewerGlobals.postUiEvent("LogCloseAsciiAction", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/LogCloseAsciiGlobalAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,51 @@
+/*
+ * 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:
+ *
+ * Handler for close ascii log global command
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.dataprocessor.Logger;
+
+/**
+ * Handler for close ascii log global command
+ */
+public final class LogCloseAsciiGlobalAction extends TraceViewerGlobalAction {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerGlobalAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		// Get the logger DataProcessor
+		Logger logger = TraceViewerGlobals.getTraceViewer()
+				.getDataProcessorAccess().getLogger();
+
+		boolean asciiLogging = logger.isPlainLogging();
+		boolean logFileOpened = logger.isLogFileOpened();
+
+		// ASCII logging must be on to be able to close it
+		if (asciiLogging && !logFileOpened) {
+
+			TraceViewerGlobals.getTraceViewer().getView().getActionFactory()
+					.getLogCloseAsciiAction().run();
+		}
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/LogCloseBinaryAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,74 @@
+/*
+ * 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:
+ *
+ * Handler for close binary log command
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import java.net.URL;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Handler for close binary log command
+ * 
+ */
+final class LogCloseBinaryAction extends TraceViewerAction {
+
+	/**
+	 * Image for the action
+	 */
+	private static ImageDescriptor image;
+
+	static {
+		URL url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				"/icons/logclose.gif"); //$NON-NLS-1$
+		image = ImageDescriptor.createFromURL(url);
+	}
+
+	/**
+	 * Constructor
+	 */
+	LogCloseBinaryAction() {
+		setText(Messages.getString("LogCloseBinaryAction.Title")); //$NON-NLS-1$
+		setToolTipText(Messages.getString("LogCloseBinaryAction.Tooltip")); //$NON-NLS-1$
+		setImageDescriptor(image);
+		setActionDefinitionId("com.nokia.traceviewer.command.close_binary_log"); //$NON-NLS-1$
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
+				TraceViewerHelpContextIDs.LOGGING);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		TraceViewerGlobals.postUiEvent("LogCloseBinaryAction", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+		TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+				.getLogger().stopBinLogging();
+		TraceViewerGlobals.postUiEvent("LogCloseBinaryAction", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/LogCloseBinaryGlobalAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,51 @@
+/*
+ * 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:
+ *
+ * Handler for close binary log global command
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.dataprocessor.Logger;
+
+/**
+ * Handler for close binary log global command
+ */
+public final class LogCloseBinaryGlobalAction extends TraceViewerGlobalAction {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerGlobalAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		// Get the logger DataProcessor
+		Logger logger = TraceViewerGlobals.getTraceViewer()
+				.getDataProcessorAccess().getLogger();
+
+		boolean binaryLogging = logger.isBinLogging();
+		boolean logFileOpened = logger.isLogFileOpened();
+
+		// Binary logging must be on to be able to close it
+		if (binaryLogging && !logFileOpened) {
+
+			TraceViewerGlobals.getTraceViewer().getView().getActionFactory()
+					.getLogCloseBinaryAction().run();
+		}
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/LogNewAsciiAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,102 @@
+/*
+ * 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:
+ *
+ * Handler for new ascii log command
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import java.net.URL;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.dialog.LogAsciiOptionsSelectionDialog;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Handler for new ascii log command
+ * 
+ */
+final class LogNewAsciiAction extends TraceViewerAction {
+
+	/**
+	 * Filters in save file dialog
+	 */
+	private static final String[] FILTER_NAMES = { Messages
+			.getString("LogNewAsciiAction.FilterNames") }; //$NON-NLS-1$
+
+	/**
+	 * Extension filters in save file dialog
+	 */
+	private static final String[] FILTER_EXTS = { "*.txt", "*.*" }; //$NON-NLS-1$ //$NON-NLS-2$
+
+	/**
+	 * Image for the action
+	 */
+	private static ImageDescriptor image;
+
+	static {
+		URL url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				"/icons/log.gif"); //$NON-NLS-1$
+		image = ImageDescriptor.createFromURL(url);
+	}
+
+	/**
+	 * Constructor
+	 */
+	LogNewAsciiAction() {
+		setText(Messages.getString("LogNewAsciiAction.Title")); //$NON-NLS-1$
+		setToolTipText(Messages.getString("LogNewAsciiAction.Tooltip")); //$NON-NLS-1$
+		setImageDescriptor(image);
+		setActionDefinitionId("com.nokia.traceviewer.command.new_ascii_log"); //$NON-NLS-1$
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
+				TraceViewerHelpContextIDs.LOGGING);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		TraceViewerGlobals.postUiEvent("LogNewAsciiAction", "1"); //$NON-NLS-1$ //$NON-NLS-2$'
+
+		// Bring up a file save dialog
+		String[] files = TraceViewerActionUtils.openFileDialog(FILTER_NAMES,
+				FILTER_EXTS, null, null, false, false);
+
+		// Check if a file name was given
+		if (files != null && files.length > 0) {
+			String fileName = files[0];
+
+			// Open new ascii option selection dialog. It will then start the
+			// logging if necessary
+			LogAsciiOptionsSelectionDialog dialog = new LogAsciiOptionsSelectionDialog(
+					PlatformUI.getWorkbench().getDisplay().getActiveShell(),
+					fileName);
+
+			dialog.open();
+		}
+
+		TraceViewerGlobals.postUiEvent("LogNewAsciiAction", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/LogNewAsciiGlobalAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,51 @@
+/*
+ * 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:
+ *
+ * Handler for new ascii log global command
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.dataprocessor.Logger;
+
+/**
+ * Handler for new ascii log global command
+ */
+public final class LogNewAsciiGlobalAction extends TraceViewerGlobalAction {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerGlobalAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		// Get the logger DataProcessor
+		Logger logger = TraceViewerGlobals.getTraceViewer()
+				.getDataProcessorAccess().getLogger();
+
+		boolean asciiLogging = logger.isPlainLogging();
+		boolean logFileOpened = logger.isLogFileOpened();
+
+		// ASCII logging must be off to be able to start it
+		if (!asciiLogging && !logFileOpened) {
+
+			TraceViewerGlobals.getTraceViewer().getView().getActionFactory()
+					.getLogNewAsciiAction().run();
+		}
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/LogNewBinaryAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,97 @@
+/*
+ * 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:
+ *
+ * Handler for new binary log command
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import java.net.URL;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Handler for new binary log command
+ * 
+ */
+final class LogNewBinaryAction extends TraceViewerAction {
+
+	/**
+	 * Filters in save file dialog
+	 */
+	private static final String[] FILTER_NAMES = { Messages
+			.getString("LogNewBinaryAction.FilterNames") }; //$NON-NLS-1$
+
+	/**
+	 * Extension filters in save file dialog
+	 */
+	private static final String[] FILTER_EXTS = { "*.bin", "*.*" }; //$NON-NLS-1$ //$NON-NLS-2$
+
+	/**
+	 * Image for the action
+	 */
+	private static ImageDescriptor image;
+
+	static {
+		URL url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				"/icons/log.gif"); //$NON-NLS-1$
+		image = ImageDescriptor.createFromURL(url);
+	}
+
+	/**
+	 * Constructor
+	 */
+	LogNewBinaryAction() {
+		setText(Messages.getString("LogNewBinaryAction.Title")); //$NON-NLS-1$
+		setToolTipText(Messages.getString("LogNewBinaryAction.Tooltip")); //$NON-NLS-1$
+		setImageDescriptor(image);
+		setActionDefinitionId("com.nokia.traceviewer.command.new_binary_log"); //$NON-NLS-1$
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
+				TraceViewerHelpContextIDs.LOGGING);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		TraceViewerGlobals.postUiEvent("LogNewBinaryAction", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+
+		// Bring up a file save dialog
+		String[] files = TraceViewerActionUtils.openFileDialog(FILTER_NAMES,
+				FILTER_EXTS, null, null, false, false);
+
+		// Check if a file name was given
+		if (files != null && files.length > 0) {
+			String fileName = files[0];
+
+			// Start logging
+			TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+					.getLogger().startBinaryLogging(fileName);
+		}
+
+		TraceViewerGlobals.postUiEvent("LogNewBinaryAction", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/LogNewBinaryGlobalAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,51 @@
+/*
+ * 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:
+ *
+ * Handler for new binary log global command
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.dataprocessor.Logger;
+
+/**
+ * Handler for new binary log global command
+ */
+public final class LogNewBinaryGlobalAction extends TraceViewerGlobalAction {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerGlobalAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		// Get the logger DataProcessor
+		Logger logger = TraceViewerGlobals.getTraceViewer()
+				.getDataProcessorAccess().getLogger();
+
+		boolean binaryLogging = logger.isBinLogging();
+		boolean logFileOpened = logger.isLogFileOpened();
+
+		// Binary logging must be off to be able to start it
+		if (!binaryLogging && !logFileOpened) {
+
+			TraceViewerGlobals.getTraceViewer().getView().getActionFactory()
+					.getLogNewBinaryAction().run();
+		}
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/LogOpenLogAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,172 @@
+/*
+ * 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:
+ *
+ * Handler for open log command
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import java.io.File;
+import java.net.URL;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.engine.TraceProvider;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.preferences.PreferenceConstants;
+
+/**
+ * Handler for open log command
+ * 
+ */
+final class LogOpenLogAction extends TraceViewerAction {
+
+	/**
+	 * Filters in plain text open file dialog
+	 */
+	private static final String[] FILTER_NAMES = { Messages
+			.getString("LogOpenLogAction.FilterNames") }; //$NON-NLS-1$
+
+	/**
+	 * Extension filters in plain text open file dialog
+	 */
+	private static final String[] FILTER_EXTS = { "*.bin;*.txt", "*.*" }; //$NON-NLS-1$ //$NON-NLS-2$
+
+	/**
+	 * Image for the action
+	 */
+	private static ImageDescriptor image;
+
+	static {
+		URL url = null;
+		url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				"/icons/logopen.gif"); //$NON-NLS-1$
+		image = ImageDescriptor.createFromURL(url);
+	}
+
+	/**
+	 * Constructor
+	 */
+	LogOpenLogAction() {
+		setText(Messages.getString("LogOpenLogAction.Title")); //$NON-NLS-1$
+		setToolTipText(Messages.getString("LogOpenLogAction.Tooltip")); //$NON-NLS-1$
+		setImageDescriptor(image);
+		setActionDefinitionId("com.nokia.traceviewer.command.open_log"); //$NON-NLS-1$
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
+				TraceViewerHelpContextIDs.LOGGING);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		TraceViewerGlobals.postUiEvent("LogOpenLogAction", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+
+		// Bring up a file selection dialog
+		String[] files = TraceViewerActionUtils.openFileDialog(FILTER_NAMES,
+				FILTER_EXTS, null, null, false, true);
+
+		// Check if a file was selected
+		if (files != null && files.length > 0) {
+			String fileName = files[0];
+
+			// Check if file exists or give an error
+			File file = new File(fileName);
+			if (file.exists()) {
+
+				boolean binary = true;
+
+				// Check extension
+				if (file.getName().endsWith(".txt")) { //$NON-NLS-1$
+					binary = false;
+				} else {
+
+					// Check if format seems to match
+					checkIfDataFormatMatches(fileName);
+				}
+
+				// Tell the Logger to open the file
+				TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+						.getLogger().openLogFile(fileName, binary);
+
+				// Update view
+				TraceViewerGlobals.getTraceViewer().getView().updateViewName();
+			} else {
+				String msg = Messages
+						.getString("LogOpenLogAction.FileDoesntExist"); //$NON-NLS-1$
+				TraceViewerGlobals.getTraceViewer().getDialogs()
+						.showErrorMessage(msg);
+			}
+		}
+		TraceViewerGlobals.postUiEvent("LogOpenLogAction", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+
+	/**
+	 * Checks if the data format matches and asks user to change it if not
+	 * 
+	 * @param fileName
+	 *            file name
+	 */
+	private void checkIfDataFormatMatches(String fileName) {
+		boolean dataMatches = TraceViewerGlobals.getTraceProvider()
+				.checkIfFileFormatMatches(fileName);
+
+		if (!dataMatches) {
+
+			// Try with other TraceProviders
+			for (int i = 0; i < TraceViewerGlobals.getListOfTraceProviders()
+					.size(); i++) {
+				TraceProvider provider = TraceViewerGlobals
+						.getListOfTraceProviders().get(i);
+
+				// Don't try with the one that is in use
+				if (!provider.getName().equals(
+						TraceViewerGlobals.getTraceProvider().getName())) {
+
+					// Check if data format seems to match
+					if (provider.checkIfFileFormatMatches(fileName)) {
+						String msg1 = Messages
+								.getString("LogOpenLogAction.ChangeDataFormatMsg1"); //$NON-NLS-1$
+						String msg2 = Messages
+								.getString("LogOpenLogAction.ChangeDataFormatMsg2"); //$NON-NLS-1$
+
+						// Ask user if he wants to change data format
+						boolean change = TraceViewerGlobals.getTraceViewer()
+								.getDialogs().showConfirmationDialog(
+										msg1 + provider.getName() + msg2);
+
+						// Change data format
+						if (change) {
+							TraceViewerPlugin.getDefault().getPreferenceStore()
+									.setValue(PreferenceConstants.DATA_FORMAT,
+											provider.getName());
+							TraceViewerGlobals
+									.setTraceProvider(provider, false);
+							break;
+						}
+					}
+				}
+			}
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/LogOpenLogGlobalAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,39 @@
+/*
+ * 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:
+ *
+ * Handler for open log global command
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Handler for open log global command
+ */
+public final class LogOpenLogGlobalAction extends TraceViewerGlobalAction {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerGlobalAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		TraceViewerGlobals.getTraceViewer().getView().getActionFactory()
+				.getLogOpenLogAction().run();
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/LogSaveAsciiAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,318 @@
+/*
+ * 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:
+ *
+ * Handler for save ascii log command
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import java.io.FileNotFoundException;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.net.URL;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.dialog.ProgressBarDialog;
+import com.nokia.traceviewer.engine.DataProcessorAccess;
+import com.nokia.traceviewer.engine.TraceProperties;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.TraceViewerDialogInterface.Dialog;
+
+/**
+ * Handler for save ascii log command
+ */
+public final class LogSaveAsciiAction extends TraceViewerAction {
+
+	/**
+	 * Number of traces to process once
+	 */
+	private static final int NUMBER_OF_TRACES_TO_PROCESS = 400;
+
+	/**
+	 * Filters in save file dialog
+	 */
+	private static final String[] FILTER_NAMES = { Messages
+			.getString("LogSaveAsciiAction.FilterNames") }; //$NON-NLS-1$
+
+	/**
+	 * Extension filters in save file dialog
+	 */
+	private static final String[] FILTER_EXTS = { "*.txt", "*.*" }; //$NON-NLS-1$ //$NON-NLS-2$
+
+	/**
+	 * Image for the action
+	 */
+	private static ImageDescriptor image;
+
+	/**
+	 * Progressbar
+	 */
+	private ProgressBarDialog progressBar;
+
+	/**
+	 * Saving file boolean
+	 */
+	private boolean savingFile;
+
+	/**
+	 * Writer to be used for writing
+	 */
+	private PrintWriter plainOutput;
+
+	/**
+	 * End line character \n
+	 */
+	private static final char ENDLINE_N = '\n';
+
+	/**
+	 * Tabulator character
+	 */
+	private static final char TABULATOR = '\t';
+
+	static {
+		URL url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				"/icons/logsaveascii.gif"); //$NON-NLS-1$
+		image = ImageDescriptor.createFromURL(url);
+	}
+
+	/**
+	 * Constructor
+	 */
+	LogSaveAsciiAction() {
+		setText(Messages.getString("LogSaveAsciiAction.Title")); //$NON-NLS-1$
+		setToolTipText(Messages.getString("LogSaveAsciiAction.Tooltip")); //$NON-NLS-1$
+		setImageDescriptor(image);
+		setActionDefinitionId("com.nokia.traceviewer.command.save_ascii_log"); //$NON-NLS-1$
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
+				TraceViewerHelpContextIDs.LOGGING);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		TraceViewerGlobals.postUiEvent("LogSaveAsciiAction", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+
+		// Bring up a file save dialog
+		String[] files = TraceViewerActionUtils.openFileDialog(FILTER_NAMES,
+				FILTER_EXTS, null, null, false, false);
+
+		// Check if a file name was given
+		if (files != null && files.length > 0) {
+			String fileName = files[0];
+			final int numberOfTraces = TraceViewerGlobals.getTraceViewer()
+					.getDataReaderAccess().getMainDataReader().getTraceCount();
+
+			// Create file writer
+			boolean writerOk = buildPlainFileWriter(fileName);
+
+			if (writerOk) {
+
+				// Create progressbar
+				progressBar = (ProgressBarDialog) TraceViewerGlobals
+						.getTraceViewer().getDialogs().createDialog(
+								Dialog.PROGRESSBAR);
+
+				// Create new thread
+				new Thread() {
+
+					/*
+					 * (non-Javadoc)
+					 * 
+					 * @see java.lang.Thread#run()
+					 */
+					@Override
+					public void run() {
+						try {
+							int traceNumberToProcess = 0;
+
+							// Get block of traces from the binary file
+							while (traceNumberToProcess < numberOfTraces) {
+
+								// From 0 to 399.
+								List<TraceProperties> traces = TraceViewerGlobals
+										.getTraceViewer()
+										.getTraces(
+												traceNumberToProcess,
+												traceNumberToProcess
+														+ NUMBER_OF_TRACES_TO_PROCESS
+														- 1);
+								Iterator<TraceProperties> i = traces.iterator();
+
+								// Iterate through the block of traces
+								while (i.hasNext()) {
+									TraceProperties trace = i.next();
+									String processedTrace = processTrace(trace);
+
+									if (processedTrace != null) {
+										plainOutput.write(processedTrace);
+									}
+								}
+
+								// Increase the counter value and update
+								// progressbar
+								traceNumberToProcess += NUMBER_OF_TRACES_TO_PROCESS;
+								notifyFilePosition(traceNumberToProcess);
+							}
+
+						} catch (Exception e) {
+							e.printStackTrace();
+
+							// Close the progressbar and the file writer
+						} finally {
+							TraceViewerGlobals.getTraceViewer().getView()
+									.closeProgressBar(progressBar);
+							plainOutput.flush();
+							plainOutput.close();
+						}
+					}
+
+				}.start();
+
+				savingFile = true;
+				progressBar.open(numberOfTraces, Messages
+						.getString("LogSaveAsciiAction.SavingText")); //$NON-NLS-1$
+				savingFile = false;
+
+				// Export possible comments
+				TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+						.getTraceCommentHandler().exportTraceComments(fileName);
+
+			} else {
+				System.out
+						.println(Messages
+								.getString("LogSaveAsciiAction.CannotCreateFileWriter")); //$NON-NLS-1$
+			}
+		}
+
+		TraceViewerGlobals.postUiEvent("LogSaveAsciiAction", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+
+	/**
+	 * Processes trace
+	 * 
+	 * @param properties
+	 *            trace properties
+	 * @return the processed trace
+	 */
+	protected String processTrace(TraceProperties properties) {
+		String ret = null;
+		StringBuffer trace = null;
+
+		DataProcessorAccess dpa = TraceViewerGlobals.getTraceViewer()
+				.getDataProcessorAccess();
+
+		// If binary trace, decode it
+		if (properties.binaryTrace) {
+			dpa.getDecoder().processData(properties);
+		}
+
+		// Null timestamp from first trace
+		if (properties.traceNumber == 1) {
+			TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+					.getTimestampParser().nullPreviousTimestamp();
+		}
+
+		// Parse timestamp
+		dpa.getTimestampParser().processData(properties);
+
+		// Normal ASCII trace log
+		if (!properties.binaryTrace) {
+
+			// No timestamp
+			if (properties.timestampString == null) {
+				int traceLen = properties.traceString.length() + 1;
+				trace = new StringBuffer(traceLen);
+				trace.append(properties.traceString);
+				trace.append(ENDLINE_N);
+
+				// With timestamp
+			} else {
+				StringBuffer timeFromPreviousSB = TraceViewerGlobals
+						.getTraceViewer().getDataProcessorAccess()
+						.getTimestampParser().getTimeFromPreviousString(
+								properties.timeFromPreviousTrace);
+				int traceLen = properties.timestampString.length() + 1
+						+ timeFromPreviousSB.length()
+						+ properties.traceString.length() + 1;
+				trace = new StringBuffer(traceLen);
+				trace.append(properties.timestampString);
+				trace.append(timeFromPreviousSB);
+				trace.append(TABULATOR);
+				trace.append(properties.traceString);
+				trace.append(ENDLINE_N);
+			}
+			ret = trace.toString();
+		}
+		return ret;
+	}
+
+	/**
+	 * Is saving file
+	 * 
+	 * @return true if saving file is going on
+	 */
+	public boolean isSavingFile() {
+		return savingFile;
+	}
+
+	/**
+	 * Update progress bar with file position
+	 * 
+	 * @param traceNumber
+	 *            trace number
+	 */
+	public void notifyFilePosition(int traceNumber) {
+
+		// Only update every third time to get more speed
+		if (progressBar != null) {
+			progressBar.updateProgressBar(traceNumber);
+		}
+	}
+
+	/**
+	 * Builds the plain file writer
+	 * 
+	 * @param filePath
+	 *            file path to save the log
+	 * @return status of building plain text file
+	 */
+	public boolean buildPlainFileWriter(String filePath) {
+		boolean success = false;
+
+		try {
+			plainOutput = new PrintWriter(new FileWriter(filePath));
+			success = true;
+		} catch (FileNotFoundException e) {
+			e.printStackTrace();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+
+		return success;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/LogSaveAsciiGlobalAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,39 @@
+/*
+ * 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:
+ *
+ * Handler for save ascii log global command
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Handler for save ascii log global command
+ */
+public final class LogSaveAsciiGlobalAction extends TraceViewerGlobalAction {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerGlobalAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		TraceViewerGlobals.getTraceViewer().getView().getActionFactory()
+				.getLogSaveAsciiAction().run();
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/LogSaveBinaryAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,233 @@
+/*
+ * 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:
+ *
+ * Handler for save binary log command
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import java.io.File;
+import java.net.URL;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.dialog.ProgressBarDialog;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.TraceViewerDialogInterface.Dialog;
+
+/**
+ * Handler for save binary log command
+ * 
+ */
+public final class LogSaveBinaryAction extends TraceViewerAction implements
+		CopyFileProgressCallback {
+
+	/**
+	 * Divide long values with this to get integers
+	 */
+	private static final int LONG_DIVIDER = 10000;
+
+	/**
+	 * Filters in save file dialog
+	 */
+	private static final String[] FILTER_NAMES = { Messages
+			.getString("LogSaveBinaryAction.FilterNames") }; //$NON-NLS-1$
+
+	/**
+	 * Extension filters in save file dialog
+	 */
+	private static final String[] FILTER_EXTS = { "*.bin", "*.*" }; //$NON-NLS-1$ //$NON-NLS-2$
+
+	/**
+	 * Image for the action
+	 */
+	private static ImageDescriptor image;
+
+	/**
+	 * Progressbar
+	 */
+	private ProgressBarDialog progressBar;
+
+	/**
+	 * Callback for copy file
+	 */
+	private final CopyFileProgressCallback callback;
+
+	/**
+	 * Saving file boolean
+	 */
+	private boolean savingFile;
+
+	/**
+	 * Update count
+	 */
+	private int updateCount;
+
+	static {
+		URL url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				"/icons/logsavebinary.gif"); //$NON-NLS-1$
+		image = ImageDescriptor.createFromURL(url);
+	}
+
+	/**
+	 * Constructor
+	 */
+	LogSaveBinaryAction() {
+		setText(Messages.getString("LogSaveBinaryAction.Title")); //$NON-NLS-1$
+		setToolTipText(Messages.getString("LogSaveBinaryAction.Tooltip")); //$NON-NLS-1$
+		setImageDescriptor(image);
+		setActionDefinitionId("com.nokia.traceviewer.command.save_binary_log"); //$NON-NLS-1$
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
+				TraceViewerHelpContextIDs.LOGGING);
+
+		callback = this;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		TraceViewerGlobals.postUiEvent("LogSaveBinaryAction", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+
+		// Bring up a file save dialog
+		String[] files = TraceViewerActionUtils.openFileDialog(FILTER_NAMES,
+				FILTER_EXTS, null, null, false, false);
+
+		// Check if a file name was given
+		if (files != null && files.length > 0) {
+			String fileName = files[0];
+			final File targetFile = new File(fileName);
+			final File sourceFile = getSourceFile();
+
+			// Create progressbar
+			updateCount = 0;
+			progressBar = (ProgressBarDialog) TraceViewerGlobals
+					.getTraceViewer().getDialogs().createDialog(
+							Dialog.PROGRESSBAR);
+
+			// Create new thread
+			new Thread() {
+
+				/*
+				 * (non-Javadoc)
+				 * 
+				 * @see java.lang.Thread#run()
+				 */
+				@Override
+				public void run() {
+					try {
+						// Start copying the file
+						TraceViewerActionUtils.copyFile(sourceFile, targetFile,
+								callback, TraceViewerGlobals.getTraceViewer()
+										.getDataReaderAccess()
+										.getCurrentDataReader()
+										.getFileStartOffset());
+					} catch (Exception e) {
+						// Close the progressBar if still open
+						TraceViewerGlobals.getTraceViewer().getView()
+								.closeProgressBar(progressBar);
+					}
+				}
+
+			}.start();
+
+			savingFile = true;
+			progressBar.open((int) (sourceFile.length() / LONG_DIVIDER),
+					Messages.getString("LogSaveBinaryAction.SavingText")); //$NON-NLS-1$
+			savingFile = false;
+
+			// Export possible comments
+			TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+					.getTraceCommentHandler().exportTraceComments(fileName);
+		}
+
+		TraceViewerGlobals.postUiEvent("LogSaveBinaryAction", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+
+	/**
+	 * Gets source file
+	 * 
+	 * @return source file to copy
+	 */
+	private File getSourceFile() {
+		String currentFile = TraceViewerGlobals.getTraceViewer()
+				.getDataReaderAccess().getCurrentDataReader().getFilePath();
+
+		File file = new File(currentFile);
+		return file;
+	}
+
+	/**
+	 * Is saving file
+	 * 
+	 * @return true if saving file is going on
+	 */
+	public boolean isSavingFile() {
+		return savingFile;
+	}
+
+	/**
+	 * Set saving file
+	 * 
+	 * @param savingFile
+	 *            new saving file status
+	 */
+	public void setSavingFile(boolean savingFile) {
+		this.savingFile = savingFile;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.action.CopyFileProgressCallback#notifyFilePosition
+	 * (long)
+	 */
+	public void notifyFilePosition(long filePosition) {
+
+		// Only update every third time to get more speed
+		if (progressBar != null && updateCount++ % 3 == 0) {
+			progressBar.updateProgressBar((int) (filePosition / LONG_DIVIDER));
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.action.CopyFileProgressCallback#cancelCopying()
+	 */
+	public boolean cancelCopying() {
+		return !savingFile;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.CopyFileProgressCallback#copyingReady()
+	 */
+	public void copyingFinished() {
+		TraceViewerGlobals.getTraceViewer().getView().closeProgressBar(
+				progressBar);
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/LogSaveBinaryGlobalAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,39 @@
+/*
+ * 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:
+ *
+ * Handler for save binary log global command
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Handler for save binary log global command
+ */
+public final class LogSaveBinaryGlobalAction extends TraceViewerGlobalAction {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerGlobalAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		TraceViewerGlobals.getTraceViewer().getView().getActionFactory()
+				.getLogSaveBinaryAction().run();
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/Messages.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,63 @@
+/*
+ * 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:
+ *
+ * String localization for action package.
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * String localization for action package.
+ * 
+ */
+final class Messages {
+
+	/**
+	 * Bundle name
+	 */
+	private static final String BUNDLE_NAME = "com.nokia.traceviewer.action.messages"; //$NON-NLS-1$
+
+	/**
+	 * Resource bundle
+	 */
+	private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
+			.getBundle(BUNDLE_NAME);
+
+	/**
+	 * Prevents construction.
+	 */
+	private Messages() {
+	}
+
+	/**
+	 * Maps a key to localized string.
+	 * 
+	 * @param key
+	 *            the key for the string
+	 * @return the localized string
+	 */
+	public static String getString(String key) {
+		String value;
+		try {
+			value = RESOURCE_BUNDLE.getString(key);
+		} catch (MissingResourceException e) {
+			value = '!' + key + '!';
+		}
+		return value;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/OpenConnectionSettingsAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,75 @@
+/*
+ * 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:
+ *
+ * Handler for open connection settings action
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import java.net.URL;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.TraceViewerDialogInterface.TVPreferencePage;
+
+/**
+ * Handler for open connection settings action
+ * 
+ */
+final class OpenConnectionSettingsAction extends TraceViewerAction {
+
+	/**
+	 * Image for this Action
+	 */
+	private static ImageDescriptor image;
+
+	static {
+		URL url = null;
+		url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				"/icons/connectionsettings.gif"); //$NON-NLS-1$
+		image = ImageDescriptor.createFromURL(url);
+	}
+
+	/**
+	 * Constructor
+	 */
+	OpenConnectionSettingsAction() {
+		setText(Messages.getString("OpenConnectionSettingsAction.Title")); //$NON-NLS-1$
+		setToolTipText(Messages
+				.getString("OpenConnectionSettingsAction.Tooltip")); //$NON-NLS-1$
+		setImageDescriptor(image);
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
+				TraceViewerHelpContextIDs.CONNECTION_PREFERENCES);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		TraceViewerGlobals.postUiEvent("ConnectionSettingsButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+		TraceViewerGlobals.getTraceViewer().getDialogs().openPreferencePage(
+				TVPreferencePage.CONNECTION);
+		TraceViewerGlobals.postUiEvent("ConnectionSettingsButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/OpenDecodeFileAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,388 @@
+/*
+ * 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:
+ *
+ * Handler for open decode file command
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.dialog.ProgressBarDialog;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.TraceViewerUtils;
+import com.nokia.traceviewer.engine.TraceViewerDialogInterface.Dialog;
+
+/**
+ * Handler for open decode file command
+ * 
+ */
+public final class OpenDecodeFileAction extends TraceViewerAction {
+
+	/**
+	 * Maximum number of file paths to show in open dialog
+	 */
+	private static final int MAX_PATHS_IN_DIALOG = 10;
+
+	/**
+	 * Spaces to indent text in dialog
+	 */
+	private static final String SPACING = "    "; //$NON-NLS-1$
+
+	/**
+	 * Filter names in open file dialog
+	 */
+	static final String[] FILTER_NAMES = { Messages
+			.getString("OpenDecodeFileAction.FilterNamesOST") }; //$NON-NLS-1$
+
+	/**
+	 * Filter extensions in open file dialog
+	 */
+	static final String[] FILTER_EXTS = { "*.xml;*.zip", "*.*" }; //$NON-NLS-1$ //$NON-NLS-2$
+
+	/**
+	 * Progress Bar
+	 */
+	private ProgressBarDialog progressBarDialog;
+
+	/**
+	 * Dictionary files to open in startup. Filled when reading general settings
+	 * file when starting TraceViewer.
+	 */
+	private final List<String> openInStartupFiles = new ArrayList<String>();
+
+	/**
+	 * Process reason when building decode model
+	 */
+	private final String processReasonBuild = Messages
+			.getString("OpenDecodeFileAction.BuildingModelString"); //$NON-NLS-1$
+
+	/**
+	 * Process reason when decoding traces
+	 */
+	private final String processReasonDecode = Messages
+			.getString("OpenDecodeFileAction.DecodingTracesString"); //$NON-NLS-1$
+
+	/**
+	 * Tells that we are already decoding traces
+	 */
+	private boolean decodingTraces;
+
+	/**
+	 * Image for this action
+	 */
+	private static ImageDescriptor image;
+	static {
+		URL url = null;
+		url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				"/icons/opendecodefile.gif"); //$NON-NLS-1$
+		image = ImageDescriptor.createFromURL(url);
+	}
+
+	/**
+	 * Constructor
+	 */
+	OpenDecodeFileAction() {
+		setText(Messages.getString("OpenDecodeFileAction.Title")); //$NON-NLS-1$
+		setToolTipText(Messages.getString("OpenDecodeFileAction.Tooltip")); //$NON-NLS-1$
+		setImageDescriptor(image);
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
+				TraceViewerHelpContextIDs.ACTIONS);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		TraceViewerGlobals.postUiEvent("OpenDecodeFileButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+
+		// DecodeProvider must be available
+		if (TraceViewerGlobals.getDecodeProvider() != null) {
+
+			// Pause the datareader if it's not paused already
+			boolean wasPausedWhenEntered = TraceViewerGlobals.getTraceViewer()
+					.getDataReaderAccess().getMainDataReader().isPaused();
+
+			if (!wasPausedWhenEntered) {
+				TraceViewerGlobals.getTraceViewer().getView()
+						.getActionFactory().getPauseAction().run();
+			}
+
+			// Get files
+			String[] files = TraceViewerActionUtils.openFileDialog(
+					FILTER_NAMES, FILTER_EXTS, null, null, true, true);
+
+			// Load files to model
+			loadFilesToModel(files, true);
+
+			// Unpause
+			if (!wasPausedWhenEntered) {
+				TraceViewerGlobals.getTraceViewer().getView()
+						.getActionFactory().getPauseAction().run();
+			}
+
+		}
+		TraceViewerGlobals.postUiEvent("OpenDecodeFileButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+
+	/**
+	 * Loads array of files to model
+	 * 
+	 * @param files
+	 *            array of files
+	 * @param createNewModel
+	 *            true if we first erase possible old model
+	 */
+	public void loadFilesToModel(String[] files, boolean createNewModel) {
+		if (files != null) {
+
+			// Create progressbar
+			progressBarDialog = (ProgressBarDialog) TraceViewerGlobals
+					.getTraceViewer().getDialogs().createDialog(
+							Dialog.PROGRESSBAR);
+
+			// Create opener thread
+			OpenDecodeFileThread openerThread = new OpenDecodeFileThread(files,
+					createNewModel, progressBarDialog);
+
+			// Get number of decode files inside given files array. This is
+			// different from the amount of files in files array if some of the
+			// files are ZIP files.
+			int numberOfFiles = openerThread.calculateNumberOfFiles();
+
+			// Start thread
+			openerThread.start();
+
+			// Open progress bar. This thread will stop here to wait for
+			// progress bar to be closed. Closing is done in the opener thread.
+			progressBarDialog.open(numberOfFiles, processReasonBuild);
+
+			// Decode traces after files are loaded
+			processDecodingTraces();
+
+			// Set new files to be watched in case of changes
+			ReloadDecodeFilesAction reloadDecodeFilesAction = (ReloadDecodeFilesAction) TraceViewerGlobals
+					.getTraceViewer().getView().getActionFactory()
+					.getReloadDecodeFilesAction();
+			reloadDecodeFilesAction.updateFilesToBeWatched();
+		}
+	}
+
+	/**
+	 * Process decoding traces
+	 */
+	private void processDecodingTraces() {
+		decodingTraces = true;
+
+		// If data reader exists
+		if (TraceViewerGlobals.getTraceViewer().getDataReaderAccess()
+				.getMainDataReader() != null
+				&& TraceViewerGlobals.getTraceViewer().getDataReaderAccess()
+						.getMainDataReader().getTraceCount() > 0) {
+
+			// Check if the read from start is needed
+			if (TraceViewerUtils.isReadingFromStartNeeded()) {
+				readTraceFileFromTheBeginning();
+
+				// Else just refresh the current view
+			} else {
+				TraceViewerGlobals.getTraceViewer().getView()
+						.refreshCurrentView();
+			}
+
+		}
+
+		decodingTraces = false;
+	}
+
+	/**
+	 * Reads the trace file from the beginning
+	 */
+	private void readTraceFileFromTheBeginning() {
+
+		// Get line count before clearing views
+		int lineCount = TraceViewerGlobals.getTraceViewer()
+				.getDataReaderAccess().getMainDataReader().getTraceCount();
+
+		// Get offset where to start showing traces again
+		int startShowingTraceOffset = TraceViewerGlobals.getTraceViewer()
+				.getView().getShowingTracesFrom()
+				- TraceViewerGlobals.blockSize + 1;
+		if (startShowingTraceOffset < 0) {
+			startShowingTraceOffset = 0;
+		}
+
+		// Set traces not to be shown in the view unless we are
+		// filtering
+		if (!TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+				.getFilterProcessor().isFiltering()) {
+			TraceViewerGlobals.getTraceViewer().getDataReaderAccess()
+					.getMainDataReader().getTraceConfiguration().setShowInView(
+							false);
+
+			// Set point to decoder where to start showing traces again
+			TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+					.getDecoder().setStartShowingTracesAgainOffset(
+							startShowingTraceOffset);
+		}
+
+		// Re-read all the data from the trace file
+		TraceViewerGlobals.getTraceViewer().readDataFileFromBeginning();
+
+		// Open progress bar
+		progressBarDialog = (ProgressBarDialog) TraceViewerGlobals
+				.getTraceViewer().getDialogs().createDialog(Dialog.PROGRESSBAR);
+		progressBarDialog.open(lineCount, processReasonDecode);
+	}
+
+	/**
+	 * Tells if opening decode file
+	 * 
+	 * @return true if opening decode file
+	 */
+	public boolean isOpeningDecodeFile() {
+		return (progressBarDialog != null
+				&& progressBarDialog.getShell() != null
+				&& !progressBarDialog.getShell().isDisposed() && !decodingTraces);
+	}
+
+	/**
+	 * Tells if decoding traces
+	 * 
+	 * @return true if decoding traces
+	 */
+	public boolean isDecodingTraces() {
+		return (progressBarDialog != null
+				&& progressBarDialog.getShell() != null
+				&& !progressBarDialog.getShell().isDisposed() && decodingTraces);
+	}
+
+	/**
+	 * Get progressBar
+	 * 
+	 * @return the progressBar
+	 */
+	public ProgressBarDialog getProgressBarDialog() {
+		return progressBarDialog;
+	}
+
+	/**
+	 * Adds open in startup Dictionary
+	 * 
+	 * @param dictionary
+	 *            new Dictionary
+	 */
+	public void addOpenInStartupDictionary(String dictionary) {
+		if (!openInStartupFiles.contains(dictionary)) {
+			openInStartupFiles.add(dictionary);
+		}
+	}
+
+	/**
+	 * Gets startup files
+	 * 
+	 * @return startup files list
+	 */
+	public List<String> getStartupFiles() {
+		return openInStartupFiles;
+	}
+
+	/**
+	 * Opens previously opened decode files
+	 */
+	public void openPreviousDecodeFiles() {
+		if (!openInStartupFiles.isEmpty()) {
+			PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
+				public void run() {
+
+					// Construct info message
+					StringBuilder infoStringSB = new StringBuilder();
+					infoStringSB
+							.append(Messages
+									.getString("OpenDecodeFileAction.OpenPreviousFilesString")); //$NON-NLS-1$
+					infoStringSB.append('\n');
+					infoStringSB.append('\n');
+
+					// Add decode files
+					if (!openInStartupFiles.isEmpty()) {
+						int i;
+						for (i = 0; i < openInStartupFiles.size()
+								&& i < MAX_PATHS_IN_DIALOG; i++) {
+							IPath path = new Path(openInStartupFiles.get(i));
+							infoStringSB.append(SPACING);
+							infoStringSB.append(path.lastSegment());
+							infoStringSB.append('\n');
+						}
+
+						if (i == MAX_PATHS_IN_DIALOG) {
+							int more = openInStartupFiles.size() - i;
+							String files = Messages
+									.getString("OpenDecodeFileAction.Files"); //$NON-NLS-1$
+							infoStringSB.append(SPACING);
+							infoStringSB.append("+ "); //$NON-NLS-1$
+							infoStringSB.append(more);
+							infoStringSB.append(files);
+							infoStringSB.append('\n');
+						}
+					}
+
+					boolean answer = TraceViewerGlobals.getTraceViewer()
+							.getDialogs().showConfirmationDialog(
+									infoStringSB.toString());
+
+					if (answer) {
+						TraceViewerGlobals.postUiEvent(
+								"OpenPreviousDecodeFilesYes", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+
+						// Create string array from arraylist and fill it
+						String[] files = new String[openInStartupFiles.size()];
+						for (int i = 0; i < openInStartupFiles.size(); i++) {
+							files[i] = openInStartupFiles.get(i);
+						}
+						openInStartupFiles.clear();
+
+						// Load files to new model
+						loadFilesToModel(files, true);
+						TraceViewerGlobals.postUiEvent(
+								"OpenPreviousDecodeFilesYes", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+					} else {
+						TraceViewerGlobals.postUiEvent(
+								"OpenPreviousDecodeFilesNo", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+
+						openInStartupFiles.clear();
+
+						TraceViewerGlobals.postUiEvent(
+								"OpenPreviousDecodeFilesNo", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+					}
+				}
+
+			});
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/OpenDecodeFileInStartupHandler.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,51 @@
+/*
+ * 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:
+ *
+ * Handles opening previous decode files in startup of TraceViewer
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Handles opening previous decode files in startup of TraceViewer
+ * 
+ */
+public class OpenDecodeFileInStartupHandler extends Thread {
+
+	/**
+	 * Run already
+	 */
+	private static boolean runAlready;
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Thread#run()
+	 */
+	@Override
+	public void run() {
+		if (!runAlready) {
+			runAlready = true;
+
+			OpenDecodeFileAction openDecodeFileAction = (OpenDecodeFileAction) TraceViewerGlobals
+					.getTraceViewer().getView().getActionFactory()
+					.getOpenDecodeFileAction();
+
+			openDecodeFileAction.openPreviousDecodeFiles();
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/OpenDecodeFileThread.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,244 @@
+/*
+ * 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:
+ *
+ * Thread for opening decode files
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Enumeration;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+import com.nokia.traceviewer.dialog.ProgressBarDialog;
+import com.nokia.traceviewer.engine.DecodeProvider;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Thread for opening decode files
+ */
+public class OpenDecodeFileThread extends Thread {
+
+	/**
+	 * Model valid waiting time
+	 */
+	private static final long MODEL_VALID_WAITING_TIME = 100;
+
+	/**
+	 * Model valid maximum waiting time
+	 */
+	private static final long MODEL_VALID_MAX_WAITING_TIME = 5000;
+
+	/**
+	 * Progress Bar
+	 */
+	private final ProgressBarDialog progressBarDialog;
+
+	/**
+	 * Create new model or append
+	 */
+	private final boolean createNew;
+
+	/**
+	 * Files to open
+	 */
+	private final String[] files;
+
+	/**
+	 * Number of files already processed
+	 */
+	private int filesProcessed;
+
+	/**
+	 * Number of total files to be processed
+	 */
+	private int totalFiles;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param files
+	 *            array of files to open
+	 * @param createNew
+	 *            indicates if creating new model or appending
+	 * @param progressBarDialog
+	 *            progressbar to update
+	 */
+	public OpenDecodeFileThread(String[] files, boolean createNew,
+			ProgressBarDialog progressBarDialog) {
+		this.files = files;
+		this.createNew = createNew;
+		this.progressBarDialog = progressBarDialog;
+		totalFiles = files.length;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Thread#run()
+	 */
+	@Override
+	public void run() {
+
+		// Process opening main decode file, create new model
+		processOpeningDecodeFile(files[0], createNew);
+
+		// Process remaining decode files as append files
+		for (int i = 1; i < files.length; i++) {
+
+			// Start processing
+			processOpeningDecodeFile(files[i], false);
+		}
+	}
+
+	/**
+	 * Opens decode file
+	 * 
+	 * @param filePath
+	 *            decode file path
+	 * @param createNew
+	 *            if true, delete old model before appending the new decode file
+	 */
+	private void processOpeningDecodeFile(String filePath, boolean createNew) {
+		DecodeProvider decoder = TraceViewerGlobals.getDecodeProvider();
+		if (decoder != null) {
+			boolean createNewModel = createNew;
+
+			// Check if the file is a ZIP file
+			File file = new File(filePath);
+
+			// Check if the file is a ZIP file
+			try {
+				ZipFile zipFile = new ZipFile(file);
+				Enumeration<? extends ZipEntry> entries = zipFile.entries();
+
+				totalFiles += zipFile.size() - 1;
+				progressBarDialog.setMax(totalFiles);
+
+				// Add ZIP file to list of opened startup files
+				((OpenDecodeFileAction) TraceViewerGlobals.getTraceViewer()
+						.getView().getActionFactory().getOpenDecodeFileAction())
+						.addOpenInStartupDictionary(filePath);
+
+				// Loop through elements
+				while (entries.hasMoreElements()) {
+					processZipEntry(createNewModel, decoder, zipFile, entries);
+					createNewModel = false;
+				}
+
+			} catch (IOException e) {
+
+				// Not a ZIP file, open as normal decode file
+				decoder.openDecodeFile(filePath, null, createNewModel);
+
+				filesProcessed++;
+				updateProgressBar();
+			}
+		}
+	}
+
+	/**
+	 * Processes ZIP entry
+	 * 
+	 * @param createNew
+	 *            if true, delete old model before appending the new decode file
+	 * @param decoder
+	 *            decode provider
+	 * @param zipFile
+	 *            ZIP file
+	 * @param entries
+	 *            entries enumeration
+	 * @throws IOException
+	 */
+	private void processZipEntry(boolean createNew, DecodeProvider decoder,
+			ZipFile zipFile, Enumeration<? extends ZipEntry> entries)
+			throws IOException {
+		ZipEntry entry = entries.nextElement();
+
+		if (!entry.isDirectory()) {
+			InputStream inputStream = zipFile.getInputStream(entry);
+
+			// Open the decode file entry from the ZIP
+			decoder.openDecodeFile(entry.getName(), inputStream, createNew);
+
+			filesProcessed++;
+
+			// Directories decrease the amount of total files
+		} else {
+			totalFiles--;
+			progressBarDialog.setMax(totalFiles);
+		}
+
+		updateProgressBar();
+	}
+
+	/**
+	 * Updates or closes progress bar
+	 */
+	private void updateProgressBar() {
+		// All files are processed, close progress bar but only after the model
+		// is valid
+		if (filesProcessed == totalFiles) {
+
+			// Wait until model is ready and loaded or maximum of five
+			// seconds
+			long startTime = System.currentTimeMillis();
+			while (!TraceViewerGlobals.getDecodeProvider()
+					.isModelLoadedAndValid()
+					&& startTime + MODEL_VALID_MAX_WAITING_TIME > System
+							.currentTimeMillis()) {
+				try {
+					Thread.sleep(MODEL_VALID_WAITING_TIME);
+				} catch (InterruptedException e) {
+				}
+			}
+
+			// Close the progress bar
+			TraceViewerGlobals.getTraceViewer().getView().closeProgressBar(
+					progressBarDialog);
+		} else {
+			progressBarDialog.updateProgressBar(filesProcessed);
+		}
+	}
+
+	/**
+	 * Calculates number of files inside given files
+	 * 
+	 * @return number of files
+	 */
+	public int calculateNumberOfFiles() {
+		int number = 0;
+
+		for (int i = 0; i < files.length; i++) {
+
+			// Check if the file is a ZIP file
+			File file = new File(files[i]);
+
+			// Check if the file is a ZIP file
+			try {
+				ZipFile zipFile = new ZipFile(file);
+				number += zipFile.size() - 1;
+
+			} catch (IOException e) {
+				number++;
+			}
+		}
+
+		return number;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/OpenTraceLocationAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,455 @@
+/*
+ * 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:
+ *
+ * Open trace location command
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import java.io.File;
+import java.net.URI;
+import java.net.URL;
+import java.util.HashMap;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.IEditorDescriptor;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IDE;
+import org.eclipse.ui.part.FileEditorInput;
+
+import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin;
+import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration;
+import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo;
+import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.engine.TraceMetaData;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Handler for open trace location command
+ */
+public final class OpenTraceLocationAction extends TraceViewerAction {
+
+	/**
+	 * Filter names in open file dialog
+	 */
+	private static final String[] FILTER_NAMES = {
+			Messages.getString("OpenTraceLocationAction.SourceCodeFilter"), //$NON-NLS-1$
+			Messages.getString("OpenTraceLocationAction.AllFilesFilter") }; //$NON-NLS-1$
+
+	/**
+	 * Filter extensions in open file dialog
+	 */
+	private static final String[] FILTER_EXTS = { "*.cpp", "*.*" }; //$NON-NLS-1$ //$NON-NLS-2$
+
+	/**
+	 * Space
+	 */
+	private static final String SPACE = " "; //$NON-NLS-1$
+
+	/**
+	 * Trace MetaData used when opening location
+	 */
+	private TraceMetaData traceMetadata;
+
+	/**
+	 * If only the drive character is changed from the path of the source files,
+	 * try to find those files also behind this drive
+	 */
+	private char changedDriveLetter;
+
+	/**
+	 * If this is true, we have already tried to open the source file also with
+	 * the changed drive letter
+	 */
+	private boolean triedWithChangedDrive;
+
+	/**
+	 * If source is not found, ask user to browse for it
+	 */
+	private boolean askToBrowseSource;
+
+	/**
+	 * Image for this Action
+	 */
+	private static ImageDescriptor image;
+
+	static {
+		URL url = null;
+		url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				"/icons/gotolocation.gif"); //$NON-NLS-1$
+		image = ImageDescriptor.createFromURL(url);
+	}
+
+	/**
+	 * Constructor
+	 */
+	OpenTraceLocationAction() {
+		setText(Messages.getString("OpenTraceLocationAction.Title")); //$NON-NLS-1$
+		setToolTipText(Messages.getString("OpenTraceLocationAction.Tooltip")); //$NON-NLS-1$
+		setImageDescriptor(image);
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
+				TraceViewerHelpContextIDs.ACTIONS);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+
+		// If metadata is null, don't do anything
+		if (traceMetadata != null && traceMetadata.getPath() != null
+				&& traceMetadata.getLineNumber() != 0) {
+
+			// Open source file to editor
+			openSourceFileToEditor(traceMetadata.getPath());
+		}
+	}
+
+	/**
+	 * Opens source file to editor
+	 * 
+	 * @param filePath
+	 *            file path
+	 */
+	private void openSourceFileToEditor(String filePath) {
+		IPath epocRootLocation = null;
+		IFile file = null;
+		IFile[] fileArr = null;
+
+		// Dictionary location
+		IPath dictionaryLocation = new Path(filePath);
+
+		// Try to find EPOC root
+		String epocRoot = getEpocRoot();
+		if (epocRoot != null && epocRoot.length() > 1) {
+
+			// Get only the device part (e.g. X:)
+			epocRoot = epocRoot.substring(0, 2);
+			epocRootLocation = dictionaryLocation.setDevice(epocRoot);
+		}
+
+		IWorkspace ws = ResourcesPlugin.getWorkspace();
+		IWorkspaceRoot root = ws.getRoot();
+
+		// Try to find with EPOC root location
+		if (epocRootLocation != null) {
+			fileArr = root.findFilesForLocationURI(makeURI(epocRootLocation));
+		}
+
+		// If not found, try to find with Dictionary location
+		if (fileArr == null || fileArr.length == 0) {
+			fileArr = root.findFilesForLocationURI(makeURI(dictionaryLocation));
+		}
+
+		// There can be only one file with this url so take the first
+		// item
+		if (fileArr != null && fileArr.length > 0) {
+			file = fileArr[0];
+		} else {
+			// File not found from Workspace, create External files project
+			file = createExternalFilesProject(dictionaryLocation, root);
+		}
+
+		// Open the file to the default editor
+		if (file != null) {
+			openEditor(file);
+		}
+	}
+
+	/**
+	 * Creates URI from given IPath instance.
+	 * 
+	 * @param path
+	 * @return URI from given IPath instance
+	 */
+	private URI makeURI(IPath path) {
+		File file = path.toFile();
+		return file.toURI();
+	}
+
+	/**
+	 * Opens the editor
+	 * 
+	 * @param file
+	 */
+	@SuppressWarnings("unchecked")
+	private void openEditor(IFile file) {
+
+		// Get workbench page
+		IWorkbenchPage page = PlatformUI.getWorkbench()
+				.getActiveWorkbenchWindow().getActivePage();
+
+		String defaultEditor = null;
+		IEditorDescriptor editorDesc = IDE.getDefaultEditor(file);
+		if (editorDesc == null) {
+			defaultEditor = "org.eclipse.ui.DefaultTextEditor"; //$NON-NLS-1$
+		} else {
+			defaultEditor = editorDesc.getId();
+		}
+
+		HashMap<String, Comparable> map = new HashMap<String, Comparable>();
+		map.put(IMarker.LINE_NUMBER, Integer.valueOf(traceMetadata
+				.getLineNumber()));
+		map.put(IDE.EDITOR_ID_ATTR, defaultEditor);
+
+		// Try to set markers
+		try {
+			IMarker marker;
+			marker = file.createMarker(IMarker.TEXT);
+
+			marker.setAttributes(map);
+			IDE.openEditor(page, marker);
+			marker.delete();
+		} catch (CoreException e) {
+			e.printStackTrace();
+		}
+	}
+
+	/**
+	 * Creates external files project
+	 * 
+	 * @param location
+	 *            location of the file
+	 * @param root
+	 *            workspace root
+	 * @return the file
+	 */
+	private IFile createExternalFilesProject(IPath location, IWorkspaceRoot root) {
+		String externalProject = Messages
+				.getString("OpenTraceLocationAction.ExternalFilesProject"); //$NON-NLS-1$
+
+		IFile file = null;
+		try {
+
+			IProject project = root.getProject(externalProject);
+			if (!project.exists()) {
+				project.create(null);
+			}
+			if (!project.isOpen()) {
+				project.open(null);
+			}
+
+			// Location must be valid
+			if (location.isValidPath(location.toOSString())) {
+				file = project.getFile(location.lastSegment());
+				if (!file.exists()) {
+					file.createLink(location, IResource.NONE, null);
+
+					// Creating the link succeeded
+					triedWithChangedDrive = false;
+				}
+			} else {
+				// Location not valid, give an error message
+
+				String locationStr = Messages
+						.getString("OpenTraceLocationAction.LocationStr"); //$NON-NLS-1$
+				String notValidStr = Messages
+						.getString("OpenTraceLocationAction.NotValidStr"); //$NON-NLS-1$
+				TraceViewerGlobals.getTraceViewer().getDialogs()
+						.showErrorMessage(
+								locationStr + SPACE + location.toOSString()
+										+ SPACE + notValidStr);
+			}
+
+		} catch (CoreException e) {
+			file = null;
+
+			// Try with changed drive letter
+			if (changedDriveLetter != Character.UNASSIGNED
+					&& !triedWithChangedDrive) {
+
+				triedWithChangedDrive = true;
+				String newPath = changedDriveLetter
+						+ traceMetadata.getPath().substring(1);
+
+				// Try to open with new drive letter
+				openSourceFileToEditor(newPath);
+
+			} else {
+
+				triedWithChangedDrive = false;
+
+				if (askToBrowseSource) {
+
+					// Show file was not found dialog
+					String notFoundStr = Messages
+							.getString("OpenTraceLocationAction.CouldNotFindStr"); //$NON-NLS-1$
+					String browseStr = Messages
+							.getString("OpenTraceLocationAction.BrowseString"); //$NON-NLS-1$
+
+					boolean browse = TraceViewerGlobals.getTraceViewer()
+							.getDialogs().showConfirmationDialog(
+									notFoundStr + SPACE + location.toOSString()
+											+ browseStr);
+
+					// Browse for a file
+					if (browse) {
+
+						// Try to find the original file but change the path to
+						// OS specific string first
+						IPath loc = new Path(traceMetadata.getPath());
+						String osString = loc.toOSString();
+						browseForTheFile(osString);
+					}
+				}
+			}
+
+		}
+		return file;
+	}
+
+	/**
+	 * Browse for a file
+	 * 
+	 * @param path
+	 *            initial file path to open
+	 */
+	private void browseForTheFile(String path) {
+		String pathSeparator = System.getProperty("file.separator"); //$NON-NLS-1$
+		int indexOfLastSeparator = path.lastIndexOf(pathSeparator);
+
+		// Get variables
+		String fileName = path.substring(indexOfLastSeparator + 1);
+		String[] names = { fileName, FILTER_NAMES[0], FILTER_NAMES[1] };
+		String[] extensions = { fileName, FILTER_EXTS[0], FILTER_EXTS[1] };
+
+		// Open the file dialog
+		String[] files = TraceViewerActionUtils.openFileDialog(names,
+				extensions, null, fileName, false, true);
+
+		// Open the file to the editor
+		if (files != null && files.length > 0) {
+			String file = files[0];
+
+			// Check if the only thing that was different in the old and new
+			// path is the drive, save the new drive letter also
+			String oldFilePath = path.substring(1);
+			String newFilePath = file.substring(1);
+			if (oldFilePath.equals(newFilePath)) {
+				changedDriveLetter = file.charAt(0);
+			}
+
+			openSourceFileToEditor(file);
+		}
+	}
+
+	/**
+	 * Sets trace metadata
+	 * 
+	 * @param metaData
+	 *            the metaData to set
+	 * @param askToBrowseSource
+	 *            if true and source was not found, ask user to browse for the
+	 *            source
+	 */
+	public void setMetaData(TraceMetaData metaData, boolean askToBrowseSource) {
+		this.traceMetadata = metaData;
+		this.askToBrowseSource = askToBrowseSource;
+	}
+
+	/**
+	 * Gets EPOC root from Carbide.c++
+	 * 
+	 * @return Current Epoc root
+	 */
+	private String getEpocRoot() {
+		String epocRoot = null;
+		IEditorInput input = null;
+		IWorkbench wb = PlatformUI.getWorkbench();
+
+		// Try to get active editor and input for that
+		if (wb != null) {
+			IWorkbenchWindow wbw = wb.getActiveWorkbenchWindow();
+			if (wbw != null) {
+				IWorkbenchPage page = wbw.getActivePage();
+				if (page != null) {
+					IEditorPart editorPart = page.getActiveEditor();
+					if (editorPart != null) {
+						input = editorPart.getEditorInput();
+					}
+				}
+			}
+		}
+
+		// Get the active File
+		if (input instanceof FileEditorInput) {
+			IFile file = ((FileEditorInput) input).getFile();
+			IPath epocRootPath = getEpocRootForProject(file.getProject());
+
+			if (epocRootPath != null) {
+				epocRoot = epocRootPath.toOSString();
+			}
+		}
+
+		return epocRoot;
+	}
+
+	/**
+	 * Returns the absolute file system path to the EPOCROOT directory of the
+	 * SDK for the active build configuration of the project
+	 * 
+	 * @param project
+	 *            the project
+	 * @return the absolute path to EPOCROOT, or null if the project is not a
+	 *         Carbide project, is closed, or there are no build configurations
+	 *         in the project.
+	 */
+	private IPath getEpocRootForProject(IProject project) {
+		IPath epocroot = null;
+
+		if (project != null) {
+			if (CarbideBuilderPlugin.getBuildManager()
+					.isCarbideProject(project)
+					&& project.isAccessible()) {
+				ICarbideProjectInfo cpi = CarbideBuilderPlugin
+						.getBuildManager().getProjectInfo(project);
+				if (cpi != null) {
+					ICarbideBuildConfiguration config = cpi
+							.getDefaultConfiguration();
+					if (config != null) {
+						ISymbianSDK sdk = config.getSDK();
+						if (sdk != null) {
+							epocroot = new Path(sdk.getEPOCROOT());
+						}
+					}
+				}
+			}
+		}
+
+		return epocroot;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/OpenVariableTracingHistoryAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,88 @@
+/*
+ * 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:
+ *
+ * Handler for open variable tracing history command
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.dialog.VariableTracingHistoryDialog;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.TraceViewerDialogInterface.Dialog;
+
+/**
+ * Handler for open variable tracing history command
+ * 
+ */
+final class OpenVariableTracingHistoryAction extends TraceViewerAction {
+
+	/**
+	 * Image for this Action
+	 */
+	private static ImageDescriptor image;
+
+	/**
+	 * Variable Tracing History dialog
+	 */
+	private VariableTracingHistoryDialog dialog;
+
+	static {
+		image = PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(
+				ISharedImages.IMG_OBJS_INFO_TSK);
+	}
+
+	/**
+	 * Constructor
+	 */
+	OpenVariableTracingHistoryAction() {
+		setText(Messages.getString("OpenVariableTracingHistoryAction.Title")); //$NON-NLS-1$
+		setToolTipText(Messages
+				.getString("OpenVariableTracingHistoryAction.Tooltip")); //$NON-NLS-1$
+		setImageDescriptor(image);
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
+				TraceViewerHelpContextIDs.VARIABLE_TRACING_HISTORY);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		// Create the dialog
+		if (dialog == null) {
+			dialog = (VariableTracingHistoryDialog) TraceViewerGlobals
+					.getTraceViewer().getDialogs().createDialog(
+							Dialog.VARIBLETRACINGHISTORY);
+			if (dialog != null) {
+				dialog.openDialog();
+			}
+			// Open the dialog
+		} else if (!dialog.isOpen()) {
+			dialog.openDialog();
+			// Set focus to the dialog
+		} else {
+			dialog.setFocus();
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/PauseAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,121 @@
+/*
+ * 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:
+ *
+ * Handler for pause command
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import java.net.URL;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Handler for pause command
+ */
+public final class PauseAction extends TraceViewerAction {
+
+	/**
+	 * Indicated if pause is on or off
+	 */
+	private boolean paused;
+
+	/**
+	 * Image for the action showing pause button
+	 */
+	private static ImageDescriptor pauseImage;
+
+	/**
+	 * Image for the action showing paused button
+	 */
+	private static ImageDescriptor pausedImage;
+
+	static {
+		URL url = null;
+		URL url2 = null;
+		url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				"/icons/pause.gif"); //$NON-NLS-1$
+		url2 = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				"/icons/resume.gif"); //$NON-NLS-1$
+		pauseImage = ImageDescriptor.createFromURL(url);
+		pausedImage = ImageDescriptor.createFromURL(url2);
+	}
+
+	/**
+	 * Constructor
+	 */
+	PauseAction() {
+		setPauseImage(true);
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
+				TraceViewerHelpContextIDs.ACTIONS);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		TraceViewerGlobals.postUiEvent("PauseButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+		setPauseImage(paused);
+		if (TraceViewerGlobals.getTraceViewer().getDataReaderAccess()
+				.getMainDataReader() != null) {
+			TraceViewerGlobals.getTraceViewer().getDataReaderAccess()
+					.getMainDataReader().pause(paused);
+		}
+
+		TraceViewerGlobals.getTraceViewer().getView().updateViewName();
+		TraceViewerGlobals.postUiEvent("PauseButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+
+	/**
+	 * Sets pause image
+	 * 
+	 * @param pause
+	 *            true to set pause image
+	 */
+	public void setPauseImage(boolean pause) {
+		if (!pause) {
+			paused = true;
+			setImageDescriptor(pausedImage);
+			setText(Messages.getString("UnPauseAction.Title")); //$NON-NLS-1$
+			setToolTipText(Messages.getString("UnPauseAction.Tooltip")); //$NON-NLS-1$
+		} else {
+			paused = false;
+			setImageDescriptor(pauseImage);
+			setText(Messages.getString("PauseAction.Title")); //$NON-NLS-1$
+			setToolTipText(Messages.getString("PauseAction.Tooltip")); //$NON-NLS-1$
+		}
+	}
+
+	/**
+	 * Sets paused
+	 * 
+	 * @param paused
+	 *            if true, pauses. If false, unpauses
+	 */
+	public void setPaused(boolean paused) {
+		this.paused = !paused;
+		doRun();
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/ReloadDecodeFilesAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,405 @@
+/*
+ * 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:
+ *
+ * Reload changed decode files Action
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import java.io.File;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Timer;
+import java.util.TimerTask;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.TraceViewerUtils;
+import com.nokia.traceviewer.engine.activation.TraceActivationComponentItem;
+import com.nokia.traceviewer.engine.preferences.PreferenceConstants;
+
+/**
+ * Reload changed decode files Action
+ */
+public final class ReloadDecodeFilesAction extends TraceViewerAction {
+
+	/**
+	 * Maximum number of times to try to open the decode file
+	 */
+	private static final int MAX_TRIES = 5;
+
+	/**
+	 * Polling interval in milliseconds
+	 */
+	private static final int POLLING_INTERVAL = 4000;
+
+	/**
+	 * Waiting time for model to be loaded
+	 */
+	private static final int WAITING_TIME = 50;
+
+	/**
+	 * Empty image
+	 */
+	private static ImageDescriptor emptyImage;
+
+	/**
+	 * Exclamation image
+	 */
+	private static ImageDescriptor exclamationImage;
+
+	/**
+	 * Timer to use to check the files
+	 */
+	private Timer timer;
+
+	/**
+	 * Map of component items and last modified times to watch in case of
+	 * changes
+	 */
+	private volatile Map<TraceActivationComponentItem, Long> files;
+
+	/**
+	 * Changed components
+	 */
+	private final List<TraceActivationComponentItem> changedComponents;
+
+	/**
+	 * List of missing dictionaries so we only inform about disappearance once
+	 */
+	private final List<String> missingDictionaries;
+
+	/**
+	 * Empty String
+	 */
+	private static final String EMPTY = ""; //$NON-NLS-1$
+
+	/**
+	 * Number of times we have tried to open decode file
+	 */
+	private int triesToOpenDecodeFile;
+
+	/**
+	 * Category for events
+	 */
+	private final static String EVENT_CATEGORY = Messages
+			.getString("ReloadDecodeFilesAction.DictionaryReloaderCategory"); //$NON-NLS-1$
+
+	static {
+		URL url = null;
+		URL url2 = null;
+		url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				"/icons/empty.gif"); //$NON-NLS-1$
+		emptyImage = ImageDescriptor.createFromURL(url);
+		url2 = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				"/icons/exclamation.gif"); //$NON-NLS-1$
+		exclamationImage = ImageDescriptor.createFromURL(url2);
+	}
+
+	/**
+	 * Constructor
+	 */
+	ReloadDecodeFilesAction() {
+		files = new HashMap<TraceActivationComponentItem, Long>();
+		changedComponents = new ArrayList<TraceActivationComponentItem>();
+		missingDictionaries = new ArrayList<String>();
+		changeToEmptyImage();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		TraceViewerGlobals.postUiEvent("ReloadDecodeFilesButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+
+		reloadFiles(true);
+
+		// Change back to empty image
+		changeToEmptyImage();
+		TraceViewerGlobals.postUiEvent("ReloadDecodeFilesButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+
+	/**
+	 * Reload files
+	 * 
+	 * @param showProgressBar
+	 *            if true, show progressbar while reloading
+	 */
+	private void reloadFiles(boolean showProgressBar) {
+
+		// Start copying the files from the array
+		List<String> filesToLoad = new ArrayList<String>();
+
+		// Copy the files from the map to a String array and remove components
+		// from the model
+		for (int i = 0; i < changedComponents.size(); i++) {
+			TraceActivationComponentItem comp = changedComponents.get(i);
+			File file = new File(comp.getFilePath());
+
+			if (file.exists()) {
+				filesToLoad.add(file.getAbsolutePath());
+
+				// Remove component from the model
+				TraceViewerGlobals.getDecodeProvider()
+						.removeComponentFromModel(comp.getId());
+
+				// Insert info about reloading to trace events
+				String msg = Messages
+						.getString("ReloadDecodeFilesAction.ReloadDescriptionMsg"); //$NON-NLS-1$
+
+				msg += TraceViewerUtils.constructTimeString();
+				TraceViewerGlobals.postInfoEvent(msg, EVENT_CATEGORY, file
+						.getAbsolutePath());
+
+				// File doesn't exist
+			} else {
+				// Insert info about disappeared Dictionary
+				String msg = Messages
+						.getString("ReloadDecodeFilesAction.DictionaryDisappearedMsg"); //$NON-NLS-1$
+
+				TraceViewerGlobals.postInfoEvent(msg, EVENT_CATEGORY, file
+						.getAbsolutePath());
+			}
+		}
+
+		changedComponents.clear();
+
+		// Show progressbar
+		if (showProgressBar) {
+
+			// Load the new files
+			OpenDecodeFileAction openAction = (OpenDecodeFileAction) TraceViewerGlobals
+					.getTraceViewer().getView().getActionFactory()
+					.getOpenDecodeFileAction();
+			openAction.loadFilesToModel(getStringArrayFromList(filesToLoad),
+					false);
+
+			// Don't show progressbar
+		} else {
+
+			// Go through the files
+			for (int i = 0; i < filesToLoad.size(); i++) {
+
+				// Open the decode file
+				TraceViewerGlobals.getDecodeProvider().openDecodeFile(
+						filesToLoad.get(i), null, false);
+			}
+			updateFilesToBeWatched();
+
+		}
+	}
+
+	/**
+	 * Changes image to empty
+	 */
+	private void changeToEmptyImage() {
+		setImageDescriptor(emptyImage);
+		setText(EMPTY);
+		setToolTipText(EMPTY);
+		setEnabled(false);
+	}
+
+	/**
+	 * Changes image to exclamation
+	 */
+	private void changeToExclamationImage() {
+		setImageDescriptor(exclamationImage);
+		setText(Messages.getString("ReloadDecodeFilesAction.Title")); //$NON-NLS-1$
+		setToolTipText(Messages.getString("ReloadDecodeFilesAction.Tooltip")); //$NON-NLS-1$
+		setEnabled(true);
+	}
+
+	/**
+	 * Update files to be watched from the model
+	 */
+	public void updateFilesToBeWatched() {
+		try {
+			if (timer == null) {
+
+				// Create the timer as a daemon
+				timer = new Timer(true);
+				timer.schedule(new FileMonitorNotifier(), POLLING_INTERVAL,
+						POLLING_INTERVAL);
+			}
+
+			// Remove old watched files
+			files.clear();
+
+			// Wait for a while
+			Thread.sleep(WAITING_TIME);
+
+			List<TraceActivationComponentItem> components = TraceViewerGlobals
+					.getDecodeProvider().getActivationInformation(false);
+
+			// Add files to the list. If they already exist, update
+			for (int i = 0; i < components.size(); i++) {
+				TraceActivationComponentItem comp = components.get(i);
+				File file = new File(comp.getFilePath());
+				if (file.exists()) {
+					files.put(comp, Long.valueOf((file.lastModified())));
+				} else {
+					files.put(comp, Long.valueOf(-1));
+				}
+			}
+
+			// Set activation dialog to changed
+			TraceActivationAction activationAction = (TraceActivationAction) TraceViewerGlobals
+					.getTraceViewer().getView().getActionFactory()
+					.getTraceActivationAction();
+			if (activationAction.getDialog() != null) {
+				activationAction.getDialog().setModelChanged(true);
+			}
+			triesToOpenDecodeFile = 0;
+
+		} catch (Exception e) {
+			e.printStackTrace();
+
+			// Something went wrong, try again
+			if (triesToOpenDecodeFile < MAX_TRIES) {
+				triesToOpenDecodeFile++;
+				updateFilesToBeWatched();
+			} else {
+				triesToOpenDecodeFile = 0;
+			}
+		}
+	}
+
+	/**
+	 * Stops file monitor
+	 */
+	public void stopFileMonitor() {
+		if (timer != null) {
+			timer.cancel();
+		}
+	}
+
+	/**
+	 * This is the timer thread which is executed every n milliseconds according
+	 * to the setting of the file monitor. It investigates the file in question
+	 * and notify listeners if changed.
+	 * 
+	 */
+	private class FileMonitorNotifier extends TimerTask {
+
+		/*
+		 * (non-Javadoc)
+		 * 
+		 * @see java.util.TimerTask#run()
+		 */
+		@Override
+		public void run() {
+
+			// Check if Dictionaries should be auto-reloaded
+			boolean autoReload = TraceViewerPlugin
+					.getDefault()
+					.getPreferenceStore()
+					.getBoolean(
+							PreferenceConstants.AUTO_RELOAD_DICTIONARIES_CHECKBOX);
+
+			// Loop over the registered files and see which have changed.
+			for (Iterator<TraceActivationComponentItem> i = files.keySet()
+					.iterator(); i.hasNext();) {
+				TraceActivationComponentItem comp = i.next();
+				File file = new File(comp.getFilePath());
+				String filePath = file.getAbsolutePath();
+				long lastModifiedTime = files.get(comp).longValue();
+				boolean fileExists = false;
+				boolean fileMissingForTheFirstTime = false;
+
+				long newModifiedTime = -1;
+				if (file.exists()) {
+					fileExists = true;
+					newModifiedTime = file.lastModified();
+
+					// If file was previously missing, remove it from the
+					// missing list
+					if (missingDictionaries.contains(filePath)) {
+						missingDictionaries.remove(filePath);
+					}
+
+					// File doesn't exist and it's not yet added to the missing
+					// Dictionaries list
+				} else {
+					if (!missingDictionaries.contains(filePath)) {
+						missingDictionaries.add(filePath);
+						fileMissingForTheFirstTime = true;
+					}
+				}
+
+				// Check if file has changed
+				if (newModifiedTime != lastModifiedTime) {
+
+					if (!autoReload && fileExists) {
+						changeToExclamationImage();
+					}
+
+					// File exists or file is missing for the first time and we
+					// are using Auto-reload, let's add the component to changed
+					// list
+					if (fileExists
+							|| (autoReload && fileMissingForTheFirstTime)) {
+
+						// Add to changed components
+						if (!changedComponents.contains(comp)) {
+							changedComponents.add(comp);
+						}
+
+					}
+				}
+			}
+
+			// Reload automatically. Must be synced with UI thread
+			if (autoReload && !changedComponents.isEmpty()) {
+				PlatformUI.getWorkbench().getDisplay().asyncExec(
+						new Runnable() {
+							public void run() {
+
+								// Re-check to be sure
+								if (!changedComponents.isEmpty()) {
+									reloadFiles(false);
+								}
+							}
+						});
+			}
+		}
+	}
+
+	/**
+	 * Gets string array from list
+	 * 
+	 * @param list
+	 *            list
+	 * @return string array
+	 */
+	private String[] getStringArrayFromList(List<String> list) {
+		String[] arr = new String[list.size()];
+
+		for (int i = 0; i < arr.length; i++) {
+			arr[i] = list.get(i);
+		}
+
+		return arr;
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/RemoveTraceCommentAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,88 @@
+/*
+ * 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:
+ *
+ * Handler for remove trace comment command
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import java.net.URL;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.view.listener.SelectionProperties;
+
+/**
+ * Handler for remove trace comment command
+ */
+public final class RemoveTraceCommentAction extends TraceViewerAction {
+
+	/**
+	 * Image for this Action
+	 */
+	private static ImageDescriptor image;
+
+	/**
+	 * Trace which comment is to be edited
+	 */
+	private final int traceNumber;
+
+	static {
+		URL url = null;
+		url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				"/icons/clear.gif"); //$NON-NLS-1$
+		image = ImageDescriptor.createFromURL(url);
+	}
+
+	/**
+	 * Constructor
+	 * 
+	 * @param traceNumber
+	 *            trace number
+	 */
+	public RemoveTraceCommentAction(int traceNumber) {
+		this.traceNumber = traceNumber;
+		setText(Messages
+				.getString("RemoveTraceCommentAction.RemoveCommentText")); //$NON-NLS-1$
+		setToolTipText(Messages
+				.getString("RemoveTraceCommentAction.RemoveCommentToolTip")); //$NON-NLS-1$
+		setImageDescriptor(image);
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
+				TraceViewerHelpContextIDs.ACTIONS);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		// First clear selections as they might get crazy when some text is
+		// taken out from the text widget
+		SelectionProperties.clear();
+
+		// Then remove the comment from the handler
+		TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+				.getTraceCommentHandler().removeComment(traceNumber);
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/SearchAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,82 @@
+/*
+ * 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:
+ *
+ * Handler for search command
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import java.net.URL;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.dialog.SearchDialog;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Handler for search command
+ */
+final class SearchAction extends TraceViewerAction {
+
+	/**
+	 * Image for the action
+	 */
+	private static ImageDescriptor image;
+
+	static {
+		URL url = null;
+		url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				"/icons/search.gif"); //$NON-NLS-1$
+		image = ImageDescriptor.createFromURL(url);
+	}
+
+	/**
+	 * Constructor
+	 */
+	SearchAction() {
+		setText(Messages.getString("SearchAction.Title")); //$NON-NLS-1$
+		setToolTipText(Messages.getString("SearchAction.Tooltip")); //$NON-NLS-1$
+		setImageDescriptor(image);
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
+				TraceViewerHelpContextIDs.ACTIONS);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		TraceViewerGlobals.postUiEvent("SearchButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+		SearchDialog dialog = TraceViewerGlobals.getTraceViewer()
+				.getDataProcessorAccess().getSearchProcessor()
+				.getSearchDialog();
+		if (!dialog.isOpen()) {
+			dialog.openDialog();
+		} else {
+			if (!dialog.isVisible()) {
+				dialog.openDialog();
+			}
+			dialog.setFocus();
+		}
+		TraceViewerGlobals.postUiEvent("SearchButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/SelectAllAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,98 @@
+/*
+ * 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:
+ *
+ * Select all action
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import java.util.List;
+
+import org.eclipse.swt.custom.StyledText;
+
+import com.nokia.traceviewer.engine.TraceProperties;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.view.listener.SelectionProperties;
+import com.nokia.traceviewer.view.listener.ViewerSelectionChangedListener;
+
+/**
+ * Select all action
+ */
+final class SelectAllAction extends TraceViewerAction {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		StyledText widget = TraceViewerGlobals.getTraceViewer().getView()
+				.getViewer().getTextWidget();
+
+		int totalTraceCount = TraceViewerGlobals.getTraceViewer()
+				.getDataReaderAccess().getCurrentDataReader().getTraceCount();
+
+		// Set selection properties
+		SelectionProperties.firstClickedLine = 0;
+		SelectionProperties.firstClickedLineCaretOffset = 0;
+		SelectionProperties.lastClickedLine = totalTraceCount;
+
+		// Save current top index
+		int topIndex = widget.getTopIndex();
+
+		// Select everything from the current showing text widget
+		int endOffset = widget.getOffsetAtLine(widget.getLineCount() - 1);
+		SelectionProperties.lastClickedLineCaretOffset = 0;
+		widget.setSelection(0, endOffset);
+
+		// Return old top index
+		widget.setTopIndex(topIndex);
+
+		// Get first trace
+		List<TraceProperties> firstTraceArr = TraceViewerGlobals
+				.getTraceViewer().getTraces(0, 0);
+		if (!firstTraceArr.isEmpty()) {
+			TraceProperties firstTrace = firstTraceArr.get(0);
+
+			// Process timestamp
+			TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+					.getTimestampParser().processData(firstTrace);
+
+			if (firstTrace.timestampString != null) {
+				SelectionProperties.firstClickedTimestamp = firstTrace.timestampString;
+			}
+
+		}
+
+		// Get last trace
+		List<TraceProperties> lastTraceArr = TraceViewerGlobals
+				.getTraceViewer().getTraces(totalTraceCount - 1,
+						totalTraceCount - 1);
+		if (!lastTraceArr.isEmpty()) {
+			TraceProperties lastTrace = lastTraceArr.get(0);
+
+			// Process timestamp
+			TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+					.getTimestampParser().processData(lastTrace);
+
+			if (lastTrace.timestampString != null) {
+				SelectionProperties.lastClickedTimestamp = lastTrace.timestampString;
+			}
+
+		}
+		ViewerSelectionChangedListener.handleTrimInformationUpdate();
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/ShowTraceInfoAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,512 @@
+/*
+ * 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:
+ *
+ * Show trace info command
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyleRange;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.dialog.ShowTraceInfoDialog;
+import com.nokia.traceviewer.engine.BTraceInformation;
+import com.nokia.traceviewer.engine.TraceMetaData;
+import com.nokia.traceviewer.engine.TraceProperties;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.TraceViewerUtils;
+
+/**
+ * Handler for show trace info command
+ * 
+ */
+public final class ShowTraceInfoAction extends TraceViewerAction {
+
+	/**
+	 * Characters for hex string
+	 */
+	private final static char hexChars[] = { '0', '1', '2', '3', '4', '5', '6',
+			'7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
+
+	/**
+	 * One byte takes this many characters to show when as hex string
+	 */
+	private static final int BYTE_AS_HEX_STRING_LENGTH = 3;
+
+	/**
+	 * Empty string
+	 */
+	private static final String EMPTY = ""; //$NON-NLS-1$
+
+	/**
+	 * Hex prefix
+	 */
+	private static final String HEX_PREFIX = "0x"; //$NON-NLS-1$
+
+	/**
+	 * Lead zero
+	 */
+	private static final String LEAD_ZERO = "0"; //$NON-NLS-1$
+
+	/**
+	 * Start parenthesis
+	 */
+	private static final char START_PARENTHESIS = '(';
+
+	/**
+	 * End parenthesis
+	 */
+	private static final char END_PARENTHESIS = ')';
+
+	/**
+	 * Line break
+	 */
+	private static final String LINE_BREAK = "\n"; //$NON-NLS-1$
+
+	/**
+	 * Colon + space combination
+	 */
+	private static final String COLON_SPACE = ": "; //$NON-NLS-1$
+
+	/**
+	 * Image for the action
+	 */
+	private static ImageDescriptor image;
+
+	/**
+	 * Trace properties
+	 */
+	private TraceProperties trace;
+
+	/**
+	 * Constructor
+	 */
+	ShowTraceInfoAction() {
+		image = PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(
+				ISharedImages.IMG_OBJS_INFO_TSK);
+		setText(Messages.getString("ShowTraceInfoAction.Title")); //$NON-NLS-1$
+		setToolTipText(Messages.getString("ShowTraceInfoAction.Tooltip")); //$NON-NLS-1$
+		setImageDescriptor(image);
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
+				TraceViewerHelpContextIDs.ACTIONS);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		List<StyleRange> styleRanges = new ArrayList<StyleRange>();
+		int lineNumber = 0;
+		if (trace != null) {
+			lineNumber = trace.traceNumber;
+		}
+
+		String traceNumberString = Messages
+				.getString("ShowTraceInfoAction.TraceNumberString") + COLON_SPACE //$NON-NLS-1$
+				+ (lineNumber) + LINE_BREAK;
+		String idString = EMPTY;
+		String locationString = EMPTY;
+		String classMethodString = EMPTY;
+		String bTraceString = EMPTY;
+		String hexString = EMPTY;
+		String hexTrace = EMPTY;
+
+		if (trace != null) {
+			TraceMetaData traceMetadata = TraceViewerGlobals
+					.getDecodeProvider().getTraceMetaData(trace.information);
+
+			// Construct ID strings
+			if (trace.information.isDefined()) {
+				idString = constructIdString();
+			}
+
+			// Construct metadata strings if it's available
+			if (traceMetadata != null) {
+
+				// Get defined in path
+				String path = traceMetadata.getPath();
+				if (path != null) {
+					String locationStr = Messages
+							.getString("ShowTraceInfoAction.LocationStr"); //$NON-NLS-1$
+					locationString += LINE_BREAK + locationStr + COLON_SPACE
+							+ path + LINE_BREAK;
+				}
+
+				// Get defined in line number
+				int definedInLine = traceMetadata.getLineNumber();
+				if (definedInLine != 0) {
+					String lineNrStr = Messages
+							.getString("ShowTraceInfoAction.LineNumberStr"); //$NON-NLS-1$
+					locationString += lineNrStr + COLON_SPACE + definedInLine
+							+ LINE_BREAK;
+				}
+
+				// Get class name
+				String className = traceMetadata.getClassName();
+				if (className != null && !className.equals(EMPTY)) {
+					String classNameStr = Messages
+							.getString("ShowTraceInfoAction.ClassnameStr"); //$NON-NLS-1$
+					classMethodString += classNameStr + COLON_SPACE + className
+							+ LINE_BREAK;
+				}
+
+				// Get method name
+				String methodName = traceMetadata.getMethodName();
+				if (methodName != null && !methodName.equals(EMPTY)) {
+					String methodNameStr = Messages
+							.getString("ShowTraceInfoAction.MethodnameStr"); //$NON-NLS-1$
+					classMethodString += methodNameStr + COLON_SPACE
+							+ methodName + LINE_BREAK;
+				}
+			}
+
+			// Construct BTrace string
+			if (trace.bTraceInformation.getRecordSize() != 0) {
+				int totalStringLength = (traceNumberString + idString
+						+ locationString + classMethodString).length();
+				bTraceString = constructBTraceString(totalStringLength,
+						styleRanges);
+			}
+
+			// Get trace as HEX
+			if (trace.byteBuffer != null) {
+				hexString = LINE_BREAK
+						+ Messages.getString("ShowTraceInfoAction.HexString"); //$NON-NLS-1$
+				hexString += COLON_SPACE + START_PARENTHESIS
+						+ trace.messageLength;
+				hexString += Messages
+						.getString("ShowTraceInfoAction.BytesString"); //$NON-NLS-1$
+				hexString += END_PARENTHESIS + LINE_BREAK;
+				hexTrace = TraceViewerUtils.getTraceAsHexString(
+						trace.byteBuffer, trace.messageStart,
+						trace.messageLength, true);
+			}
+		}
+
+		int headerLength = 0;
+
+		// Create the contents
+		hexString += hexTrace + LINE_BREAK;
+		String contents = traceNumberString + idString + locationString
+				+ classMethodString + bTraceString + hexString;
+		int headerStartOffset = contents.length() - hexTrace.length() - 1;
+		if (trace != null) {
+
+			// Calculate header color offset
+			headerLength = (trace.dataStart - trace.messageStart)
+					* BYTE_AS_HEX_STRING_LENGTH;
+			StyleRange headerRange = new StyleRange(headerStartOffset,
+					headerLength, Display.getDefault().getSystemColor(
+							SWT.COLOR_RED), null);
+			styleRanges.add(headerRange);
+
+			// Calculate data color offset
+			if (headerStartOffset + headerLength + 1 < contents.length()) {
+				StyleRange dataRange = new StyleRange(headerStartOffset
+						+ headerLength, contents.length()
+						- (headerStartOffset + headerLength + 1) - 1, Display
+						.getDefault().getSystemColor(SWT.COLOR_BLUE), null);
+				styleRanges.add(dataRange);
+			}
+		}
+
+		// Show information message
+		new ShowTraceInfoDialog(PlatformUI.getWorkbench().getDisplay()
+				.getActiveShell(), contents, styleRanges).openDialog();
+	}
+
+	/**
+	 * Constructs ID string
+	 * 
+	 * @return ID string
+	 */
+	private String constructIdString() {
+
+		// Get names from Dictionary
+		String[] names = TraceViewerGlobals.getDecodeProvider()
+				.getComponentGroupTraceName(trace.information.getComponentId(),
+						trace.information.getGroupId(),
+						trace.information.getTraceId());
+
+		// Component ID and name
+		String idStr = Messages.getString("ShowTraceInfoAction.CidStr"); //$NON-NLS-1$
+		String idString = LINE_BREAK
+				+ idStr
+				+ COLON_SPACE
+				+ idToHexNameString(trace.information.getComponentId(),
+						names[0]);
+
+		// Group ID and name
+		idStr = Messages.getString("ShowTraceInfoAction.GidStr"); //$NON-NLS-1$
+		idString += LINE_BREAK + idStr + COLON_SPACE
+				+ idToHexNameString(trace.information.getGroupId(), names[1]);
+
+		// Trace ID and name
+		idStr = Messages.getString("ShowTraceInfoAction.TidStr"); //$NON-NLS-1$
+		idString += LINE_BREAK + idStr + COLON_SPACE
+				+ idToHexNameString(trace.information.getTraceId(), names[2])
+				+ LINE_BREAK;
+		return idString;
+	}
+
+	/**
+	 * Constructs BTrace string
+	 * 
+	 * @param totalStringLength
+	 *            total string length before this string
+	 * @param styleRanges
+	 *            list of style ranges
+	 * @return BTrace string
+	 */
+	private String constructBTraceString(int totalStringLength,
+			List<StyleRange> styleRanges) {
+		BTraceInformation bTraceInf = trace.bTraceInformation;
+
+		StringBuffer bTraceString = new StringBuffer();
+		bTraceString.append(LINE_BREAK);
+		bTraceString.append(Messages
+				.getString("ShowTraceInfoAction.BTraceInformation")); //$NON-NLS-1$
+		bTraceString.append(LINE_BREAK);
+
+		// BTrace header
+		bTraceString.append(Messages
+				.getString("ShowTraceInfoAction.RecordSize")); //$NON-NLS-1$
+		bTraceString.append(byteToString(bTraceInf.getRecordSize()));
+		bTraceString.append(LINE_BREAK);
+		bTraceString.append(Messages.getString("ShowTraceInfoAction.Flags")); //$NON-NLS-1$
+		bTraceString.append(byteToString(bTraceInf.getFlags()));
+		bTraceString.append(LINE_BREAK);
+		bTraceString.append(Messages.getString("ShowTraceInfoAction.Category")); //$NON-NLS-1$
+		bTraceString.append(byteToString(bTraceInf.getCategory()));
+		bTraceString.append(LINE_BREAK);
+		bTraceString.append(Messages
+				.getString("ShowTraceInfoAction.SubCategory")); //$NON-NLS-1$
+		bTraceString.append(byteToString(bTraceInf.getSubCategory()));
+		bTraceString.append(LINE_BREAK);
+
+		// BTrace variables
+		if (bTraceInf.isHeader2Present()) {
+			bTraceString
+					.append(Messages.getString("ShowTraceInfoAction.CpuId")); //$NON-NLS-1$
+			bTraceString.append(bTraceInf.getCpuId());
+			bTraceString.append(LINE_BREAK);
+		}
+		if (bTraceInf.isTimestampPresent()) {
+			bTraceString.append(Messages
+					.getString("ShowTraceInfoAction.Timestamp")); //$NON-NLS-1$
+			bTraceString.append(idToHexNameString(bTraceInf.getTimestamp(),
+					null));
+			bTraceString.append(LINE_BREAK);
+		}
+		if (bTraceInf.isTimestamp2Present()) {
+			bTraceString.append(Messages
+					.getString("ShowTraceInfoAction.Timestamp2")); //$NON-NLS-1$
+			bTraceString.append(idToHexNameString(bTraceInf.getTimestamp2(),
+					null));
+			bTraceString.append(LINE_BREAK);
+		}
+		if (bTraceInf.isContextIdPresent()) {
+			bTraceString.append(Messages
+					.getString("ShowTraceInfoAction.ContextId")); //$NON-NLS-1$
+			bTraceString
+					.append(idToHexNameString(bTraceInf.getThreadId(), null));
+
+			// Check context
+			if ((bTraceInf.getThreadId() & (1 << 0)) == 0) {
+
+				// NThread
+				if ((bTraceInf.getThreadId() & (1 << 1)) == 0) {
+					bTraceString.append(Messages
+							.getString("ShowTraceInfoAction.NThread")); //$NON-NLS-1$
+					// FIQ Context
+				} else {
+					bTraceString.append(Messages
+							.getString("ShowTraceInfoAction.FIQ")); //$NON-NLS-1$
+				}
+			} else {
+				// IRQ Context
+				if ((bTraceInf.getThreadId() & (1 << 1)) == 0) {
+					bTraceString.append(Messages
+							.getString("ShowTraceInfoAction.IRQ")); //$NON-NLS-1$
+
+					// IDFC Context
+				} else {
+					bTraceString.append(Messages
+							.getString("ShowTraceInfoAction.IDFC")); //$NON-NLS-1$
+				}
+			}
+			bTraceString.append(LINE_BREAK);
+		}
+		if (bTraceInf.isProgramCounterPresent()) {
+			bTraceString.append(Messages
+					.getString("ShowTraceInfoAction.ProgramCounter")); //$NON-NLS-1$
+			bTraceString.append(idToHexNameString(
+					bTraceInf.getProgramCounter(), null));
+			bTraceString.append(LINE_BREAK);
+		}
+		if (bTraceInf.isExtraValuePresent()) {
+			bTraceString.append(Messages
+					.getString("ShowTraceInfoAction.ExtraValue")); //$NON-NLS-1$
+			bTraceString.append(idToHexNameString(bTraceInf.getExtraValue(),
+					null));
+			bTraceString.append(LINE_BREAK);
+		}
+		if (bTraceInf.isTruncated()) {
+			bTraceString.append(Messages
+					.getString("ShowTraceInfoAction.Truncated")); //$NON-NLS-1$
+			bTraceString.append(LINE_BREAK);
+		}
+		if (bTraceInf.isTraceMissing()) {
+			bTraceString.append(Messages
+					.getString("ShowTraceInfoAction.RecordMissing")); //$NON-NLS-1$
+			bTraceString.append(LINE_BREAK);
+		}
+
+		// Multipart stuff
+		if (bTraceInf.getMultiPart() != 0) {
+			bTraceString.append(Messages
+					.getString("ShowTraceInfoAction.MultiPart")); //$NON-NLS-1$
+			if (bTraceInf.getMultiPartTraceParts() != null) {
+				bTraceString.append(LINE_BREAK);
+				bTraceString.append(Messages
+						.getString("ShowTraceInfoAction.AssembledFromParts")); //$NON-NLS-1$
+				bTraceString.append(LINE_BREAK);
+				bTraceString.append(LINE_BREAK);
+				Iterator<byte[]> i = bTraceInf.getMultiPartTraceParts()
+						.getTraceParts().iterator();
+				Iterator<Integer> headerLenIterator = bTraceInf
+						.getMultiPartTraceParts().getTracePartHeaderSizes()
+						.iterator();
+
+				// Loop through trace parts
+				int partNumber = 1;
+				while (i.hasNext()) {
+					byte[] byteArr = i.next();
+					bTraceString.append(Messages
+							.getString("ShowTraceInfoAction.Part")); //$NON-NLS-1$
+					bTraceString.append(partNumber++);
+					bTraceString.append(COLON_SPACE + START_PARENTHESIS
+							+ byteArr.length);
+					bTraceString.append(Messages
+							.getString("ShowTraceInfoAction.BytesString")); //$NON-NLS-1$
+					bTraceString.append(END_PARENTHESIS + LINE_BREAK);
+					String hexTrace = TraceViewerUtils.getTraceAsHexString(
+							ByteBuffer.wrap(byteArr), 0, byteArr.length, true);
+
+					int headerLen = headerLenIterator.next().intValue();
+					int colorHeaderStartOffset = totalStringLength
+							+ bTraceString.length();
+					int colorDataStartOffset = colorHeaderStartOffset
+							+ (headerLen * BYTE_AS_HEX_STRING_LENGTH);
+
+					// Add offsets to style range
+					StyleRange headerRange = new StyleRange(
+							colorHeaderStartOffset, headerLen
+									* BYTE_AS_HEX_STRING_LENGTH,
+							Display.getDefault().getSystemColor(SWT.COLOR_RED),
+							null);
+					StyleRange dataRange = new StyleRange(
+							colorDataStartOffset,
+							hexTrace.length()
+									- (headerLen * BYTE_AS_HEX_STRING_LENGTH),
+							Display.getDefault().getSystemColor(SWT.COLOR_BLUE),
+							null);
+					styleRanges.add(headerRange);
+					styleRanges.add(dataRange);
+
+					bTraceString.append(hexTrace);
+					bTraceString.append(LINE_BREAK);
+					bTraceString.append(LINE_BREAK);
+				}
+
+			} else if (bTraceInf.getMultiPart() == 1) {
+				bTraceString.append(Messages
+						.getString("ShowTraceInfoAction.FirstPart")); //$NON-NLS-1$
+			} else if (bTraceInf.getMultiPart() == 2) {
+				bTraceString.append(Messages
+						.getString("ShowTraceInfoAction.MiddlePart")); //$NON-NLS-1$
+			} else if (bTraceInf.getMultiPart() == 3) {
+				bTraceString.append(Messages
+						.getString("ShowTraceInfoAction.LastPart")); //$NON-NLS-1$
+			}
+			bTraceString.append(LINE_BREAK);
+		}
+
+		return bTraceString.toString();
+	}
+
+	/**
+	 * Converts ID to hex string and name
+	 * 
+	 * @param id
+	 *            ID
+	 * @param name
+	 *            name
+	 * @return ID as hex and name string
+	 */
+	private String idToHexNameString(int id, String name) {
+		String idString = Integer.toHexString(id);
+		if (idString.length() == 1) {
+			idString = LEAD_ZERO + idString;
+		}
+		idString = HEX_PREFIX + idString;
+
+		if (name != null) {
+			idString += " (" + name + ")"; //$NON-NLS-1$//$NON-NLS-2$
+		}
+
+		return idString;
+	}
+
+	/**
+	 * Converts byte to string
+	 * 
+	 * @param b
+	 *            byte to be converted
+	 * @return byte as a string
+	 */
+	private String byteToString(byte b) {
+		StringBuffer out = new StringBuffer();
+		int v = b & 0xFF;
+		out.append(hexChars[v >>> 4]);
+		out.append(hexChars[v & 0xF]);
+		return out.toString();
+	}
+
+	/**
+	 * Sets trace metadata
+	 * 
+	 * @param trace
+	 *            the trace properties
+	 */
+	public void setTrace(TraceProperties trace) {
+		this.trace = trace;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/StartExternalFilterAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,136 @@
+/*
+ * 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:
+ *
+ * Start External Filter Application Action
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import java.net.URL;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.TraceViewerDialogInterface.TVPreferencePage;
+import com.nokia.traceviewer.engine.dataprocessor.ExternalFilterProcessor;
+import com.nokia.traceviewer.engine.preferences.PreferenceConstants;
+
+/**
+ * Start External Filter Application Action
+ */
+public class StartExternalFilterAction extends TraceViewerAction {
+
+	/**
+	 * Image for the start action
+	 */
+	private static ImageDescriptor startImage;
+
+	/**
+	 * Image for the stop action
+	 */
+	private static ImageDescriptor stopImage;
+
+	static {
+		URL url = null;
+		URL url2 = null;
+		url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				"/icons/startexternal.gif"); //$NON-NLS-1$
+		url2 = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				"/icons/stopexternal.gif"); //$NON-NLS-1$
+		startImage = ImageDescriptor.createFromURL(url);
+		stopImage = ImageDescriptor.createFromURL(url2);
+	}
+
+	/**
+	 * Constructor
+	 */
+	public StartExternalFilterAction() {
+		setText(Messages.getString("StartExternalFilterAction.Title")); //$NON-NLS-1$
+		setToolTipText(Messages.getString("StartExternalFilterAction.Tooltip")); //$NON-NLS-1$
+		setImageDescriptor(startImage);
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
+				TraceViewerHelpContextIDs.ACTIONS);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		TraceViewerGlobals.postUiEvent("StartExternalFilterButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+
+		// If external filter is not defined, open the preference page
+		boolean externalFilterIsDefined = TraceViewerPlugin.getDefault()
+				.getPreferenceStore().getBoolean(
+						PreferenceConstants.EXTERNAL_FILTER_CHECKBOX);
+
+		if (!externalFilterIsDefined) {
+			TraceViewerGlobals.getTraceViewer().getDialogs()
+					.openPreferencePage(TVPreferencePage.ADVANCED);
+
+			// If defined but not using, set as using
+		} else if (!TraceViewerGlobals.getTraceViewer()
+				.getDataProcessorAccess().getFilterProcessor()
+				.isUsingExternalFilter()) {
+			TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+					.getFilterProcessor().setUsingExternalFilter(true);
+		}
+
+		// Check checkbox again
+		externalFilterIsDefined = TraceViewerPlugin.getDefault()
+				.getPreferenceStore().getBoolean(
+						PreferenceConstants.EXTERNAL_FILTER_CHECKBOX);
+
+		// Start external application and show stop image
+		if (externalFilterIsDefined
+				&& !TraceViewerGlobals.getTraceViewer()
+						.getDataProcessorAccess().getFilterProcessor()
+						.isUsingExternalFilter()) {
+			boolean success = TraceViewerGlobals.getTraceViewer()
+					.getDataProcessorAccess().getFilterProcessor()
+					.getExternalFilterProcessor().startExternalApplication();
+
+			if (success) {
+				setImageDescriptor(stopImage);
+				setText(Messages.getString("StopExternalFilterAction.Title")); //$NON-NLS-1$
+				setToolTipText(Messages
+						.getString("StopExternalFilterAction.Tooltip")); //$NON-NLS-1$
+			}
+			// Stop external application and show start image
+		} else {
+			setImageDescriptor(startImage);
+			setText(Messages.getString("StartExternalFilterAction.Title")); //$NON-NLS-1$
+			setToolTipText(Messages
+					.getString("StartExternalFilterAction.Tooltip")); //$NON-NLS-1$
+
+			// Get the processor and stop it if it exists
+			ExternalFilterProcessor extProcessor = TraceViewerGlobals
+					.getTraceViewer().getDataProcessorAccess()
+					.getFilterProcessor().getExternalFilterProcessor();
+
+			if (extProcessor != null) {
+				extProcessor.stopExternalApplication();
+			}
+		}
+		TraceViewerGlobals.postUiEvent("StartExternalFilterButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/ToolbarShortcutAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,78 @@
+/*
+ * 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:
+ *
+ * Opens TraceViewer main view
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * Opens TraceViewer main view
+ */
+public class ToolbarShortcutAction implements IWorkbenchWindowActionDelegate {
+
+	/**
+	 * TraceViewer main view ID
+	 */
+	private static final String TV_VIEW_ID = "com.nokia.traceviewer.view.TraceViewerView"; //$NON-NLS-1$
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
+	 */
+	public void dispose() {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @seeorg.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.
+	 * IWorkbenchWindow)
+	 */
+	public void init(IWorkbenchWindow window) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+	 */
+	public void run(IAction action) {
+		try {
+			PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+					.getActivePage().showView(TV_VIEW_ID);
+		} catch (PartInitException e) {
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action
+	 * .IAction, org.eclipse.jface.viewers.ISelection)
+	 */
+	public void selectionChanged(IAction action, ISelection selection) {
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/TraceActivationAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,98 @@
+/*
+ * 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:
+ *
+ * Handler for trace activation command
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import java.net.URL;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.dialog.TraceActivationDialog;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.TraceViewerDialogInterface.Dialog;
+
+/**
+ * Handler for trace activation command
+ * 
+ */
+public final class TraceActivationAction extends TraceViewerAction {
+
+	/**
+	 * Trace activation dialog
+	 */
+	private TraceActivationDialog dialog;
+
+	/**
+	 * Image for the action
+	 */
+	private static ImageDescriptor image;
+
+	static {
+		URL url = null;
+		url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				"/icons/traceactivation.gif"); //$NON-NLS-1$
+		image = ImageDescriptor.createFromURL(url);
+	}
+
+	/**
+	 * Constructor
+	 */
+	TraceActivationAction() {
+		setText(Messages.getString("TraceActivationAction.Title")); //$NON-NLS-1$
+		setToolTipText(Messages.getString("TraceActivationAction.Tooltip")); //$NON-NLS-1$
+		setImageDescriptor(image);
+		setActionDefinitionId("com.nokia.traceviewer.command.trace_activation"); //$NON-NLS-1$
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
+				TraceViewerHelpContextIDs.ACTIVATION_DIALOG);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		TraceViewerGlobals.postUiEvent("TraceActivationButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+		if (dialog == null) {
+			dialog = (TraceActivationDialog) TraceViewerGlobals
+					.getTraceViewer().getDialogs().createDialog(
+							Dialog.TRACEACTIVATION);
+			dialog.openDialog();
+		} else if (!dialog.isOpen()) {
+			dialog.openDialog();
+		} else {
+			dialog.setFocus();
+		}
+		TraceViewerGlobals.postUiEvent("TraceActivationButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+
+	/**
+	 * Gets trace activation dialog
+	 * 
+	 * @return the dialog
+	 */
+	public TraceActivationDialog getDialog() {
+		return dialog;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/TraceActivationGlobalAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,39 @@
+/*
+ * 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:
+ *
+ * Handler for trace activation global command
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Handler for trace activation global command
+ */
+public final class TraceActivationGlobalAction extends TraceViewerGlobalAction {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerGlobalAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		TraceViewerGlobals.getTraceViewer().getView().getActionFactory()
+				.getTraceActivationAction().run();
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/TraceCommentValidator.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,41 @@
+/*
+ * 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:
+ *
+ * Trace comment validator
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import org.eclipse.jface.dialogs.IInputValidator;
+
+/**
+ * Trace comment validator
+ */
+public class TraceCommentValidator implements IInputValidator {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.dialogs.IInputValidator#isValid(java.lang.String)
+	 */
+	public String isValid(String str) {
+		String ret = null;
+		if (str == null || str.equals("")) { //$NON-NLS-1$
+			ret = ""; //$NON-NLS-1$
+		}
+		return ret;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/TraceVariablesAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,78 @@
+/*
+ * 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:
+ *
+ * Handler for trace variables command
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import java.net.URL;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.engine.TraceViewerDialog;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Handler for trace variables command
+ * 
+ */
+final class TraceVariablesAction extends TraceViewerAction {
+
+	/**
+	 * Image for the action
+	 */
+	private static ImageDescriptor image;
+
+	static {
+		URL url = null;
+		url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				"/icons/tracevariable.gif"); //$NON-NLS-1$
+		image = ImageDescriptor.createFromURL(url);
+	}
+
+	/**
+	 * Constructor
+	 */
+	TraceVariablesAction() {
+		setText(Messages.getString("TraceVariablesAction.Title")); //$NON-NLS-1$
+		setToolTipText(Messages.getString("TraceVariablesAction.Tooltip")); //$NON-NLS-1$
+		setImageDescriptor(image);
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
+				TraceViewerHelpContextIDs.ACTIONS);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		TraceViewerGlobals.postUiEvent("TraceVariablesButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+		TraceViewerDialog dialog = TraceViewerGlobals.getTraceViewer()
+				.getDataProcessorAccess().getVariableTracingProcessor()
+				.getVariableTracingDialog();
+		if (dialog != null) {
+			dialog.openDialog();
+		}
+		TraceViewerGlobals.postUiEvent("TraceVariablesButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/TraceViewerAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,70 @@
+/*
+ * 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:
+ *
+ * Base class for all action objects of Trace Viewer view
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import org.eclipse.jface.action.Action;
+
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Base class for all action objects of Trace Viewer view
+ * 
+ */
+abstract class TraceViewerAction extends Action {
+
+	/**
+	 * Constructor
+	 */
+	protected TraceViewerAction() {
+	}
+
+	/**
+	 * Constructor with action type
+	 * 
+	 * @param type
+	 *            the action type
+	 */
+	protected TraceViewerAction(int type) {
+		super("", type); //$NON-NLS-1$
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.action.IAction#run()
+	 */
+	@Override
+	public void run() {
+		if (TraceViewerGlobals.getTraceProvider() != null) {
+			doRun();
+		} else {
+			String providerMissingMsg = Messages
+					.getString("TraceViewerAction.ProviderMissingError"); //$NON-NLS-1$
+
+			// Show message that trace provider is missing
+			TraceViewerGlobals.getTraceViewer().getDialogs().showErrorMessage(
+					providerMissingMsg);
+		}
+	}
+
+	/**
+	 * Runs this action
+	 */
+	protected abstract void doRun();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/TraceViewerActionUtils.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,222 @@
+/*
+ * 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:
+ *
+ * TraceViewer Action Utils contains utilities that can be used from all Actions
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.TraceViewerViewInterface;
+
+/**
+ * TraceViewer Action Utils contains utilities that can be used from all Actions
+ * 
+ */
+public class TraceViewerActionUtils {
+
+	/**
+	 * Previous filter path
+	 */
+	private static String previousFilterPath;
+
+	/**
+	 * Copy buffer size
+	 */
+	private static final int COPY_BUFFER_SIZE = 8192 * 100 * 2;
+
+	/**
+	 * Comment prefix
+	 */
+	public static final String COMMENT_PREFIX = " // "; //$NON-NLS-1$
+
+	/**
+	 * Traces dropped message
+	 */
+	public static final String TRACES_DROPPED_MSG = Messages
+			.getString("TraceViewerActionUtils.TracesDroppedMsg"); //$NON-NLS-1$
+
+	/**
+	 * Opens a file browse dialog
+	 * 
+	 * @param filters
+	 *            file filters
+	 * @param filterExtensions
+	 *            file filter extensions
+	 * @param filterPath
+	 *            initial filter path to open
+	 * @param fileName
+	 *            initial filename to open
+	 * @param multiSelect
+	 *            if true, open as multiselection dialog
+	 * @param opendialog
+	 *            if true, open as OPEN dialog. If false, open as SAVE dialog.
+	 * 
+	 * @return array of selected files or null if no files were selected
+	 */
+	static String[] openFileDialog(String[] filters, String[] filterExtensions,
+			String filterPath, String fileName, boolean multiSelect,
+			boolean opendialog) {
+		String pathSeparator = System.getProperty("file.separator"); //$NON-NLS-1$
+		Shell activeShell = PlatformUI.getWorkbench().getDisplay()
+				.getActiveShell();
+		Shell fileDialogShell = new Shell(activeShell);
+		FileDialog dlg;
+
+		// Create as multiselect dialog
+		if (multiSelect) {
+			if (opendialog) {
+				dlg = new FileDialog(fileDialogShell, SWT.MULTI | SWT.OPEN);
+			} else {
+				dlg = new FileDialog(fileDialogShell, SWT.MULTI | SWT.SAVE);
+			}
+		} else {
+			if (opendialog) {
+				dlg = new FileDialog(fileDialogShell, SWT.OPEN);
+			} else {
+				dlg = new FileDialog(fileDialogShell, SWT.SAVE);
+			}
+		}
+
+		dlg.setFilterNames(filters);
+		dlg.setFilterExtensions(filterExtensions);
+		String filterPathToUse = filterPath;
+		if (filterPathToUse == null) {
+			filterPathToUse = previousFilterPath;
+		}
+		dlg.setFilterPath(filterPathToUse);
+		dlg.setFileName(fileName);
+
+		// Move the dialog to the center of the top level shell.
+		Rectangle shellBounds = activeShell.getBounds();
+		Point dialogSize = fileDialogShell.getSize();
+
+		fileDialogShell.setLocation(shellBounds.x
+				+ (shellBounds.width - dialogSize.x) / 2, shellBounds.y
+				+ (shellBounds.height - dialogSize.y) / 2);
+		String file = dlg.open();
+		String[] files = null;
+		if (file != null) {
+			files = dlg.getFileNames();
+
+			// Add path to files
+			for (int i = 0; i < files.length; i++) {
+				files[i] = dlg.getFilterPath() + pathSeparator + files[i];
+			}
+			previousFilterPath = dlg.getFilterPath();
+		}
+		return files;
+	}
+
+	/**
+	 * Copies file to another file
+	 * 
+	 * @param sourceFile
+	 *            to to be copied
+	 * @param targetFile
+	 *            new file to be created
+	 * @param callback
+	 *            callback whom to inform about file position when copying. Can
+	 *            be null.
+	 * @param fileStartOffset
+	 *            source file reading start offset
+	 * @throws Exception
+	 */
+	public static void copyFile(File sourceFile, File targetFile,
+			CopyFileProgressCallback callback, long fileStartOffset)
+			throws Exception {
+		InputStream in = null;
+		OutputStream out = null;
+
+		byte[] buffer = new byte[COPY_BUFFER_SIZE];
+		int bytesRead;
+		long numberOfBytesTransferred = 0;
+		try {
+			in = new FileInputStream(sourceFile);
+			out = new FileOutputStream(targetFile);
+
+			// Skip bytes
+			long skipped = in.skip(fileStartOffset);
+			if (skipped != fileStartOffset) {
+				throw new Exception(Messages
+						.getString("TraceViewerActionUtils.SkippingFailedMsg")); //$NON-NLS-1$
+			}
+
+			while ((bytesRead = in.read(buffer)) >= 0) {
+				out.write(buffer, 0, bytesRead);
+				numberOfBytesTransferred += bytesRead;
+
+				// Inform callback about new file position
+				if (callback != null) {
+					callback.notifyFilePosition(numberOfBytesTransferred);
+
+					// If callback says cancel, abort the copy
+					if (callback.cancelCopying()) {
+						break;
+					}
+				}
+			}
+		} catch (Exception e) {
+			throw e;
+		} finally {
+			if (in != null) {
+				in.close();
+			}
+			if (out != null) {
+				out.close();
+			}
+
+			// Inform callback that copying ended
+			if (callback != null) {
+				callback.copyingFinished();
+			}
+		}
+	}
+
+	/**
+	 * Opens property view if it's not open
+	 */
+	public static void openPropertyView() {
+		// View is already open, do nothing
+		if (TraceViewerGlobals.getTraceViewer().getPropertyView() != null
+				&& !TraceViewerGlobals.getTraceViewer().getPropertyView()
+						.isDisposed()) {
+
+		} else {
+			// Open it
+			try {
+				PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+						.getActivePage().showView(
+								TraceViewerViewInterface.PROPERTYVIEW_ID);
+			} catch (PartInitException e) {
+				e.printStackTrace();
+			}
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/TraceViewerGlobalAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,105 @@
+/*
+ * 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:
+ *
+ * Base class for all global action objects of TraceViewer
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.core.commands.IHandlerListener;
+
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Base class for all global action objects of TraceViewer
+ */
+public abstract class TraceViewerGlobalAction implements IHandler {
+
+	/**
+	 * Constructor
+	 */
+	public TraceViewerGlobalAction() {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.core.commands.IHandler#addHandlerListener(org.eclipse.core
+	 * .commands.IHandlerListener)
+	 */
+	public void addHandlerListener(IHandlerListener handlerListener) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.core.commands.IHandler#dispose()
+	 */
+	public void dispose() {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.
+	 * ExecutionEvent)
+	 */
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+		if (TraceViewerGlobals.getTraceViewer().getView() != null) {
+			doRun();
+		}
+
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.core.commands.IHandler#isEnabled()
+	 */
+	public boolean isEnabled() {
+		return true;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.core.commands.IHandler#isHandled()
+	 */
+	public boolean isHandled() {
+		return true;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.core.commands.IHandler#removeHandlerListener(org.eclipse.
+	 * core.commands.IHandlerListener)
+	 */
+	public void removeHandlerListener(IHandlerListener handlerListener) {
+	}
+
+	/**
+	 * Runs this action
+	 */
+	protected abstract void doRun();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/TriggerAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,77 @@
+/*
+ * 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:
+ *
+ * Handler for trigger command
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import java.net.URL;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.engine.TraceViewerDialog;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Handler for trigger command
+ * 
+ */
+final class TriggerAction extends TraceViewerAction {
+
+	/**
+	 * Image for the action
+	 */
+	private static ImageDescriptor image;
+
+	static {
+		URL url = null;
+		url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				"/icons/trigger.gif"); //$NON-NLS-1$
+		image = ImageDescriptor.createFromURL(url);
+	}
+
+	/**
+	 * Constructor
+	 */
+	TriggerAction() {
+		setText(Messages.getString("TriggerAction.Title")); //$NON-NLS-1$
+		setToolTipText(Messages.getString("TriggerAction.Tooltip")); //$NON-NLS-1$
+		setImageDescriptor(image);
+		setActionDefinitionId("com.nokia.traceviewer.command.trigger"); //$NON-NLS-1$
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
+				TraceViewerHelpContextIDs.TRIGGERING);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		TraceViewerGlobals.postUiEvent("TriggerButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+		TraceViewerDialog dialog = TraceViewerGlobals.getTraceViewer()
+				.getDataProcessorAccess().getTriggerProcessor()
+				.getTriggerDialog();
+		dialog.openDialog();
+		TraceViewerGlobals.postUiEvent("TriggerButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/TriggerGlobalAction.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,39 @@
+/*
+ * 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:
+ *
+ * Handler for trigger global command
+ *
+ */
+package com.nokia.traceviewer.action;
+
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Handler for trigger global command
+ */
+public final class TriggerGlobalAction extends TraceViewerGlobalAction {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.action.TraceViewerGlobalAction#doRun()
+	 */
+	@Override
+	protected void doRun() {
+		TraceViewerGlobals.getTraceViewer().getView().getActionFactory()
+				.getTriggerAction().run();
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/messages.properties	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,160 @@
+AddCommentToTraceAction.AddCommentShellTitle=Add comment
+AddCommentToTraceAction.AddCommentTipText=Give a comment for this trace
+AddCommentToTraceAction.AddCommentToTraceText=Add comment to the trace
+AddCommentToTraceAction.AddCommentToTraceToolTip=Add comment to the trace
+AddLineCountRuleAction.Title=Add line counting rule
+AddLineCountRuleAction.Tooltip=Add line counting rule
+EditLineCountRuleAction.Title=Edit rule
+EditLineCountRuleAction.Tooltip=Edit rule
+EditTraceCommentAction.EditCommentShellTitle=Edit comment
+EditTraceCommentAction.EditCommentText=Edit comment
+EditTraceCommentAction.EditCommentTipText=Give the comment for this trace
+EditTraceCommentAction.EditCommentToolTip=Edit comment
+AddVariableTracingRuleAction.Title=Add variable tracing rule
+AddVariableTracingRuleAction.Tooltip=Add variable tracing rule
+EditVariableTracingRuleAction.Title=Edit rule
+EditVariableTracingRuleAction.Tooltip=Edit rule
+ConnectAction.TCPIPMsg=TCP / IP
+ConnectAction.Title=Connect
+ConnectAction.Tooltip=Connect to 
+ConnectAction.Tooltip2=trace source
+ConnectAction.TooltipCurr=current connection
+DeactivateLineCountRuleAction.DeactivateRuleText=Deactivate rule
+DeactivateLineCountRuleAction.DeactivateRuleToolTip=Deactivate rule
+DeactivateVariableTracingRuleAction.DeactivateRuleText=Deactivate rule
+DeactivateVariableTracingRuleAction.DeactivateRuleToolTip=Deactivate rule
+DisconnectAction.Title=Disconnect
+DisconnectAction.Tooltip=Disconnect from 
+PauseAction.Title=Pause
+PauseAction.Tooltip=Pause
+UnPauseAction.Title=UnPause
+UnPauseAction.Tooltip=UnPause
+FilterAction.Title=Filter
+FilterAction.Tooltip=Filter with keywords
+SearchAction.Title=Search
+SearchAction.Tooltip=Search
+ColorAction.Title=Color
+ColorAction.Tooltip=Colors traces based on rules
+CountLinesAction.Title=Count lines
+CountLinesAction.Tooltip=Count lines
+TraceVariablesAction.Title=Trace variables
+TraceVariablesAction.Tooltip=Trace variables
+ClearViewAction.Title=Clear view
+ClearViewAction.Tooltip=Clear view
+CloseAndRestartLoggingAction.CloseLogText=Close machine ASCII log
+CloseAndRestartLoggingAction.CloseLogToolTip=Close machine ASCII log
+CloseAndRestartLoggingAction.RetakeLogText=Retake previous machine ASCII log
+CloseAndRestartLoggingAction.RetakeLogToolTip=Retake previous machine ASCII log
+TraceActivationAction.Title=Trace Activation
+TraceActivationAction.Tooltip=Trace activation
+LogCloseAsciiAction.Title=Close ASCII log
+LogCloseAsciiAction.Tooltip=Close ASCII log file
+LogCloseBinaryAction.Title=Close Binary log
+LogCloseBinaryAction.Tooltip=Close Binary log file
+LogNewAsciiAction.FilterNames=ASCII log file (*.txt)
+LogNewAsciiAction.Title=New ASCII log
+LogNewAsciiAction.Tooltip=Create new ASCII log file
+LogNewBinaryAction.FilterNames=Binary log file (*.bin)
+LogNewBinaryAction.Title=New Binary log
+LogNewBinaryAction.Tooltip=Create new Binary log file
+LogOpenLogAction.ChangeDataFormatMsg1=Seems that the file you were trying to open does not match the current data format in use. However, it seems to match\n\n  
+LogOpenLogAction.ChangeDataFormatMsg2=\n\ndata format. Do you want to change to that data format?
+LogOpenLogAction.FileDoesntExist=File doesn't exist\!
+LogOpenLogAction.FilterNames=TraceViewer log file (*.bin, *.txt)
+LogOpenLogAction.Title=Open log
+LogOpenLogAction.Tooltip=Open a log file
+LogSaveBinaryAction.FilterNames=Binary log file (*.bin)
+LogSaveBinaryAction.SavingText=Saving...
+LogSaveBinaryAction.Title=Save current traces to Binary log
+LogSaveBinaryAction.Tooltip=Saves current traces to Binary log file
+LogSaveAsciiAction.CannotCreateFileWriter=Cannot create file writer\!
+LogSaveAsciiAction.FilterNames=ASCII log file (*.txt)
+LogSaveAsciiAction.SavingText=Saving...
+LogSaveAsciiAction.Title=Save current traces to ASCII log
+LogSaveAsciiAction.Tooltip=Saves current traces to ASCII log file
+TriggerAction.Title=Triggers
+TriggerAction.Tooltip=Triggers
+OpenDecodeFileAction.Title=Open Dictionary File(s)
+OpenDecodeFileAction.Files=\ more files 
+OpenDecodeFileAction.Tooltip=Open Dictionary File(s)
+OpenDecodeFileAction.FilterNamesOST=OST Dictionary files (*.xml, *.zip)
+OpenDecodeFileAction.BuildingModelString=Building decode model
+OpenDecodeFileAction.DecodingTracesString=Decoding traces
+OpenDecodeFileAction.OpenPreviousFilesString=Open previously opened Dictionary file(s)?
+ActionFactory.LogSubMenuTitle=Log...
+AppendDecodeFileAction.Title=Append Dictionary File(s)
+AppendDecodeFileAction.Tooltip=Append Dictionary File(s)
+ShowTraceInfoAction.AssembledFromParts=Assembled from parts: 
+ShowTraceInfoAction.BTraceInformation=BTrace information:
+ShowTraceInfoAction.BytesString=\ bytes
+ShowTraceInfoAction.TidStr=Trace
+ShowTraceInfoAction.Timestamp=Timestamp: 
+ShowTraceInfoAction.Timestamp2=Timestamp2: 
+ShowTraceInfoAction.Title=Trace information
+ShowTraceInfoAction.TraceNumberString=Trace number
+ShowTraceInfoAction.HexString=Trace as a hex
+ShowTraceInfoAction.LastPart=Last part
+ShowTraceInfoAction.LocationStr=Location
+ShowTraceInfoAction.LineNumberStr=Linenumber
+ShowTraceInfoAction.Category=Category: 0x
+ShowTraceInfoAction.CidStr=Component
+ShowTraceInfoAction.ClassnameStr=Classname
+ShowTraceInfoAction.ContextId=Context ID: 
+ShowTraceInfoAction.CpuId=CPU ID: 
+ShowTraceInfoAction.ExtraValue=Extra value:
+ShowTraceInfoAction.Truncated=Trace is truncated
+ShowTraceInfoAction.RecordMissing=Record(s) before this one are missing
+ShowTraceInfoAction.FIQ=\ (FIQ)
+ShowTraceInfoAction.FirstPart=First part
+ShowTraceInfoAction.Flags=Flags: 0x
+ShowTraceInfoAction.GidStr=Group
+ShowTraceInfoAction.IDFC=\ (IDFC)
+ShowTraceInfoAction.IRQ=\ (IRQ)
+ShowTraceInfoAction.MethodnameStr=Methodname
+ShowTraceInfoAction.MiddlePart=Middle part
+ShowTraceInfoAction.MultiPart=Multipart trace: 
+ShowTraceInfoAction.NThread=\ (NThread)
+ShowTraceInfoAction.Part=Part 
+ShowTraceInfoAction.ProgramCounter=Program counter: 
+ShowTraceInfoAction.RecordSize=Record size: 0x
+ShowTraceInfoAction.SubCategory=Sub-Category: 0x
+ShowTraceInfoAction.Tooltip=Trace information
+OpenTraceLocationAction.Title=Open trace location
+OpenTraceLocationAction.Tooltip=Open trace location
+OpenTraceLocationAction.ExternalFilesProject=External Files
+OpenTraceLocationAction.LocationStr=Location
+OpenTraceLocationAction.NotValidStr=is not valid\!
+OpenTraceLocationAction.BrowseString=.\n\nWould you like to browse for the file?
+OpenTraceLocationAction.AllFilesFilter=All files
+OpenTraceLocationAction.CouldNotFindStr=Could not find
+OpenTraceLocationAction.SourceCodeFilter=Source code files (*.cpp)
+CopySelectionAction.Title=Copy
+CopySelectionAction.Tooltip=Copy
+OpenVariableTracingHistoryAction.Title=Open history
+OpenVariableTracingHistoryAction.Tooltip=Open history
+StartExternalFilterAction.Title=Start external filter command
+StartExternalFilterAction.Tooltip=Start external filter command
+StopExternalFilterAction.Title=Stop external filter command
+StopExternalFilterAction.Tooltip=Stop external filter command
+TraceViewerAction.ProviderMissingError=Trace Provider Plugin missing or not loaded yet\! Wait few seconds and try again\!
+TraceViewerActionUtils.SkippingFailedMsg=Couldn't skip as many bytes as wanted\!
+TraceViewerActionUtils.TracesDroppedMsg=*Traces dropped* 
+ConnectAction.EraseLogConfirmation=Connecting will erase data fetched from the log file. Do you still want to connect?
+ConnectAction.ChangeDataFormatMsg1=\ is normally used with 
+ConnectAction.ChangeDataFormatMsg2=\ data format. Do you want to change to that? 
+ConnectAction.ConnectionNotSupported=\ TraceProvider doesn't support connections\!
+ConnectAction.ConnectionPreferencesError=Cannot connect\! Check connection preferences
+ConnectAction.USBSerialMsg=USB Serial
+CopySelectionDataFetcher.MaxTracesLine1=Only
+CopySelectionDataFetcher.MaxTracesLine2=traces can be copied to the clipboard, the remaining traces were not copied
+JumpToTraceAction.JumpToTraceText=Go to the trace
+JumpToTraceAction.JumpToTraceToolTip=Go to the trace
+ReloadDecodeFilesAction.DictionaryReloaderCategory=Dictionary Reloader
+ReloadDecodeFilesAction.ReloadDescriptionMsg=Reloading changed Dictionary at 
+ReloadDecodeFilesAction.DictionaryDisappearedMsg=Dictionary can no longer be found. It will be reloaded if it reappears but until then those dictionary formats will remain unchanged  
+ReloadDecodeFilesAction.Title=Some Dictionary files have changed. Reload them by clicking here.
+ReloadDecodeFilesAction.Tooltip=Some Dictionary files have changed. Reload them by clicking here.
+RemoveTraceCommentAction.RemoveCommentText=Remove comment
+RemoveTraceCommentAction.RemoveCommentToolTip=Remove comment
+OpenConnectionSettingsAction.Title=Connection Settings...
+OpenConnectionSettingsAction.Tooltip=Open Connection Settings dialog
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/api/ConnectionHandler.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,452 @@
+/*
+ * 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:
+ *
+ * Connection handler handles the connecting and disconnecting
+ *
+ */
+package com.nokia.traceviewer.api;
+
+import java.util.List;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.swt.widgets.Display;
+
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.action.ConnectAction;
+import com.nokia.traceviewer.api.TraceViewerAPI.TVAPIError;
+import com.nokia.traceviewer.engine.TraceProvider;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.preferences.PreferenceConstants;
+import com.nokia.traceviewer.internal.api.TraceViewerAPI2Impl;
+
+/**
+ * Connection handler handles the connecting and disconnecting
+ * 
+ */
+final class ConnectionHandler {
+
+	/**
+	 * Old connection method
+	 */
+	private String oldConnectionMethod;
+
+	/**
+	 * Old connection parameters
+	 */
+	private String[] oldParameters;
+
+	/**
+	 * Old connection ID that was selected.
+	 */
+	private String oldSelectedConnectionID;
+
+	/**
+	 * Connect using current settings defined in TraceViewer's preferences
+	 * 
+	 * @return error code from TraceViewerAPI
+	 */
+	public TVAPIError connect() {
+		TVAPIError errorcode = TVAPIError.NONE;
+
+		// Check if already connected
+		if (isAlreadyConnected()) {
+			errorcode = TVAPIError.ALREADY_CONNECTED;
+
+		} else {
+
+			// If view exists and we are in UI thread, do the connecting through
+			// the view action
+			if (TraceViewerGlobals.getTraceViewer().getView() != null
+					&& Display.getCurrent() != null) {
+				ConnectAction action = ((ConnectAction) (TraceViewerGlobals
+						.getTraceViewer().getView().getActionFactory()
+						.getConnectAction()));
+
+				errorcode = action.connect(false, true);
+
+				// Connect through engine
+			} else {
+				changeDataFormat();
+				boolean success = TraceViewerGlobals.getTraceViewer().connect();
+
+				if (!success) {
+					errorcode = TVAPIError.INVALID_CONNECTION_SETTINGS;
+				}
+
+				// If succeeded and view exists, change button
+				if (success
+						&& TraceViewerGlobals.getTraceViewer().getView() != null) {
+					ConnectAction action = ((ConnectAction) (TraceViewerGlobals
+							.getTraceViewer().getView().getActionFactory()
+							.getConnectAction()));
+					action.changeToDisconnectAction();
+				}
+			}
+		}
+		return errorcode;
+	}
+
+	/**
+	 * Connect using given parameters. Possible connection methods can be found
+	 * from TraceViewerAPI constants. Parameters should be given in this order:
+	 * When using TCP connection, parameters are IP address port number and
+	 * channel number in this order. When using USB serial connection, the only
+	 * parameter is the COM port number. This function will also set given
+	 * parameters to TraceViewer's connection preferences if the connecting
+	 * succeeds.
+	 * 
+	 * @param connectionMethod
+	 *            the connection method to use
+	 * @param parameters
+	 *            array of parameters
+	 * @return error code from TraceViewerAPI
+	 */
+	public TVAPIError connect(int connectionMethod, String[] parameters) {
+		TVAPIError errorcode = TVAPIError.NONE;
+
+		// Check if already connected
+		if (isAlreadyConnected()) {
+			errorcode = TVAPIError.ALREADY_CONNECTED;
+
+		} else {
+			// Save old connection preferences
+			saveConnectionPreferences();
+
+			// Set new connection preferences
+			boolean parametersOk = setNewConnectionPreferences(
+					connectionMethod, parameters);
+
+			if (parametersOk) {
+
+				// If view exists and we are in UI thread, do the connecting
+				// through the view action
+				if (TraceViewerGlobals.getTraceViewer().getView() != null
+						&& Display.getCurrent() != null) {
+					ConnectAction action = ((ConnectAction) (TraceViewerGlobals
+							.getTraceViewer().getView().getActionFactory()
+							.getConnectAction()));
+					errorcode = action.connect(false, false);
+
+					// Connect through engine
+				} else {
+					changeDataFormat();
+					boolean success = TraceViewerGlobals.getTraceViewer()
+							.connect();
+
+					if (success) {
+						errorcode = TVAPIError.NONE;
+					} else {
+						errorcode = TVAPIError.INVALID_CONNECTION_SETTINGS;
+					}
+				}
+
+				// Connecting failed
+				if (errorcode != TVAPIError.NONE) {
+
+					// Set old preferences back
+					setOldPreferencesBack();
+
+					// If succeeded and view exists, change button
+				} else if (TraceViewerGlobals.getTraceViewer().getView() != null) {
+					ConnectAction action = ((ConnectAction) (TraceViewerGlobals
+							.getTraceViewer().getView().getActionFactory()
+							.getConnectAction()));
+					action.changeToDisconnectAction();
+				}
+
+			} else {
+				// Set old preferences back
+				setOldPreferencesBack();
+
+				errorcode = TVAPIError.INVALID_CONNECTION_PARAMETERS;
+			}
+		}
+		return errorcode;
+	}
+
+	/**
+	 * Changes Data Format
+	 */
+	private void changeDataFormat() {
+
+		// Get the TraceViewer preferenceStore
+		IPreferenceStore store = TraceViewerPlugin.getDefault()
+				.getPreferenceStore();
+
+		// If there are more than one TraceProvider
+		if (TraceViewerGlobals.getListOfTraceProviders().size() > 1) {
+
+			String selectedConnectionType = store
+					.getString(PreferenceConstants.CONNECTION_TYPE);
+
+			// If the currently selected TraceProvider doesn't has selected
+			// connection as preferred, try to find one that does
+			if (!TraceViewerGlobals.getTraceProvider()
+					.getPreferredConnectionType()
+					.equals(selectedConnectionType)) {
+
+				List<TraceProvider> traceProviders = TraceViewerGlobals
+						.getListOfTraceProviders();
+
+				// Go through list of TraceProviders
+				for (int i = 0; i < traceProviders.size(); i++) {
+					TraceProvider newProvider = traceProviders.get(i);
+					if (newProvider.getPreferredConnectionType().equals(
+							selectedConnectionType)) {
+						store.setValue(PreferenceConstants.DATA_FORMAT,
+								newProvider.getName());
+
+						// Set new Trace provider
+						TraceViewerGlobals.setTraceProvider(newProvider, true);
+						break;
+					}
+				}
+			}
+		}
+	}
+
+	/**
+	 * Sets new connection preferences
+	 * 
+	 * @param connectionMethod
+	 *            connection method
+	 * @param parameters
+	 *            connection parameters
+	 * @return true if succeeded, false if failed
+	 */
+	private boolean setNewConnectionPreferences(int connectionMethod,
+			String[] parameters) {
+
+		boolean succeeded = true;
+
+		// Get the TraceViewer preferenceStore
+		IPreferenceStore store = TraceViewerPlugin.getDefault()
+				.getPreferenceStore();
+
+		try {
+			String connectionMethodStr = null;
+
+			// TCP / IP
+			if (connectionMethod == TraceViewerAPI.TVAPI_CONNECTION_TCP) {
+				connectionMethodStr = PreferenceConstants.CONNECTION_TYPE_TCPIP;
+
+				// There must be at least 2 parameters
+				if (parameters != null && parameters.length > 1) {
+
+					// Set IP address
+					store.setValue(PreferenceConstants.IP_ADDRESS,
+							parameters[0]);
+
+					// Set port number
+					store.setValue(PreferenceConstants.TCPIP_PORT,
+							parameters[1]);
+
+					// Check if there is channel specified
+					if (parameters.length > 2) {
+
+						// Set channel number
+						store.setValue(PreferenceConstants.TCPIP_CHANNEL,
+								parameters[2]);
+					}
+
+				} else {
+					succeeded = false;
+				}
+
+				// USB Serial
+			} else if (connectionMethod == TraceViewerAPI.TVAPI_CONNECTION_USB_SERIAL) {
+				connectionMethodStr = PreferenceConstants.CONNECTION_TYPE_USB_SERIAL;
+
+				// There must be at least 1 parameters
+				if (parameters != null && parameters.length > 0) {
+
+					// Set com port
+					store.setValue(PreferenceConstants.USB_SERIAL_COM_PORT,
+							parameters[0]);
+
+				} else {
+					succeeded = false;
+				}
+			}
+
+			// Set the connection method
+			if (succeeded) {
+				store.setValue(PreferenceConstants.CONNECTION_TYPE,
+						connectionMethodStr);
+
+				// Old connection ID is not valid, since connection settings
+				// have been changed.
+				store.setValue(PreferenceConstants.SELECTED_CONNECTION_ID, ""); //$NON-NLS-1$
+			}
+		} catch (Exception e) {
+			succeeded = false;
+		}
+
+		return succeeded;
+	}
+
+	/**
+	 * Saves old connection preferences
+	 */
+	private void saveConnectionPreferences() {
+
+		// Get the TraceViewer preferenceStore
+		IPreferenceStore store = TraceViewerPlugin.getDefault()
+				.getPreferenceStore();
+
+		oldConnectionMethod = store
+				.getString(PreferenceConstants.CONNECTION_TYPE);
+
+		oldSelectedConnectionID = store
+				.getString(PreferenceConstants.SELECTED_CONNECTION_ID);
+
+		// TCP / IP connection
+		if (oldConnectionMethod
+				.equals(PreferenceConstants.CONNECTION_TYPE_TCPIP)) {
+			oldParameters = new String[2];
+			oldParameters[0] = store.getString(PreferenceConstants.IP_ADDRESS);
+			oldParameters[1] = store.getString(PreferenceConstants.TCPIP_PORT);
+
+			// USB Serial connection
+		} else if (oldConnectionMethod
+				.equals(PreferenceConstants.CONNECTION_TYPE_USB_SERIAL)) {
+			oldParameters = new String[1];
+			oldParameters[0] = store
+					.getString(PreferenceConstants.USB_SERIAL_COM_PORT);
+		}
+	}
+
+	/**
+	 * Sets old connection preferences back to preference store
+	 */
+	private void setOldPreferencesBack() {
+
+		// Get the TraceViewer preferenceStore
+		IPreferenceStore store = TraceViewerPlugin.getDefault()
+				.getPreferenceStore();
+
+		// Set the connection method
+		store
+				.setValue(PreferenceConstants.CONNECTION_TYPE,
+						oldConnectionMethod);
+		// Set the selected connection ID
+		store.setValue(PreferenceConstants.SELECTED_CONNECTION_ID,
+				oldSelectedConnectionID);
+
+		// TCP / IP connection
+		if (oldConnectionMethod
+				.equals(PreferenceConstants.CONNECTION_TYPE_TCPIP)) {
+			store.setValue(PreferenceConstants.IP_ADDRESS, oldParameters[0]);
+			store.setValue(PreferenceConstants.TCPIP_PORT, oldParameters[1]);
+
+			// USB Serial connection
+		} else if (oldConnectionMethod
+				.equals(PreferenceConstants.CONNECTION_TYPE_USB_SERIAL)) {
+			store.setValue(PreferenceConstants.USB_SERIAL_COM_PORT,
+					oldParameters[0]);
+		}
+
+		// Resetting old connection settings
+		oldConnectionMethod = null;
+		oldParameters = null;
+	}
+
+	/**
+	 * Checks if there are old connection preferences to restore.
+	 * 
+	 * @return <code>true</code> if are settings to restore, otherwise
+	 *         <code>false</code>.
+	 */
+	public boolean hasRestorableConnectionPreferences() {
+		return (oldConnectionMethod != null && oldParameters != null);
+	}
+
+	/**
+	 * Disconnects from the target
+	 * 
+	 * @return error code from TraceViewerAPI
+	 */
+	public TVAPIError disconnect() {
+		TVAPIError errorcode = TVAPIError.NONE;
+
+		// Check if not connected
+		if (!isAlreadyConnected()) {
+			errorcode = TVAPIError.NOT_CONNECTED;
+
+		} else {
+			// Doing real disconnect only if client has been connected with
+			// custom connection preferences
+			// or there are no more registered clients left using the
+			// connection.
+			if (hasRestorableConnectionPreferences()
+					|| !TraceViewerAPI2Impl.hasRegisteredClients()) {
+
+				boolean disconnect;
+				// If view exists and we are in UI thread, do the disconnecting
+				// through the view action
+				if (TraceViewerGlobals.getTraceViewer().getView() != null
+						&& Display.getCurrent() != null) {
+					ConnectAction action = ((ConnectAction) (TraceViewerGlobals
+							.getTraceViewer().getView().getActionFactory()
+							.getConnectAction()));
+					disconnect = action.disconnect();
+
+					// Disconnect through engine
+				} else {
+					disconnect = TraceViewerGlobals.getTraceViewer()
+							.disconnect();
+				}
+
+				// Disconnection failed
+				if (!disconnect) {
+					errorcode = TVAPIError.DISCONNECTING_FAILED;
+
+					// Disconnecting succeeded and view exists, change button
+				} else if (TraceViewerGlobals.getTraceViewer().getView() != null) {
+					ConnectAction action = ((ConnectAction) (TraceViewerGlobals
+							.getTraceViewer().getView().getActionFactory()
+							.getConnectAction()));
+					action.changeToConnectAction();
+				}
+			}
+		}
+
+		// In case custom connection parameters were used in last connect...
+		if (hasRestorableConnectionPreferences()) {
+			// ... we are restoring the old settings back
+			setOldPreferencesBack();
+		}
+
+		return errorcode;
+	}
+
+	/**
+	 * Checks if the connection is already connected
+	 * 
+	 * @return true if already connected
+	 */
+	private boolean isAlreadyConnected() {
+		boolean alreadyConnected = false;
+
+		// Check if already connected
+		if (TraceViewerGlobals.getTraceViewer().getConnection() != null) {
+			if (TraceViewerGlobals.getTraceViewer().getConnection()
+					.isConnected()) {
+				alreadyConnected = true;
+			}
+		}
+		return alreadyConnected;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/api/DPLocation.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,56 @@
+/*
+ * 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:
+ *
+ * Enumeration containing the location amongst default DataProcessors
+ *
+ */
+package com.nokia.traceviewer.api;
+
+/**
+ * Enumeration containing the location amongst default DataProcessors
+ * 
+ */
+public enum DPLocation {
+
+	/**
+	 * Before decoder
+	 */
+	BEFORE_DECODER,
+
+	/**
+	 * After decoder
+	 */
+	AFTER_DECODER,
+
+	/**
+	 * Before filter
+	 */
+	BEFORE_FILTER,
+
+	/**
+	 * After filter
+	 */
+	AFTER_FILTER,
+
+	/**
+	 * Before view
+	 */
+	BEFORE_VIEW,
+
+	/**
+	 * After view
+	 */
+	AFTER_VIEW;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/api/DataProcessorAdder.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,204 @@
+/*
+ * 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:
+ *
+ * Handles adding of DataProcessors to the list 
+ *
+ */
+package com.nokia.traceviewer.api;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import com.nokia.traceviewer.api.TraceViewerAPI.TVAPIError;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.TraceViewerViewInterface;
+import com.nokia.traceviewer.engine.dataprocessor.DataProcessor;
+import com.nokia.traceviewer.engine.dataprocessor.Decoder;
+import com.nokia.traceviewer.engine.dataprocessor.FilterProcessor;
+
+/**
+ * Handles adding of DataProcessors to the list
+ */
+final class DataProcessorAdder {
+
+	/**
+	 * Locations map
+	 */
+	private Map<DataProcessor, DataProcessorLocation> locations;
+
+	/**
+	 * Adds DataProcessor to the DataProcessors list and keeps track of the
+	 * locations
+	 * 
+	 * @param dp
+	 *            Dataprocessor
+	 * @param location
+	 *            location
+	 * @param priority
+	 *            priority of the DataProcessor
+	 * @return error code from TraceViewerAPI
+	 */
+	public TVAPIError addDataProcessor(DataProcessor dp, DPLocation location,
+			int priority) {
+		TVAPIError errorCode = TVAPIError.NONE;
+
+		// Create new dataprocessor location object
+		DataProcessorLocation newLocation = new DataProcessorLocation(location,
+				priority);
+
+		// Create the map if it doesn't exist
+		if (locations == null) {
+			locations = new HashMap<DataProcessor, DataProcessorLocation>();
+		}
+
+		List<DataProcessor> list = TraceViewerGlobals.getTraceViewer()
+				.getDataProcessorAccess().getDataProcessorList();
+
+		int decoderPos = 0;
+		int filterPos = 0;
+		int viewStartPos = 0;
+		int viewEndPos = 0;
+
+		// Loop through the list and gather the positions
+		for (int i = 0; i < list.size(); i++) {
+			if (list.get(i) instanceof Decoder) {
+				decoderPos = i;
+			} else if (list.get(i) instanceof FilterProcessor) {
+				filterPos = i;
+			} else if (list.get(i) instanceof TraceViewerViewInterface) {
+				if (viewStartPos == 0) {
+					viewStartPos = i;
+					viewEndPos = i;
+				} else {
+					viewEndPos = i;
+				}
+			}
+		}
+
+		// Check if this DataProcessor already exists in the list. If so, don't
+		// add anything and return error
+		if (locations.containsKey(dp)) {
+			errorCode = TVAPIError.DATAPROCESSOR_ALREADY_ADDED;
+
+			// If DataProcessor doesn't exist, add it to the list
+		} else {
+			// Add the dataprocessor to a right place
+			addToRightPlace(dp, location, priority, list, decoderPos,
+					filterPos, viewStartPos, viewEndPos);
+
+			// Add location to the list
+			locations.put(dp, newLocation);
+		}
+
+		return errorCode;
+
+	}
+
+	/**
+	 * Adds the dataprocessor to the right place in the DataProcessor list
+	 * 
+	 * @param dp
+	 *            the dataprocessor
+	 * @param location
+	 *            location where to add the dataprocessor
+	 * @param priority
+	 *            priority of the dataprocessor
+	 * @param list
+	 *            list of dataprocessors
+	 * @param decoderPos
+	 *            position of decoder in the list
+	 * @param filterPos
+	 *            position of filter in the list
+	 * @param viewStartPos
+	 *            position of first view in the list
+	 * @param viewEndPos
+	 *            position of last view in the list
+	 */
+	private void addToRightPlace(DataProcessor dp, DPLocation location,
+			int priority, List<DataProcessor> list, int decoderPos,
+			int filterPos, int viewStartPos, int viewEndPos) {
+
+		// Calculate how many dataprocessors there are with the same Location
+		// with smaller and bigger prioritys
+		int smallerPrioritys = 0;
+		int higherPrioritys = 0;
+
+		Iterator<DataProcessorLocation> iterator = locations.values()
+				.iterator();
+		while (iterator.hasNext()) {
+			DataProcessorLocation loc = iterator.next();
+			if (loc.getLocation() == location) {
+				if (loc.getPriority() > priority) {
+					higherPrioritys++;
+				} else {
+					smallerPrioritys++;
+				}
+			}
+		}
+
+		// Switch the location
+		switch (location) {
+
+		case BEFORE_DECODER:
+			list.add(decoderPos - smallerPrioritys, dp);
+			break;
+		case AFTER_DECODER:
+			list.add(decoderPos + 1 + higherPrioritys, dp);
+			break;
+		case BEFORE_FILTER:
+			list.add(filterPos - smallerPrioritys, dp);
+			break;
+		case AFTER_FILTER:
+			list.add(filterPos + 1 + higherPrioritys, dp);
+			break;
+		case BEFORE_VIEW:
+			list.add(viewStartPos - smallerPrioritys, dp);
+			break;
+		case AFTER_VIEW:
+			list.add(viewEndPos + 1 + higherPrioritys, dp);
+			break;
+		default:
+			break;
+		}
+	}
+
+	/**
+	 * Removes DataProcessor from the list of DataProcessors
+	 * 
+	 * @param dataProcessor
+	 *            the DataProcessor to be removed
+	 * @return error code from TraceViewerAPI
+	 */
+	public TVAPIError removeDataProcessor(DataProcessor dataProcessor) {
+		TVAPIError errorCode = TVAPIError.DATAPROCESSOR_NOT_FOUND;
+
+		// Check if the DataProcessor can be found from the list
+		if (locations != null && locations.containsKey(dataProcessor)) {
+
+			// Remove DataProcessor from the list and from the locations
+			boolean removed = TraceViewerGlobals.getTraceViewer()
+					.getDataProcessorAccess().getDataProcessorList().remove(
+							dataProcessor);
+
+			if (removed) {
+				errorCode = TVAPIError.NONE;
+			}
+			locations.remove(dataProcessor);
+		}
+		return errorCode;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/api/DataProcessorLocation.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,87 @@
+/*
+ * 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:
+ *
+ * Contains the location of DataProcessors in the DataProcessors list
+ *
+ */
+package com.nokia.traceviewer.api;
+
+/**
+ * Contains the location of DataProcessors
+ * 
+ */
+final class DataProcessorLocation {
+
+	/**
+	 * Location of this location
+	 */
+	private DPLocation location;
+
+	/**
+	 * Priority level of this location
+	 */
+	private int priority;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param location
+	 *            location
+	 * @param priority
+	 *            priority
+	 */
+	public DataProcessorLocation(DPLocation location, int priority) {
+		this.location = location;
+		this.priority = priority;
+	}
+
+	/**
+	 * Gets the location
+	 * 
+	 * @return the location
+	 */
+	public DPLocation getLocation() {
+		return location;
+	}
+
+	/**
+	 * Sets the location
+	 * 
+	 * @param location
+	 *            the location to set
+	 */
+	public void setLocation(DPLocation location) {
+		this.location = location;
+	}
+
+	/**
+	 * Gets the priority
+	 * 
+	 * @return the priority
+	 */
+	public int getPriority() {
+		return priority;
+	}
+
+	/**
+	 * Sets the priority
+	 * 
+	 * @param priority
+	 *            the priority to set
+	 */
+	public void setPriority(int priority) {
+		this.priority = priority;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/api/DataSender.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,175 @@
+/*
+ * 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:
+ *
+ * Data sender sends data to the device
+ *
+ */
+package com.nokia.traceviewer.api;
+
+import java.util.ArrayList;
+
+import com.nokia.traceviewer.api.TraceViewerAPI.TVAPIError;
+import com.nokia.traceviewer.engine.Connection;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Data sender sends data to the device
+ */
+final class DataSender {
+
+	/**
+	 * Group ID not found error code
+	 */
+	private static final int GROUP_ID_NOT_FOUND = -1;
+
+	/**
+	 * Decode file not loaded error code
+	 */
+	private static final int DECODE_FILE_NOT_LOADED = -2;
+
+	/**
+	 * Sends raw data to the device
+	 * 
+	 * @param msg
+	 *            array of bytes to send
+	 * @param addHeader
+	 *            if true, adds current protocol header to the message before
+	 *            sending. If false, possible header is already included in the
+	 *            data array
+	 * @param messageId
+	 *            messageID to add to the header. Might not be needed, depends
+	 *            on the protocol.
+	 * @param changeMediaType
+	 *            if true, change media type to the header according to the
+	 *            selected media
+	 * @return error code from TraceViewerAPI
+	 */
+	public TVAPIError sendRawData(byte[] msg, boolean addHeader,
+			byte messageId, boolean changeMediaType) {
+		TVAPIError errorCode = TVAPIError.NONE;
+
+		Connection connection = TraceViewerGlobals.getTraceViewer()
+				.getConnection();
+
+		// If connection exists and is connected, writing is propably ok
+		if (connection != null && connection.isConnected()) {
+
+			// Add header from TraceProvider
+			if (addHeader) {
+				TraceViewerGlobals.getTraceProvider().sendMessage(msg, true,
+						messageId, false);
+
+				// Else change the media type
+			} else if (changeMediaType) {
+				TraceViewerGlobals.getTraceProvider().sendMessage(msg, false,
+						messageId, true);
+				// Else just send as it is
+			} else {
+				connection.write(msg);
+			}
+
+		} else {
+			errorCode = TVAPIError.NOT_CONNECTED;
+		}
+		return errorCode;
+	}
+
+	/**
+	 * Activates given trace groups
+	 * 
+	 * @param componentId
+	 *            component ID
+	 * @param groupIds
+	 *            array of group ID's
+	 * @param activate
+	 *            if true, activates given traces. If false, deactivates them
+	 * @return error code from TraceViewerAPI
+	 */
+	public TVAPIError activateTraces(int componentId, int[] groupIds,
+			boolean activate) {
+		TVAPIError errorCode = TVAPIError.NONE;
+
+		Connection connection = TraceViewerGlobals.getTraceViewer()
+				.getConnection();
+
+		// If connection exists and is connected, writing is propably ok
+		if (connection != null && connection.isConnected()) {
+
+			// Activate
+			TraceViewerGlobals.getTraceProvider().activate(activate, false,
+					componentId, groupIds);
+		} else {
+			errorCode = TVAPIError.NOT_CONNECTED;
+		}
+
+		return errorCode;
+	}
+
+	/**
+	 * Activates given trace groups
+	 * 
+	 * @param componentId
+	 *            component ID
+	 * @param groupNames
+	 *            array of group names
+	 * @param activate
+	 *            if true, activates given traces. If false, deactivates them
+	 * @return error code from TraceViewerAPI
+	 */
+	public TVAPIError activateTraces(int componentId, String[] groupNames,
+			boolean activate) {
+		TVAPIError errorCode = TVAPIError.NONE;
+
+		ArrayList<Integer> groupIds = new ArrayList<Integer>();
+
+		// Get group ID's for the names
+		for (int i = 0; i < groupNames.length; i++) {
+			int groupId = TraceViewerAPI.getTraceGroupId(componentId,
+					groupNames[i]);
+
+			// Group not found from the decode model
+			if (groupId == GROUP_ID_NOT_FOUND) {
+				errorCode = TVAPIError.SOME_GROUPS_NOT_FOUND_FROM_DECODE_MODEL;
+				groupIds.clear();
+				break;
+
+				// No decode file loaded
+			} else if (groupId == DECODE_FILE_NOT_LOADED) {
+				errorCode = TVAPIError.DECODE_FILE_NOT_LOADED;
+				groupIds.clear();
+				break;
+
+				// Group ID ok
+			} else {
+				groupIds.add(Integer.valueOf(groupId));
+			}
+		}
+
+		if (!groupIds.isEmpty()) {
+
+			// Transfer the ID's to the array
+			int[] groups = new int[groupIds.size()];
+			for (int i = 0; i < groupIds.size(); i++) {
+				groups[i] = groupIds.get(i).intValue();
+			}
+
+			// Use the other activate function
+			errorCode = activateTraces(componentId, groups, activate);
+
+		}
+
+		return errorCode;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/api/DecodeHandler.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,253 @@
+/*
+ * 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:
+ *
+ * Decode handler handles stuff related to decode files
+ *
+ */
+package com.nokia.traceviewer.api;
+
+import java.io.File;
+import java.util.ArrayList;
+
+import com.nokia.traceviewer.action.OpenDecodeFileAction;
+import com.nokia.traceviewer.api.TraceViewerAPI.TVAPIError;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.TraceViewerUtils;
+import com.nokia.traceviewer.engine.activation.TraceActivationComponentItem;
+
+/**
+ * Decode handler handles stuff related to decode files
+ * 
+ */
+final class DecodeHandler {
+
+	/**
+	 * Model valid waiting time
+	 */
+	private static final long MODEL_VALID_WAITING_TIME = 100;
+
+	/**
+	 * Model valid maximum waiting time
+	 */
+	private static final long MODEL_VALID_MAX_WAITING_TIME = 5000;
+
+	/**
+	 * Decode file not loaded error code
+	 */
+	private static final int DECODE_FILE_NOT_LOADED = -2;
+
+	/**
+	 * Gets trace component name from the Decode model with a component id
+	 * 
+	 * @param componentId
+	 *            component ID
+	 * @return component name or null if not found or no Decode files are loaded
+	 */
+	public String getTraceComponentName(int componentId) {
+		String componentName = null;
+
+		if (TraceViewerGlobals.getDecodeProvider() != null) {
+			if (TraceViewerGlobals.getDecodeProvider().isModelLoadedAndValid()) {
+
+				// Returns null if the component is not found
+				componentName = TraceViewerGlobals.getDecodeProvider()
+						.getComponentName(componentId);
+			}
+		}
+
+		return componentName;
+	}
+
+	/**
+	 * Gets trace group ID with a group name
+	 * 
+	 * @param componentId
+	 *            the component ID
+	 * @param groupName
+	 *            the group name
+	 * @return trace group ID or -1 if group ID not found or -2 if no Decode
+	 *         files are loaded
+	 */
+	public int getTraceGroupId(int componentId, String groupName) {
+		int groupId = DECODE_FILE_NOT_LOADED;
+
+		if (TraceViewerGlobals.getDecodeProvider() != null) {
+			if (TraceViewerGlobals.getDecodeProvider().isModelLoadedAndValid()) {
+
+				// Returns -1 if the group is not found
+				groupId = TraceViewerGlobals.getDecodeProvider().getGroupId(
+						componentId, groupName);
+			}
+		}
+
+		return groupId;
+	}
+
+	/**
+	 * Gets trace group name from the Decode model with a component and group
+	 * ids
+	 * 
+	 * @param componentId
+	 *            component ID
+	 * @param groupId
+	 *            group ID
+	 * @return group name or null if not found or no Decode files are loaded
+	 */
+	public String getTraceGroupName(int componentId, int groupId) {
+		String groupName = null;
+
+		if (TraceViewerGlobals.getDecodeProvider() != null) {
+			if (TraceViewerGlobals.getDecodeProvider().isModelLoadedAndValid()) {
+
+				// Returns null if the component is not found
+				groupName = TraceViewerGlobals.getDecodeProvider()
+						.getGroupName(componentId, groupId);
+			}
+		}
+
+		return groupName;
+	}
+
+	/**
+	 * Gets trace name from the Decode model with a component, group and trace
+	 * IDs
+	 * 
+	 * @param componentId
+	 *            component ID
+	 * @param groupId
+	 *            group ID
+	 * @param traceId
+	 *            trace ID
+	 * @return trace name or null if not found or no Decode files are loaded
+	 */
+	public String getTraceName(int componentId, int groupId, int traceId) {
+		String traceName = null;
+
+		if (TraceViewerGlobals.getDecodeProvider() != null) {
+			if (TraceViewerGlobals.getDecodeProvider().isModelLoadedAndValid()) {
+
+				// Returns null if the component is not found
+				traceName = TraceViewerGlobals.getDecodeProvider()
+						.getTraceName(componentId, groupId, traceId);
+			}
+		}
+
+		return traceName;
+	}
+
+	/**
+	 * Loads decode file to the decode model. User must remember that loading
+	 * the decode file can take some time and this function will block until the
+	 * model is loaded or a maximum of 5 seconds.
+	 * 
+	 * @param decodeFilePath
+	 *            absolute path to the decode file. Path must be in correct
+	 *            format for any operating system (Windows, Linux)
+	 * @param deleteExistingModel
+	 *            if true, old decode model is removed before this decode file
+	 *            is loaded
+	 * @return error code from TraceViewerAPI
+	 */
+	public TVAPIError loadDecodeFile(String decodeFilePath,
+			boolean deleteExistingModel) {
+		TVAPIError errorCode = TVAPIError.DECODE_PROVIDER_PLUGIN_MISSING;
+
+		if (TraceViewerGlobals.getDecodeProvider() != null) {
+			errorCode = TVAPIError.NONE;
+			File file = new File(decodeFilePath);
+
+			// Check that file exists
+			if (file.exists()) {
+
+				// TraceViewer view is visible, use it
+				if (TraceViewerGlobals.getTraceViewer().getView() != null
+						&& !TraceViewerGlobals.getTraceViewer().getView()
+								.isDisposed()) {
+
+					OpenDecodeFileAction action = (OpenDecodeFileAction) TraceViewerGlobals
+							.getTraceViewer().getView().getActionFactory()
+							.getOpenDecodeFileAction();
+					action.loadFilesToModel(new String[] { decodeFilePath },
+							deleteExistingModel);
+
+					// No TraceViewer view available, use API
+				} else {
+					// Open the decode file
+					TraceViewerGlobals.getDecodeProvider().openDecodeFile(
+							decodeFilePath, null, deleteExistingModel);
+
+					// Wait until model is ready and loaded or maximum of five
+					// seconds
+					long startTime = System.currentTimeMillis();
+					while (!TraceViewerGlobals.getDecodeProvider()
+							.isModelLoadedAndValid()
+							&& startTime + MODEL_VALID_MAX_WAITING_TIME > System
+									.currentTimeMillis()) {
+						try {
+							Thread.sleep(MODEL_VALID_WAITING_TIME);
+						} catch (InterruptedException e) {
+						}
+					}
+
+					// Refresh the view
+					refreshViewAfterDecodeFileLoad();
+				}
+
+				// File doesn't exist
+			} else {
+				errorCode = TVAPIError.FILE_DOES_NOT_EXIST;
+			}
+		}
+
+		return errorCode;
+	}
+
+	/**
+	 * Refresh the view after Decode file has been loaded
+	 */
+	private void refreshViewAfterDecodeFileLoad() {
+
+		// Refresh the view
+		if (TraceViewerGlobals.getTraceViewer().getView() != null) {
+
+			// Check if reading from the start is needed
+			if (TraceViewerUtils.isReadingFromStartNeeded()) {
+				TraceViewerGlobals.getTraceViewer().readDataFileFromBeginning();
+
+				// Refresh the current view
+			} else {
+				TraceViewerGlobals.getTraceViewer().getView()
+						.refreshCurrentView();
+			}
+		}
+	}
+
+	/**
+	 * Gets components from all loaded Dictionaries
+	 * 
+	 * @return list of components from all loaded Dictionaries. List can be
+	 *         empty.
+	 */
+	public ArrayList<TraceActivationComponentItem> getDictionaryComponents() {
+		ArrayList<TraceActivationComponentItem> components = new ArrayList<TraceActivationComponentItem>();
+
+		if (TraceViewerGlobals.getDecodeProvider() != null) {
+			components = TraceViewerGlobals.getDecodeProvider()
+					.getActivationInformation(true);
+		}
+
+		return components;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/api/ITraceConnClient.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,50 @@
+/*
+ * 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:
+ *
+ */
+
+package com.nokia.traceviewer.api;
+
+/**
+ * This is interface that each client has to implement in order to get
+ * notifications about connection status changes
+ */
+public interface ITraceConnClient {
+
+	/**
+	 * Registered connection is re-established after connection break.
+	 * 
+	 * @param connectionInfo
+	 *            connection info for the newly connected connection
+	 */
+	void notifyConnection(ITraceConnInfo connectionInfo);
+
+	/**
+	 * Registered connection is disconnected.
+	 */
+	void notifyDisconnection();
+
+	/**
+	 * Connection preferences has been changed and the new settings will be
+	 * taken into use when trace connection is restarted next time i.e. in next
+	 * <code>notifyConnection()</code>. Interface implementor can already notify
+	 * user in this point if connection preferences are not acceptable ones.
+	 * 
+	 * @param connectionInfo
+	 *            connection info for the newly set connection preference
+	 */
+	void notifyConnPrefsChanged(ITraceConnInfo connectionInfo);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/api/ITraceConnInfo.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,49 @@
+/*
+ * 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:
+ *
+ */
+
+package com.nokia.traceviewer.api;
+
+import com.nokia.carbide.remoteconnections.interfaces.IConnectionType;
+
+/**
+ * Connection info object for client getting information about the user
+ * connection.
+ */
+public interface ITraceConnInfo {
+
+	/**
+	 * Gets connection type.
+	 * 
+	 * @return connection type
+	 */
+	public IConnectionType getConnectionType();
+
+	/**
+	 * Gets display name.
+	 * 
+	 * @return display name
+	 */
+	public String getDisplayName();
+
+	/**
+	 * Gets connection identifier.
+	 * 
+	 * @return connection identifier
+	 */
+	public String getIdentifier();
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/api/LogHandler.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,289 @@
+/*
+ * 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:
+ *
+ * Log handler handles operations related to log files 
+ *
+ */
+package com.nokia.traceviewer.api;
+
+import java.io.File;
+
+import com.nokia.traceviewer.action.CopyFileProgressCallback;
+import com.nokia.traceviewer.action.LogSaveBinaryAction;
+import com.nokia.traceviewer.action.TraceViewerActionUtils;
+import com.nokia.traceviewer.api.TraceViewerAPI.TVAPIError;
+import com.nokia.traceviewer.dialog.ProgressBarDialog;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.TraceViewerDialogInterface.Dialog;
+
+/**
+ * Log handler handles operations related to log files
+ * 
+ */
+final class LogHandler implements CopyFileProgressCallback {
+
+	/**
+	 * Ascii file extension
+	 */
+	private static final String ASCII_FILE_EXTENSION = ".txt"; //$NON-NLS-1$
+
+	/**
+	 * Divide long values with this to get integers
+	 */
+	private static final int LONG_DIVIDER = 10000;
+
+	/**
+	 * Progressbar
+	 */
+	private ProgressBarDialog progressBar;
+
+	/**
+	 * Callback for copy file
+	 */
+	private final CopyFileProgressCallback callback;
+
+	/**
+	 * Update count
+	 */
+	private int updateCount;
+
+	/**
+	 * Saving file boolean
+	 */
+	private boolean savingFile;
+
+	/**
+	 * Constructor
+	 */
+	LogHandler() {
+		callback = this;
+	}
+
+	/**
+	 * Saves current traces shown in TraceViewer view to a Binary log. If
+	 * TraceViewer view is visible, a progress bar about the saving will be
+	 * shown for the user. If TraceViewer view is not visible, saving the file
+	 * will be done with the calling thread. Note that saving the file can take
+	 * a long time!
+	 * 
+	 * @param filePath
+	 *            file path where to save the log. If null and TraceViewer view
+	 *            is visible, a file selection dialog is shown
+	 * @return error code from TraceViewerAPI
+	 */
+	public TVAPIError saveCurrentTracesToLog(String filePath) {
+		TVAPIError ret = TVAPIError.NONE;
+
+		progressBar = null;
+
+		// Both the file and the TV view are null, return error
+		if (filePath == null
+				&& TraceViewerGlobals.getTraceViewer().getView() == null) {
+
+			ret = TVAPIError.TRACE_VIEW_NOT_OPEN;
+
+			// Else, we can do something
+		} else {
+
+			// File is null but TV view is available, use Save Binary log action
+			if (filePath == null
+					&& TraceViewerGlobals.getTraceViewer().getView() != null) {
+
+				TraceViewerGlobals.getTraceViewer().getView()
+						.getActionFactory().getLogSaveBinaryAction().run();
+
+				// File is given
+			} else {
+
+				// Get source file and target files
+				String currentFile = TraceViewerGlobals.getTraceViewer()
+						.getDataReaderAccess().getCurrentDataReader()
+						.getFilePath();
+
+				final File sourceFile = new File(currentFile);
+				final File targetFile = new File(filePath);
+
+				// If TV view is available, create a progressbar
+				if (TraceViewerGlobals.getTraceViewer().getView() != null) {
+					progressBar = (ProgressBarDialog) TraceViewerGlobals
+							.getTraceViewer().getDialogs().createDialog(
+									Dialog.PROGRESSBAR);
+
+					// Let's set the real action to think we are saving the log
+					// file to enable possibility for the user to cancel the
+					// saving and ProgressBarCloseHandler will notice the
+					// current action
+					LogSaveBinaryAction saveAction = (LogSaveBinaryAction) TraceViewerGlobals
+							.getTraceViewer().getView().getActionFactory()
+							.getLogSaveBinaryAction();
+
+					// Create new thread because progressbar takes UI thread
+					new Thread() {
+
+						/*
+						 * (non-Javadoc)
+						 * 
+						 * @see java.lang.Thread#run()
+						 */
+						@Override
+						public void run() {
+							startCopying(sourceFile, targetFile);
+						}
+
+					}.start();
+
+					if (progressBar != null) {
+						String msg = Messages
+								.getString("LogHandler.SavingLogMsg"); //$NON-NLS-1$
+						savingFile = true;
+						saveAction.setSavingFile(true);
+						progressBar
+								.open(
+										(int) (sourceFile.length() / LONG_DIVIDER),
+										msg);
+						savingFile = false;
+						saveAction.setSavingFile(false);
+					}
+
+					// View not available, use the current thread
+				} else {
+					savingFile = true;
+					startCopying(sourceFile, targetFile);
+					savingFile = false;
+				}
+
+			}
+
+		}
+
+		return ret;
+	}
+
+	/**
+	 * Starts copying
+	 * 
+	 * @param sourceFile
+	 *            source file
+	 * @param targetFile
+	 *            target file
+	 */
+	private void startCopying(final File sourceFile, final File targetFile) {
+
+		try {
+			// Start copying the file
+			TraceViewerActionUtils.copyFile(sourceFile, targetFile, callback,
+					TraceViewerGlobals.getTraceViewer().getDataReaderAccess()
+							.getCurrentDataReader().getFileStartOffset());
+		} catch (Exception e) {
+
+			// Close the progressBar if still open
+			if (progressBar != null) {
+				TraceViewerGlobals.getTraceViewer().getView().closeProgressBar(
+						progressBar);
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.action.CopyFileProgressCallback#cancelCopying()
+	 */
+	public boolean cancelCopying() {
+		return !savingFile;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.action.CopyFileProgressCallback#copyingFinished()
+	 */
+	public void copyingFinished() {
+		if (progressBar != null) {
+			TraceViewerGlobals.getTraceViewer().getView().closeProgressBar(
+					progressBar);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.action.CopyFileProgressCallback#notifyFilePosition
+	 * (long)
+	 */
+	public void notifyFilePosition(long filePosition) {
+		// Only update every third time to save time
+		if (progressBar != null && updateCount++ % 3 == 0) {
+			progressBar.updateProgressBar((int) (filePosition / LONG_DIVIDER));
+		}
+	}
+
+	/**
+	 * Opens log file to TraceViewer. If filePath is null and TraceViewer view
+	 * is not open, error will be returned.
+	 * 
+	 * @param filePath
+	 *            file path to open. If file path ends with .txt, file is opened
+	 *            as ASCII log. If filePath is null and TraceViewer view is
+	 *            open, a file selection dialog is opened.
+	 * @return error code from TraceViewerAPI
+	 */
+	public TVAPIError openLogFile(String filePath) {
+		TVAPIError ret = TVAPIError.NONE;
+
+		// File path is not given
+		if (filePath == null) {
+
+			// If view exists, use open log file action
+			if (TraceViewerGlobals.getTraceViewer().getView() != null) {
+				TraceViewerGlobals.getTraceViewer().getView()
+						.getActionFactory().getLogOpenLogAction().run();
+			} else {
+				ret = TVAPIError.TRACE_VIEW_NOT_OPEN;
+			}
+
+			// File path is given, open the log file
+		} else {
+
+			File file = new File(filePath);
+
+			// File must exist
+			if (file.exists()) {
+
+				// Check if the file is ASCII log
+				if (filePath.trim().endsWith(ASCII_FILE_EXTENSION)) {
+					TraceViewerGlobals.getTraceViewer()
+							.getDataProcessorAccess().getLogger().openLogFile(
+									filePath, false);
+
+					// Binary log
+				} else {
+					TraceViewerGlobals.getTraceViewer()
+							.getDataProcessorAccess().getLogger().openLogFile(
+									filePath, true);
+				}
+
+				// File doesn't exist
+			} else {
+				ret = TVAPIError.FILE_DOES_NOT_EXIST;
+			}
+		}
+		return ret;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/api/Messages.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,63 @@
+/*
+ * 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:
+ *
+ * String localization for api package.
+ *
+ */
+package com.nokia.traceviewer.api;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * String localization for api package.
+ * 
+ */
+final class Messages {
+
+	/**
+	 * Bundle name
+	 */
+	private static final String BUNDLE_NAME = "com.nokia.traceviewer.api.messages"; //$NON-NLS-1$
+
+	/**
+	 * Resource bundle
+	 */
+	private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
+			.getBundle(BUNDLE_NAME);
+
+	/**
+	 * Prevents construction.
+	 */
+	private Messages() {
+	}
+
+	/**
+	 * Maps a key to localized string.
+	 * 
+	 * @param key
+	 *            the key for the string
+	 * @return the localized string
+	 */
+	public static String getString(String key) {
+		String value;
+		try {
+			value = RESOURCE_BUNDLE.getString(key);
+		} catch (MissingResourceException e) {
+			value = '!' + key + '!';
+		}
+		return value;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/api/TraceConnectivityException.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,59 @@
+/*
+ * 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:
+ *
+ */
+
+package com.nokia.traceviewer.api;
+
+import com.nokia.traceviewer.api.TraceViewerAPI.TVAPIError;
+import com.nokia.traceviewer.internal.api.TraceViewerAPI2Impl;
+
+/**
+ * Exception that is thrown when <code>TraceViewerAPI2</code> connectivity
+ * operations fail.
+ * 
+ * @see TraceViewerAPI2Impl
+ */
+public class TraceConnectivityException extends Exception {
+
+	/**
+	 * Serial version UID.
+	 */
+	private static final long serialVersionUID = 6945640644336014817L;
+	/**
+	 * Trace viewer error due to which connect failed.
+	 */
+	private final TVAPIError error;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param error
+	 *            trace viewer error due to which connect failed
+	 */
+	public TraceConnectivityException(TVAPIError error) {
+		this.error = error;
+	}
+
+	/**
+	 * Gets trace viewer error due to which connect failed.
+	 * 
+	 * @return trace viewer error due to which connect failed
+	 */
+	public TVAPIError getError() {
+		return error;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/api/TraceViewerAPI.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,713 @@
+/*
+ * 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:
+ *
+ * Access point to TraceViewer API functions
+ *
+ */
+package com.nokia.traceviewer.api;
+
+import java.util.ArrayList;
+
+import com.nokia.traceviewer.engine.TraceInformation;
+import com.nokia.traceviewer.engine.TraceMetaData;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.activation.TraceActivationComponentItem;
+import com.nokia.traceviewer.engine.dataprocessor.DataProcessor;
+
+/**
+ * Access point to TraceViewer API functions
+ */
+public final class TraceViewerAPI {
+
+	/**
+	 * Enum indicating the error codes of TraceViewer API operations
+	 */
+	public enum TVAPIError {
+
+		/**
+		 * No error, operation succeeded.
+		 */
+		NONE,
+
+		/**
+		 * Not connected error. Is given when trying to operate with the
+		 * connection when it is not open.
+		 */
+		NOT_CONNECTED,
+
+		/**
+		 * Disconnecting failed error.
+		 */
+		DISCONNECTING_FAILED,
+
+		/**
+		 * Invalid connection parameters error. Parameters are not what they
+		 * should be for this connection method.
+		 */
+		INVALID_CONNECTION_PARAMETERS,
+
+		/**
+		 * Already connected error. Connection is already open.
+		 */
+		ALREADY_CONNECTED,
+
+		/**
+		 * Cannot open the connection port
+		 */
+		CANNOT_OPEN,
+
+		/**
+		 * Connection port already open
+		 */
+		ALREADY_OPEN,
+
+		/**
+		 * Invalid connection handle
+		 */
+		INVALID_CONNECTION_HANDLE,
+
+		/**
+		 * Timeout when connecting
+		 */
+		TIMEOUT,
+
+		/**
+		 * Tracefile is already open
+		 */
+		TRACEFILE_ALREADY_OPEN,
+
+		/**
+		 * Tracefile doesn't exist
+		 */
+		TRACEFILE_DOESNT_EXIST,
+
+		/**
+		 * No tracefile open where to write
+		 */
+		NO_TRACEFILE_OPEN,
+
+		/**
+		 * Cannot write to the tracefile
+		 */
+		CANNOT_WRITE_TO_TRACEFILE,
+
+		/**
+		 * Media seems not to be open
+		 */
+		MEDIA_NOT_OPEN,
+
+		/**
+		 * Invalid connection settings
+		 */
+		INVALID_CONNECTION_SETTINGS,
+
+		/**
+		 * Cannot find trace router application
+		 */
+		CANNOT_FIND_TRACEROUTER,
+
+		/**
+		 * Cannot create trace router process
+		 */
+		CANNOT_CREATE_TRACEROUTER,
+
+		/**
+		 * Media busy
+		 */
+		MEDIA_BUSY,
+
+		/**
+		 * User canceled connection
+		 */
+		USER_CANCELED,
+
+		/**
+		 * Unknown error
+		 */
+		UNKNOWN_ERROR,
+
+		/**
+		 * DataProcessor already added error. DataProcessor is already in the
+		 * DataProcessor list.
+		 */
+		DATAPROCESSOR_ALREADY_ADDED,
+
+		/**
+		 * DataProcessor could not be found error. DataProcessor was not in the
+		 * DataProcessor list.
+		 */
+		DATAPROCESSOR_NOT_FOUND,
+
+		/**
+		 * Decode Provider plugin is missing
+		 */
+		DECODE_PROVIDER_PLUGIN_MISSING,
+
+		/**
+		 * No Decode files loaded error.
+		 */
+		DECODE_FILE_NOT_LOADED,
+
+		/**
+		 * Some groups couldn't be found from the decode model. They are
+		 * propably missing from the loaded decode files.
+		 */
+		SOME_GROUPS_NOT_FOUND_FROM_DECODE_MODEL,
+
+		/**
+		 * File doesn't exist
+		 */
+		FILE_DOES_NOT_EXIST,
+
+		/**
+		 * TraceViewer view not open
+		 */
+		TRACE_VIEW_NOT_OPEN;
+	}
+
+	/**
+	 * TCP / IP connection method value
+	 */
+	public static final int TVAPI_CONNECTION_TCP = 1;
+
+	/**
+	 * USB Serial connection method value
+	 */
+	public static final int TVAPI_CONNECTION_USB_SERIAL = 2;
+
+	/**
+	 * DataProcessor adder object
+	 */
+	private static DataProcessorAdder dpAdder;
+
+	/**
+	 * Data sender object
+	 */
+	private static DataSender dataSender;
+
+	/**
+	 * Connection handler object
+	 */
+	private static ConnectionHandler connectionHandler;
+
+	/**
+	 * Decode handler object
+	 */
+	private static DecodeHandler decodeHandler;
+
+	/**
+	 * View handler object
+	 */
+	private static ViewHandler viewHandler;
+
+	/**
+	 * Log handler object
+	 */
+	private static LogHandler logHandler;
+
+	/**
+	 * Activates traces using group ID's
+	 * 
+	 * @param componentId
+	 *            component ID
+	 * @param groupIds
+	 *            array of group IDs
+	 * @param activate
+	 *            if true, activate. If false, deactivate.
+	 * @return error code from TraceViewerAPI
+	 */
+	public static TVAPIError activateTraces(int componentId, int[] groupIds,
+			boolean activate) {
+
+		// Create the sender if it doesn't exist
+		if (dataSender == null) {
+			dataSender = new DataSender();
+		}
+
+		// Send the data and check error status
+		TVAPIError errorCode = dataSender.activateTraces(componentId, groupIds,
+				activate);
+
+		return errorCode;
+
+	}
+
+	/**
+	 * Activates traces using group names
+	 * 
+	 * @param componentId
+	 *            component ID
+	 * @param groupNames
+	 *            array of group names
+	 * @param activate
+	 *            if true, activate. If false, deactivate.
+	 * @return error code from TraceViewerAPI
+	 */
+	public static TVAPIError activateTraces(int componentId,
+			String[] groupNames, boolean activate) {
+
+		// Create the sender if it doesn't exist
+		if (dataSender == null) {
+			dataSender = new DataSender();
+		}
+
+		// Send the data and check error status
+		TVAPIError errorCode = dataSender.activateTraces(componentId,
+				groupNames, activate);
+
+		return errorCode;
+
+	}
+
+	/**
+	 * Adds own DataProcessor to a specific location in dataprocessor list.
+	 * DataProcessors registered through this method will receive all traces
+	 * that are coming from the device.
+	 * 
+	 * @param dataProcessor
+	 *            the dataprocessor to be added
+	 * @param location
+	 *            location in the list
+	 * @param priority
+	 *            priority of the dataprocessor. If two dataprocessors are in
+	 *            the same location in the dataprocessor list, the one with
+	 *            higher priority will be run first
+	 * @return error code from TraceViewerAPI
+	 */
+	public static TVAPIError addDataProcessor(DataProcessor dataProcessor,
+			DPLocation location, int priority) {
+
+		// Create the adder if it doesn't exist
+		if (dpAdder == null) {
+			dpAdder = new DataProcessorAdder();
+		}
+
+		// Add the processor and check error status
+		TVAPIError errorCode = dpAdder.addDataProcessor(dataProcessor,
+				location, priority);
+
+		return errorCode;
+	}
+
+	/**
+	 * Connect using current settings defined in TraceViewer's preferences
+	 * 
+	 * @return error code from TraceViewerAPI
+	 */
+	public static TVAPIError connect() {
+
+		// Create the connection handler if it doesn't exist
+		if (connectionHandler == null) {
+			connectionHandler = new ConnectionHandler();
+		}
+
+		// Try to connect
+		TVAPIError errorCode = connectionHandler.connect();
+
+		return errorCode;
+	}
+
+	/**
+	 * Connect using given parameters. Possible connection methods can be found
+	 * from TraceViewerAPI constants. Parameters should be given in this order:
+	 * When using TCP connection, parameters are IP address port number and
+	 * channel number in this order. When using USB serial connection, the only
+	 * parameter is the COM port number. This function will also set given
+	 * parameters to TraceViewer's connection preferences if the connecting
+	 * succeeds.
+	 * 
+	 * @param connectionMethod
+	 *            the connection method to use
+	 * @param parameters
+	 *            array of parameters
+	 * @return error code from TraceViewerAPI
+	 */
+	public static TVAPIError connect(int connectionMethod, String[] parameters) {
+
+		// Create the connection handler if it doesn't exist
+		if (connectionHandler == null) {
+			connectionHandler = new ConnectionHandler();
+		}
+
+		// Try to connect
+		TVAPIError errorCode = connectionHandler.connect(connectionMethod,
+				parameters);
+
+		return errorCode;
+	}
+
+	/**
+	 * Disconnects from the target
+	 * 
+	 * @return error code from TraceViewerAPI
+	 */
+	public static TVAPIError disconnect() {
+
+		// Create the connection handler if it doesn't exist
+		if (connectionHandler == null) {
+			connectionHandler = new ConnectionHandler();
+		}
+
+		// Try to disconnect
+		TVAPIError errorCode = connectionHandler.disconnect();
+
+		return errorCode;
+	}
+
+	/**
+	 * Gets components from all loaded Dictionaries
+	 * 
+	 * @return list of components from all loaded Dictionaries. List can be
+	 *         empty.
+	 */
+	public static ArrayList<TraceActivationComponentItem> getDictionaryComponents() {
+
+		// Create the decode handler if it doesn't exist
+		if (decodeHandler == null) {
+			decodeHandler = new DecodeHandler();
+		}
+
+		// Get the component list
+		ArrayList<TraceActivationComponentItem> components = decodeHandler
+				.getDictionaryComponents();
+
+		return components;
+	}
+
+	/**
+	 * Gets trace component name from the Decode model with a component ID
+	 * 
+	 * @param componentId
+	 *            component ID
+	 * @return component name or null if not found or no Decode files are loaded
+	 */
+	public static String getTraceComponentName(int componentId) {
+
+		// Create the decode handler if it doesn't exist
+		if (decodeHandler == null) {
+			decodeHandler = new DecodeHandler();
+		}
+
+		// Get the component name
+		String componentName = decodeHandler.getTraceComponentName(componentId);
+
+		return componentName;
+	}
+
+	/**
+	 * Gets trace group ID from the Decode model with a group name
+	 * 
+	 * @param componentId
+	 *            component ID
+	 * @param groupName
+	 *            the group name
+	 * @return trace group ID or -1 if group ID not found or -2 if no Decode
+	 *         files are loaded
+	 */
+	public static int getTraceGroupId(int componentId, String groupName) {
+
+		// Create the decode handler if it doesn't exist
+		if (decodeHandler == null) {
+			decodeHandler = new DecodeHandler();
+		}
+
+		// Get the group ID
+		int groupId = decodeHandler.getTraceGroupId(componentId, groupName);
+
+		return groupId;
+	}
+
+	/**
+	 * Gets trace group name from the Decode model with a component and group
+	 * IDs
+	 * 
+	 * @param componentId
+	 *            component ID
+	 * @param groupId
+	 *            group ID
+	 * @return group name or null if not found or no Decode files are loaded
+	 */
+	public static String getTraceGroupName(int componentId, int groupId) {
+
+		// Create the decode handler if it doesn't exist
+		if (decodeHandler == null) {
+			decodeHandler = new DecodeHandler();
+		}
+
+		// Get the group name
+		String groupName = decodeHandler
+				.getTraceGroupName(componentId, groupId);
+
+		return groupName;
+	}
+
+	/**
+	 * Gets trace name from the Decode model with a component, group and trace
+	 * IDs
+	 * 
+	 * @param componentId
+	 *            component ID
+	 * @param groupId
+	 *            group ID
+	 * @param traceId
+	 *            trace ID
+	 * @return trace name or null if not found or no Decode files are loaded
+	 */
+	public static String getTraceName(int componentId, int groupId, int traceId) {
+
+		// Create the decode handler if it doesn't exist
+		if (decodeHandler == null) {
+			decodeHandler = new DecodeHandler();
+		}
+
+		// Get the trace name
+		String traceName = decodeHandler.getTraceName(componentId, groupId,
+				traceId);
+
+		return traceName;
+	}
+
+	/**
+	 * Gets trace metadata
+	 * 
+	 * @param information
+	 *            TraceInformation to be used when finding correct metadata
+	 * @return trace metadata or null if nothing is found
+	 */
+	public static TraceMetaData getTraceMetaData(TraceInformation information) {
+		TraceMetaData metaData = null;
+		if (information != null && information.isDefined()
+				&& TraceViewerGlobals.getDecodeProvider() != null) {
+			metaData = TraceViewerGlobals.getDecodeProvider().getTraceMetaData(
+					information);
+		}
+
+		return metaData;
+	}
+
+	/**
+	 * Loads decode file to the decode model. User must remember that loading
+	 * the decode file can take some time and this function will block until the
+	 * model is loaded or a maximum of 5 seconds.
+	 * 
+	 * @param decodeFilePath
+	 *            absolute path to the decode file. Path must be in correct
+	 *            format for any operating system (Windows, Linux)
+	 * @param deleteExistingModel
+	 *            if true, old decode model is removed before this decode file
+	 *            is loaded
+	 * @return error code from TraceViewerAPI
+	 */
+	public static TVAPIError loadDecodeFile(String decodeFilePath,
+			boolean deleteExistingModel) {
+
+		// Create the decode handler if it doesn't exist
+		if (decodeHandler == null) {
+			decodeHandler = new DecodeHandler();
+		}
+
+		// Load the decode file
+		TVAPIError errorCode = decodeHandler.loadDecodeFile(decodeFilePath,
+				deleteExistingModel);
+
+		return errorCode;
+	}
+
+	/**
+	 * Opens log file to TraceViewer. If filePath is null and TraceViewer view
+	 * is not open, error will be returned.
+	 * 
+	 * @param filePath
+	 *            file path to open. If file path ends with .txt, file is opened
+	 *            as ASCII log. If filePath is null and TraceViewer view is
+	 *            open, a file selection dialog is opened.
+	 * @return error code from TraceViewerAPI
+	 */
+	public static TVAPIError openLogFile(String filePath) {
+
+		// Create the handler if it doesn't exist
+		if (logHandler == null) {
+			logHandler = new LogHandler();
+		}
+
+		// Save current traces to a log file
+		TVAPIError errorCode = logHandler.openLogFile(filePath);
+
+		return errorCode;
+	}
+
+	/**
+	 * Removes this DataProcessor from the list of DataProcessors.
+	 * 
+	 * @param dataProcessor
+	 *            the DataProcessor to be removed
+	 * @return error code from TraceViewerAPI
+	 */
+	public static TVAPIError removeDataProcessor(DataProcessor dataProcessor) {
+
+		// Create the adder if it doesn't exist
+		if (dpAdder == null) {
+			dpAdder = new DataProcessorAdder();
+		}
+
+		// Remove the Data Processor
+		TVAPIError errorCode = dpAdder.removeDataProcessor(dataProcessor);
+
+		return errorCode;
+	}
+
+	/**
+	 * Saves current traces shown in TraceViewer view to a Binary log. If
+	 * TraceViewer view is visible, a progress bar about the saving will be
+	 * shown for the user. If TraceViewer view is not visible, saving the file
+	 * will be done with the calling thread. Note that saving the file can take
+	 * a long time!
+	 * 
+	 * @param filePath
+	 *            file path where to save the log. If null and TraceViewer view
+	 *            is visible, a file selection dialog is shown
+	 * @return error code from TraceViewerAPI
+	 */
+	public static TVAPIError saveCurrentTracesToLog(String filePath) {
+
+		// Create the handler if it doesn't exist
+		if (logHandler == null) {
+			logHandler = new LogHandler();
+		}
+
+		// Save current traces to a log file
+		TVAPIError errorCode = logHandler.saveCurrentTracesToLog(filePath);
+
+		return errorCode;
+	}
+
+	/**
+	 * Sends raw data to the device with header
+	 * 
+	 * @param msg
+	 *            byte array to be sent
+	 * @param changeMediaType
+	 *            If true, changes media type to the header when sending the
+	 *            message. Otherwise leaves the message as it is.
+	 * @return error code from TraceViewerAPI
+	 */
+	public static TVAPIError sendDataToDeviceWithHeader(byte[] msg,
+			boolean changeMediaType) {
+
+		// Create the sender if it doesn't exist
+		if (dataSender == null) {
+			dataSender = new DataSender();
+		}
+
+		// Send the data and check error status
+		byte b = 0x00;
+		TVAPIError errorCode = dataSender.sendRawData(msg, false, b,
+				changeMediaType);
+
+		return errorCode;
+	}
+
+	/**
+	 * Sends raw data to the device without header
+	 * 
+	 * @param msg
+	 *            byte array to be sent
+	 * @param messageId
+	 *            messageID to add to the header. Might not be needed, depends
+	 *            on the protocol.
+	 * @return error code from TraceViewerAPI
+	 */
+	public static TVAPIError sendDataToDeviceWithoutHeader(byte[] msg,
+			byte messageId) {
+
+		// Create the sender if it doesn't exist
+		if (dataSender == null) {
+			dataSender = new DataSender();
+		}
+
+		// Send the data and check error status
+		TVAPIError errorCode = dataSender.sendRawData(msg, true, messageId,
+				false);
+
+		return errorCode;
+	}
+
+	/**
+	 * Stops or restarts the TraceViewer view update
+	 * 
+	 * @param stop
+	 *            if true, stops the view update. If false, restarts the update.
+	 */
+	public static void stopViewUpdate(boolean stop) {
+
+		// Create the handler if it doesn't exist
+		if (viewHandler == null) {
+			viewHandler = new ViewHandler();
+		}
+
+		// Ask handler to stop / restart view update
+		viewHandler.stopViewUpdate(stop);
+	}
+
+	/**
+	 * Syncs to timestamp in the TraceViewer view. If both start and end
+	 * timestamps are given, the range is selected. This function assumes that
+	 * the traces in the TraceViewer view are in chronological order. Also,
+	 * endTimestamp must always be "bigger" than startTimestamp
+	 * 
+	 * @param startTimestamp
+	 *            start timestamp in the format of hh:mm:ss.SSS
+	 * @param endTimestamp
+	 *            end timestamp in the format of hh:mm:ss.SSS or null if only
+	 *            start timestamp is searched for
+	 * @return error code from TraceViewerAPI
+	 */
+	public static TVAPIError syncToTimestamp(String startTimestamp,
+			String endTimestamp) {
+
+		// Create the handler if it doesn't exist
+		if (viewHandler == null) {
+			viewHandler = new ViewHandler();
+		}
+
+		// Try to sync and check error status
+		TVAPIError errorCode = viewHandler.syncToTimestamp(startTimestamp,
+				endTimestamp);
+
+		return errorCode;
+	}
+
+	/**
+	 * Syncs to trace in the TraceViewer view
+	 * 
+	 * @param startTrace
+	 *            start trace number
+	 * @param endTrace
+	 *            end trace number of 0 if only start trace is searched for
+	 * @return error code from TraceViewerAPI
+	 */
+	public static TVAPIError syncToTrace(int startTrace, int endTrace) {
+
+		// Create the handler if it doesn't exist
+		if (viewHandler == null) {
+			viewHandler = new ViewHandler();
+		}
+
+		// Try to sync and check error status
+		TVAPIError errorCode = viewHandler.syncToTrace(startTrace, endTrace);
+
+		return errorCode;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/api/TraceViewerAPI2.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,355 @@
+/*
+ * 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:
+ *
+ */
+
+package com.nokia.traceviewer.api;
+
+import java.util.ArrayList;
+
+import com.nokia.traceviewer.api.TraceViewerAPI.TVAPIError;
+import com.nokia.traceviewer.engine.TraceInformation;
+import com.nokia.traceviewer.engine.TraceMetaData;
+import com.nokia.traceviewer.engine.activation.TraceActivationComponentItem;
+import com.nokia.traceviewer.engine.dataprocessor.DataProcessor;
+import com.nokia.traceviewer.internal.api.TraceViewerAPI2Impl;
+
+/**
+ * Public API access point to TraceViewer API functions that offers the
+ * following enhancements to the original <code>TraceViewerAPI</code>
+ * implementation: - notification services for client on connection status
+ * changes. - keeps count of active clients, and disconnects data source only
+ * when there is no more active clients.
+ * 
+ * Public API calls are further delegated to internal implementation of the API
+ * in <code>TraceViewerAPIImpl2</code> class.
+ * 
+ * Other API services that are not connectivity related are just delegated to
+ * original <code>TraceViewerAPI</code> implementation.
+ * 
+ * @see TraceViewerAPI2Impl
+ * @see TraceViewerAPI
+ */
+public class TraceViewerAPI2 {
+
+	/**
+	 * Connect using current settings defined in TraceViewer's preferences.
+	 * Client is registered successfully in case no exceptions are thrown.
+	 * 
+	 * @param client
+	 *            client requesting the connection.
+	 * @return connection info about the connected service.
+	 * @throws TraceConnectivityException
+	 * @see TraceConnectivityException
+	 */
+	public static ITraceConnInfo connect(ITraceConnClient client)
+			throws TraceConnectivityException {
+		return TraceViewerAPI2Impl.connect(client);
+	}
+
+	/**
+	 * Connects using current settings defined in TraceViewer's preferences
+	 * Client is disconnected and unregistered successfully for notifications in
+	 * case no exceptions are thrown.
+	 * 
+	 * @param client
+	 *            client requesting the connection.
+	 * @throws TraceConnectivityException
+	 * @see TraceConnectivityException
+	 */
+	public static void disconnect(ITraceConnClient client)
+			throws TraceConnectivityException {
+		TraceViewerAPI2Impl.disconnect(client);
+	}
+
+	/**
+	 * @see com.nokia.traceviewer.api.TraceViewerAPI#activateTraces(int, int[],
+	 *      boolean)
+	 * 
+	 * @param componentId
+	 *            component ID
+	 * @param groupIds
+	 *            group ID array
+	 * @param activate
+	 *            if true, activate. If false, deactivate
+	 * @return error code from TVAPIError
+	 * @throws TraceConnectivityException
+	 */
+	public static TVAPIError activateTraces(int componentId, int[] groupIds,
+			boolean activate) throws TraceConnectivityException {
+		TVAPIError error = TraceViewerAPI.activateTraces(componentId, groupIds,
+				activate);
+		if (error == TVAPIError.NOT_CONNECTED) {
+			throw new TraceConnectivityException(error);
+		}
+		return error;
+	}
+
+	/**
+	 * @see com.nokia.traceviewer.api.TraceViewerAPI#activateTraces(int,
+	 *      java.lang.String[], boolean)
+	 * 
+	 * @param componentId
+	 *            component ID
+	 * @param groupNames
+	 *            array of group names
+	 * @param activate
+	 *            if true, activate. If false, deactivate.
+	 * @return error code from TraceViewerAPI
+	 * 
+	 * @throws TraceConnectivityException
+	 */
+	public static TVAPIError activateTraces(int componentId,
+			String[] groupNames, boolean activate)
+			throws TraceConnectivityException {
+		TVAPIError error = TraceViewerAPI.activateTraces(componentId,
+				groupNames, activate);
+		if (error == TVAPIError.NOT_CONNECTED) {
+			throw new TraceConnectivityException(error);
+		}
+		return error;
+	}
+
+	/**
+	 * @see com.nokia.traceviewer.api.TraceViewerAPI#addDataProcessor(com.nokia.traceviewer.engine.dataprocessor.DataProcessor,
+	 *      com.nokia.traceviewer.api.DPLocation, int)
+	 * 
+	 * @param dataProcessor
+	 *            the dataprocessor to be added
+	 * @param location
+	 *            location in the list
+	 * @param priority
+	 *            priority of the dataprocessor. If two dataprocessors are in
+	 *            the same location in the dataprocessor list, the one with
+	 *            higher priority will be run first
+	 * @return error code from TraceViewerAPI
+	 */
+	public static TVAPIError addDataProcessor(DataProcessor dataProcessor,
+			DPLocation location, int priority) {
+		return TraceViewerAPI.addDataProcessor(dataProcessor, location,
+				priority);
+	}
+
+	/**
+	 * @see com.nokia.traceviewer.api.TraceViewerAPI#getDictionaryComponents()
+	 * 
+	 * @return list of components from all loaded Dictionaries. List can be
+	 *         empty.
+	 */
+	public static ArrayList<TraceActivationComponentItem> getDictionaryComponents() {
+		return TraceViewerAPI.getDictionaryComponents();
+	}
+
+	/**
+	 * @see com.nokia.traceviewer.api.TraceViewerAPI#getTraceComponentName(int)
+	 * 
+	 * @param componentId
+	 *            component ID
+	 * @return component name or null if not found or no Decode files are loaded
+	 */
+	public static String getTraceComponentName(int componentId) {
+		return TraceViewerAPI.getTraceComponentName(componentId);
+	}
+
+	/**
+	 * @see com.nokia.traceviewer.api.TraceViewerAPI#getTraceGroupId(int,
+	 *      java.lang.String)
+	 * 
+	 * @param componentId
+	 *            component ID
+	 * @param groupName
+	 *            the group name
+	 * @return trace group ID or -1 if group ID not found or -2 if no Decode
+	 *         files are loaded
+	 */
+	public static int getTraceGroupId(int componentId, String groupName) {
+		return TraceViewerAPI.getTraceGroupId(componentId, groupName);
+	}
+
+	/**
+	 * @see com.nokia.traceviewer.api.TraceViewerAPI#getTraceGroupName(int, int)
+	 * 
+	 * @param componentId
+	 *            component ID
+	 * @param groupId
+	 *            group ID
+	 * @return group name or null if not found or no Decode files are loaded
+	 */
+	public static String getTraceGroupName(int componentId, int groupId) {
+		return TraceViewerAPI.getTraceGroupName(componentId, groupId);
+	}
+
+	/**
+	 * @see com.nokia.traceviewer.api.TraceViewerAPI#getTraceName(int, int, int)
+	 * 
+	 * @param componentId
+	 *            component ID
+	 * @param groupId
+	 *            group ID
+	 * @param traceId
+	 *            trace ID
+	 * @return trace name or null if not found or no Decode files are loaded
+	 */
+	public static String getTraceName(int componentId, int groupId, int traceId) {
+		return TraceViewerAPI.getTraceName(componentId, groupId, traceId);
+	}
+
+	/**
+	 * @see com.nokia.traceviewer.api.TraceViewerAPI#getTraceMetaData(com.nokia.traceviewer.engine.TraceInformation)
+	 * 
+	 * @param information
+	 *            TraceInformation to be used when finding correct metadata
+	 * @return trace metadata or null if nothing is found
+	 */
+	public static TraceMetaData getTraceMetaData(TraceInformation information) {
+		return TraceViewerAPI.getTraceMetaData(information);
+	}
+
+	/**
+	 * @see com.nokia.traceviewer.api.TraceViewerAPI#loadDecodeFile(java.lang.String,
+	 *      boolean)
+	 * 
+	 * @param decodeFilePath
+	 *            absolute path to the decode file. Path must be in correct
+	 *            format for any operating system (Windows, Linux)
+	 * @param deleteExistingModel
+	 *            if true, old decode model is removed before this decode file
+	 *            is loaded
+	 * @return error code from TraceViewerAPI
+	 */
+	public static TVAPIError loadDecodeFile(String decodeFilePath,
+			boolean deleteExistingModel) {
+		return TraceViewerAPI.loadDecodeFile(decodeFilePath,
+				deleteExistingModel);
+	}
+
+	/**
+	 * @see com.nokia.traceviewer.api.TraceViewerAPI#openLogFile(java.lang.String)
+	 * 
+	 * @param filePath
+	 *            file path to open. If file path ends with .txt, file is opened
+	 *            as ASCII log. If filePath is null and TraceViewer view is
+	 *            open, a file selection dialog is opened.
+	 * @return error code from TraceViewerAPI
+	 */
+	public static TVAPIError openLogFile(String filePath) {
+		return TraceViewerAPI.openLogFile(filePath);
+	}
+
+	/**
+	 * @see com.nokia.traceviewer.api.TraceViewerAPI#removeDataProcessor(com.nokia.traceviewer.engine.dataprocessor.DataProcessor)
+	 * @param dataProcessor
+	 *            the DataProcessor to be removed
+	 * @return error code from TraceViewerAPI
+	 */
+	public static TVAPIError removeDataProcessor(DataProcessor dataProcessor) {
+		return TraceViewerAPI.removeDataProcessor(dataProcessor);
+	}
+
+	/**
+	 * @see com.nokia.traceviewer.api.TraceViewerAPI#saveCurrentTracesToLog(java.lang.String)
+	 * @param filePath
+	 *            file path where to save the log. If null and TraceViewer view
+	 *            is visible, a file selection dialog is shown
+	 * @return error code from TraceViewerAPI
+	 */
+	public static TVAPIError saveCurrentTracesToLog(String filePath) {
+		return TraceViewerAPI.saveCurrentTracesToLog(filePath);
+	}
+
+	/**
+	 * @see com.nokia.traceviewer.api.TraceViewerAPI#sendDataToDeviceWithHeader(byte
+	 *      [], boolean)
+	 * 
+	 * @param msg
+	 *            byte array to be sent
+	 * @param changeMediaType
+	 *            If true, changes media type to the header when sending the
+	 *            message. Otherwise leaves the message as it is.
+	 * @return error code from TraceViewerAPI
+	 * @throws TraceConnectivityException
+	 */
+	public static TVAPIError sendDataToDeviceWithHeader(byte[] msg,
+			boolean changeMediaType) throws TraceConnectivityException {
+		TVAPIError error = TraceViewerAPI.sendDataToDeviceWithHeader(msg,
+				changeMediaType);
+		if (error == TVAPIError.NOT_CONNECTED) {
+			throw new TraceConnectivityException(error);
+		}
+		return error;
+	}
+
+	/**
+	 * @see com.nokia.traceviewer.api.TraceViewerAPI#sendDataToDeviceWithoutHeader
+	 *      (byte[], byte)
+	 * 
+	 * @param msg
+	 *            byte array to be sent
+	 * @param messageId
+	 *            messageID to add to the header. Might not be needed, depends
+	 *            on the protocol.
+	 * @return error code from TraceViewerAPI
+	 * @throws TraceConnectivityException
+	 */
+	public static TVAPIError sendDataToDeviceWithoutHeader(byte[] msg,
+			byte messageId) throws TraceConnectivityException {
+		TVAPIError error = TraceViewerAPI.sendDataToDeviceWithoutHeader(msg,
+				messageId);
+		if (error == TVAPIError.NOT_CONNECTED) {
+			throw new TraceConnectivityException(error);
+		}
+		return error;
+	}
+
+	/**
+	 * @see com.nokia.traceviewer.api.TraceViewerAPI#stopViewUpdate(boolean)
+	 * 
+	 * @param stop
+	 *            if true, stops the view update. If false, restarts the update.
+	 */
+	public static void stopViewUpdate(boolean stop) {
+		TraceViewerAPI.stopViewUpdate(stop);
+	}
+
+	/**
+	 * @see com.nokia.traceviewer.api.TraceViewerAPI#syncToTimestamp(java.lang.String,
+	 *      java.lang.String)
+	 * 
+	 * @param startTimestamp
+	 *            start timestamp in the format of hh:mm:ss.SSS
+	 * @param endTimestamp
+	 *            end timestamp in the format of hh:mm:ss.SSS or null if only
+	 *            start timestamp is searched for
+	 * @return error code from TraceViewerAPI
+	 */
+	public static TVAPIError syncToTimestamp(String startTimestamp,
+			String endTimestamp) {
+		return TraceViewerAPI.syncToTimestamp(startTimestamp, endTimestamp);
+	}
+
+	/**
+	 * @see com.nokia.traceviewer.api.TraceViewerAPI#syncToTrace(int, int)
+	 * 
+	 * @param startTrace
+	 *            start trace number
+	 * @param endTrace
+	 *            end trace number of 0 if only start trace is searched for
+	 * @return error code from TraceViewerAPI
+	 */
+	public static TVAPIError syncToTrace(int startTrace, int endTrace) {
+		return TraceViewerAPI.syncToTrace(startTrace, endTrace);
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/api/ViewHandler.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,134 @@
+/*
+ * 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:
+ *
+ * View handler handles operations that require TraceViewer view 
+ *
+ */
+package com.nokia.traceviewer.api;
+
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.api.TraceViewerAPI.TVAPIError;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * View handler handles operations that require TraceViewer view
+ */
+final class ViewHandler {
+
+	/**
+	 * Private variable to be able to change it in inner class
+	 */
+	private TVAPIError syncToTimestampRet;
+
+	/**
+	 * Stops or restarts the TraceViewer view update
+	 * 
+	 * @param stop
+	 *            if true, stops the view update. If false, restarts the update.
+	 */
+	public void stopViewUpdate(boolean stop) {
+		if (TraceViewerGlobals.getTraceViewer().getView() != null) {
+			TraceViewerGlobals.getTraceViewer().getView().stopViewUpdate(stop);
+		}
+	}
+
+	/**
+	 * Syncs to timestamp in the TraceViewer view. If both start and end
+	 * timestamps are given, the range is selected. This function assumes that
+	 * the traces in the TraceViewer view are in chronological order. Also,
+	 * endTimestamp must always be "bigger" than startTimestamp
+	 * 
+	 * @param startTimestamp
+	 *            start timestamp in the format of hh:mm:ss.SSS
+	 * @param endTimestamp
+	 *            end timestamp in the format of hh:mm:ss.SSS or null if only
+	 *            start timestamp is searched for
+	 * @return error code from TraceViewerAPI
+	 */
+	public TVAPIError syncToTimestamp(final String startTimestamp,
+			final String endTimestamp) {
+		syncToTimestampRet = TVAPIError.NONE;
+
+		if (TraceViewerGlobals.getTraceViewer().getView() != null) {
+
+			PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+
+				/*
+				 * (non-Javadoc)
+				 * 
+				 * @see java.lang.Runnable#run()
+				 */
+				public void run() {
+
+					// Check that the view is not disposed
+					if (!TraceViewerGlobals.getTraceViewer().getView()
+							.isDisposed()) {
+
+						// Start searching for the timestamp(s)
+						TraceViewerGlobals.getTraceViewer()
+								.getDataProcessorAccess().getSearchProcessor()
+								.searchTraceWithTimestamp(startTimestamp,
+										endTimestamp);
+					} else {
+						syncToTimestampRet = TVAPIError.TRACE_VIEW_NOT_OPEN;
+					}
+
+				}
+			});
+
+		} else {
+			syncToTimestampRet = TVAPIError.TRACE_VIEW_NOT_OPEN;
+		}
+
+		return syncToTimestampRet;
+	}
+
+	/**
+	 * Syncs to trace in the TraceViewer view
+	 * 
+	 * @param startTrace
+	 *            start trace number
+	 * @param endTrace
+	 *            end trace number of 0 if only start trace is searched for
+	 * @return error code from TraceViewerAPI
+	 */
+	public TVAPIError syncToTrace(int startTrace, int endTrace) {
+		TVAPIError ret = TVAPIError.NONE;
+
+		if (TraceViewerGlobals.getTraceViewer().getView() != null) {
+			int start = startTrace;
+			int end = endTrace;
+
+			// Decrease lines by one because actually traces start from index 0
+			if (start > 0) {
+				start--;
+			}
+			if (end > 0) {
+				end--;
+			}
+
+			// Highlight lines
+			TraceViewerGlobals.getTraceViewer().getView().highlightLines(start,
+					end, true);
+
+		} else {
+			ret = TVAPIError.TRACE_VIEW_NOT_OPEN;
+		}
+
+		return ret;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/api/messages.properties	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,1 @@
+LogHandler.SavingLogMsg=Saving...
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/BaseDialog.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,173 @@
+/*
+ * 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:
+ *
+ * Base class for own dialogs
+ *
+ */
+package com.nokia.traceviewer.dialog;
+
+import org.eclipse.jface.dialogs.TrayDialog;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.engine.TraceViewerDialog;
+
+/**
+ * Base class for own dialogs
+ * 
+ */
+public abstract class BaseDialog extends TrayDialog implements
+		TraceViewerDialog {
+
+	/**
+	 * Integer value indicating not defined
+	 */
+	protected static final int NOT_DEFINED = -1;
+
+	/**
+	 * Composite in this dialog
+	 */
+	protected Composite composite;
+
+	/**
+	 * Old rectangle used when returning to same position
+	 */
+	private Rectangle oldRectangle;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parent
+	 *            parent shell
+	 * @param style
+	 *            style bits
+	 */
+	public BaseDialog(Shell parent, int style) {
+		super(parent);
+		setShellStyle(style);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.dialogs.TrayDialog#close()
+	 */
+	@Override
+	public boolean close() {
+		saveSettings();
+		boolean close = super.close();
+		return close;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.window.Window#open()
+	 */
+	@Override
+	public int open() {
+		Shell shell = getShell();
+		if (shell == null || shell.isDisposed()) {
+			shell = null;
+			// create the window
+			create();
+		}
+
+		shell = getShell();
+
+		// Move the dialog to the center of the top level shell.
+		Rectangle shellBounds = getParentShell().getBounds();
+		Point dialogSize = shell.getSize();
+		int middleX = shellBounds.x + ((shellBounds.width - dialogSize.x) / 2);
+		int middleY = shellBounds.y + ((shellBounds.height - dialogSize.y) / 2);
+		shell.setLocation(middleX, middleY);
+
+		// Restore settings
+		restoreSettings();
+
+		return super.open();
+	}
+
+	/**
+	 * Saves user input settings
+	 */
+	protected void saveSettings() {
+		// Save the old location
+		Shell shell = getShell();
+		if (shell != null && !shell.isDisposed()) {
+			oldRectangle = shell.getBounds();
+		}
+	}
+
+	/**
+	 * Restores user input settings
+	 */
+	protected void restoreSettings() {
+		// Restore the location of the dialog
+		Shell shell = getShell();
+		if (oldRectangle != null && shell != null) {
+			shell.setBounds(oldRectangle);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets
+	 * .Composite)
+	 */
+	@Override
+	protected Control createDialogArea(Composite parent) {
+		this.composite = (Composite) super.createDialogArea(parent);
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(getShell(),
+				TraceViewerHelpContextIDs.ACTIONS);
+
+		// Create dialog contents
+		createDialogContents();
+
+		// Create action listeners
+		createActionListeners();
+
+		return composite;
+	}
+
+	/**
+	 * This method creates dialog contents. Subclasses must implement.
+	 */
+	abstract protected void createDialogContents();
+
+	/**
+	 * This method creates action listeners for controls in this dialog.
+	 * Subclasses must implement.
+	 */
+	abstract protected void createActionListeners();
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.TraceViewerDialog#openDialog()
+	 */
+	public void openDialog() {
+		open();
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/BasePropertyDialog.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,887 @@
+/*
+ * 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:
+ *
+ * Base class for property dialogs
+ *
+ */
+package com.nokia.traceviewer.dialog;
+
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+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.List;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+import com.nokia.traceviewer.dialog.treeitem.TreeItem;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Base class for property dialogs
+ * 
+ */
+public abstract class BasePropertyDialog extends BaseDialog {
+
+	/**
+	 * Index of Text Rule in Rules list
+	 */
+	protected static final int TEXT_RULE_INDEX = 0;
+
+	/**
+	 * Index of Component Rule in Rules list
+	 */
+	protected static final int COMPONENT_RULE_INDEX = 1;
+
+	/**
+	 * Wildcard indicating any component / group ID
+	 */
+	protected static final String WILDCARD_STRING = "*"; //$NON-NLS-1$
+
+	/**
+	 * Hex prefix
+	 */
+	protected static final String HEX_PREFIX = "0x"; //$NON-NLS-1$
+
+	/**
+	 * Hex radix
+	 */
+	protected static final int HEX_RADIX = 16;
+
+	/**
+	 * Wildcard integer value indicating any component / group ID
+	 */
+	public static final int WILDCARD_INTEGER = -1;
+
+	/**
+	 * Text rule name
+	 */
+	protected static final String TEXT_RULE_NAME = Messages
+			.getString("BasePropertyDialog.TextRuleName"); //$NON-NLS-1$
+
+	/**
+	 * Component rule name
+	 */
+	protected static final String COMPONENT_RULE_NAME = Messages
+			.getString("BasePropertyDialog.ComponentRuleName"); //$NON-NLS-1$
+
+	/**
+	 * Main UI Composite
+	 */
+	protected Composite mainComposite;
+
+	/**
+	 * Upper UI Composite
+	 */
+	protected Composite upperComposite;
+
+	/**
+	 * Right under UI Composite
+	 */
+	protected Composite rightUnderComposite;
+
+	/**
+	 * List of available rules
+	 */
+	protected List ruleList;
+
+	/**
+	 * UI Label for name
+	 */
+	protected Label nameLabel;
+
+	/**
+	 * UI Label for rule
+	 */
+	protected Label ruleLabel;
+
+	/**
+	 * UI Label for selected rule
+	 */
+	protected Label selectedRuleLabel;
+
+	/**
+	 * UI Label for information
+	 */
+	protected Label informationLabel;
+
+	/**
+	 * Text field for the name of the rule
+	 */
+	protected Text nameText;
+
+	/**
+	 * Button to change component ID
+	 */
+	protected Button changeComponentButton;
+
+	/**
+	 * Button to change group ID
+	 */
+	protected Button changeGroupButton;
+
+	/**
+	 * Component / Group selection dialog
+	 */
+	protected ComponentSelectionDialog selDialog;
+
+	/**
+	 * Text field for text of the rule when text rule is selected
+	 */
+	protected Text textText;
+
+	/**
+	 * Text field for component ID when component rule is selected
+	 */
+	protected Text componentTextField;
+
+	/**
+	 * UI Label for component name
+	 */
+	protected Label componentNameLabel;
+
+	/**
+	 * Text field for group ID when component rule is selected
+	 */
+	protected Text groupTextField;
+
+	/**
+	 * UI Label for group name
+	 */
+	protected Label groupNameLabel;
+
+	/**
+	 * UI Label for component ID
+	 */
+	protected Label componentLabel;
+
+	/**
+	 * UI Label for group ID
+	 */
+	protected Label groupLabel;
+
+	/**
+	 * UI Label for text
+	 */
+	protected Label textLabel;
+
+	/**
+	 * Matchcase checkbox
+	 */
+	protected Button matchCaseCheckBox;
+
+	/**
+	 * Always selected checkbox
+	 */
+	protected Button alwaysEnabledCheckBox;
+
+	/**
+	 * Spacer label
+	 */
+	protected Label spacer;
+
+	/**
+	 * Indicates if user has touched text field. Used when replicating user
+	 * input to another field
+	 */
+	protected boolean textFieldTouched;
+
+	/**
+	 * Indicates if user has touched name field. Used when replicating user
+	 * input to another field
+	 */
+	protected boolean nameFieldTouched;
+
+	/**
+	 * New item to be created in this dialog
+	 */
+	protected TreeItem newItem;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parent
+	 *            parent shell
+	 * @param style
+	 *            style bits
+	 */
+	public BasePropertyDialog(Shell parent, int style) {
+		super(parent, style);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseDialog#createActionListeners()
+	 */
+	@Override
+	protected void createActionListeners() {
+		// Add selection listener to name field
+		nameText.addModifyListener(new ModifyListener() {
+			public void modifyText(ModifyEvent e) {
+				// Text rule selected
+				if (isTextRuleSelected()) {
+
+					// Set the name text to follow text field
+					if (!textFieldTouched) {
+						textText.setText(nameText.getText());
+					}
+
+					if (isTextComponentsFilled()) {
+						getButton(IDialogConstants.OK_ID).setEnabled(true);
+					} else {
+						getButton(IDialogConstants.OK_ID).setEnabled(false);
+					}
+
+					// Component rule selected
+				} else if (isComponentRuleSelected()) {
+					if (isComponentComponentsFilled()) {
+						getButton(IDialogConstants.OK_ID).setEnabled(true);
+					} else {
+						getButton(IDialogConstants.OK_ID).setEnabled(false);
+					}
+				}
+			}
+		});
+
+		// Add key listener to name field
+		nameText.addKeyListener(new KeyListener() {
+			public void keyPressed(KeyEvent e) {
+				nameFieldTouched = true;
+			}
+
+			public void keyReleased(KeyEvent e) {
+			}
+		});
+
+		// Add selection listener to rule list
+		ruleList.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				TraceViewerGlobals.postUiEvent("RuleListSelection" //$NON-NLS-1$
+						+ ruleList.getSelectionIndex(), "1"); //$NON-NLS-1$
+				setInformationLabel();
+				createRightUnderComposite();
+				TraceViewerGlobals.postUiEvent("RuleListSelection" //$NON-NLS-1$
+						+ ruleList.getSelectionIndex(), "0"); //$NON-NLS-1$
+			}
+		});
+	}
+
+	/**
+	 * Creates action listener when text rule is selected
+	 */
+	protected void createActionListenersForTextRule() {
+		// Add selection listeners when text rule is selected
+		if (isTextRuleSelected()) {
+			textText.addModifyListener(new ModifyListener() {
+				public void modifyText(ModifyEvent e) {
+					if (isTextRuleSelected()) {
+
+						// Set the name text to follow text field
+						if (!nameFieldTouched) {
+							nameText.setText(textText.getText());
+						}
+
+						if (isTextComponentsFilled()) {
+							getButton(IDialogConstants.OK_ID).setEnabled(true);
+						} else {
+							getButton(IDialogConstants.OK_ID).setEnabled(false);
+						}
+					}
+				}
+			});
+
+			// Add key listener to text field
+			textText.addKeyListener(new KeyListener() {
+				public void keyPressed(KeyEvent e) {
+					textFieldTouched = true;
+				}
+
+				public void keyReleased(KeyEvent e) {
+				}
+			});
+		}
+	}
+
+	/**
+	 * Creates action listeners when component rule is selected
+	 */
+	protected void createActionListenersForComponentRule() {
+		// Add selection listeners when component rule is selected
+		if (isComponentRuleSelected()) {
+			// Component text field
+			componentTextField.addModifyListener(new ModifyListener() {
+				public void modifyText(ModifyEvent e) {
+					if (isComponentRuleSelected()) {
+						if (isComponentComponentsFilled()) {
+							getButton(IDialogConstants.OK_ID).setEnabled(true);
+						} else {
+							getButton(IDialogConstants.OK_ID).setEnabled(false);
+						}
+					}
+				}
+			});
+
+			// Group text field
+			groupTextField.addModifyListener(new ModifyListener() {
+				public void modifyText(ModifyEvent e) {
+					if (isComponentRuleSelected()) {
+						if (isComponentComponentsFilled()) {
+							getButton(IDialogConstants.OK_ID).setEnabled(true);
+						} else {
+							getButton(IDialogConstants.OK_ID).setEnabled(false);
+						}
+					}
+				}
+			});
+			// Add selection listener to change component button
+			changeComponentButton.addSelectionListener(new SelectionAdapter() {
+				@Override
+				public void widgetSelected(SelectionEvent event) {
+					TraceViewerGlobals
+							.postUiEvent("ChangeComponentButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+					if (selDialog == null) {
+						selDialog = new ComponentSelectionDialog();
+					}
+					selDialog.setDialogToShowComponents(true, 0);
+					selDialog.open();
+					String componentId = selDialog.getSelectedItemId();
+					if (componentId != null && !componentId.equals("")) { //$NON-NLS-1$
+						componentTextField.setText(componentId);
+						String componentName = selDialog.getSelectedItemName();
+						componentNameLabel.setText(componentName);
+					}
+					TraceViewerGlobals
+							.postUiEvent("ChangeComponentButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+				}
+			});
+
+			// Add selection listener to change group button
+			changeGroupButton.addSelectionListener(new SelectionAdapter() {
+				@Override
+				public void widgetSelected(SelectionEvent event) {
+					TraceViewerGlobals.postUiEvent("ChangeGroupButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+					if (selDialog == null) {
+						selDialog = new ComponentSelectionDialog();
+					}
+					int componentId = NOT_DEFINED;
+					try {
+						String cid = componentTextField.getText();
+						if (cid.length() > HEX_PREFIX.length()
+								&& cid.substring(0, HEX_PREFIX.length())
+										.equals(HEX_PREFIX)) {
+							cid = cid.substring(HEX_PREFIX.length());
+						}
+						componentId = Integer.parseInt(cid, HEX_RADIX);
+					} catch (NumberFormatException e) {
+					}
+					selDialog.setDialogToShowComponents(false, componentId);
+					selDialog.open();
+					String groupId = selDialog.getSelectedItemId();
+					if (!groupId.equals("")) { //$NON-NLS-1$
+						groupTextField.setText(groupId);
+						String groupName = selDialog.getSelectedItemName();
+						groupNameLabel.setText(groupName);
+					}
+					TraceViewerGlobals.postUiEvent("ChangeGroupButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+				}
+			});
+
+		}
+	}
+
+	/**
+	 * Tells that text rule is selected from the view
+	 * 
+	 * @return true if text rule is selected from the view
+	 */
+	private boolean isTextRuleSelected() {
+		boolean textRuleSelected = false;
+		if (textText != null && !textText.isDisposed()) {
+			textRuleSelected = true;
+		}
+		return textRuleSelected;
+	}
+
+	/**
+	 * Tells that component rule is selected from the view
+	 * 
+	 * @return true if component rule is selected from the view
+	 */
+	private boolean isComponentRuleSelected() {
+		boolean componentRuleSelected = false;
+		if (componentTextField != null && !componentTextField.isDisposed()
+				&& groupTextField != null && !groupTextField.isDisposed()) {
+			componentRuleSelected = true;
+		}
+		return componentRuleSelected;
+	}
+
+	/**
+	 * Checks if all needed components are filled when text rule is selected
+	 * 
+	 * @return true if all needed components are filled
+	 */
+	private boolean isTextComponentsFilled() {
+		boolean componentsFilled = false;
+		if (textText.getText().length() > 0 && nameText.getText().length() > 0) {
+			componentsFilled = true;
+		}
+		return componentsFilled;
+	}
+
+	/**
+	 * Checks if all needed components are filled when component rule is
+	 * selected
+	 * 
+	 * @return true if all needed components are filled
+	 */
+	private boolean isComponentComponentsFilled() {
+		boolean componentsFilled = false;
+		if (componentTextField.getText().length() > 0
+				&& groupTextField.getText().length() > 0
+				&& nameText.getText().length() > 0) {
+			componentsFilled = true;
+		}
+		return componentsFilled;
+	}
+
+	/**
+	 * Disposes changeable elements if they exist. Is called when selection is
+	 * changed from the selection list and components are changed
+	 */
+	private void disposeChangeableElements() {
+		if (textLabel != null) {
+			textLabel.dispose();
+		}
+		if (textText != null) {
+			textText.dispose();
+		}
+		if (matchCaseCheckBox != null) {
+			matchCaseCheckBox.dispose();
+		}
+		if (spacer != null) {
+			spacer.dispose();
+		}
+		if (componentLabel != null) {
+			componentLabel.dispose();
+		}
+		if (componentTextField != null) {
+			componentTextField.dispose();
+		}
+		if (groupLabel != null) {
+			groupLabel.dispose();
+		}
+		if (groupTextField != null) {
+			groupTextField.dispose();
+		}
+		if (changeComponentButton != null) {
+			changeComponentButton.dispose();
+		}
+		if (changeGroupButton != null) {
+			changeGroupButton.dispose();
+		}
+		if (componentNameLabel != null) {
+			componentNameLabel.dispose();
+		}
+		if (groupNameLabel != null) {
+			groupNameLabel.dispose();
+		}
+	}
+
+	/**
+	 * This method creates mainComposite
+	 */
+	protected void createMainComposite() {
+		// Main composite
+		GridLayout mainCompositeGridLayout = new GridLayout();
+		mainCompositeGridLayout.horizontalSpacing = 4;
+		mainCompositeGridLayout.verticalSpacing = 4;
+		mainCompositeGridLayout.marginWidth = 0;
+		mainCompositeGridLayout.marginHeight = 0;
+		mainCompositeGridLayout.numColumns = 2;
+		GridData mainCompositeGridData = new GridData();
+		mainComposite = new Composite(composite, SWT.NONE);
+		mainComposite.setLayoutData(mainCompositeGridData);
+		mainComposite.setLayout(mainCompositeGridLayout);
+		createUpperComposite();
+		createLeftUnderComposite();
+		createRightUnderComposite();
+		createRightReallyUnderComposite();
+
+		nameText.setFocus();
+	}
+
+	/**
+	 * This method initializes upperComposite
+	 */
+	private void createUpperComposite() {
+		// Upper composite
+		GridData upperCompositeGridData = new GridData();
+		upperCompositeGridData.horizontalSpan = 2;
+		upperCompositeGridData.grabExcessHorizontalSpace = true;
+		upperCompositeGridData.horizontalAlignment = SWT.FILL;
+		GridLayout upperCompositeGridLayout = new GridLayout();
+		upperCompositeGridLayout.numColumns = 3;
+		upperComposite = new Composite(mainComposite, SWT.NONE);
+		upperComposite.setLayout(upperCompositeGridLayout);
+		upperComposite.setLayoutData(upperCompositeGridData);
+
+		// Name label
+		GridData nameLabelGridData = new GridData();
+		nameLabelGridData.horizontalIndent = 5;
+		nameLabel = new Label(upperComposite, SWT.NONE);
+		nameLabel
+				.setText(Messages.getString("BasePropertyDialog.RuleNameText")); //$NON-NLS-1$
+		nameLabel.setLayoutData(nameLabelGridData);
+
+		// Name text
+		GridData nameTextGridData = new GridData();
+		nameTextGridData.grabExcessHorizontalSpace = true;
+		nameTextGridData.horizontalAlignment = SWT.FILL;
+		nameTextGridData.horizontalIndent = 30;
+		nameTextGridData.horizontalSpan = 2;
+		nameTextGridData.widthHint = 235;
+		nameText = new Text(upperComposite, SWT.BORDER);
+		nameText.setLayoutData(nameTextGridData);
+		nameText.setToolTipText(Messages
+				.getString("BasePropertyDialog.NameTexToolTip")); //$NON-NLS-1$
+
+		// Rule label
+		GridData ruleLabelGridData = new GridData();
+		ruleLabelGridData.horizontalIndent = 5;
+		ruleLabel = new Label(upperComposite, SWT.NONE);
+		ruleLabel.setText(Messages
+				.getString("BasePropertyDialog.SelectedRuleText")); //$NON-NLS-1$
+		ruleLabel.setLayoutData(ruleLabelGridData);
+
+		// Selected rule label
+		GridData selectedRuleLabelGridData = new GridData();
+		selectedRuleLabelGridData.widthHint = 150;
+		selectedRuleLabelGridData.horizontalIndent = 30;
+		selectedRuleLabelGridData.horizontalSpan = 2;
+		selectedRuleLabelGridData.grabExcessHorizontalSpace = true;
+		selectedRuleLabelGridData.horizontalAlignment = SWT.FILL;
+		selectedRuleLabel = new Label(upperComposite, SWT.NONE);
+		selectedRuleLabel.setLayoutData(selectedRuleLabelGridData);
+		selectedRuleLabel.setToolTipText(Messages
+				.getString("BasePropertyDialog.RuleLabelToolTip")); //$NON-NLS-1$
+
+		// Spacer label
+		new Label(upperComposite, SWT.NONE);
+
+		// Insert data to fields
+		insertDataToUpperComposite();
+	}
+
+	/**
+	 * This method initializes leftUnderComposite
+	 */
+	protected void createLeftUnderComposite() {
+		// Left under composite
+		GridLayout leftUnderCompositeGridLayout = new GridLayout();
+		leftUnderCompositeGridLayout.verticalSpacing = 0;
+		leftUnderCompositeGridLayout.marginHeight = 0;
+		leftUnderCompositeGridLayout.horizontalSpacing = 0;
+		leftUnderCompositeGridLayout.marginWidth = 0;
+		GridData leftUnderCompositeGridData = new GridData();
+		leftUnderCompositeGridData.heightHint = 190;
+		leftUnderCompositeGridData.horizontalIndent = 0;
+		leftUnderCompositeGridData.verticalSpan = 2;
+		leftUnderCompositeGridData.widthHint = 200;
+		Composite leftUnderComposite = new Composite(mainComposite, SWT.BORDER);
+		leftUnderComposite.setLayoutData(leftUnderCompositeGridData);
+		leftUnderComposite.setLayout(leftUnderCompositeGridLayout);
+		leftUnderComposite.setBackground(getShell().getDisplay()
+				.getSystemColor(SWT.COLOR_WHITE));
+
+		// Rule list
+		GridData ruleListGridData = new GridData();
+		ruleListGridData.heightHint = 190;
+		ruleListGridData.horizontalAlignment = GridData.CENTER;
+		ruleListGridData.verticalAlignment = GridData.CENTER;
+		ruleListGridData.horizontalIndent = 15;
+		ruleListGridData.verticalIndent = 5;
+		ruleListGridData.widthHint = 200;
+		ruleList = new List(leftUnderComposite, SWT.NONE);
+		ruleList.setLayoutData(ruleListGridData);
+		ruleList.setBackground(getShell().getDisplay().getSystemColor(
+				SWT.COLOR_WHITE));
+		ruleList.setToolTipText(Messages
+				.getString("BasePropertyDialog.RuleListToolTip")); //$NON-NLS-1$
+
+		setListSelection();
+	}
+
+	/**
+	 * This method initializes rightUnderComposite
+	 */
+	protected void createRightUnderComposite() {
+		// Dispose changeable elements
+		if (rightUnderComposite != null) {
+			disposeChangeableElements();
+		} else {
+			// Create Right under composite
+			GridLayout rightUnderCompositeGridLayout = new GridLayout();
+			rightUnderCompositeGridLayout.marginHeight = 12;
+			rightUnderCompositeGridLayout.numColumns = 3;
+			GridData rightUnderCompositeGridData = new GridData();
+			rightUnderCompositeGridData.heightHint = 110;
+			rightUnderCompositeGridData.verticalAlignment = GridData.BEGINNING;
+			rightUnderCompositeGridData.widthHint = 250;
+			rightUnderCompositeGridData.horizontalAlignment = GridData.CENTER;
+			rightUnderComposite = new Composite(mainComposite, SWT.BORDER);
+			rightUnderComposite.setLayoutData(rightUnderCompositeGridData);
+			rightUnderComposite.setLayout(rightUnderCompositeGridLayout);
+		}
+
+		// Text rule
+		if (ruleList.getSelectionIndex() == TEXT_RULE_INDEX) {
+			createTextRuleComposite();
+			createActionListenersForTextRule();
+		} else if (ruleList.getSelectionIndex() == COMPONENT_RULE_INDEX) {
+			createComponentRuleComposite();
+			createActionListenersForComponentRule();
+		} else {
+			createTextRuleComposite();
+			createActionListenersForTextRule();
+		}
+
+		// Layout again
+		rightUnderComposite.layout();
+	}
+
+	/**
+	 * Creates text rule composite
+	 */
+	private void createTextRuleComposite() {
+		// Text label
+		textLabel = new Label(rightUnderComposite, SWT.NONE);
+		textLabel.setText(Messages
+				.getString("BasePropertyDialog.TextLabelText")); //$NON-NLS-1$
+
+		// Text text
+		GridData textTextGridData = new GridData();
+		textTextGridData.horizontalIndent = 30;
+		textTextGridData.grabExcessHorizontalSpace = true;
+		textTextGridData.horizontalAlignment = SWT.FILL;
+		textTextGridData.horizontalSpan = 2;
+		textText = new Text(rightUnderComposite, SWT.BORDER);
+		textText.setLayoutData(textTextGridData);
+		textText.setToolTipText(Messages
+				.getString("BasePropertyDialog.SearchTooltip")); //$NON-NLS-1$
+
+		// Spacer label
+		spacer = new Label(rightUnderComposite, SWT.NONE);
+
+		// Match case checkbox
+		GridData matchCaseCheckBoxGridData = new GridData();
+		matchCaseCheckBoxGridData.horizontalIndent = 30;
+		matchCaseCheckBoxGridData.horizontalSpan = 2;
+		matchCaseCheckBox = new Button(rightUnderComposite, SWT.CHECK);
+		matchCaseCheckBox.setText(Messages
+				.getString("BasePropertyDialog.MatchCaseText")); //$NON-NLS-1$
+		matchCaseCheckBox.setToolTipText(Messages
+				.getString("BasePropertyDialog.MatchCaseToolTip")); //$NON-NLS-1$
+		matchCaseCheckBox.setLayoutData(matchCaseCheckBoxGridData);
+
+		// Insert data to fields
+		insertDataToTextFields();
+	}
+
+	/**
+	 * Create component rule composite
+	 */
+	private void createComponentRuleComposite() {
+		// Component ID Label
+		componentLabel = new Label(rightUnderComposite, SWT.NONE);
+		componentLabel.setText(Messages
+				.getString("BasePropertyDialog.ComponentIDText")); //$NON-NLS-1$
+
+		// Component ID field
+		GridData componentTextGridData = new GridData();
+		componentTextGridData.horizontalIndent = 5;
+		componentTextGridData.horizontalAlignment = SWT.FILL;
+		componentTextGridData.grabExcessHorizontalSpace = true;
+		componentTextField = new Text(rightUnderComposite, SWT.BORDER);
+		componentTextField.setLayoutData(componentTextGridData);
+		componentTextField.setToolTipText(Messages
+				.getString("BasePropertyDialog.ComponentFieldToolTip")); //$NON-NLS-1$
+
+		// Change component ID button
+		GridData changeComponentButtonGridData = new GridData();
+		changeComponentButtonGridData.heightHint = 25;
+		changeComponentButtonGridData.widthHint = 30;
+		changeComponentButton = new Button(rightUnderComposite, SWT.NONE);
+		changeComponentButton.setText("..."); //$NON-NLS-1$
+		changeComponentButton.setToolTipText(Messages
+				.getString("BasePropertyDialog.ComponentBrowseTooltip")); //$NON-NLS-1$
+		changeComponentButton.setLayoutData(changeComponentButtonGridData);
+
+		// Component name
+		GridData componentNameLabelGridData = new GridData();
+		componentNameLabelGridData.horizontalSpan = 3;
+		componentNameLabelGridData.horizontalIndent = 5;
+		componentNameLabelGridData.widthHint = 230;
+		componentNameLabel = new Label(rightUnderComposite, SWT.NONE);
+		componentNameLabel.setForeground(getShell().getDisplay()
+				.getSystemColor(SWT.COLOR_RED));
+		componentNameLabel.setLayoutData(componentNameLabelGridData);
+
+		// Group ID Label
+		groupLabel = new Label(rightUnderComposite, SWT.NONE);
+		groupLabel
+				.setText(Messages.getString("BasePropertyDialog.GroupIdText")); //$NON-NLS-1$
+
+		// Group ID field
+		GridData groupTextGridData = new GridData();
+		groupTextGridData.horizontalIndent = 5;
+		groupTextGridData.horizontalAlignment = SWT.FILL;
+		groupTextGridData.grabExcessHorizontalSpace = true;
+		groupTextField = new Text(rightUnderComposite, SWT.BORDER);
+		groupTextField.setLayoutData(groupTextGridData);
+		groupTextField.setToolTipText(Messages
+				.getString("BasePropertyDialog.GroupFieldToolTip")); //$NON-NLS-1$
+
+		// Change group ID button
+		GridData changeGroupButtonGridData = new GridData();
+		changeGroupButtonGridData.heightHint = 25;
+		changeGroupButtonGridData.widthHint = 30;
+		changeGroupButton = new Button(rightUnderComposite, SWT.NONE);
+		changeGroupButton.setText("..."); //$NON-NLS-1$
+		changeGroupButton.setToolTipText(Messages
+				.getString("BasePropertyDialog.GroupBrowseToolTip")); //$NON-NLS-1$
+		changeGroupButton.setLayoutData(changeGroupButtonGridData);
+
+		// Group name
+		GridData groupNameLabelGridData = new GridData();
+		groupNameLabelGridData.horizontalSpan = 3;
+		groupNameLabelGridData.horizontalIndent = 5;
+		groupNameLabelGridData.widthHint = 230;
+		groupNameLabel = new Label(rightUnderComposite, SWT.NONE);
+		groupNameLabel.setForeground(getShell().getDisplay().getSystemColor(
+				SWT.COLOR_RED));
+		groupNameLabel.setLayoutData(groupNameLabelGridData);
+
+		// Insert data to fields
+		insertDataToComponentFields();
+	}
+
+	/**
+	 * This method initializes rightReallyUnderComposite
+	 */
+	protected void createRightReallyUnderComposite() {
+		// Right really under composite
+		GridLayout rightReallyUnderCompositeGridLayout = new GridLayout();
+		rightReallyUnderCompositeGridLayout.verticalSpacing = 0;
+		rightReallyUnderCompositeGridLayout.marginWidth = 0;
+		rightReallyUnderCompositeGridLayout.horizontalSpacing = 0;
+		GridData rightReallyUnderCompositeGridData = new GridData();
+		rightReallyUnderCompositeGridData.heightHint = 70;
+		rightReallyUnderCompositeGridData.horizontalAlignment = GridData.CENTER;
+		rightReallyUnderCompositeGridData.verticalAlignment = GridData.CENTER;
+		rightReallyUnderCompositeGridData.widthHint = 250;
+		Composite rightReallyUnderComposite = new Composite(mainComposite,
+				SWT.BORDER);
+		rightReallyUnderComposite
+				.setLayoutData(rightReallyUnderCompositeGridData);
+		rightReallyUnderComposite
+				.setLayout(rightReallyUnderCompositeGridLayout);
+
+		// Information label
+		GridData informationLabelGridData = new GridData();
+		informationLabelGridData.grabExcessVerticalSpace = false;
+		informationLabelGridData.heightHint = 69;
+		informationLabelGridData.widthHint = 239;
+		informationLabelGridData.horizontalIndent = 5;
+		informationLabelGridData.grabExcessHorizontalSpace = false;
+		informationLabel = new Label(rightReallyUnderComposite, SWT.WRAP);
+		informationLabel.setLayoutData(informationLabelGridData);
+		setInformationLabel();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse
+	 * .swt.widgets.Composite)
+	 */
+	@Override
+	protected void createButtonsForButtonBar(Composite parent) {
+		super.createButtonsForButtonBar(parent);
+
+		// If not editing old rule, disable OK button when opening the dialog
+		if (newItem == null) {
+			getButton(IDialogConstants.OK_ID).setEnabled(false);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.dialogs.Dialog#cancelPressed()
+	 */
+	@Override
+	protected void cancelPressed() {
+		newItem = null;
+		super.cancelPressed();
+	}
+
+	/**
+	 * Opens dialog shell
+	 * 
+	 * @return the new item created
+	 */
+	public TreeItem openAndGetItem() {
+		open();
+		return newItem;
+	}
+
+	/**
+	 * Inserts data to upper composite
+	 */
+	protected abstract void insertDataToUpperComposite();
+
+	/**
+	 * Sets list selection
+	 */
+	protected abstract void setListSelection();
+
+	/**
+	 * Inserts data to text fields
+	 */
+	protected abstract void insertDataToTextFields();
+
+	/**
+	 * Inserts data to component fields
+	 */
+	protected abstract void insertDataToComponentFields();
+
+	/**
+	 * Sets information label
+	 */
+	protected abstract void setInformationLabel();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/BaseTreeDialog.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,1138 @@
+/*
+ * 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:
+ *
+ * Base class for tree dialogs
+ *
+ */
+package com.nokia.traceviewer.dialog;
+
+import java.net.URL;
+
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.CheckboxTreeViewer;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.DragSource;
+import org.eclipse.swt.dnd.DragSourceEvent;
+import org.eclipse.swt.dnd.DragSourceListener;
+import org.eclipse.swt.dnd.DropTarget;
+import org.eclipse.swt.dnd.DropTargetAdapter;
+import org.eclipse.swt.dnd.DropTargetEvent;
+import org.eclipse.swt.dnd.TextTransfer;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.action.PauseAction;
+import com.nokia.traceviewer.dialog.treeitem.TreeCheckboxStateListener;
+import com.nokia.traceviewer.dialog.treeitem.TreeItem;
+import com.nokia.traceviewer.dialog.treeitem.TreeItemContentProvider;
+import com.nokia.traceviewer.dialog.treeitem.TreeItemLabelProvider;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Base class for tree dialogs
+ * 
+ */
+public abstract class BaseTreeDialog extends BaseDialog {
+
+	/**
+	 * Tree viewer object
+	 */
+	protected CheckboxTreeViewer viewer;
+
+	/**
+	 * Toolbar where actionbuttons are
+	 */
+	protected ToolBar toolBar;
+
+	/**
+	 * Add group button
+	 */
+	protected ToolItem addGroupItem;
+
+	/**
+	 * Add item button
+	 */
+	protected ToolItem addItem;
+
+	/**
+	 * Edit item button
+	 */
+	protected ToolItem editItem;
+
+	/**
+	 * Remove item button
+	 */
+	protected ToolItem removeItem;
+
+	/**
+	 * Clear all button
+	 */
+	protected ToolItem clearItem;
+
+	/**
+	 * ProgressBar Dialog
+	 */
+	protected ProgressBarDialog progressBarDialog;
+
+	/**
+	 * Content provider
+	 */
+	protected TreeItemContentProvider contentProvider;
+
+	/**
+	 * Checkbox state listener used to check/uncheck many items at once
+	 */
+	protected TreeCheckboxStateListener checkboxStateListener;
+
+	/**
+	 * Tree root
+	 */
+	protected TreeItem treeRoot;
+
+	/**
+	 * Root item in tree
+	 */
+	protected TreeItem root;
+
+	/**
+	 * Selected object when starting drag and drop
+	 */
+	private TreeItem selectedObject;
+
+	// Images
+	/**
+	 * Group add image
+	 */
+	protected Image groupAddImage;
+
+	/**
+	 * Item add image
+	 */
+	protected Image itemAddImage;
+
+	/**
+	 * Item edit image
+	 */
+	protected Image itemEditImage;
+
+	/**
+	 * Item remove image
+	 */
+	protected Image itemRemoveImage;
+
+	/**
+	 * Item clear image
+	 */
+	protected Image clearImage;
+
+	/**
+	 * Create group menu item
+	 */
+	private MenuItem addGroup;
+
+	/**
+	 * Add new rule menu item
+	 */
+	private MenuItem addRule;
+
+	/**
+	 * Edit rule menu item
+	 */
+	private MenuItem editRule;
+
+	/**
+	 * Remove rule menu item
+	 */
+	private MenuItem removeRule;
+
+	/**
+	 * Rename configuration menu item
+	 */
+	private MenuItem renameRule;
+
+	/**
+	 * Indicates that something changed while visiting this dialog -> Apply
+	 * settings
+	 */
+	protected boolean somethingChanged = false;
+
+	/**
+	 * Checks if DataReader was paused when we entered dialog -> Don't pause
+	 * again and don't unpause in exit
+	 */
+	protected boolean wasPausedWhenEntered = true;
+
+	/**
+	 * Tells that we are inserting before item under the mouse cursor when
+	 * dragging and dropping items
+	 */
+	private boolean dndAddBefore;
+
+	/**
+	 * Add group image
+	 */
+	private static final String groupAddImageLocation = "/icons/folderadd.gif"; //$NON-NLS-1$
+
+	/**
+	 * Add item image
+	 */
+	private static final String itemAddImageLocation = "/icons/coloradd.gif"; //$NON-NLS-1$
+
+	/**
+	 * Edit item image
+	 */
+	private static final String itemEditImageLocation = "/icons/coloredit.gif"; //$NON-NLS-1$
+
+	/**
+	 * Remove item image
+	 */
+	private static final String itemRemoveImageLocation = "/icons/colorremove.gif"; //$NON-NLS-1$
+
+	/**
+	 * Clear all image
+	 */
+	private static final String clearImageLocation = "/icons/clear.gif"; //$NON-NLS-1$
+
+	/**
+	 * Name of the dialog
+	 */
+	private static final String dialogName = Messages
+			.getString("BaseTreeDialog.DialogName"); //$NON-NLS-1$
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parent
+	 *            parent shell
+	 * @param contentProvider
+	 *            content provider
+	 * @param treeRoot
+	 *            tree root
+	 */
+	protected BaseTreeDialog(Shell parent,
+			TreeItemContentProvider contentProvider, TreeItem treeRoot) {
+		super(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.RESIZE);
+		this.contentProvider = contentProvider;
+		this.treeRoot = treeRoot;
+		root = (TreeItem) treeRoot.getChildren()[0];
+	}
+
+	/**
+	 * Export
+	 */
+	protected abstract void export();
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.dialogs.TrayDialog#close()
+	 */
+	@Override
+	public boolean close() {
+		boolean close = super.close();
+		if (!wasPausedWhenEntered) {
+			// Unpause
+			PauseAction action = (PauseAction) TraceViewerGlobals
+					.getTraceViewer().getView().getActionFactory()
+					.getPauseAction();
+			action.setPaused(false);
+		}
+		export();
+		return close;
+	}
+
+	/**
+	 * Disposes images when shell is closed
+	 */
+	protected void dispose() {
+		// Dispose images
+		if (groupAddImage != null) {
+			groupAddImage.dispose();
+		}
+		if (itemAddImage != null) {
+			itemAddImage.dispose();
+		}
+		if (itemEditImage != null) {
+			itemEditImage.dispose();
+		}
+		if (itemRemoveImage != null) {
+			itemRemoveImage.dispose();
+		}
+		if (clearImage != null) {
+			clearImage.dispose();
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseDialog#restoreSettings()
+	 */
+	@Override
+	protected void restoreSettings() {
+		// Restore the location of the dialog
+		super.restoreSettings();
+
+		// Set clear button enabled if there's more than root
+		if (root.getChildren().length > 0) {
+			clearItem.setEnabled(true);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseDialog#createDialogContents()
+	 */
+	@Override
+	protected void createDialogContents() {
+		createDialogContents(dialogName);
+	}
+
+	/**
+	 * Creates dialog contents
+	 * 
+	 * @param dialogName
+	 *            dialog name
+	 */
+	protected void createDialogContents(String dialogName) {
+		doInitialSetup();
+
+		// Shell
+		GridLayout shellGridLayout = new GridLayout();
+		shellGridLayout.numColumns = 3;
+		GridData compositeGridData = new GridData();
+		compositeGridData.horizontalAlignment = SWT.FILL;
+		compositeGridData.verticalAlignment = SWT.FILL;
+		compositeGridData.grabExcessHorizontalSpace = true;
+		compositeGridData.grabExcessVerticalSpace = true;
+		getShell().setText(dialogName);
+		root.setName(dialogName);
+		composite.setLayout(shellGridLayout);
+		composite.setLayoutData(compositeGridData);
+
+		createToolBar();
+		getShell().setMinimumSize(new Point(280, 380));
+		createTree();
+
+		// Spacer label
+		Label spacer = new Label(composite, SWT.NONE);
+		GridData spacerGridData = new GridData(SWT.FILL, SWT.FILL);
+		spacerGridData.grabExcessHorizontalSpace = true;
+		spacer.setLayoutData(spacerGridData);
+	}
+
+	/**
+	 * Does initial dialog setup
+	 */
+	protected void doInitialSetup() {
+		// Pause the datareader if it's not paused already
+		wasPausedWhenEntered = TraceViewerGlobals.getTraceViewer()
+				.getDataReaderAccess().getMainDataReader().isPaused();
+		if (!wasPausedWhenEntered) {
+			TraceViewerGlobals.getTraceViewer().getView().getActionFactory()
+					.getPauseAction().run();
+		}
+		somethingChanged = false;
+	}
+
+	/**
+	 * Creates the tree viewer
+	 */
+	protected void createTree() {
+		GridData treeGridData = new GridData();
+		treeGridData.horizontalSpan = 3;
+		treeGridData.horizontalAlignment = SWT.FILL;
+		treeGridData.verticalAlignment = SWT.FILL;
+		treeGridData.grabExcessVerticalSpace = true;
+		treeGridData.grabExcessHorizontalSpace = true;
+		treeGridData.heightHint = 227;
+		treeGridData.widthHint = 250;
+
+		// Create Viewer with the checkbox style bit
+		viewer = new CheckboxTreeViewer(composite, SWT.CHECK | SWT.BORDER
+				| SWT.V_SCROLL | SWT.H_SCROLL);
+
+		viewer.getTree().setLayoutData(treeGridData);
+		viewer.setLabelProvider(new TreeItemLabelProvider());
+		viewer.setContentProvider(contentProvider);
+
+		// Set root and expand all items
+		viewer.setInput(treeRoot);
+		viewer.expandAll();
+
+		// Select the root item
+		if (viewer.getTree().getItem(0) != null) {
+			viewer.getTree().setSelection(viewer.getTree().getItem(0));
+		}
+
+		// Create listener for checkboxes
+		checkboxStateListener = new TreeCheckboxStateListener(viewer);
+		viewer.addCheckStateListener(checkboxStateListener);
+
+		// Drag and Drop support
+		createDNDSupport();
+
+		// Context menu
+		createContextMenu();
+
+		// Set initial button states
+		setButtonStates();
+	}
+
+	/**
+	 * Creates Drag and Drop support
+	 */
+	private void createDNDSupport() {
+		Transfer[] types = new Transfer[] { TextTransfer.getInstance() };
+		int operations = DND.DROP_MOVE;
+
+		// Drag Source definitions
+		final DragSource source = new DragSource(viewer.getTree(), operations);
+		source.setTransfer(types);
+
+		// Add drag listener
+		source.addDragListener(new DragSourceListener() {
+
+			/*
+			 * (non-Javadoc)
+			 * 
+			 * @see
+			 * org.eclipse.swt.dnd.DragSourceListener#dragStart(org.eclipse.
+			 * swt.dnd.DragSourceEvent)
+			 */
+			public void dragStart(DragSourceEvent event) {
+				// Get selected object
+				selectedObject = ((TreeItem) ((IStructuredSelection) viewer
+						.getSelection()).getFirstElement());
+				if (selectedObject != null) {
+					event.doit = true;
+				} else {
+					event.doit = false;
+				}
+			}
+
+			/*
+			 * (non-Javadoc)
+			 * 
+			 * @see
+			 * org.eclipse.swt.dnd.DragSourceListener#dragSetData(org.eclipse
+			 * .swt.dnd.DragSourceEvent)
+			 */
+			public void dragSetData(DragSourceEvent event) {
+				// Have to put some String here
+				event.data = "blaa"; //$NON-NLS-1$
+			}
+
+			/*
+			 * (non-Javadoc)
+			 * 
+			 * @see
+			 * org.eclipse.swt.dnd.DragSourceListener#dragFinished(org.eclipse
+			 * .swt.dnd.DragSourceEvent)
+			 */
+			public void dragFinished(DragSourceEvent event) {
+			}
+		});
+
+		// Drop Target definitions
+		DropTarget target = new DropTarget(viewer.getTree(), operations);
+		target.setTransfer(types);
+
+		// Add drop listener
+		target.addDropListener(new DropTargetAdapter() {
+
+			/*
+			 * (non-Javadoc)
+			 * 
+			 * @see
+			 * org.eclipse.swt.dnd.DropTargetAdapter#dragOver(org.eclipse.swt
+			 * .dnd.DropTargetEvent)
+			 */
+			@Override
+			public void dragOver(DropTargetEvent event) {
+				event.feedback = DND.FEEDBACK_EXPAND | DND.FEEDBACK_SCROLL;
+				if (event.item != null) {
+					org.eclipse.swt.widgets.TreeItem item = (org.eclipse.swt.widgets.TreeItem) event.item;
+					Point pt = getShell().getDisplay().map(null,
+							viewer.getTree(), event.x, event.y);
+					Rectangle bounds = item.getBounds();
+					TreeItem it = (TreeItem) item.getData();
+					dndAddBefore = false;
+					if (pt.y < bounds.y + bounds.height / 3) {
+						dndAddBefore = true;
+						event.feedback = DND.FEEDBACK_INSERT_BEFORE;
+					} else if (pt.y > bounds.y + 2 * bounds.height / 3) {
+						event.feedback = DND.FEEDBACK_INSERT_AFTER;
+					} else if (!it.isGroup()) {
+						event.feedback = DND.FEEDBACK_NONE;
+					} else {
+						event.feedback = DND.FEEDBACK_SELECT;
+					}
+				}
+			}
+
+			/*
+			 * (non-Javadoc)
+			 * 
+			 * @see
+			 * org.eclipse.swt.dnd.DropTargetAdapter#drop(org.eclipse.swt.dnd
+			 * .DropTargetEvent)
+			 */
+			@Override
+			public void drop(DropTargetEvent event) {
+
+				// Dragging something
+				if (selectedObject != null) {
+
+					TreeItem parent = null;
+
+					// Something is selected
+					if (event.item != null) {
+
+						// Get parent node under cursor
+						parent = (TreeItem) ((org.eclipse.swt.widgets.TreeItem) event.item)
+								.getData();
+
+						// if parent is group, add item to end of list
+						if (parent.isGroup()) {
+
+							boolean addingOk = true;
+
+							// Moving from the same group
+							if (selectedObject.getParent().equals(parent)) {
+								parent.removeChild(selectedObject);
+								// Moving to another group
+							} else {
+								// Don't allow moving to itself
+								if (!parent.equals(selectedObject)) {
+
+									((TreeItem) selectedObject.getParent())
+											.removeChild(selectedObject);
+								} else {
+									addingOk = false;
+								}
+							}
+
+							// Add to new parent
+							if (addingOk) {
+								parent.addChild(selectedObject);
+								selectedObject.setParent(parent);
+								// If group has children, expand it
+								if (selectedObject.isGroup()
+										&& selectedObject.getChildren()[0] != null) {
+									viewer.expandToLevel(selectedObject
+											.getChildren()[0], 0);
+								}
+							}
+
+							// Parent is not group
+						} else {
+
+							// Get parent group of the selected item
+							TreeItem realParent = (TreeItem) parent.getParent();
+
+							// Check that we aren't moving folder to a item
+							// inside the same folder
+							if (!selectedObject.equals(realParent)) {
+
+								// Remove from old parent
+								((TreeItem) selectedObject.getParent())
+										.removeChild(selectedObject);
+
+								// Get position of parent
+								int pos = 0;
+
+								// Go through children to find this one
+								Object[] children = ((TreeItem) parent
+										.getParent()).getChildren();
+								for (int i = 0; i < children.length; i++) {
+									if (children[i].equals(parent)) {
+										pos = i;
+										break;
+									}
+								}
+
+								// Insert after the item under cursor, add
+								// position by one
+								if (!dndAddBefore) {
+									pos++;
+								}
+
+								// Add to new parent
+								realParent.addChild(pos, selectedObject);
+								selectedObject.setParent(realParent);
+
+								// If group has children, expand it
+								if (selectedObject.isGroup()
+										&& selectedObject.getChildren()[0] != null) {
+									viewer.expandToLevel(selectedObject
+											.getChildren()[0], 0);
+								}
+
+							}
+						}
+					} else {
+						parent = (TreeItem) getParentGroup();
+
+						// Remove from old parent
+						((TreeItem) selectedObject.getParent())
+								.removeChild(selectedObject);
+
+						// Add to new parent
+						parent.addChild(selectedObject);
+						selectedObject.setParent(parent);
+
+						// If group has children, expand it
+						if (selectedObject.isGroup()
+								&& selectedObject.getChildren()[0] != null) {
+							viewer.expandToLevel(
+									selectedObject.getChildren()[0], 0);
+						}
+
+					}
+				}
+				// Set button states
+				setButtonStates();
+			}
+		});
+	}
+
+	/**
+	 * Create toolbar with default image locations
+	 */
+	protected void createToolBar() {
+		createToolBar(itemAddImageLocation, itemEditImageLocation,
+				itemRemoveImageLocation);
+	}
+
+	/**
+	 * Create toolbar with given image locations
+	 * 
+	 * @param itemAddImageLocation
+	 *            add image location
+	 * @param itemEditImageLocation
+	 *            edit image location
+	 * @param itemRemoveImageLocation
+	 *            remove image location
+	 */
+	protected void createToolBar(String itemAddImageLocation,
+			String itemEditImageLocation, String itemRemoveImageLocation) {
+		URL url = null;
+		GridData toolBarGridData = new GridData();
+		toolBarGridData.horizontalSpan = 3;
+		toolBar = new ToolBar(composite, SWT.NONE);
+		toolBar.setLayoutData(toolBarGridData);
+
+		addGroupItem = new ToolItem(toolBar, SWT.PUSH);
+		addGroupItem
+				.setText(Messages.getString("BaseTreeDialog.GroupItemText")); //$NON-NLS-1$
+		addGroupItem.setToolTipText(Messages
+				.getString("BaseTreeDialog.AddGroupToolTip")); //$NON-NLS-1$
+		url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				groupAddImageLocation);
+		groupAddImage = ImageDescriptor.createFromURL(url).createImage();
+		addGroupItem.setImage(groupAddImage);
+
+		addItem = new ToolItem(toolBar, SWT.PUSH);
+		addItem.setText(Messages.getString("BaseTreeDialog.AddItemText")); //$NON-NLS-1$
+		addItem.setToolTipText(Messages
+				.getString("BaseTreeDialog.AddItemToolTip")); //$NON-NLS-1$
+		url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				itemAddImageLocation);
+		itemAddImage = ImageDescriptor.createFromURL(url).createImage();
+		addItem.setImage(itemAddImage);
+
+		editItem = new ToolItem(toolBar, SWT.PUSH);
+		editItem.setText(Messages.getString("BaseTreeDialog.EditItemText")); //$NON-NLS-1$
+		editItem.setToolTipText(Messages
+				.getString("BaseTreeDialog.EditItemToolTip")); //$NON-NLS-1$
+		url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				itemEditImageLocation);
+		itemEditImage = ImageDescriptor.createFromURL(url).createImage();
+		editItem.setImage(itemEditImage);
+		editItem.setEnabled(false);
+
+		removeItem = new ToolItem(toolBar, SWT.PUSH);
+		removeItem.setText(Messages.getString("BaseTreeDialog.RemoveItemText")); //$NON-NLS-1$
+		removeItem.setToolTipText(Messages
+				.getString("BaseTreeDialog.RemoveItemToolTip")); //$NON-NLS-1$
+		url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				itemRemoveImageLocation);
+		itemRemoveImage = ImageDescriptor.createFromURL(url).createImage();
+		removeItem.setImage(itemRemoveImage);
+		removeItem.setEnabled(false);
+
+		clearItem = new ToolItem(toolBar, SWT.PUSH);
+		clearItem.setText(Messages.getString("BaseTreeDialog.ClearItemText")); //$NON-NLS-1$
+		clearItem.setToolTipText(Messages
+				.getString("BaseTreeDialog.ClearItemToolTip")); //$NON-NLS-1$
+		url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				clearImageLocation);
+		clearImage = ImageDescriptor.createFromURL(url).createImage();
+		clearItem.setImage(clearImage);
+		clearItem.setEnabled(false);
+	}
+
+	/**
+	 * Sets button states depending on selected item
+	 */
+	protected void setButtonStates() {
+		// Get selection
+		Object selection = ((IStructuredSelection) viewer.getSelection())
+				.getFirstElement();
+
+		// If selection is null
+		if (selection == null) {
+			addItem.setEnabled(false);
+			addRule.setEnabled(false);
+			editItem.setEnabled(false);
+			editRule.setEnabled(false);
+			removeItem.setEnabled(false);
+			removeRule.setEnabled(false);
+			addGroupItem.setEnabled(false);
+			addGroup.setEnabled(false);
+			renameRule.setEnabled(false);
+			// Root node is selected
+		} else if (selection.equals(root)) {
+			addItem.setEnabled(true);
+			addRule.setEnabled(true);
+			editItem.setEnabled(false);
+			editRule.setEnabled(false);
+			removeItem.setEnabled(false);
+			removeRule.setEnabled(false);
+			addGroupItem.setEnabled(true);
+			addGroup.setEnabled(true);
+			renameRule.setEnabled(false);
+			// Something else than group is selected
+		} else if (!((TreeItem) selection).isGroup()) {
+			addItem.setEnabled(true);
+			addRule.setEnabled(true);
+			editItem.setEnabled(true);
+			editRule.setEnabled(true);
+			removeItem.setEnabled(true);
+			removeRule.setEnabled(true);
+			addGroupItem.setEnabled(true);
+			addGroup.setEnabled(true);
+			renameRule.setEnabled(true);
+			// Group is selected
+		} else if (((TreeItem) selection).isGroup()) {
+			addItem.setEnabled(true);
+			addRule.setEnabled(true);
+			editItem.setEnabled(false);
+			editRule.setEnabled(false);
+			removeItem.setEnabled(true);
+			removeRule.setEnabled(true);
+			addGroupItem.setEnabled(true);
+			addGroup.setEnabled(true);
+			renameRule.setEnabled(true);
+		}
+
+		// If root has children, enable clear button
+		if (root.getChildren().length > 0) {
+			clearItem.setEnabled(true);
+		} else {
+			clearItem.setEnabled(false);
+		}
+	}
+
+	/**
+	 * Gets progressBarDialog
+	 * 
+	 * @return progressBarDialog
+	 */
+	public ProgressBarDialog getProgressBar() {
+		return progressBarDialog;
+	}
+
+	/**
+	 * Sets something changed in this dialog
+	 * 
+	 * @param somethingChanged
+	 *            the somethingChanged to set
+	 */
+	public void setSomethingChanged(boolean somethingChanged) {
+		this.somethingChanged = somethingChanged;
+	}
+
+	/**
+	 * Returns parent group
+	 * 
+	 * @return parent group of the selected item
+	 */
+	private Object getParentGroup() {
+		// Get selected object
+		Object selection = ((IStructuredSelection) viewer.getSelection())
+				.getFirstElement();
+
+		// Get parent of the selected object
+		if (selection != null) {
+			selection = ((TreeItem) selection).getParent();
+		}
+		return selection;
+	}
+
+	/**
+	 * Returns selected group
+	 * 
+	 * @return selected group
+	 */
+	protected Object getSelectedGroup() {
+		// Get selected object
+		Object selection = ((IStructuredSelection) viewer.getSelection())
+				.getFirstElement();
+
+		// If selected item is not group, take parent of selected item
+		if (selection != null && !((TreeItem) selection).isGroup()) {
+			selection = ((TreeItem) selection).getParent();
+		}
+		return selection;
+	}
+
+	/**
+	 * Creates context menu
+	 */
+	private void createContextMenu() {
+		// Main menu
+		Menu menu = new Menu(composite);
+
+		// Add group item
+		addGroup = new MenuItem(menu, SWT.PUSH);
+		addGroup.setImage(groupAddImage);
+		addGroup
+				.setText(Messages.getString("BaseTreeDialog.GroupMenuItemText")); //$NON-NLS-1$
+
+		// Add rule item
+		addRule = new MenuItem(menu, SWT.PUSH);
+		addRule.setImage(itemAddImage);
+		addRule.setText(Messages.getString("BaseTreeDialog.AddRuleText")); //$NON-NLS-1$
+
+		// Edit rule item
+		editRule = new MenuItem(menu, SWT.PUSH);
+		editRule.setImage(itemEditImage);
+		editRule.setText(Messages.getString("BaseTreeDialog.EditRuleText")); //$NON-NLS-1$
+
+		// Remove rule item
+		removeRule = new MenuItem(menu, SWT.PUSH);
+		removeRule.setImage(itemRemoveImage);
+		removeRule.setText(Messages.getString("BaseTreeDialog.RemoveRuleText")); //$NON-NLS-1$
+
+		// Rename rule item
+		renameRule = new MenuItem(menu, SWT.PUSH);
+		renameRule.setText(Messages.getString("BaseTreeDialog.RenameRuleText")); //$NON-NLS-1$
+
+		// Set menu to tree
+		viewer.getTree().setMenu(menu);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseDialog#createActionListeners()
+	 */
+	@Override
+	public void createActionListeners() {
+
+		// Add selection listener to add group button
+		addGroupItem.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				TraceViewerGlobals.postUiEvent("AddGroupButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+				processAddGroupAction();
+				TraceViewerGlobals.postUiEvent("AddGroupButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+			}
+		});
+
+		// Add selection listener to add group menu item
+		addGroup.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				TraceViewerGlobals.postUiEvent("AddGroupMenuItem", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+				processAddGroupAction();
+				TraceViewerGlobals.postUiEvent("AddGroupMenuItem", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+			}
+		});
+
+		// Add selection listener to Add button
+		addItem.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				TraceViewerGlobals.postUiEvent("AddRuleButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+				processAddItemAction();
+				TraceViewerGlobals.postUiEvent("AddRuleButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+			}
+		});
+
+		// Add selection listener to Add menu item
+		addRule.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				TraceViewerGlobals.postUiEvent("AddRuleMenuItem", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+				processAddItemAction();
+				TraceViewerGlobals.postUiEvent("AddRuleMenuItem", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+			}
+		});
+
+		// Add selection listener to Edit button
+		editItem.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				TraceViewerGlobals.postUiEvent("EditRuleButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+				processEditItemAction();
+				TraceViewerGlobals.postUiEvent("EditRuleButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+			}
+		});
+
+		// Add selection listener to Edit menu item
+		editRule.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				TraceViewerGlobals.postUiEvent("EditRuleMenuItem", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+				processEditItemAction();
+				TraceViewerGlobals.postUiEvent("EditRuleMenuItem", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+			}
+		});
+
+		// Add selection listener to Remove button
+		removeItem.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				TraceViewerGlobals.postUiEvent("RemoveRuleButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+				processRemoveItemAction();
+				TraceViewerGlobals.postUiEvent("RemoveRuleButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+			}
+		});
+
+		// Add selection listener to Remove menu item
+		removeRule.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				TraceViewerGlobals.postUiEvent("RemoveRuleMenuItem", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+				processRemoveItemAction();
+				TraceViewerGlobals.postUiEvent("RemoveRuleMenuItem", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+			}
+		});
+
+		// Add selection listener to Clear button
+		clearItem.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				TraceViewerGlobals.postUiEvent("ClearRulesButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+				MessageBox messageBox = new MessageBox(getShell(),
+						SWT.ICON_QUESTION | SWT.YES | SWT.NO);
+				messageBox.setMessage(Messages
+						.getString("BaseTreeDialog.ClearAllConfirmation")); //$NON-NLS-1$
+				messageBox.setText(Messages
+						.getString("BaseTreeDialog.ClearAllDialogTitle")); //$NON-NLS-1$
+				int response = messageBox.open();
+				if (response == SWT.YES) {
+					// Clear all
+					Object[] children = root.getChildren();
+
+					for (int i = 0; i < children.length; i++) {
+						root.removeChild((TreeItem) children[i]);
+					}
+					viewer.setGrayChecked(root, false);
+					setButtonStates();
+					somethingChanged = true;
+				}
+				TraceViewerGlobals.postUiEvent("ClearRulesButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+			}
+		});
+
+		// Add selection listener to Tree
+		viewer.getTree().addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				TraceViewerGlobals.postUiEvent("TreeSelection", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+				setButtonStates();
+				TraceViewerGlobals.postUiEvent("TreeSelection", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+			}
+		});
+
+		// Add selection listener to Rename menu item
+		renameRule.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				TraceViewerGlobals.postUiEvent("RenameMenuItem", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+				Object selection = ((IStructuredSelection) viewer
+						.getSelection()).getFirstElement();
+
+				// If something is selected, show rename dialog
+				if (selection != null) {
+					TreeItem selected = (TreeItem) selection;
+					String dialogTitle = Messages
+							.getString("BaseTreeDialog.RenameDialogTitle"); //$NON-NLS-1$
+					String dialogText = Messages
+							.getString("BaseTreeDialog.RenameDialogText"); //$NON-NLS-1$
+					InputDialog dialog = new InputDialog(getShell(),
+							dialogTitle, dialogText, selected.getName(), null);
+					int ret = dialog.open();
+					if (ret == Window.OK) {
+						selected.setName(dialog.getValue());
+					}
+					viewer.refresh();
+				}
+				TraceViewerGlobals.postUiEvent("RenameMenuItem", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+			}
+		});
+
+	}
+
+	/**
+	 * Removes selected item from the tree
+	 */
+	protected void processRemoveItemAction() {
+		Object selection = ((IStructuredSelection) viewer.getSelection())
+				.getFirstElement();
+		if (selection != null && !selection.equals(treeRoot)
+				&& !selection.equals(root)) {
+
+			// Remove selection
+			Object parent = ((TreeItem) selection).getParent();
+			((TreeItem) parent).removeChild((TreeItem) selection);
+			checkboxStateListener.checkStateChanged((TreeItem) parent);
+
+			// Select parent from the deleted item
+			viewer.setSelection(new StructuredSelection(parent), true);
+			viewer.reveal(parent);
+		}
+
+		setButtonStates();
+		somethingChanged = true;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+	 */
+	@Override
+	protected void okPressed() {
+		processApplyButtonAction();
+		super.okPressed();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.dialogs.Dialog#cancelPressed()
+	 */
+	@Override
+	protected void cancelPressed() {
+		somethingChanged = false;
+		super.cancelPressed();
+	}
+
+	/**
+	 * Process Add action
+	 * 
+	 * @return new tree item or null if nothing was created
+	 */
+	protected TreeItem processAddItemAction() {
+		Object selection = getSelectedGroup();
+		BasePropertyDialog dialog = getPropertyDialog(selection, false);
+
+		// Open dialog
+		TreeItem item = dialog.openAndGetItem();
+		if (item != null) {
+			viewer.expandToLevel(item, 0);
+			viewer.setChecked(item, true);
+			checkboxStateListener.checkStateChanged(item);
+
+			setButtonStates();
+			somethingChanged = true;
+		}
+
+		return item;
+	}
+
+	/**
+	 * Process Edit action
+	 * 
+	 * @return modified tree item or null if item was not edited
+	 */
+	protected TreeItem processEditItemAction() {
+		TreeItem item = null;
+
+		// Get selected object
+		Object selection = ((IStructuredSelection) viewer.getSelection())
+				.getFirstElement();
+
+		if (selection != null) {
+			boolean wasChecked = viewer.getChecked(selection);
+			BasePropertyDialog dialog = getPropertyDialog(selection, true);
+			item = dialog.openAndGetItem();
+
+			if (item != null) {
+
+				// If selection was checked, check it again
+				if (wasChecked) {
+					viewer.setChecked(item, true);
+					checkboxStateListener.checkStateChanged(item);
+				}
+
+				viewer.setSelection(new StructuredSelection(item), true);
+				viewer.reveal(item);
+				setButtonStates();
+				somethingChanged = true;
+			}
+		}
+
+		return item;
+	}
+
+	/**
+	 * Process Add group action
+	 */
+	protected abstract void processAddGroupAction();
+
+	/**
+	 * Get property dialog for this dialog
+	 * 
+	 * @param selection
+	 *            selected object from the tree
+	 * @param editOldItem
+	 *            if true, edit old item
+	 * @return property dialog
+	 */
+	protected abstract BasePropertyDialog getPropertyDialog(Object selection,
+			boolean editOldItem);
+
+	/**
+	 * Process Apply button action
+	 */
+	protected abstract void processApplyButtonAction();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/ColorDialog.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,293 @@
+/*
+ * 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:
+ *
+ * Color dialog class
+ *
+ */
+package com.nokia.traceviewer.dialog;
+
+import java.util.List;
+
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.custom.StyleRange;
+import org.eclipse.swt.widgets.Shell;
+
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.dialog.treeitem.ColorTreeBaseItem;
+import com.nokia.traceviewer.dialog.treeitem.ColorTreeComponentItem;
+import com.nokia.traceviewer.dialog.treeitem.ColorTreeItem;
+import com.nokia.traceviewer.dialog.treeitem.ColorTreeTextItem;
+import com.nokia.traceviewer.dialog.treeitem.TreeItem;
+import com.nokia.traceviewer.dialog.treeitem.TreeItemContentProvider;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.preferences.PreferenceConstants;
+import com.nokia.traceviewer.engine.preferences.XMLColorConfigurationExporter;
+
+/**
+ * Color dialog class
+ */
+public final class ColorDialog extends BaseTreeDialog {
+
+	/**
+	 * Add item image
+	 */
+	private static final String itemAddImageLocation = "/icons/coloradd.gif"; //$NON-NLS-1$
+
+	/**
+	 * Edit item image
+	 */
+	private static final String itemEditImageLocation = "/icons/coloredit.gif"; //$NON-NLS-1$
+
+	/**
+	 * Remove item image
+	 */
+	private static final String itemRemoveImageLocation = "/icons/colorremove.gif"; //$NON-NLS-1$
+
+	/**
+	 * Dialog name
+	 */
+	private final String dialogName = Messages
+			.getString("ColorDialog.DialogName"); //$NON-NLS-1$
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parent
+	 *            parent shell
+	 * @param contentProvider
+	 *            content provider
+	 * @param treeRoot
+	 *            root tree item for the dialog
+	 */
+	public ColorDialog(Shell parent, TreeItemContentProvider contentProvider,
+			TreeItem treeRoot) {
+		super(parent, contentProvider, treeRoot);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseTreeDialog#export()
+	 */
+	@Override
+	public void export() {
+		// Export rules to XML file
+		XMLColorConfigurationExporter exporter;
+
+		// Default configuration file
+		if (!TraceViewerPlugin.getDefault().getPreferenceStore().getString(
+				PreferenceConstants.CONFIGURATION_FILE).equals(
+				PreferenceConstants.DEFAULT_CONFIGURATION_FILE)) {
+			exporter = new XMLColorConfigurationExporter(root,
+					TraceViewerPlugin.getDefault().getPreferenceStore()
+							.getString(PreferenceConstants.CONFIGURATION_FILE),
+					false);
+		} else {
+			exporter = new XMLColorConfigurationExporter(root,
+					PreferenceConstants.DEFAULT_CONFIGURATION_FILE, true);
+		}
+
+		exporter.export();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseTreeDialog#saveSettings()
+	 */
+	@Override
+	public void saveSettings() {
+		// Save the old location
+		super.saveSettings();
+
+		// Save rules if something changed
+		if (somethingChanged) {
+			Object[] arr = viewer.getCheckedElements();
+
+			// Get rule arrays
+			List<ColorTreeTextItem> textRules = TraceViewerGlobals
+					.getTraceViewer().getDataProcessorAccess().getColorer()
+					.getTextRules();
+			List<ColorTreeComponentItem> componentRules = TraceViewerGlobals
+					.getTraceViewer().getDataProcessorAccess().getColorer()
+					.getComponentRules();
+
+			// Clear old rules
+			textRules.clear();
+			componentRules.clear();
+
+			// Insert new rules
+			for (int i = 0; i < arr.length; i++) {
+				// Text rule
+				if (((ColorTreeItem) arr[i]).getRule() == ColorTreeItem.Rule.TEXT_RULE) {
+					textRules.add(((ColorTreeTextItem) arr[i]));
+					// Component rule
+				} else if (((ColorTreeItem) arr[i]).getRule() == ColorTreeItem.Rule.COMPONENT_RULE) {
+					componentRules.add(((ColorTreeComponentItem) arr[i]));
+				}
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseTreeDialog#restoreSettings()
+	 */
+	@Override
+	protected void restoreSettings() {
+		super.restoreSettings();
+		// Get rule arrays
+		List<ColorTreeTextItem> textRules = TraceViewerGlobals.getTraceViewer()
+				.getDataProcessorAccess().getColorer().getTextRules();
+		List<ColorTreeComponentItem> componentRules = TraceViewerGlobals
+				.getTraceViewer().getDataProcessorAccess().getColorer()
+				.getComponentRules();
+
+		// Tree has to be re-checked
+		for (int i = 0; i < textRules.size(); i++) {
+			ColorTreeTextItem item = textRules.get(i);
+			viewer.setChecked(item, true);
+			checkboxStateListener.checkStateChanged(item);
+		}
+		for (int i = 0; i < componentRules.size(); i++) {
+			ColorTreeComponentItem item = componentRules.get(i);
+			viewer.setChecked(item, true);
+			checkboxStateListener.checkStateChanged(item);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseDialog#createDialogContents()
+	 */
+	@Override
+	protected void createDialogContents() {
+		super.createDialogContents(dialogName);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseTreeDialog#createToolBar()
+	 */
+	@Override
+	public void createToolBar() {
+		super.createToolBar(itemAddImageLocation, itemEditImageLocation,
+				itemRemoveImageLocation);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseTreeDialog#processAddGroupAction()
+	 */
+	@Override
+	protected void processAddGroupAction() {
+		String name = Messages.getString("ColorDialog.NewGroupName"); //$NON-NLS-1$
+		InputDialog dialog = new InputDialog(getShell(), name, Messages
+				.getString("ColorDialog.NewGroupInputText"), name, null); //$NON-NLS-1$
+		int ret = dialog.open();
+		if (ret == Window.OK) {
+			name = dialog.getValue();
+
+			// Get parent node
+			Object selection = getSelectedGroup();
+			ColorTreeBaseItem item = new ColorTreeBaseItem(contentProvider,
+					selection, name, ColorTreeItem.Rule.GROUP, null, null);
+			((TreeItem) selection).addChild(item);
+			viewer.expandToLevel(item, 0);
+
+			somethingChanged = true;
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.dialog.BaseTreeDialog#processApplyButtonAction()
+	 */
+	@Override
+	protected void processApplyButtonAction() {
+		saveSettings();
+
+		if (somethingChanged) {
+			// Clear all old rules
+			TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+					.getColorer().clearRanges();
+			TraceViewerGlobals.getTraceViewer().getView().applyColorRules(
+					TraceViewerGlobals.getTraceViewer()
+							.getDataProcessorAccess().getColorer().getRanges()
+							.toArray(new StyleRange[0]));
+
+			// Create new rules
+			TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+					.getColorer().createColorRules();
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.dialog.BaseTreeDialog#processRemoveItemAction()
+	 */
+	@Override
+	protected void processRemoveItemAction() {
+		Object selection = ((IStructuredSelection) viewer.getSelection())
+				.getFirstElement();
+		if (selection != null && selection != treeRoot && selection != root) {
+			// Remove selection
+			Object parent = ((ColorTreeItem) selection).getParent();
+			((ColorTreeItem) parent).removeChild((ColorTreeItem) selection);
+			checkboxStateListener.checkStateChanged((ColorTreeItem) parent);
+
+			// Dispose colors
+			((ColorTreeItem) selection).getForegroundColor().dispose();
+			((ColorTreeItem) selection).getBackgroundColor().dispose();
+
+			// Select parent from the deleted item
+			viewer.setSelection(new StructuredSelection(parent), true);
+			viewer.reveal(parent);
+
+			somethingChanged = true;
+		}
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.dialog.BaseTreeDialog#getPropertyDialog(java.lang
+	 * .Object, boolean)
+	 */
+	@Override
+	protected BasePropertyDialog getPropertyDialog(Object selection,
+			boolean editOldItem) {
+		ColorTreeItem oldItem = null;
+		if (editOldItem) {
+			oldItem = (ColorTreeItem) selection;
+		}
+		ColorPropertyDialog dialog = new ColorPropertyDialog(getShell(),
+				oldItem, contentProvider, selection);
+		return dialog;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/ColorPropertyDialog.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,614 @@
+/*
+ * 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:
+ *
+ * Color Property Dialog class
+ *
+ */
+package com.nokia.traceviewer.dialog;
+
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.RGB;
+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.Shell;
+import org.eclipse.swt.widgets.Text;
+
+import com.nokia.traceviewer.dialog.treeitem.ColorTreeComponentItem;
+import com.nokia.traceviewer.dialog.treeitem.ColorTreeItem;
+import com.nokia.traceviewer.dialog.treeitem.ColorTreeTextItem;
+import com.nokia.traceviewer.dialog.treeitem.TreeItemListener;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.activation.TraceActivationComponentItem;
+import com.nokia.traceviewer.engine.activation.TraceActivationGroupItem;
+
+/**
+ * Color Property Dialog class
+ * 
+ */
+public class ColorPropertyDialog extends BasePropertyDialog {
+
+	/**
+	 * Text to show when Text rule is selected
+	 */
+	private static final String TEXT_RULE_INFORMATION_TEXT = Messages
+			.getString("ColorPropertyDialog.TextRuleInfo"); //$NON-NLS-1$
+
+	/**
+	 * Text to show when Component rule is selected
+	 */
+	private static final String COMPONENT_RULE_INFORMATION_TEXT = Messages
+			.getString("ColorPropertyDialog.ComponentRuleInfo1") //$NON-NLS-1$
+			+ " " //$NON-NLS-1$
+			+ WILDCARD_STRING + " " //$NON-NLS-1$
+			+ Messages.getString("ColorPropertyDialog.ComponentRuleInfo2"); //$NON-NLS-1$
+
+	/**
+	 * Old item used when editing
+	 */
+	protected ColorTreeItem oldItem;
+
+	/**
+	 * Selected item in tree
+	 */
+	private final ColorTreeItem selectedItem;
+
+	/**
+	 * UI Label for foreground color
+	 */
+	private Label foregroundColorShowLabel;
+
+	/**
+	 * UI Label for background color
+	 */
+	private Label backGroundColorShowLabel;
+
+	/**
+	 * Button to change foreground color
+	 */
+	private Button foreGroundColorButton;
+
+	/**
+	 * Button to change background color
+	 */
+	private Button backGroundColorButton;
+
+	/**
+	 * Foreground color
+	 */
+	private Color foregroundColor;
+
+	/**
+	 * Background color
+	 */
+	private Color backgroundColor;
+
+	/**
+	 * TreeItem listener
+	 */
+	private final TreeItemListener listener;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parent
+	 *            Parent shell
+	 * @param newItem
+	 *            TreeItem to modify, null if creating new one
+	 * @param listener
+	 *            TreeItem listener
+	 * @param selected
+	 *            selected item in tree
+	 */
+	public ColorPropertyDialog(Shell parent, ColorTreeItem newItem,
+			TreeItemListener listener, Object selected) {
+		super(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
+		this.newItem = newItem;
+		this.selectedItem = (ColorTreeItem) selected;
+		this.listener = listener;
+
+		// If edit, save the old item to insert info to fields
+		if (newItem != null) {
+			oldItem = newItem;
+			textFieldTouched = true;
+			nameFieldTouched = true;
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseDialog#createDialogContents()
+	 */
+	@Override
+	protected void createDialogContents() {
+		getShell().setText(
+				Messages.getString("ColorPropertyDialog.ColorDefinition")); //$NON-NLS-1$
+		createMainComposite();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.dialog.BasePropertyDialog#createMainComposite()
+	 */
+	@Override
+	protected void createMainComposite() {
+		// Main composite
+		GridLayout mainCompositeGridLayout = new GridLayout();
+		mainCompositeGridLayout.horizontalSpacing = 4;
+		mainCompositeGridLayout.verticalSpacing = 4;
+		mainCompositeGridLayout.marginWidth = 0;
+		mainCompositeGridLayout.marginHeight = 0;
+		mainCompositeGridLayout.numColumns = 2;
+		GridData mainCompositeGridData = new GridData();
+		mainComposite = new Composite(composite, SWT.NONE);
+		mainComposite.setLayoutData(mainCompositeGridData);
+		mainComposite.setLayout(mainCompositeGridLayout);
+		createUpperComposite();
+		createLeftUnderComposite();
+		createRightUnderComposite();
+		createRightReallyUnderComposite();
+
+		nameText.setFocus();
+	}
+
+	/**
+	 * This method initializes upperComposite
+	 * 
+	 */
+	private void createUpperComposite() {
+		// Upper composite
+		GridLayout upperCompositeGridLayout = new GridLayout();
+		upperCompositeGridLayout.numColumns = 7;
+		GridData upperCompositeGridData = new GridData();
+		upperCompositeGridData.horizontalSpan = 2;
+		upperCompositeGridData.grabExcessHorizontalSpace = true;
+		upperCompositeGridData.horizontalAlignment = SWT.FILL;
+		upperComposite = new Composite(mainComposite, SWT.NONE);
+		upperComposite.setLayout(upperCompositeGridLayout);
+		upperComposite.setLayoutData(upperCompositeGridData);
+
+		// Name label
+		GridData nameLabelGridData = new GridData();
+		nameLabelGridData.horizontalIndent = 5;
+		nameLabel = new Label(upperComposite, SWT.NONE);
+		nameLabel.setText(Messages
+				.getString("ColorPropertyDialog.ColorCodingName")); //$NON-NLS-1$
+		nameLabel.setLayoutData(nameLabelGridData);
+
+		// Name text field
+		GridData nameTextGridData = new GridData();
+		nameTextGridData.grabExcessHorizontalSpace = true;
+		nameTextGridData.horizontalAlignment = SWT.FILL;
+		nameTextGridData.horizontalIndent = 10;
+		nameTextGridData.horizontalSpan = 6;
+		nameTextGridData.verticalAlignment = GridData.CENTER;
+		nameTextGridData.widthHint = 230;
+		nameText = new Text(upperComposite, SWT.BORDER);
+		nameText.setLayoutData(nameTextGridData);
+		nameText.setToolTipText(Messages
+				.getString("ColorPropertyDialog.NameFieldToolTip")); //$NON-NLS-1$
+
+		// Rule label
+		GridData ruleLabelGridData = new GridData();
+		ruleLabelGridData.horizontalIndent = 5;
+		ruleLabel = new Label(upperComposite, SWT.NONE);
+		ruleLabel.setText(Messages
+				.getString("ColorPropertyDialog.SelectedRule")); //$NON-NLS-1$
+		ruleLabel.setLayoutData(ruleLabelGridData);
+
+		// Selected rule label
+		GridData selectedRuleLabelGridData = new GridData();
+		selectedRuleLabelGridData.widthHint = 150;
+		selectedRuleLabelGridData.horizontalIndent = 10;
+		selectedRuleLabelGridData.horizontalSpan = 6;
+		selectedRuleLabelGridData.grabExcessHorizontalSpace = true;
+		selectedRuleLabelGridData.horizontalAlignment = SWT.FILL;
+		selectedRuleLabel = new Label(upperComposite, SWT.NONE);
+		selectedRuleLabel.setLayoutData(selectedRuleLabelGridData);
+		selectedRuleLabel.setToolTipText(Messages
+				.getString("ColorPropertyDialog.RuleLabelToolTip")); //$NON-NLS-1$
+
+		// Fore color label
+		GridData foreColorLabelGridData = new GridData();
+		foreColorLabelGridData.horizontalIndent = 5;
+		Label foreColorLabel = new Label(upperComposite, SWT.NONE);
+		foreColorLabel.setText(Messages
+				.getString("ColorPropertyDialog.ForegroundColor")); //$NON-NLS-1$
+		foreColorLabel.setLayoutData(foreColorLabelGridData);
+
+		// Foreground color show label
+		GridData foregroundColorShowLabelGridData = new GridData();
+		foregroundColorShowLabelGridData.heightHint = 19;
+		foregroundColorShowLabelGridData.horizontalIndent = 10;
+		foregroundColorShowLabelGridData.widthHint = 33;
+		foregroundColorShowLabel = new Label(upperComposite, SWT.BORDER);
+		foregroundColorShowLabel.setText(""); //$NON-NLS-1$
+		foregroundColorShowLabel
+				.setLayoutData(foregroundColorShowLabelGridData);
+
+		// Foreground color button
+		GridData foreGroundColorButtonGridData = new GridData();
+		foreGroundColorButtonGridData.heightHint = 25;
+		foreGroundColorButtonGridData.widthHint = 28;
+		foreGroundColorButton = new Button(upperComposite, SWT.NONE);
+		foreGroundColorButton.setText("..."); //$NON-NLS-1$
+		foreGroundColorButton.setLayoutData(foreGroundColorButtonGridData);
+
+		// Background label
+		GridData backGroundLabelGridData = new GridData();
+		backGroundLabelGridData.horizontalIndent = 10;
+		Label backGroundLabel = new Label(upperComposite, SWT.NONE);
+		backGroundLabel.setText(Messages
+				.getString("ColorPropertyDialog.BackgroundColor")); //$NON-NLS-1$
+		backGroundLabel.setLayoutData(backGroundLabelGridData);
+
+		// Background color show label
+		GridData backGroundColorShowLabelGridData = new GridData();
+		backGroundColorShowLabelGridData.heightHint = 19;
+		backGroundColorShowLabelGridData.widthHint = 33;
+		backGroundColorShowLabel = new Label(upperComposite, SWT.BORDER);
+		backGroundColorShowLabel.setText(""); //$NON-NLS-1$
+		backGroundColorShowLabel
+				.setLayoutData(backGroundColorShowLabelGridData);
+
+		// Background color button
+		GridData backGroundColorButtonGridData = new GridData();
+		backGroundColorButtonGridData.heightHint = 25;
+		backGroundColorButtonGridData.widthHint = 28;
+		backGroundColorButton = new Button(upperComposite, SWT.NONE);
+		backGroundColorButton.setText("..."); //$NON-NLS-1$
+		backGroundColorButton.setLayoutData(backGroundColorButtonGridData);
+
+		// Spacer labels
+		new Label(upperComposite, SWT.NONE);
+		new Label(upperComposite, SWT.NONE);
+
+		// Insert data to fields
+		insertDataToUpperComposite();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.dialog.BasePropertyDialog#insertDataToUpperComposite
+	 * ()
+	 */
+	@Override
+	protected void insertDataToUpperComposite() {
+		// Set data from old item
+		if (oldItem != null) {
+			nameText.setText(oldItem.getName());
+
+			// Set colors from old item
+			foregroundColorShowLabel
+					.setBackground(oldItem.getForegroundColor());
+			backGroundColorShowLabel
+					.setBackground(oldItem.getBackgroundColor());
+
+			// Set selected rule label value
+			if (oldItem.getRule() == ColorTreeItem.Rule.TEXT_RULE) {
+				selectedRuleLabel.setText(TEXT_RULE_NAME);
+			} else if (oldItem.getRule() == ColorTreeItem.Rule.COMPONENT_RULE) {
+				selectedRuleLabel.setText(COMPONENT_RULE_NAME);
+			}
+			// Old item doesn't exist, insert defaults
+		} else {
+			selectedRuleLabel.setText(TEXT_RULE_NAME);
+			foregroundColorShowLabel.setBackground(getShell().getDisplay()
+					.getSystemColor(SWT.COLOR_BLUE));
+			backGroundColorShowLabel.setBackground(getShell().getDisplay()
+					.getSystemColor(SWT.COLOR_WHITE));
+		}
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BasePropertyDialog#setListSelection()
+	 */
+	@Override
+	protected void setListSelection() {
+		ruleList.add(TEXT_RULE_NAME, TEXT_RULE_INDEX);
+		ruleList.add(COMPONENT_RULE_NAME, COMPONENT_RULE_INDEX);
+		// Set list selection
+		if (oldItem != null) {
+			if (oldItem.getRule() == ColorTreeItem.Rule.TEXT_RULE) {
+				ruleList.setSelection(TEXT_RULE_INDEX);
+			} else if (oldItem.getRule() == ColorTreeItem.Rule.COMPONENT_RULE) {
+				ruleList.setSelection(COMPONENT_RULE_INDEX);
+			}
+		} else {
+			ruleList.setSelection(TEXT_RULE_INDEX);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.dialog.BasePropertyDialog#insertDataToTextFields()
+	 */
+	@Override
+	protected void insertDataToTextFields() {
+		if (oldItem instanceof ColorTreeTextItem) {
+			ColorTreeTextItem item = (ColorTreeTextItem) oldItem;
+			if (item.getText() != null) {
+				textText.setText(item.getText());
+			}
+			matchCaseCheckBox.setSelection(item.isMatchCase());
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.dialog.BasePropertyDialog#insertDataToComponentFields
+	 * ()
+	 */
+	@Override
+	protected void insertDataToComponentFields() {
+		// Get component list
+		List<TraceActivationComponentItem> components = null;
+		if (TraceViewerGlobals.getDecodeProvider() != null) {
+			components = TraceViewerGlobals.getDecodeProvider()
+					.getActivationInformation(false);
+		}
+
+		// Insert data to fields
+		if (oldItem instanceof ColorTreeComponentItem) {
+			ColorTreeComponentItem item = (ColorTreeComponentItem) oldItem;
+			if (item.getComponentId() == WILDCARD_INTEGER) {
+				componentTextField.setText(WILDCARD_STRING);
+			} else {
+				componentTextField.setText(HEX_PREFIX
+						+ Integer.toHexString(item.getComponentId()));
+			}
+			if (item.getGroupId() == WILDCARD_INTEGER) {
+				groupTextField.setText(WILDCARD_STRING);
+			} else {
+				groupTextField.setText(HEX_PREFIX
+						+ Integer.toHexString(item.getGroupId()));
+			}
+
+			// Loop through components
+			if (components != null) {
+				for (int i = 0; i < components.size(); i++) {
+					if (components.get(i).getId() == item.getComponentId()) {
+						componentNameLabel.setText(components.get(i).getName());
+						// Get groups
+						List<TraceActivationGroupItem> groups = components.get(
+								i).getGroups();
+						// Loop through groups
+						for (int j = 0; j < groups.size(); j++) {
+							if (groups.get(j).getId() == item.getGroupId()) {
+								groupNameLabel.setText(groups.get(j).getName());
+								break;
+							}
+						}
+						break;
+					}
+				}
+			}
+		}
+
+		// Disable change component / group buttons if no components are
+		// available
+		if (components == null || components.size() <= 0) {
+			changeComponentButton.setEnabled(false);
+			changeGroupButton.setEnabled(false);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+	 */
+	@Override
+	protected void okPressed() {
+		TraceViewerGlobals.postUiEvent("OkButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+		// Save the position of this item to set it back after creation
+		// and remove the old child
+		int pos = 0;
+		ColorTreeItem parent = selectedItem;
+		if (oldItem != null) {
+			pos = getOldPosition();
+			parent = (ColorTreeItem) oldItem.getParent();
+			parent.removeChild(oldItem);
+		}
+
+		// Create new ColorTreeTextItem
+		if (ruleList.getSelectionIndex() == TEXT_RULE_INDEX) {
+			newItem = new ColorTreeTextItem(listener, parent, nameText
+					.getText(), ColorTreeItem.Rule.TEXT_RULE,
+					foregroundColorShowLabel.getBackground(),
+					backGroundColorShowLabel.getBackground(), textText
+							.getText(), matchCaseCheckBox.getSelection());
+
+			// Create new ColorTreeComponentItem
+		} else if (ruleList.getSelectionIndex() == COMPONENT_RULE_INDEX) {
+			int componentId = WILDCARD_INTEGER;
+			int groupId = WILDCARD_INTEGER;
+
+			// Get component ID
+			try {
+				String cid = componentTextField.getText();
+				if (cid.substring(0, HEX_PREFIX.length()).equals(HEX_PREFIX)) {
+					cid = cid.substring(HEX_PREFIX.length());
+				}
+				componentId = Integer.parseInt(cid, HEX_RADIX);
+			} catch (Exception e) {
+			}
+
+			// Get group ID
+			try {
+				String gid = groupTextField.getText();
+				if (gid.substring(0, HEX_PREFIX.length()).equals(HEX_PREFIX)) {
+					gid = gid.substring(HEX_PREFIX.length());
+				}
+				groupId = Integer.parseInt(gid, HEX_RADIX);
+			} catch (Exception e) {
+			}
+
+			// Create new item
+			newItem = new ColorTreeComponentItem(listener, parent, nameText
+					.getText(), ColorTreeItem.Rule.COMPONENT_RULE,
+					foregroundColorShowLabel.getBackground(),
+					backGroundColorShowLabel.getBackground(), componentId,
+					groupId);
+		} else {
+			// No other rules defined yet
+		}
+
+		// Add mode
+		if (parent.equals(selectedItem)) {
+			parent.addChild(newItem);
+
+			// Edit mode
+		} else {
+			parent.addChild(pos, newItem);
+		}
+
+		super.okPressed();
+		TraceViewerGlobals.postUiEvent("OkButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.dialog.BasePropertyDialog#createActionListeners()
+	 */
+	@Override
+	protected void createActionListeners() {
+		super.createActionListeners();
+
+		// Add selection listener to foreground color selection button
+		foreGroundColorButton.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				TraceViewerGlobals.postUiEvent("ChangeForegroundColorButton", //$NON-NLS-1$
+						"1"); //$NON-NLS-1$
+
+				// Create the color-change dialog
+				org.eclipse.swt.widgets.ColorDialog dlg = new org.eclipse.swt.widgets.ColorDialog(
+						getShell());
+				dlg.setRGB(foregroundColorShowLabel.getBackground().getRGB());
+
+				// Change the title bar text
+				String chooseForeColor = Messages
+						.getString("ColorPropertyDialog.ChooseForegroundColor"); //$NON-NLS-1$
+				dlg.setText(chooseForeColor);
+
+				// Open the dialog and retrieve the selected color
+				RGB rgb = dlg.open();
+				if (rgb != null) {
+					// Dispose the old color, create the
+					// new one, and set into the label
+
+					if (foregroundColor != null) {
+						foregroundColor.dispose();
+					}
+					foregroundColor = new Color(getShell().getDisplay(), rgb);
+					foregroundColorShowLabel.setBackground(foregroundColor);
+				}
+				TraceViewerGlobals.postUiEvent("ChangeForegroundColorButton", //$NON-NLS-1$
+						"0"); //$NON-NLS-1$
+			}
+		});
+
+		// Add selection listener to background color selection button
+		backGroundColorButton.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				TraceViewerGlobals.postUiEvent("ChangeBackgroundColorButton", //$NON-NLS-1$
+						"1"); //$NON-NLS-1$
+				// Create the color-change dialog
+				org.eclipse.swt.widgets.ColorDialog dlg = new org.eclipse.swt.widgets.ColorDialog(
+						getShell());
+				dlg.setRGB(foregroundColorShowLabel.getBackground().getRGB());
+
+				// Change the title bar text
+				String chooseBackColor = Messages
+						.getString("ColorPropertyDialog.ChooseBackgroundColor"); //$NON-NLS-1$
+				dlg.setText(chooseBackColor);
+
+				// Open the dialog and retrieve the selected color
+				RGB rgb = dlg.open();
+				if (rgb != null) {
+					// Dispose the old color, create the
+					// new one, and set into the label
+
+					if (backgroundColor != null) {
+						backgroundColor.dispose();
+					}
+					backgroundColor = new Color(getShell().getDisplay(), rgb);
+					backGroundColorShowLabel.setBackground(backgroundColor);
+				}
+				TraceViewerGlobals.postUiEvent("ChangeBackgroundColorButton", //$NON-NLS-1$
+						"0"); //$NON-NLS-1$
+			}
+		});
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.dialog.BasePropertyDialog#setInformationLabel()
+	 */
+	@Override
+	protected void setInformationLabel() {
+		if (ruleList.getSelectionIndex() == TEXT_RULE_INDEX) {
+			informationLabel.setText(TEXT_RULE_INFORMATION_TEXT);
+			selectedRuleLabel.setText(TEXT_RULE_NAME);
+		} else if (ruleList.getSelectionIndex() == COMPONENT_RULE_INDEX) {
+			informationLabel.setText(COMPONENT_RULE_INFORMATION_TEXT);
+			selectedRuleLabel.setText(COMPONENT_RULE_NAME);
+		}
+	}
+
+	/**
+	 * Gets old position of this item
+	 * 
+	 * @return old position
+	 */
+	protected int getOldPosition() {
+		ColorTreeItem item = (ColorTreeItem) oldItem.getParent();
+		Object[] children = item.getChildren();
+		int pos = 0;
+		for (int i = 0; i < children.length; i++) {
+			if (children[i].equals(oldItem)) {
+				pos = i;
+				break;
+			}
+		}
+		return pos;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/ComponentSelectionDialog.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,325 @@
+/*
+ * 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:
+ *
+ * Component / Group selection dialog
+ *
+ */
+package com.nokia.traceviewer.dialog;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.activation.TraceActivationComponentItem;
+import com.nokia.traceviewer.engine.activation.TraceActivationGroupItem;
+
+/**
+ * Component / Group selection dialog
+ * 
+ */
+public final class ComponentSelectionDialog extends BaseDialog {
+
+	/**
+	 * Hex prefix
+	 */
+	private static final String HEX_PREFIX = "0x"; //$NON-NLS-1$
+
+	/**
+	 * Group column text
+	 */
+	private static final String GROUP_COLUMN_TEXT = Messages
+			.getString("ComponentSelectionDialog.GroupColumnText"); //$NON-NLS-1$
+
+	/**
+	 * Component column text
+	 */
+	private static final String COMPONENT_COLUMN_TEXT = Messages
+			.getString("ComponentSelectionDialog.ComponentColumnText"); //$NON-NLS-1$
+
+	/**
+	 * Group shell text
+	 */
+	private static final String GROUP_SHELL_TEXT = Messages
+			.getString("ComponentSelectionDialog.GroupShellText"); //$NON-NLS-1$
+
+	/**
+	 * Component shell text
+	 */
+	private static final String COMPONENT_SHELL_TEXT = Messages
+			.getString("ComponentSelectionDialog.ComponentShellText"); //$NON-NLS-1$
+
+	/**
+	 * Table where components / groups are shown
+	 */
+	private Table table;
+
+	/**
+	 * Name column for table
+	 */
+	private TableColumn nameColumn;
+
+	/**
+	 * ID column for table
+	 */
+	private TableColumn idColumn;
+
+	/**
+	 * Indicates that should dialog show components or groups
+	 */
+	private boolean isShowingComponents = true;
+
+	/**
+	 * If dialog is showing groups, show them from this component ID
+	 */
+	private int componentId;
+
+	/**
+	 * Selected item ID that can be asked after dialog is closed
+	 */
+	private String selectedItemId;
+
+	/**
+	 * Selected item name that can be asked after dialog is closed
+	 */
+	private String selectedItemName;
+
+	/**
+	 * Constructor
+	 */
+	public ComponentSelectionDialog() {
+		// Pass the default styles here
+		super(PlatformUI.getWorkbench().getDisplay().getActiveShell(),
+				SWT.DIALOG_TRIM | SWT.RESIZE | SWT.SYSTEM_MODAL);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseDialog#createDialogContents()
+	 */
+	@Override
+	protected void createDialogContents() {
+
+		// Shell
+		GridLayout shellGridLayout = new GridLayout();
+		shellGridLayout.numColumns = 3;
+		if (isShowingComponents) {
+			getShell().setText(COMPONENT_SHELL_TEXT);
+		} else {
+			getShell().setText(GROUP_SHELL_TEXT);
+		}
+		composite.setLayout(shellGridLayout);
+
+		// Table
+		GridData listGridData = new GridData();
+		listGridData.horizontalAlignment = GridData.FILL;
+		listGridData.grabExcessHorizontalSpace = true;
+		listGridData.grabExcessVerticalSpace = true;
+		listGridData.horizontalSpan = 3;
+		listGridData.verticalAlignment = GridData.FILL;
+		listGridData.heightHint = 400;
+		listGridData.widthHint = 300;
+		table = new Table(composite, SWT.BORDER | SWT.FULL_SELECTION);
+		table.setHeaderVisible(true);
+		table.setLayoutData(listGridData);
+
+		// Table columns
+		nameColumn = new TableColumn(table, SWT.NONE);
+		if (isShowingComponents) {
+			nameColumn.setText(COMPONENT_COLUMN_TEXT);
+		} else {
+			nameColumn.setText(GROUP_COLUMN_TEXT);
+		}
+		idColumn = new TableColumn(table, SWT.NONE);
+		idColumn.setText("ID"); //$NON-NLS-1$
+
+		// Spacer
+		GridData spacerGridData = new GridData();
+		spacerGridData.horizontalAlignment = GridData.BEGINNING;
+		spacerGridData.grabExcessHorizontalSpace = true;
+		spacerGridData.verticalAlignment = GridData.CENTER;
+		Label spacerLabel = new Label(composite, SWT.NONE);
+		spacerLabel.setText(""); //$NON-NLS-1$
+		spacerLabel.setLayoutData(spacerGridData);
+
+		// Fill table
+		if (TraceViewerGlobals.getDecodeProvider() != null) {
+			fillTable();
+		}
+	}
+
+	/**
+	 * Fills table from decode provider
+	 */
+	private void fillTable() {
+		List<TraceActivationComponentItem> components = TraceViewerGlobals
+				.getDecodeProvider().getActivationInformation(false);
+		// Show components
+		if (isShowingComponents) {
+			for (int i = 0; i < components.size(); i++) {
+				TableItem item = new TableItem(table, SWT.NONE);
+				String id = HEX_PREFIX
+						+ Integer.toHexString(components.get(i).getId());
+				item.setText(new String[] { components.get(i).getName(), id });
+			}
+
+			// Show groups
+		} else {
+			// Component is defined, show groups from that component only
+			if (componentId != NOT_DEFINED) {
+				TraceActivationComponentItem component = null;
+
+				// Find the right component
+				for (int i = 0; i < components.size(); i++) {
+					if (components.get(i).getId() == componentId) {
+						component = components.get(i);
+						break;
+					}
+				}
+
+				if (component != null) {
+
+					// Print the groups from the component
+					for (int i = 0; i < component.getGroups().size(); i++) {
+						TraceActivationGroupItem group = component.getGroups()
+								.get(i);
+						TableItem item = new TableItem(table, SWT.NONE);
+						String id = HEX_PREFIX
+								+ Integer.toHexString(group.getId());
+						item.setText(new String[] { group.getName(), id });
+					}
+				}
+
+				// Component is not defined, show all groups
+			} else {
+				// Put all groups to one arraylist
+				ArrayList<TraceActivationGroupItem> allGroups = new ArrayList<TraceActivationGroupItem>();
+
+				// Loop through components
+				for (int i = 0; i < components.size(); i++) {
+					allGroups.addAll(components.get(i).getGroups());
+				}
+				// Create listitems from the list
+				for (int i = 0; i < allGroups.size(); i++) {
+					TableItem item = new TableItem(table, SWT.NONE);
+					String id = HEX_PREFIX
+							+ Integer.toHexString(allGroups.get(i).getId());
+					item
+							.setText(new String[] { allGroups.get(i).getName(),
+									id });
+				}
+			}
+		}
+
+		nameColumn.pack();
+		idColumn.pack();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+	 */
+	@Override
+	protected void okPressed() {
+		TableItem[] selection = table.getSelection();
+		if (selection.length > 0) {
+			try {
+				// Get the ID
+				selectedItemId = selection[0].getText(1);
+			} catch (NumberFormatException e) {
+				selectedItemId = ""; //$NON-NLS-1$
+			}
+			// Get the name
+			selectedItemName = selection[0].getText(0);
+		} else {
+			selectedItemId = ""; //$NON-NLS-1$
+			selectedItemName = ""; //$NON-NLS-1$
+		}
+		super.okPressed();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.dialogs.Dialog#cancelPressed()
+	 */
+	@Override
+	protected void cancelPressed() {
+		selectedItemId = ""; //$NON-NLS-1$
+		selectedItemName = ""; //$NON-NLS-1$
+		super.cancelPressed();
+	}
+
+	/**
+	 * Gets the selected item ID as a hex String
+	 * 
+	 * @return the selectedItemId
+	 */
+	public String getSelectedItemId() {
+		return selectedItemId;
+	}
+
+	/**
+	 * Gets selected item name
+	 * 
+	 * @return the selectedItemName
+	 */
+	public String getSelectedItemName() {
+		return selectedItemName;
+	}
+
+	/**
+	 * Sets dialog to show either components or groups
+	 * 
+	 * @param showComponents
+	 *            if true, dialog shows components
+	 * @param componentId
+	 *            if showing groups, show them only from this component
+	 */
+	public void setDialogToShowComponents(boolean showComponents,
+			int componentId) {
+		// Remove old items
+		if (table != null && !table.isDisposed()) {
+			table.removeAll();
+		}
+		isShowingComponents = showComponents;
+		if (!showComponents) {
+			this.componentId = componentId;
+		} else {
+			this.componentId = NOT_DEFINED;
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseDialog#createActionListeners()
+	 */
+	@Override
+	protected void createActionListeners() {
+		// No need for action listeners in this dialog
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/FilterAdvancedDialog.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,1063 @@
+/*
+ * 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:
+ *
+ * Advanced filter dialog
+ *
+ */
+package com.nokia.traceviewer.dialog;
+
+import java.net.URL;
+
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+import org.eclipse.swt.widgets.Tree;
+
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.dialog.treeitem.FilterTreeBaseItem;
+import com.nokia.traceviewer.dialog.treeitem.FilterTreeComponentItem;
+import com.nokia.traceviewer.dialog.treeitem.FilterTreeTextItem;
+import com.nokia.traceviewer.dialog.treeitem.TreeItem;
+import com.nokia.traceviewer.dialog.treeitem.TreeItemContentProvider;
+import com.nokia.traceviewer.dialog.treeitem.TreeItemLabelProvider;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.dataprocessor.FilterRuleObject;
+import com.nokia.traceviewer.engine.dataprocessor.FilterRuleSet;
+import com.nokia.traceviewer.engine.dataprocessor.FilterRuleSet.LogicalOperator;
+
+/**
+ * Advanced filter dialog
+ * 
+ */
+public final class FilterAdvancedDialog extends BaseDialog {
+
+	/**
+	 * Indicates how this dialog was exited
+	 */
+	public enum ExitStatus {
+
+		/**
+		 * Initial state
+		 */
+		NORMAL,
+
+		/**
+		 * Exited through apply button
+		 */
+		APPLYBUTTON,
+
+		/**
+		 * Exited through cancel button
+		 */
+		CANCELBUTTON,
+
+		/**
+		 * Exited through simple button
+		 */
+		SIMPLEBUTTON;
+	}
+
+	/**
+	 * Error message to show when there is multiple operators inside same set
+	 */
+	private static final String MULTIPLE_OPERATORS_ERROR_MSG = Messages
+			.getString("FilterAdvancedDialog.MultipleOperatorsErrorMsg"); //$NON-NLS-1$
+
+	/**
+	 * Error message to show when there is extra characters inside same set
+	 */
+	private static final String EXTRA_CHARS_ERROR_MSG = Messages
+			.getString("FilterAdvancedDialog.InvalidSyntaxErrorMsg"); //$NON-NLS-1$
+
+	/**
+	 * Tree
+	 */
+	private Tree tree;
+
+	/**
+	 * TreeViewer
+	 */
+	private TreeViewer treeViewer;
+
+	/**
+	 * Styled Text rule field
+	 */
+	private StyledText ruleTextfield;
+
+	/**
+	 * Button
+	 */
+	private Button showButton;
+
+	/**
+	 * Content provider
+	 */
+	private final TreeItemContentProvider contentProvider;
+
+	/**
+	 * Tree root
+	 */
+	private final TreeItem treeRoot;
+
+	/**
+	 * Start set tool item
+	 */
+	private ToolItem startSetToolItem;
+
+	/**
+	 * Start set image location
+	 */
+	private static final String startSetImageLocation = "/icons/startset.gif"; //$NON-NLS-1$
+
+	/**
+	 * Start set image
+	 */
+	private Image startSetImage;
+
+	/**
+	 * End set tool item
+	 */
+	private ToolItem endSetToolItem;
+
+	/**
+	 * End set image location
+	 */
+	private static final String endSetImageLocation = "/icons/endset.gif"; //$NON-NLS-1$
+
+	/**
+	 * End set image
+	 */
+	private Image endSetImage;
+
+	/**
+	 * AND tool item
+	 */
+	private ToolItem andToolItem;
+
+	/**
+	 * AND image location
+	 */
+	private static final String andImageLocation = "/icons/logicaland.gif"; //$NON-NLS-1$
+
+	/**
+	 * AND image
+	 */
+	private Image andImage;
+
+	/**
+	 * OR tool item
+	 */
+	private ToolItem orToolItem;
+
+	/**
+	 * OR image location
+	 */
+	private static final String orImageLocation = "/icons/logicalor.gif"; //$NON-NLS-1$
+
+	/**
+	 * OR image
+	 */
+	private Image orImage;
+
+	/**
+	 * NOT tool item
+	 */
+	private ToolItem notToolItem;
+
+	/**
+	 * NOT image location
+	 */
+	private static final String notImageLocation = "/icons/logicalnot.gif"; //$NON-NLS-1$
+
+	/**
+	 * NOT image
+	 */
+	private Image notImage;
+
+	/**
+	 * Back tool item
+	 */
+	private ToolItem backToolItem;
+
+	/**
+	 * Back image location
+	 */
+	private static final String backImageLocation = "/icons/backarrow.gif"; //$NON-NLS-1$
+
+	/**
+	 * Clear tool item
+	 */
+	private ToolItem clearToolItem;
+
+	/**
+	 * Clear image location
+	 */
+	private static final String clearImageLocation = "/icons/clear.gif"; //$NON-NLS-1$
+
+	/**
+	 * Simple tool item
+	 */
+	private ToolItem simpleToolItem;
+
+	/**
+	 * Simple image location
+	 */
+	private static final String simpleImageLocation = "/icons/simplefilter.gif"; //$NON-NLS-1$
+
+	/**
+	 * Simple image
+	 */
+	private Image simpleImage;
+
+	/**
+	 * Indicates to show traces containing the rule. Otherwise they're hidden
+	 */
+	private boolean showTracesContainingRule = true;
+
+	/**
+	 * Rule parser
+	 */
+	private FilterAdvancedParser ruleParser;
+
+	/**
+	 * Filter rule set to create from the rule text
+	 */
+	private FilterRuleObject ruleSet;
+
+	/**
+	 * Indicates that the dialog can be closed
+	 */
+	private boolean canBeClosed = true;
+
+	/**
+	 * Selection menu that opens when user clicks a group in the Tree
+	 */
+	private Menu menu;
+
+	/**
+	 * Indicates the exit status of this dialog
+	 */
+	public ExitStatus exitStatus;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parent
+	 *            parent shell
+	 * @param contentProvider
+	 *            contentprovider for the tree
+	 * @param treeRoot
+	 *            tree root
+	 */
+	public FilterAdvancedDialog(Shell parent,
+			TreeItemContentProvider contentProvider, TreeItem treeRoot) {
+		super(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.RESIZE);
+		this.contentProvider = contentProvider;
+		this.treeRoot = treeRoot;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseDialog#close()
+	 */
+	@Override
+	public boolean close() {
+		// If closing dialog by clicking X, do as in Cancel button
+		if (exitStatus == ExitStatus.NORMAL) {
+			exitStatus = ExitStatus.CANCELBUTTON;
+			saveSettings();
+			dispose();
+		} else if (exitStatus == ExitStatus.SIMPLEBUTTON) {
+			saveSettings();
+		}
+
+		return super.close();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseDialog#createShell()
+	 */
+	@Override
+	protected void createDialogContents() {
+		// Shell
+		GridLayout shellGridLayout = new GridLayout();
+		shellGridLayout.numColumns = 3;
+		shellGridLayout.makeColumnsEqualWidth = false;
+		getShell().setText("Advanced Filter Rules"); //$NON-NLS-1$
+		composite.setLayout(shellGridLayout);
+		getShell().setMinimumSize(new Point(435, 515));
+
+		// Tree
+		GridData treeGridData = new GridData();
+		treeGridData.horizontalAlignment = GridData.FILL;
+		treeGridData.grabExcessHorizontalSpace = true;
+		treeGridData.grabExcessVerticalSpace = true;
+		treeGridData.horizontalSpan = 2;
+		treeGridData.verticalAlignment = GridData.FILL;
+		treeGridData.widthHint = 250;
+		tree = new Tree(composite, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
+		tree.setLayoutData(treeGridData);
+
+		// Tree viewer
+		treeViewer = new TreeViewer(tree);
+		treeViewer.setLabelProvider(new TreeItemLabelProvider());
+		treeViewer.setContentProvider(contentProvider);
+
+		// Set root and expand all items
+		treeViewer.setInput(treeRoot);
+		treeViewer.expandAll();
+
+		// Select the root item
+		if (tree.getItem(0) != null) {
+			tree.setSelection(tree.getItem(0));
+		}
+
+		// Create toolbar
+		createToolBar();
+
+		// Rule text field
+		GridData ruleTextFieldGridData = new GridData();
+		ruleTextFieldGridData.grabExcessHorizontalSpace = true;
+		ruleTextFieldGridData.horizontalAlignment = GridData.FILL;
+		ruleTextFieldGridData.verticalAlignment = GridData.FILL;
+		ruleTextFieldGridData.heightHint = 70;
+		ruleTextFieldGridData.horizontalSpan = 2;
+		ruleTextFieldGridData.grabExcessVerticalSpace = false;
+		ruleTextFieldGridData.minimumHeight = 100;
+		ruleTextFieldGridData.horizontalIndent = 5;
+		ruleTextfield = new StyledText(composite, SWT.BORDER | SWT.WRAP
+				| SWT.V_SCROLL);
+		ruleTextfield.setLayoutData(ruleTextFieldGridData);
+
+		// Create new rule parser to this rule text field
+		ruleParser = new FilterAdvancedParser(ruleTextfield, tree.getItems()[0]
+				.getItems());
+		// Set parser to be the key, mouse and focus listener
+		ruleTextfield.addKeyListener(ruleParser);
+		ruleTextfield.addMouseListener(ruleParser);
+		ruleTextfield.addFocusListener(ruleParser);
+
+		// Set text from previous visit
+		ruleTextfield.setText(FilterAdvancedParser.SPACE_STR
+				+ TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+						.getFilterProcessor().getAdvancedFilterString()
+				+ FilterAdvancedParser.SPACE_STR);
+		ruleTextfield.setCaretOffset(ruleTextfield.getCharCount());
+
+		// Create Group
+		createGroup();
+	}
+
+	/**
+	 * Creates the toolbar containing pushable buttons to the right side of the
+	 * dialog.
+	 */
+	private void createToolBar() {
+		// Create the toolBar
+		GridData toolBarGridData = new GridData();
+		toolBarGridData.horizontalAlignment = GridData.FILL;
+		toolBarGridData.grabExcessVerticalSpace = true;
+		toolBarGridData.verticalSpan = 2;
+		toolBarGridData.verticalAlignment = GridData.FILL;
+		ToolBar toolBar = new ToolBar(composite, SWT.VERTICAL);
+		toolBar.setLayoutData(toolBarGridData);
+
+		// Create "Start set" item
+		startSetToolItem = new ToolItem(toolBar, SWT.PUSH);
+		startSetToolItem.setText(Messages
+				.getString("FilterAdvancedDialog.StartSetButtonText")); //$NON-NLS-1$
+		startSetToolItem.setToolTipText(Messages
+				.getString("FilterAdvancedDialog.StartSetToolTip")); //$NON-NLS-1$
+		// Set image to the "Start set" item
+		URL url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				startSetImageLocation);
+		startSetImage = ImageDescriptor.createFromURL(url).createImage();
+		startSetToolItem.setImage(startSetImage);
+
+		// Create "End set" item
+		endSetToolItem = new ToolItem(toolBar, SWT.PUSH);
+		endSetToolItem.setText(Messages
+				.getString("FilterAdvancedDialog.EndSetButtonText")); //$NON-NLS-1$
+		endSetToolItem.setToolTipText(Messages
+				.getString("FilterAdvancedDialog.EndSetToolTip")); //$NON-NLS-1$
+		// Set image to the "End set" item
+		url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				endSetImageLocation);
+		endSetImage = ImageDescriptor.createFromURL(url).createImage();
+		endSetToolItem.setImage(endSetImage);
+
+		// Create "And" item
+		andToolItem = new ToolItem(toolBar, SWT.PUSH);
+		andToolItem.setText(FilterAdvancedParser.AND);
+		andToolItem.setToolTipText(Messages
+				.getString("FilterAdvancedDialog.ANDToolTip")); //$NON-NLS-1$
+		// Set image to the "And" item
+		url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				andImageLocation);
+		andImage = ImageDescriptor.createFromURL(url).createImage();
+		andToolItem.setImage(andImage);
+
+		// Create "Or" item
+		orToolItem = new ToolItem(toolBar, SWT.PUSH);
+		orToolItem.setText(FilterAdvancedParser.OR);
+		orToolItem.setToolTipText(Messages
+				.getString("FilterAdvancedDialog.ORToolTip")); //$NON-NLS-1$
+		// Set image to the "Or" item
+		url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				orImageLocation);
+		orImage = ImageDescriptor.createFromURL(url).createImage();
+		orToolItem.setImage(orImage);
+
+		// Create "Not" item
+		notToolItem = new ToolItem(toolBar, SWT.PUSH);
+		notToolItem.setText(FilterAdvancedParser.NOT);
+		notToolItem.setToolTipText(Messages
+				.getString("FilterAdvancedDialog.NOTToolTip")); //$NON-NLS-1$
+		// Set image to the "Not" item
+		url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				notImageLocation);
+		notImage = ImageDescriptor.createFromURL(url).createImage();
+		notToolItem.setImage(notImage);
+
+		// Create "Back" item
+		backToolItem = new ToolItem(toolBar, SWT.PUSH);
+		backToolItem.setText(Messages
+				.getString("FilterAdvancedDialog.BackButtonText")); //$NON-NLS-1$
+		backToolItem.setToolTipText(Messages
+				.getString("FilterAdvancedDialog.BackToolTip")); //$NON-NLS-1$
+		// Set image to the "Back" item
+		url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				backImageLocation);
+		Image backImage = ImageDescriptor.createFromURL(url).createImage();
+		backToolItem.setImage(backImage);
+
+		// Create "Clear" item
+		clearToolItem = new ToolItem(toolBar, SWT.PUSH);
+		clearToolItem.setText(Messages
+				.getString("FilterAdvancedDialog.ClearButtonText")); //$NON-NLS-1$
+		clearToolItem.setToolTipText(Messages
+				.getString("FilterAdvancedDialog.ClearToolTip")); //$NON-NLS-1$
+		// Set image to the "Clear" item
+		url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				clearImageLocation);
+		Image clearImage = ImageDescriptor.createFromURL(url).createImage();
+		clearToolItem.setImage(clearImage);
+
+		// Create "Simple" item
+		simpleToolItem = new ToolItem(toolBar, SWT.PUSH);
+		simpleToolItem.setText(Messages
+				.getString("FilterAdvancedDialog.SimpleButtonText")); //$NON-NLS-1$
+		simpleToolItem.setToolTipText(Messages
+				.getString("FilterAdvancedDialog.SimpleViewToolTip")); //$NON-NLS-1$
+		// Set image to the "Simple" item
+		url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				simpleImageLocation);
+		simpleImage = ImageDescriptor.createFromURL(url).createImage();
+		simpleToolItem.setImage(simpleImage);
+	}
+
+	/**
+	 * This method initializes group
+	 */
+	private void createGroup() {
+		// Settings group
+		GridData settingsGroupGridData = new GridData();
+		settingsGroupGridData.horizontalAlignment = GridData.BEGINNING;
+		settingsGroupGridData.grabExcessHorizontalSpace = false;
+		settingsGroupGridData.grabExcessVerticalSpace = false;
+		settingsGroupGridData.verticalAlignment = GridData.FILL;
+		GridLayout settingsGroupGridLayout = new GridLayout();
+		settingsGroupGridLayout.verticalSpacing = 5;
+		settingsGroupGridLayout.marginWidth = 5;
+		settingsGroupGridLayout.marginHeight = 5;
+		settingsGroupGridLayout.numColumns = 2;
+		settingsGroupGridLayout.horizontalSpacing = 5;
+		Group settingsGroup = new Group(composite, SWT.NONE);
+		settingsGroup.setLayout(settingsGroupGridLayout);
+		settingsGroup.setLayoutData(settingsGroupGridData);
+		settingsGroup.setText(Messages
+				.getString("FilterAdvancedDialog.SettingsGroupName")); //$NON-NLS-1$
+
+		// Show button
+		showButton = new Button(settingsGroup, SWT.RADIO);
+		showButton.setText(Messages
+				.getString("FilterAdvancedDialog.ShowButtonText")); //$NON-NLS-1$
+		showButton.setToolTipText(Messages
+				.getString("FilterAdvancedDialog.ShowButtonToolTip")); //$NON-NLS-1$
+		showButton.setSelection(showTracesContainingRule);
+
+		// Hide button
+		Button hideButton = new Button(settingsGroup, SWT.RADIO);
+		hideButton.setText(Messages
+				.getString("FilterAdvancedDialog.HideButtonText")); //$NON-NLS-1$
+		hideButton.setToolTipText(Messages
+				.getString("FilterAdvancedDialog.HideButtonToolTip")); //$NON-NLS-1$
+		hideButton.setSelection(!showTracesContainingRule);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseDialog#restoreSettings()
+	 */
+	@Override
+	protected void restoreSettings() {
+		super.restoreSettings();
+		exitStatus = ExitStatus.NORMAL;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseDialog#saveSettings()
+	 */
+	@Override
+	protected void saveSettings() {
+		super.saveSettings();
+
+		if (exitStatus == ExitStatus.APPLYBUTTON) {
+			// Save advanced filter string
+			TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+					.getFilterProcessor().setAdvancedFilterString(
+							ruleTextfield.getText());
+
+			showTracesContainingRule = showButton.getSelection();
+
+			// Create the rule set
+			String ruleText = ruleTextfield.getText();
+			ruleSet = null;
+			if (ruleText.length() > 0
+					&& ruleParser.containsFilterRule(ruleText, tree.getItems())) {
+				ruleSet = createRuleSet(ruleText, false);
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+	 */
+	@Override
+	protected void okPressed() {
+		exitStatus = ExitStatus.APPLYBUTTON;
+		boolean valid = checkWrittenRules(ruleTextfield.getText());
+		if (valid) {
+			saveSettings();
+		} else {
+			TraceViewerGlobals.getTraceViewer().getDialogs().showErrorMessage(
+					EXTRA_CHARS_ERROR_MSG);
+			canBeClosed = false;
+		}
+
+		if (canBeClosed) {
+			super.okPressed();
+			dispose();
+		} else {
+			canBeClosed = true;
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.dialogs.Dialog#cancelPressed()
+	 */
+	@Override
+	protected void cancelPressed() {
+		exitStatus = ExitStatus.CANCELBUTTON;
+		saveSettings();
+
+		super.cancelPressed();
+
+		dispose();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseDialog#createActionListeners()
+	 */
+	@Override
+	protected void createActionListeners() {
+
+		// Add selection listener to start Set button
+		startSetToolItem.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				TraceViewerGlobals.postUiEvent("StartSetButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+				updateRuleTextField(FilterAdvancedParser.START_BRACKET_STR);
+				TraceViewerGlobals.postUiEvent("StartSetButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+			}
+		});
+
+		// Add selection listener to end Set button
+		endSetToolItem.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				TraceViewerGlobals.postUiEvent("EndSetButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+				updateRuleTextField(FilterAdvancedParser.END_BRACKET_STR);
+				TraceViewerGlobals.postUiEvent("EndSetButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+			}
+		});
+
+		// Add selection listener to and button
+		andToolItem.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				TraceViewerGlobals.postUiEvent("AndButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+				updateRuleTextField(FilterAdvancedParser.AND);
+				TraceViewerGlobals.postUiEvent("AndButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+			}
+		});
+
+		// Add selection listener to or button
+		orToolItem.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				TraceViewerGlobals.postUiEvent("OrButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+				updateRuleTextField(FilterAdvancedParser.OR);
+				TraceViewerGlobals.postUiEvent("OrButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+			}
+		});
+
+		// Add selection listener to not button
+		notToolItem.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				TraceViewerGlobals.postUiEvent("NotButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+				updateRuleTextField(FilterAdvancedParser.NOT);
+				TraceViewerGlobals.postUiEvent("NotButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+			}
+		});
+
+		// Add selection listener to back button
+		backToolItem.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				TraceViewerGlobals.postUiEvent("BackButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+				removeLastWord();
+				TraceViewerGlobals.postUiEvent("BackButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+			}
+		});
+
+		// Add selection listener to clear button
+		clearToolItem.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				TraceViewerGlobals.postUiEvent("ClearButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+				ruleTextfield.setText(""); //$NON-NLS-1$
+				setButtonStates();
+				TraceViewerGlobals.postUiEvent("ClearButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+			}
+		});
+
+		// Add selection listener to simple button
+		simpleToolItem.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				TraceViewerGlobals.postUiEvent("SimpleButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+
+				// Save exit status and advanced filter string
+				exitStatus = ExitStatus.SIMPLEBUTTON;
+				TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+						.getFilterProcessor().setAdvancedFilterString(
+								ruleTextfield.getText());
+				close();
+				dispose();
+				TraceViewerGlobals.postUiEvent("SimpleButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+			}
+		});
+
+		// Add selection listener to Tree
+		tree.addSelectionListener(new SelectionAdapter() {
+
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				TraceViewerGlobals.postUiEvent("TreeSelected", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+				// Get selection
+				Object selection = ((IStructuredSelection) treeViewer
+						.getSelection()).getFirstElement();
+
+				if (selection != null) {
+					// If group selected, add all rules to the list
+					if (((TreeItem) selection).isGroup()) {
+						processGroupSelection();
+
+					} else {
+						// Dispose menu if it exists
+						if (menu != null && !menu.isDisposed()) {
+							menu.dispose();
+						}
+						updateRuleTextField(tree.getSelection()[0].getText());
+					}
+				}
+				TraceViewerGlobals.postUiEvent("TreeSelected", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+			}
+
+			/**
+			 * Processes group item selection
+			 */
+			private void processGroupSelection() {
+				// Add menu to Tree
+				menu = new Menu(composite);
+
+				MenuItem orItem = new MenuItem(menu, SWT.CASCADE);
+				if (orImage != null && !orImage.isDisposed()) {
+					orItem.setImage(orImage);
+				}
+				orItem.setEnabled(ruleParser.canOrBeInserted()
+						|| ruleTextfield.getCharCount() < 4);
+				orItem.setText(FilterAdvancedParser.OR);
+
+				// Add selection listener to OR button
+				orItem.addSelectionListener(new SelectionAdapter() {
+					@Override
+					public void widgetSelected(SelectionEvent event) {
+						processSelection(FilterAdvancedParser.OR);
+					}
+				});
+
+				// And item
+				MenuItem andItem = new MenuItem(menu, SWT.CASCADE);
+				if (andImage != null && !andImage.isDisposed()) {
+					andItem.setImage(andImage);
+				}
+				andItem.setEnabled(ruleParser.canAndBeInserted()
+						|| ruleTextfield.getCharCount() < 3);
+				andItem.setText(FilterAdvancedParser.AND);
+
+				// Add selection listener to AND button
+				andItem.addSelectionListener(new SelectionAdapter() {
+					@Override
+					public void widgetSelected(SelectionEvent event) {
+						processSelection(FilterAdvancedParser.AND);
+					}
+				});
+
+				tree.setMenu(menu);
+				menu.setVisible(true);
+			}
+		});
+
+		// Validate and set button states
+		ruleParser.validate();
+		setButtonStates();
+	}
+
+	/**
+	 * Checks written rules from the rule field
+	 * 
+	 * @param text
+	 *            text to check
+	 * @return true if rules are ok, false otherwise
+	 */
+	public boolean checkWrittenRules(String text) {
+		boolean ok = false;
+		if (ruleParser != null) {
+			ok = ruleParser.checkWrittenRules(text);
+		}
+		return ok;
+	}
+
+	/**
+	 * Process selection of AND or OR
+	 * 
+	 * @param operator
+	 *            operator String
+	 */
+	private void processSelection(String operator) {
+		StringBuffer buf = new StringBuffer();
+
+		// Get selection
+		Object selection = ((IStructuredSelection) treeViewer.getSelection())
+				.getFirstElement();
+		if (selection != null) {
+			Object[] children = ((TreeItem) selection).getChildren();
+
+			// If previous word is a rule, add the operator
+			String prevWord = ruleParser.getPreviousWord(ruleTextfield
+					.getText(), ruleTextfield.getText().length() - 1);
+			if (ruleParser.containsFilterRule(prevWord, tree.getItems())) {
+				buf.append(" " + operator + " "); //$NON-NLS-1$ //$NON-NLS-2$
+			}
+
+			// Loop through children and append them to the string buffer
+			for (int i = 0; i < children.length; i++) {
+				if (!((TreeItem) children[i]).isGroup()) {
+
+					// If previous word is a rule, add the operator
+					prevWord = ruleParser.getPreviousWord(buf.toString(), buf
+							.length() - 1);
+					if (ruleParser
+							.containsFilterRule(prevWord, tree.getItems())) {
+						buf.append(" " + operator + " "); //$NON-NLS-1$ //$NON-NLS-2$
+					}
+
+					buf.append(((TreeItem) children[i]).getName());
+					if (i < children.length - 1
+							&& !((TreeItem) children[i + 1]).isGroup()) {
+						buf.append(" " + operator + " "); //$NON-NLS-1$ //$NON-NLS-2$
+					}
+				}
+
+			}
+			updateRuleTextField(buf.toString());
+		}
+	}
+
+	/**
+	 * Disposes UI resources if they exist. Is called when the shell is closed
+	 * or user clicks apply, cancel of simple buttons
+	 */
+	private void dispose() {
+		if (startSetImage != null) {
+			startSetImage.dispose();
+		}
+		if (endSetImage != null) {
+			endSetImage.dispose();
+		}
+		if (orImage != null) {
+			orImage.dispose();
+		}
+		if (andImage != null) {
+			andImage.dispose();
+		}
+		if (notImage != null) {
+			notImage.dispose();
+		}
+		if (simpleImage != null) {
+			simpleImage.dispose();
+		}
+	}
+
+	/**
+	 * Updates rule text field
+	 * 
+	 * @param text
+	 *            text to add to text field
+	 */
+	private void updateRuleTextField(String text) {
+		ruleTextfield.insert(FilterAdvancedParser.SPACE_STR + text
+				+ FilterAdvancedParser.SPACE_STR);
+		ruleTextfield.setCaretOffset(ruleTextfield.getCaretOffset()
+				+ text.length() + 2);
+		ruleParser.validate();
+		setButtonStates();
+	}
+
+	/**
+	 * Removes last word from the rule text field
+	 */
+	private void removeLastWord() {
+
+		// Get caret offset and text from the text field
+		int caretPos = ruleTextfield.getCaretOffset();
+		StringBuffer text = new StringBuffer(ruleTextfield.getText());
+		int startPos = 0;
+		if (caretPos == ruleTextfield.getCharCount()) {
+			caretPos--;
+		}
+
+		// Go through characters starting from the last one
+		for (int i = caretPos; i > 0; i--) {
+			char c = text.charAt(i);
+
+			// When space is found, set start position for deleting
+			if (c == FilterAdvancedParser.SPACE && i != caretPos) {
+				startPos = i;
+				break;
+			}
+		}
+
+		// Replace the last word from the text field and set button states
+		if (startPos < caretPos) {
+			ruleTextfield.replaceTextRange(startPos, caretPos - startPos, ""); //$NON-NLS-1$
+			setButtonStates();
+		}
+	}
+
+	/**
+	 * Sets button states
+	 */
+	public void setButtonStates() {
+
+		// Get different statuses from rule parser and set button states
+		// according to those
+		startSetToolItem.setEnabled(ruleParser.canNewSetBeStarted());
+		endSetToolItem.setEnabled(ruleParser.canSetBeEnded());
+		Button okButton = getButton(IDialogConstants.OK_ID);
+		if (okButton != null) {
+			getButton(OK).setEnabled(ruleParser.canApplyBeClicked());
+		}
+		andToolItem.setEnabled(ruleParser.canAndBeInserted());
+		orToolItem.setEnabled(ruleParser.canOrBeInserted());
+		backToolItem.setEnabled(ruleTextfield.getCaretOffset() > 1);
+		clearToolItem.setEnabled(ruleTextfield.getCharCount() > 1);
+	}
+
+	/**
+	 * Creates a rule set out of the rule String
+	 * 
+	 * @param text
+	 *            text to create the rule set from
+	 * @param notRule
+	 *            indicates if a rule is a NOT rule
+	 * @return rule object
+	 */
+	public FilterRuleObject createRuleSet(String text, boolean notRule) {
+		// Tells that NOT status has changed
+		boolean notHasChanged = false;
+
+		// New Filter rule object to be created
+		FilterRuleObject object = null;
+
+		// Trim the text
+		text = text.trim();
+
+		// Check if result is a basic rule
+		boolean isBasicRule = ruleParser.isBasicRule(text);
+
+		// Basic rule
+		if (isBasicRule) {
+			// Get the rule from the tree
+			object = getRuleWithName(text, treeRoot.getChildren());
+
+			// Rule set
+		} else {
+			object = new FilterRuleSet();
+
+			// Get and set Logical Operator for this rule set
+			LogicalOperator op = ruleParser.getLogicalOperator(text);
+			((FilterRuleSet) object).setOperator(op);
+
+			// Both or non operators in the set, show error
+			if (op == null) {
+				canBeClosed = false;
+				TraceViewerGlobals.getTraceViewer().getDialogs()
+						.showErrorMessage(MULTIPLE_OPERATORS_ERROR_MSG);
+			}
+
+			// Get children and loop through them
+			String[] children = ruleParser.getChildren(text);
+			for (int i = 0; canBeClosed && children != null
+					&& i < children.length; i++) {
+
+				// Check if child is NOT. If yes, it means that the next child
+				// will have modified NOT status
+				if (children[i].trim().equals(FilterAdvancedParser.NOT)) {
+					notHasChanged = true;
+				} else {
+					FilterRuleObject child;
+					if (notHasChanged) {
+						child = createRuleSet(children[i], !notRule);
+					} else {
+						child = createRuleSet(children[i], notRule);
+					}
+
+					((FilterRuleSet) object).addObject(child);
+					notHasChanged = false;
+				}
+			}
+
+		}
+
+		// Set NOT rule status
+		object.setLogicalNotRule(notRule);
+		return object;
+	}
+
+	/**
+	 * Gets rule with a name
+	 * 
+	 * @param name
+	 *            name text
+	 * @param items
+	 *            items array
+	 * @return true if rule is found from the items
+	 */
+	private FilterRuleObject getRuleWithName(String name, Object[] items) {
+		FilterRuleObject ret = null;
+		for (int i = 0; i < items.length; i++) {
+			FilterTreeBaseItem item = (FilterTreeBaseItem) items[i];
+
+			// Contains children, recurse
+			if ((item.getChildren().length > 0)) {
+				ret = getRuleWithName(name, item.getChildren());
+
+				// Check item
+			} else {
+				if (name.equals(item.getName())) {
+
+					// Create new objects from the existing ones
+					// Text item
+					if (item instanceof FilterTreeTextItem) {
+						FilterTreeTextItem item2 = (FilterTreeTextItem) item;
+						ret = new FilterTreeTextItem(null, null, name, item2
+								.getRule(), item2.getText(), item2
+								.isMatchCase());
+
+						// Component item
+					} else if (item instanceof FilterTreeComponentItem) {
+						FilterTreeComponentItem item2 = (FilterTreeComponentItem) item;
+						ret = new FilterTreeComponentItem(null, null, name,
+								item2.getRule(), item2.getComponentId(), item2
+										.getGroupId());
+					}
+					break;
+				}
+			}
+		}
+		return ret;
+	}
+
+	/**
+	 * Checks if traces hitting filter should be displayed or not.
+	 * 
+	 * @return true if traces hitting filter should be displayed.
+	 */
+	public boolean isShowTracesContainingRule() {
+		return showTracesContainingRule;
+	}
+
+	/**
+	 * Gets the rule set created
+	 * 
+	 * @return the ruleSet created
+	 */
+	public FilterRuleObject getRuleSet() {
+		return ruleSet;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/FilterAdvancedParser.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,1066 @@
+/*
+ * 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:
+ *
+ * Parses the rule text field for validity
+ *
+ */
+package com.nokia.traceviewer.dialog;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyleRange;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.FocusListener;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.TreeItem;
+
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.dataprocessor.FilterRuleSet.LogicalOperator;
+
+/**
+ * Parses the rule text field for validity
+ */
+public final class FilterAdvancedParser implements FocusListener, KeyListener,
+		MouseListener {
+
+	/**
+	 * Indicates the max number of brackets in a rule. Used to shut down while
+	 * loop if there is something wrong
+	 */
+	private static final int MAX_NUMBER_OF_BRACKETS = 50;
+
+	/**
+	 * AND String
+	 */
+	public static final String AND = "AND"; //$NON-NLS-1$
+
+	/**
+	 * OR String
+	 */
+	public static final String OR = "OR"; //$NON-NLS-1$
+
+	/**
+	 * NOT String
+	 */
+	public static final String NOT = "NOT"; //$NON-NLS-1$
+
+	/**
+	 * Start bracket
+	 */
+	private static final char START_BRACKET = '(';
+
+	/**
+	 * Start bracket String
+	 */
+	public static final String START_BRACKET_STR = "("; //$NON-NLS-1$
+
+	/**
+	 * End bracket
+	 */
+	private static final char END_BRACKET = ')';
+
+	/**
+	 * End bracket String
+	 */
+	public static final String END_BRACKET_STR = ")"; //$NON-NLS-1$
+
+	/**
+	 * Space
+	 */
+	public static final char SPACE = ' ';
+
+	/**
+	 * Space String
+	 */
+	public static final String SPACE_STR = " "; //$NON-NLS-1$
+
+	/**
+	 * Empty String
+	 */
+	private static final String EMPTY = ""; //$NON-NLS-1$
+
+	/**
+	 * Text field to validate
+	 */
+	private final StyledText textField;
+
+	/**
+	 * Rule items
+	 */
+	private final TreeItem[] items;
+
+	/**
+	 * Blue color
+	 */
+	private final Color blue;
+
+	/**
+	 * Gray color
+	 */
+	private final Color gray;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param ruleTextfield
+	 *            rule text field
+	 * @param items
+	 *            rule items
+	 */
+	public FilterAdvancedParser(StyledText ruleTextfield, TreeItem[] items) {
+		textField = ruleTextfield;
+		this.items = items;
+		blue = textField.getDisplay().getSystemColor(SWT.COLOR_BLUE);
+		gray = textField.getDisplay().getSystemColor(SWT.COLOR_GRAY);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.swt.events.KeyListener#keyPressed(org.eclipse.swt.events.
+	 * KeyEvent)
+	 */
+	public void keyPressed(KeyEvent e) {
+		if (e.keyCode != SWT.CTRL) {
+			validate();
+
+			// Set button states
+			TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+					.getFilterProcessor().getFilterDialog().getAdvancedDialog()
+					.setButtonStates();
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @seeorg.eclipse.swt.events.MouseListener#mouseUp(org.eclipse.swt.events.
+	 * MouseEvent)
+	 */
+	public void mouseUp(MouseEvent e) {
+		if (textField.getText().length() > 1) {
+			Point selection = null;
+			if (textField.getSelectionRange().y > 0) {
+				selection = textField.getSelection();
+			}
+			validate();
+			// Set button states
+			TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+					.getFilterProcessor().getFilterDialog().getAdvancedDialog()
+					.setButtonStates();
+			if (selection != null) {
+				textField.setSelection(selection);
+			}
+		}
+	}
+
+	/**
+	 * Validates the text field
+	 */
+	void validate() {
+		textField.getCaret().setVisible(false);
+		String text = textField.getText();
+		// Change logical operations to upper case
+		text = text.replace(" and ", SPACE + AND + SPACE); //$NON-NLS-1$
+		text = text.replace(" or ", SPACE + OR + SPACE); //$NON-NLS-1$
+		text = text.replace(" not ", SPACE + NOT + SPACE); //$NON-NLS-1$
+
+		StringBuffer newText = new StringBuffer(text);
+		int caretPos = textField.getCaretOffset();
+
+		int removedBeforeCaret = removeDoubleSpaces(newText, caretPos);
+		caretPos -= removedBeforeCaret;
+
+		// Empty, add one space
+		if (newText.length() == 0) {
+			newText.append(SPACE);
+			caretPos = 1;
+
+		}
+
+		// Insert the text and color the caret
+		textField.setText(newText.toString());
+		textField.setCaretOffset(caretPos);
+		colorCaretAndRules();
+		textField.getCaret().setVisible(true);
+	}
+
+	/**
+	 * Removes double spaces
+	 * 
+	 * @param newText
+	 *            StringBuffer to use
+	 * @param caretPos
+	 *            old caret position
+	 * @return number of chars removed before caret position
+	 */
+	private int removeDoubleSpaces(StringBuffer newText, int caretPos) {
+		int charsRemoved = 0;
+		boolean lastCharSpace = false;
+		for (int i = 0; i < newText.length(); i++) {
+			if (newText.charAt(i) == SPACE) {
+				if (lastCharSpace) {
+					newText.deleteCharAt(i);
+					if (i < caretPos) {
+						charsRemoved++;
+					}
+					i--;
+				}
+				lastCharSpace = true;
+			} else {
+				lastCharSpace = false;
+			}
+		}
+		return charsRemoved;
+	}
+
+	/**
+	 * Counts occurrences of a character from a string
+	 * 
+	 * @param text
+	 *            text to find from
+	 * @param c
+	 *            the character
+	 * @return number of occurrences in the string
+	 */
+	private int countOccurrences(String text, char c) {
+		int occ = 0;
+		for (int i = 0; i < text.length(); i++) {
+			if (text.charAt(i) == c) {
+				occ++;
+			}
+		}
+		return occ;
+	}
+
+	/**
+	 * Colors the caret and the rules
+	 */
+	private void colorCaretAndRules() {
+		List<StyleRange> ranges = new ArrayList<StyleRange>();
+		int caretPos = textField.getCaretOffset();
+
+		// Color the rules
+		if (items != null) {
+			String text = textField.getText();
+			text = text.replace(START_BRACKET, SPACE);
+			text = text.replace(END_BRACKET, SPACE);
+			StringBuffer buf = new StringBuffer();
+			ArrayList<String> words = new ArrayList<String>();
+			ArrayList<Integer> offsets = new ArrayList<Integer>();
+
+			// Gather the words
+			for (int i = 0; i < text.length(); i++) {
+				char c = text.charAt(i);
+				if (c == SPACE) {
+					// If the buffer is not empty, it's a word and should be
+					// added to the list
+					if (!buf.toString().replace(SPACE_STR, EMPTY).equals(EMPTY)) {
+						words.add(buf.toString());
+						offsets.add(Integer.valueOf(i - buf.length()));
+					}
+					buf.setLength(0);
+				} else {
+					buf.append(c);
+				}
+			}
+
+			// Create the style ranges for the basic rules found
+			for (int j = 0; j < words.size(); j++) {
+				if (isBasicRule(words.get(j))) {
+					ranges.add(new StyleRange(offsets.get(j).intValue(), words
+							.get(j).length(), blue, null));
+				}
+			}
+		}
+
+		// Color the caret if not focused
+		if (!textField.isFocusControl()) {
+			if (caretPos > textField.getCharCount()) {
+				caretPos = textField.getCharCount();
+			}
+			ranges.add(new StyleRange(caretPos - 1, 1, gray, gray));
+		}
+		// Sort and set the ranges
+		ranges = sortColorRanges(ranges);
+		textField.setStyleRanges(ranges.toArray(new StyleRange[ranges.size()]));
+	}
+
+	/**
+	 * Sorts color ranges
+	 * 
+	 * @param ranges
+	 *            color ranges
+	 * @return ordered list
+	 */
+	private List<StyleRange> sortColorRanges(List<StyleRange> ranges) {
+		Collections.sort(ranges, new Comparator<StyleRange>() {
+
+			public int compare(StyleRange o1, StyleRange o2) {
+				int id1 = o1.start;
+				int id2 = o2.start;
+				return id1 > id2 ? 1 : id1 < id2 ? -1 : 0;
+			}
+
+		});
+		return ranges;
+	}
+
+	/**
+	 * Finds and returns a set from caret pos
+	 * 
+	 * @param text
+	 *            text to search from
+	 * @param caretOffset
+	 *            caret offset
+	 * @return the set where the caret is on
+	 */
+	private String findSet(String text, int caretOffset) {
+		String set = null;
+		if (text.length() > 0) {
+
+			// Get counts for the brackets
+			int startCount = countOccurrences(text.substring(0, caretOffset),
+					START_BRACKET);
+			int endCount = countOccurrences(text.substring(0, caretOffset),
+					END_BRACKET);
+
+			// Full sets before the caret, start from last end bracket
+			if (startCount == endCount) {
+				// Get indices for the nearest brackets
+				int startIdx = getNearestChar(text, caretOffset, START_BRACKET,
+						true);
+				int endIdx = getNearestChar(text, caretOffset, END_BRACKET,
+						false);
+				if (startIdx == -1) {
+					startIdx = text.length();
+				}
+				if (endIdx == -1) {
+					endIdx = 0;
+				} else {
+					endIdx++;
+				}
+				set = text.substring(endIdx, startIdx);
+			} else {
+				// Get indices for the nearest brackets
+				int startIdx = getNearestChar(text, caretOffset, START_BRACKET,
+						false);
+				int endIdx = getNearestChar(text, caretOffset, END_BRACKET,
+						true);
+				if (startIdx == -1) {
+					startIdx = 0;
+				} else {
+					startIdx++;
+				}
+				if (endIdx == -1) {
+					endIdx = text.length();
+				}
+				set = text.substring(startIdx, endIdx);
+			}
+		}
+		return set;
+	}
+
+	/**
+	 * Gets nearest char from a string
+	 * 
+	 * @param text
+	 *            text to search from
+	 * @param caretOffset
+	 *            caret offset
+	 * @param c
+	 *            character to search for
+	 * @param forward
+	 *            forward or backward search
+	 * @return offset of nearest character. -1 if not found
+	 */
+	private int getNearestChar(String text, int caretOffset, char c,
+			boolean forward) {
+		int idx = -1;
+		// Searching forwards
+		if (forward) {
+			idx = text.indexOf(c, caretOffset);
+
+			// Searching backwards
+		} else if (text.length() > 0) {
+			for (int i = caretOffset - 1; i >= 0; i--) {
+				if (text.charAt(i) == c) {
+					idx = i;
+					break;
+				}
+			}
+		}
+		return idx;
+	}
+
+	/**
+	 * Tells if a set is open
+	 * 
+	 * @return true if set is open
+	 */
+	boolean isSetOpen() {
+		boolean setOpen = false;
+		int startCount = countOccurrences(textField.getText(), START_BRACKET);
+		int endCount = countOccurrences(textField.getText(), END_BRACKET);
+		if (startCount > endCount) {
+			setOpen = true;
+		}
+		return setOpen;
+	}
+
+	/**
+	 * Check if AND can be inserted to current pos
+	 * 
+	 * @return true if AND can be inserted
+	 */
+	boolean canAndBeInserted() {
+		boolean canBeInserted = true;
+		String set = findSet(textField.getText(), textField.getCaretOffset());
+		// If there is OR
+		if (set != null && set.contains(OR)) {
+			canBeInserted = false;
+		} else if (set != null && !containsFilterRule(set, items)
+				&& !isSetOpen()
+				&& !containsFilterRule(textField.getText(), items)) {
+			canBeInserted = false;
+		} else if (set != null && !containsFilterRule(set, items)
+				&& isSetOpen()) {
+			canBeInserted = false;
+		} else if (set == null) {
+			canBeInserted = false;
+		}
+
+		return canBeInserted;
+	}
+
+	/**
+	 * Check if OR can be inserted to current pos
+	 * 
+	 * @return true if OR can be inserted
+	 */
+	boolean canOrBeInserted() {
+		boolean canBeInserted = true;
+		String set = findSet(textField.getText(), textField.getCaretOffset());
+		// If there is AND
+		if (set != null && set.contains(AND)) {
+			canBeInserted = false;
+		} else if (set != null && !containsFilterRule(set, items)
+				&& !isSetOpen()
+				&& !containsFilterRule(textField.getText(), items)) {
+			canBeInserted = false;
+		} else if (set != null && !containsFilterRule(set, items)
+				&& isSetOpen()) {
+			canBeInserted = false;
+		} else if (set == null) {
+			canBeInserted = false;
+		}
+
+		return canBeInserted;
+	}
+
+	/**
+	 * Check if new set can be started to current pos
+	 * 
+	 * @return true if new set can be started
+	 */
+	boolean canNewSetBeStarted() {
+		boolean canBeStarted = false;
+		String text = textField.getText();
+		int caretPos = textField.getCaretOffset();
+		boolean ready = false;
+		StringBuffer buf = new StringBuffer();
+
+		// Text has to contain at least one rule
+		if (containsFilterRule(text, items) && caretPos > 1) {
+
+			// Go backwards and check the previous word
+			for (int i = caretPos - 1; i > 0; i--) {
+				char c = text.charAt(i);
+				// Space, do nothing
+				if (c == SPACE) {
+					if (ready) {
+						// Remove NOT
+						if (buf.toString().equals(NOT)) {
+							buf.setLength(0);
+							ready = false;
+						} else {
+							break;
+						}
+					}
+				} else {
+					buf.insert(0, c);
+					ready = true;
+				}
+			}
+
+			String word = buf.toString();
+			if (word.contains(OR) || word.contains(AND)) {
+				canBeStarted = true;
+			}
+		} else {
+			canBeStarted = true;
+		}
+		return canBeStarted;
+	}
+
+	/**
+	 * Check if a set can be ended here
+	 * 
+	 * @return true if a set can be ended here
+	 */
+	boolean canSetBeEnded() {
+		boolean canBeEnded = false;
+		String text = textField.getText();
+		int caretPos = textField.getCaretOffset();
+		boolean ready = false;
+		StringBuffer buf = new StringBuffer();
+
+		// Text has to contain at least one rule
+		if (containsFilterRule(text, items) && isSetOpen()) {
+			// Go backwards and check the previous word
+			for (int i = caretPos - 1; i > 0; i--) {
+				char c = text.charAt(i);
+				// Space, do nothing
+				if (c == SPACE) {
+					if (ready) {
+						break;
+					}
+				} else {
+					buf.insert(0, c);
+					ready = true;
+				}
+			}
+
+			String word = buf.toString();
+			if (!word.contains(OR) && !word.contains(AND)) {
+				canBeEnded = true;
+			}
+		}
+		return canBeEnded;
+	}
+
+	/**
+	 * Check if apply can be clicked
+	 * 
+	 * @return true if apply can be clicked
+	 */
+	boolean canApplyBeClicked() {
+		boolean canBeClicked = false;
+		if (!isSetOpen()) {
+			String text = textField.getText();
+
+			// Length bigger than one and contains at least one rule
+			if (text.length() > 1 && containsFilterRule(text, items)) {
+				int nrOfRules = 0;
+				// Check that after every rule there cannot be another rule
+				text = text.replace(START_BRACKET_STR, SPACE_STR);
+				text = text.replace(END_BRACKET_STR, SPACE_STR);
+				String[] words = text.split(SPACE_STR);
+				boolean lastWasRule = false;
+				for (int i = 0; i < words.length; i++) {
+					if (containsFilterRule(words[i], items)) {
+						nrOfRules++;
+						canBeClicked = true;
+						if (lastWasRule) {
+							canBeClicked = false;
+							break;
+						}
+						lastWasRule = true;
+					} else {
+						lastWasRule = false;
+					}
+
+				}
+				// If more than one rule, there has to be logical operator too
+				if (canBeClicked && nrOfRules > 1) {
+					// All good
+					if (text.contains(AND) || text.contains(OR)) {
+						// Not good
+					} else {
+						canBeClicked = false;
+					}
+				}
+
+				// Check that logical operators have a rule in both sides
+				if (canBeClicked) {
+					text = text.replace(START_BRACKET_STR, EMPTY);
+					text = text.replace(END_BRACKET_STR, EMPTY);
+					text = text.replace(NOT, EMPTY);
+
+					// Remove double spaces
+					StringBuffer buf = new StringBuffer(text);
+					removeDoubleSpaces(buf, 0);
+					text = buf.toString();
+
+					canBeClicked = checkLogicalOperatorValidity(canBeClicked,
+							text, AND);
+					if (canBeClicked) {
+						canBeClicked = checkLogicalOperatorValidity(
+								canBeClicked, text, OR);
+					}
+				}
+
+				// Length is 0 or 1
+			} else if (text.length() <= 1) {
+				canBeClicked = true;
+			}
+		}
+		return canBeClicked;
+	}
+
+	/**
+	 * Checks that logical operators have filter rule in both sides
+	 * 
+	 * @param canBeClicked
+	 *            variable indicating if apply can be clicked
+	 * @param text
+	 *            text to process
+	 * @param operator
+	 *            logical operator as string
+	 * @return true if logical operators are ok
+	 */
+	private boolean checkLogicalOperatorValidity(boolean canBeClicked,
+			String text, String operator) {
+		StringBuffer buf = new StringBuffer();
+		int pos = text.indexOf(operator);
+		// Loop while next operator is found
+		while (pos != -1) {
+			// Check backwards
+			for (int i = pos - 2; i > -1; i--) {
+				char c = text.charAt(i);
+				if (c == SPACE) {
+					break;
+				}
+				buf.insert(0, c);
+			}
+			if (!ruleInItems(buf.toString(), items)) {
+				canBeClicked = false;
+			}
+			buf.setLength(0);
+
+			// Check forwards
+			for (int i = pos + operator.length() + 1; canBeClicked
+					&& i < text.length(); i++) {
+				char c = text.charAt(i);
+				if (c == SPACE) {
+					break;
+				}
+				buf.append(c);
+			}
+			if (!ruleInItems(buf.toString(), items)) {
+				canBeClicked = false;
+			}
+			buf.setLength(0);
+
+			pos = text.indexOf(operator, pos + 1);
+		}
+
+		return canBeClicked;
+	}
+
+	/**
+	 * Checks if a string contains filter rule from the tree
+	 * 
+	 * @param text
+	 *            text to search from
+	 * @param items
+	 *            items to go through
+	 * @return true if at least one rule can be found from the string
+	 */
+	boolean containsFilterRule(String text, TreeItem[] items) {
+		boolean found = false;
+		if (text != null && items != null) {
+			for (int i = 0; i < items.length && !found; i++) {
+
+				// Contains children, recurse
+				if (items[i].getItemCount() > 0) {
+					found = containsFilterRule(text, items[i].getItems());
+
+					// Check item
+				} else if (text.contains(items[i].getText())) {
+					found = true;
+				}
+			}
+		}
+		return found;
+	}
+
+	/**
+	 * Gets logical operator from a text
+	 * 
+	 * @param text
+	 *            text to get logical operator from
+	 * @return logical operator of this set. Returns OR if this is a basic rule.
+	 *         Null if both operators are found.
+	 */
+	LogicalOperator getLogicalOperator(String text) {
+		LogicalOperator op = LogicalOperator.OR;
+		String mainLevel = getMainLevelOfRule(text);
+
+		// Contains AND but no OR
+		if (mainLevel.contains(AND) && !mainLevel.contains(OR)) {
+			op = LogicalOperator.AND;
+			// Contains OR but no AND
+		} else if (mainLevel.contains(OR) && !mainLevel.contains(AND)) {
+			op = LogicalOperator.OR;
+			// Contains either both or not any
+		} else if ((mainLevel.contains(AND) && mainLevel.contains(OR))
+				|| (!mainLevel.contains(AND) && !mainLevel.contains(OR))) {
+			String newText = removeStartAndEndBracket(text);
+			if (newText != null) {
+				text = newText;
+			}
+			text = text.replace(NOT, EMPTY);
+			text = text.trim();
+			if (!isBasicRule(text)) {
+				// Is not basic rule
+				op = null;
+			}
+		}
+		return op;
+	}
+
+	/**
+	 * Gets the main level of the rule
+	 * 
+	 * @param text
+	 *            rule text to process
+	 * @return main level of the rule
+	 */
+	private String getMainLevelOfRule(String text) {
+		int safeCounter = 0;
+		String mainLevel = removeTextBetweenBrackets(text);
+		if (mainLevel != null && mainLevel.indexOf(OR) == -1
+				&& mainLevel.indexOf(AND) == -1) {
+			mainLevel = text;
+		}
+		while (mainLevel != null && mainLevel.indexOf(OR) == -1
+				&& mainLevel.indexOf(AND) == -1 && mainLevel.length() > 0
+				&& safeCounter < MAX_NUMBER_OF_BRACKETS) {
+			safeCounter++;
+			mainLevel = removeStartAndEndBracket(mainLevel);
+			mainLevel = removeTextBetweenBrackets(mainLevel);
+		}
+		return mainLevel;
+	}
+
+	/**
+	 * Removes all text between brackets (including brackets)
+	 * 
+	 * @param text
+	 *            text to be processed
+	 * @return text without information inside brackets
+	 */
+	private String removeTextBetweenBrackets(String text) {
+		StringBuffer str = new StringBuffer();
+		if (text != null && text.length() > 0) {
+			int nrOfStartBrackets = 0;
+			for (int i = 0; i < text.length(); i++) {
+				char c = text.charAt(i);
+				if (c == START_BRACKET) {
+					nrOfStartBrackets++;
+				} else if (c == END_BRACKET) {
+					nrOfStartBrackets--;
+				} else if (nrOfStartBrackets == 0) {
+					str.append(c);
+				}
+			}
+		}
+		return str.toString();
+	}
+
+	/**
+	 * Removes first start and last end bracket
+	 * 
+	 * @param text
+	 *            text to process
+	 * @return text without first start and last end bracket. Null if cannot
+	 *         find both brackets
+	 */
+	private String removeStartAndEndBracket(String text) {
+		String ret = null;
+		int startPos = text.indexOf(START_BRACKET);
+		int endPos = text.lastIndexOf(END_BRACKET);
+		if (startPos != -1 && endPos != -1 && startPos + 1 < endPos) {
+			ret = text.substring(startPos + 1, endPos);
+		}
+		return ret;
+	}
+
+	/**
+	 * Tells if the String given is a basic rule
+	 * 
+	 * @param text
+	 *            String to search from
+	 * @return true if the String given is a basic rule
+	 */
+	boolean isBasicRule(String text) {
+		boolean basicRule = false;
+
+		// Find rule from the tree items
+		if (text.length() > 0 && !text.equals(SPACE_STR)) {
+			if (ruleInItems(text, items)) {
+				basicRule = true;
+			}
+		}
+		return basicRule;
+	}
+
+	/**
+	 * Checks if rule is contained in the items
+	 * 
+	 * @param text
+	 *            rule text
+	 * @param items
+	 *            items array
+	 * @return true if rule is found from the items
+	 */
+	private boolean ruleInItems(String text, TreeItem[] items) {
+		boolean found = false;
+		for (int i = 0; i < items.length; i++) {
+
+			// Contains children, recurse
+			if ((items[i].getItemCount() > 0)) {
+				found = ruleInItems(text, items[i].getItems());
+
+				// Check item
+			} else if (text.equals(items[i].getText())) {
+				found = true;
+				break;
+			}
+		}
+		return found;
+	}
+
+	/**
+	 * Gets children rule sets from a String
+	 * 
+	 * @param text
+	 *            String to split to rule sets
+	 * @return array of children
+	 */
+	String[] getChildren(String text) {
+		// Add space before start and after end brackets and to both sides of
+		// each logical operator
+		text = text.replace(START_BRACKET_STR, SPACE_STR + START_BRACKET_STR);
+		text = text.replace(END_BRACKET_STR, END_BRACKET_STR + SPACE_STR);
+		text = text.replace(AND, SPACE_STR + AND + SPACE_STR);
+		text = text.replace(OR, SPACE_STR + OR + SPACE_STR);
+		text = text.replace(NOT, SPACE_STR + NOT + SPACE_STR);
+
+		String[] strings;
+		int nrOfStartBrackets = 0;
+		ArrayList<String> children = new ArrayList<String>();
+		StringBuffer buf = new StringBuffer();
+
+		// Go through every character
+		for (int i = 0; i < text.length(); i++) {
+			char c = text.charAt(i);
+			if (c == START_BRACKET) {
+				nrOfStartBrackets++;
+			} else if (c == END_BRACKET) {
+				nrOfStartBrackets--;
+
+				// When brackets are processed, create a child from the
+				// buffer
+				if (nrOfStartBrackets == 0) {
+					addBufferToChildList(children, buf);
+				}
+			} else if (nrOfStartBrackets > 0) {
+				buf.append(c);
+
+				// Nr of start brackets is zero
+			} else {
+				// Character is space
+				if (c == SPACE) {
+					if (buf.length() > 0) {
+						addBufferToChildList(children, buf);
+					}
+				} else {
+					buf.append(c);
+					// If processing the last character, add child
+					if (i == text.length() - 1) {
+						addBufferToChildList(children, buf);
+					}
+				}
+			}
+		}
+
+		// Insert the strings to a array
+		strings = new String[children.size()];
+		for (int j = 0; j < children.size(); j++) {
+			strings[j] = children.get(j);
+		}
+
+		return strings;
+	}
+
+	/**
+	 * Adds buffer contents to child list and empties the buffer
+	 * 
+	 * @param children
+	 *            children list
+	 * @param buf
+	 *            buffer
+	 */
+	private void addBufferToChildList(List<String> children, StringBuffer buf) {
+		// AND and OR cannot be children
+		if (!buf.toString().trim().equals(AND)
+				&& !buf.toString().trim().equals(OR)) {
+			// Add child to the list
+			children.add(buf.toString());
+		}
+		buf.setLength(0);
+	}
+
+	/**
+	 * Checks written rules
+	 * 
+	 * @param text
+	 *            text to check
+	 * @return true if text field contains only valid rules and operations
+	 */
+	boolean checkWrittenRules(String text) {
+		// Replace brackets and logical operations with spaces
+		text = text.replace(START_BRACKET_STR, SPACE_STR);
+		text = text.replace(END_BRACKET_STR, SPACE_STR);
+		text = text.replace(AND, SPACE_STR);
+		text = text.replace(OR, SPACE_STR);
+		text = text.replace(NOT, SPACE_STR);
+
+		// Add space to start and end and then remove filter rules
+		StringBuffer buf = new StringBuffer(text);
+		buf.insert(0, SPACE);
+		buf.append(SPACE);
+		text = removeFilterRules(buf.toString(), items);
+
+		// Remove spaces
+		text = text.replace(SPACE_STR, EMPTY);
+
+		// Text should now be empty
+		boolean empty = text.length() == 0;
+		return empty;
+	}
+
+	/**
+	 * Removes filter rules from the text
+	 * 
+	 * @param text
+	 *            the text
+	 * @param items
+	 *            tree items
+	 * @return original text without filter rules
+	 */
+	private String removeFilterRules(String text, TreeItem[] items) {
+		for (int i = 0; i < items.length; i++) {
+
+			// Has children, recurse
+			if (items[i].getItemCount() > 0) {
+				text = removeFilterRules(text, items[i].getItems());
+
+				// Remove the rule from the text.
+			} else {
+				text = text.replace(items[i].getText() + SPACE_STR, EMPTY);
+			}
+		}
+		return text;
+	}
+
+	/**
+	 * Gets previous word from the text field
+	 * 
+	 * @param text
+	 *            text to search from
+	 * @param pos
+	 *            position where to read
+	 * @return previous word
+	 */
+	String getPreviousWord(String text, int pos) {
+		StringBuffer buf = new StringBuffer();
+		for (int i = pos; i >= 0; i--) {
+			char c = text.charAt(i);
+
+			// Space, break
+			if ((c == SPACE) && (i < pos - 1)) {
+				break;
+			}
+			buf.insert(0, c);
+		}
+		return buf.toString().trim();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.swt.events.FocusListener#focusGained(org.eclipse.swt.events
+	 * .FocusEvent)
+	 */
+	public void focusGained(FocusEvent e) {
+		colorCaretAndRules();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.swt.events.FocusListener#focusLost(org.eclipse.swt.events
+	 * .FocusEvent)
+	 */
+	public void focusLost(FocusEvent e) {
+		colorCaretAndRules();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.swt.events.KeyListener#keyReleased(org.eclipse.swt.events
+	 * .KeyEvent)
+	 */
+	public void keyReleased(KeyEvent e) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.swt.events.MouseListener#mouseDoubleClick(org.eclipse.swt
+	 * .events.MouseEvent)
+	 */
+	public void mouseDoubleClick(MouseEvent e) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.swt.events.MouseListener#mouseDown(org.eclipse.swt.events
+	 * .MouseEvent)
+	 */
+	public void mouseDown(MouseEvent e) {
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/FilterDialog.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,735 @@
+/*
+ * 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:
+ *
+ * Filter dialog
+ *
+ */
+package com.nokia.traceviewer.dialog;
+
+import java.net.URL;
+
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+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.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.ToolItem;
+
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.dialog.FilterAdvancedDialog.ExitStatus;
+import com.nokia.traceviewer.dialog.treeitem.FilterTreeBaseItem;
+import com.nokia.traceviewer.dialog.treeitem.FilterTreeItem;
+import com.nokia.traceviewer.dialog.treeitem.TreeItem;
+import com.nokia.traceviewer.dialog.treeitem.TreeItemContentProvider;
+import com.nokia.traceviewer.engine.DataReaderAccess;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.TraceViewerDialogInterface.Dialog;
+import com.nokia.traceviewer.engine.dataprocessor.FilterRuleObject;
+import com.nokia.traceviewer.engine.dataprocessor.FilterRuleSet;
+import com.nokia.traceviewer.engine.dataprocessor.FilterRuleSet.LogicalOperator;
+import com.nokia.traceviewer.engine.preferences.PreferenceConstants;
+import com.nokia.traceviewer.engine.preferences.XMLFilterConfigurationExporter;
+
+/**
+ * Filter dialog
+ * 
+ */
+public final class FilterDialog extends BaseTreeDialog {
+
+	/**
+	 * Processing reason to give to progressBar dialog when filtering
+	 */
+	private static final String filterProcessReason = Messages
+			.getString("FilterDialog.ProcessReason"); //$NON-NLS-1$
+
+	/**
+	 * Processing reason to give to progressBar dialog when clearing filters
+	 */
+	private static final String clearProcessReason = Messages
+			.getString("FilterDialog.ClearProcessReason"); //$NON-NLS-1$
+
+	/**
+	 * Add item image
+	 */
+	private static final String itemAddImageLocation = "/icons/filteradd.gif"; //$NON-NLS-1$
+
+	/**
+	 * Edit item image
+	 */
+	private static final String itemEditImageLocation = "/icons/filteredit.gif"; //$NON-NLS-1$
+
+	/**
+	 * Remove item image
+	 */
+	private static final String itemRemoveImageLocation = "/icons/filterremove.gif"; //$NON-NLS-1$
+
+	/**
+	 * Advanced item image
+	 */
+	private static final String advancedImageLocation = "/icons/advancedfilter.gif"; //$NON-NLS-1$
+
+	/**
+	 * Name of the dialog
+	 */
+	private static final String dialogName = Messages
+			.getString("FilterDialog.DialogName"); //$NON-NLS-1$
+
+	/**
+	 * Indicates that applying the rules caused search dialog to be closed ->
+	 * reopen after filter
+	 */
+	private boolean closedSearchDialog;
+
+	/**
+	 * Advanced toolItem to switch to advanced view
+	 */
+	private ToolItem advancedItem;
+
+	/**
+	 * Advanced toolBar image
+	 */
+	private Image advancedImage;
+
+	/**
+	 * Radio buttons to implify if we are showing or hiding traces
+	 */
+	private Button[] showHideButton = new Button[2];
+
+	/**
+	 * Radio buttons to implify if we are ORring or ANDing
+	 */
+	private Button[] orAndButton = new Button[2];
+
+	/**
+	 * Advanced dialog
+	 */
+	private FilterAdvancedDialog advancedDialog;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parent
+	 *            parent shell
+	 * @param contentProvider
+	 *            contentprovider for the tree
+	 * @param treeRoot
+	 *            tree root
+	 */
+	public FilterDialog(Shell parent, TreeItemContentProvider contentProvider,
+			TreeItem treeRoot) {
+		super(parent, contentProvider, treeRoot);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseTreeDialog#export()
+	 */
+	@Override
+	public void export() {
+
+		// Export rules to XML file
+		XMLFilterConfigurationExporter exporter;
+
+		// Default configuration file
+		if (!TraceViewerPlugin.getDefault().getPreferenceStore().getString(
+				PreferenceConstants.CONFIGURATION_FILE).equals(
+				PreferenceConstants.DEFAULT_CONFIGURATION_FILE)) {
+			exporter = new XMLFilterConfigurationExporter(root,
+					TraceViewerPlugin.getDefault().getPreferenceStore()
+							.getString(PreferenceConstants.CONFIGURATION_FILE),
+					false);
+		} else {
+			exporter = new XMLFilterConfigurationExporter(root,
+					PreferenceConstants.DEFAULT_CONFIGURATION_FILE, true);
+		}
+
+		exporter.export();
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseTreeDialog#saveSettings()
+	 */
+	@Override
+	protected void saveSettings() {
+		super.saveSettings();
+
+		FilterRuleSet ruleSet = TraceViewerGlobals.getTraceViewer()
+				.getDataProcessorAccess().getFilterProcessor().getFilterRules();
+
+		// Save filters if something changed
+		if (somethingChanged) {
+			Object[] arr = viewer.getCheckedElements();
+			ruleSet.getFilterRules().clear();
+
+			LogicalOperator op;
+			if (orAndButton[0].getSelection()) {
+				op = LogicalOperator.OR;
+			} else {
+				op = LogicalOperator.AND;
+			}
+			FilterRuleSet set = new FilterRuleSet();
+			set.setOperator(op);
+
+			for (int i = 0; i < arr.length; i++) {
+				// Text rule, add to the end of the list
+				if (((FilterTreeItem) arr[i]).getRule() == FilterTreeItem.Rule.TEXT_RULE) {
+					set.addObject((FilterRuleObject) arr[i]);
+					// Component rule, add to the beginning of the list
+				} else if (((FilterTreeItem) arr[i]).getRule() == FilterTreeItem.Rule.COMPONENT_RULE) {
+					set.addObject(0, (FilterRuleObject) arr[i]);
+				}
+			}
+			if (set.getFilterRules().size() > 0) {
+				ruleSet.addObject(set);
+			}
+
+			// Set show / hide and logical operator to processor
+			TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+					.getFilterProcessor().setShowTracesContainingRule(
+							showHideButton[0].getSelection());
+			TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+					.getFilterProcessor().setLogicalOrInUse(
+							orAndButton[0].getSelection());
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseTreeDialog#restoreSettings()
+	 */
+	@Override
+	protected void restoreSettings() {
+		super.restoreSettings();
+
+		// Get rule array
+		FilterRuleSet ruleSet = TraceViewerGlobals.getTraceViewer()
+				.getDataProcessorAccess().getFilterProcessor().getFilterRules();
+
+		// Check that the format of the rule sets is correct
+		if (!ruleSet.getFilterRules().isEmpty()
+				&& ruleSet.getFilterRules().get(0) instanceof FilterRuleSet) {
+			FilterRuleSet set = (FilterRuleSet) ruleSet.getFilterRules().get(0);
+
+			// Tree has to be re-checked
+			for (int i = 0; i < set.getFilterRules().size(); i++) {
+				FilterRuleObject obj = set.getFilterRules().get(i);
+
+				// Check instance type
+				if (obj instanceof FilterTreeItem) {
+					FilterTreeItem item = (FilterTreeItem) obj;
+					viewer.setChecked(item, true);
+					checkboxStateListener.checkStateChanged(item);
+				}
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseTreeDialog#createDialogContents()
+	 */
+	@Override
+	protected void createDialogContents() {
+		super.doInitialSetup();
+
+		// Shell & composite
+		GridLayout shellGridLayout = new GridLayout();
+		shellGridLayout.numColumns = 3;
+		shellGridLayout.horizontalSpacing = 3;
+		getShell().setText(dialogName);
+		root.setName(dialogName);
+		composite.setLayout(shellGridLayout);
+		getShell().setMinimumSize(new Point(300, 450));
+		createToolBar();
+		super.createTree();
+
+		// Filter settings group
+		GridLayout filterSettingsGroupGridLayout = new GridLayout();
+		filterSettingsGroupGridLayout.numColumns = 4;
+		Group filterSettingsGroup = new Group(composite, SWT.NONE);
+		filterSettingsGroup.setText(Messages
+				.getString("FilterDialog.SettingsGroupName")); //$NON-NLS-1$
+		filterSettingsGroup.setLayout(filterSettingsGroupGridLayout);
+		GridData filterSettingsGroupGridData = new GridData();
+		filterSettingsGroupGridData.horizontalSpan = 3;
+		filterSettingsGroupGridData.horizontalAlignment = SWT.FILL;
+		filterSettingsGroup.setLayoutData(filterSettingsGroupGridData);
+
+		// Show hide Button
+		GridLayout comp1GridLayout = new GridLayout();
+		comp1GridLayout.numColumns = 2;
+		comp1GridLayout.verticalSpacing = 0;
+		comp1GridLayout.marginHeight = 0;
+		Composite comp1 = new Composite(filterSettingsGroup, SWT.NONE);
+		comp1.setLayout(comp1GridLayout);
+		showHideButton[0] = new Button(comp1, SWT.RADIO);
+		showHideButton[0].setText(Messages
+				.getString("FilterDialog.ShowButtonText")); //$NON-NLS-1$
+		showHideButton[0].setToolTipText(Messages
+				.getString("FilterDialog.ShowButtonToolTip")); //$NON-NLS-1$
+		showHideButton[1] = new Button(comp1, SWT.RADIO);
+		showHideButton[1].setText(Messages
+				.getString("FilterDialog.HideButtonText")); //$NON-NLS-1$
+		showHideButton[1].setToolTipText(Messages
+				.getString("FilterDialog.HideButtonToolTip")); //$NON-NLS-1$
+		boolean show = TraceViewerGlobals.getTraceViewer()
+				.getDataProcessorAccess().getFilterProcessor()
+				.isShowTracesContainingRule();
+		showHideButton[0].setSelection(show);
+		showHideButton[1].setSelection(!show);
+
+		// Spacer label
+		GridData spacerGridData = new GridData();
+		spacerGridData.grabExcessHorizontalSpace = true;
+		spacerGridData.horizontalAlignment = SWT.FILL;
+		Label spacer = new Label(filterSettingsGroup, SWT.NONE);
+		spacer.setLayoutData(spacerGridData);
+
+		// Or And Button
+		GridLayout comp2GridLayout = new GridLayout();
+		comp2GridLayout.numColumns = 2;
+		comp2GridLayout.verticalSpacing = 0;
+		comp2GridLayout.marginHeight = 0;
+		Composite comp2 = new Composite(filterSettingsGroup, SWT.NONE);
+		comp2.setLayout(comp2GridLayout);
+		orAndButton[0] = new Button(comp2, SWT.RADIO);
+		orAndButton[0].setText(Messages.getString("FilterDialog.OrButtonText")); //$NON-NLS-1$
+		orAndButton[0].setToolTipText(Messages
+				.getString("FilterDialog.ORRuleToolTip")); //$NON-NLS-1$
+		orAndButton[0].setSelection(true);
+		orAndButton[1] = new Button(comp2, SWT.RADIO);
+		orAndButton[1]
+				.setText(Messages.getString("FilterDialog.AndButtonText")); //$NON-NLS-1$
+		orAndButton[1].setToolTipText(Messages
+				.getString("FilterDialog.ANDRuleToolTip")); //$NON-NLS-1$
+		boolean logicalOr = TraceViewerGlobals.getTraceViewer()
+				.getDataProcessorAccess().getFilterProcessor()
+				.isLogicalOrInUse();
+		orAndButton[0].setSelection(logicalOr);
+		orAndButton[1].setSelection(!logicalOr);
+
+		// Spacer label 2
+		GridData spacer2GridData = new GridData();
+		spacer2GridData.grabExcessHorizontalSpace = true;
+		spacer2GridData.horizontalAlignment = SWT.FILL;
+		Label spacer2 = new Label(composite, SWT.NONE);
+		spacer2.setLayoutData(spacer2GridData);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseTreeDialog#createToolBar()
+	 */
+	@Override
+	public void createToolBar() {
+		super.createToolBar(itemAddImageLocation, itemEditImageLocation,
+				itemRemoveImageLocation);
+
+		// Add advanded filter ToolBar Item
+		advancedItem = new ToolItem(toolBar, SWT.PUSH);
+		advancedItem.setText(Messages
+				.getString("FilterDialog.AdvancedItemText")); //$NON-NLS-1$
+		advancedItem.setToolTipText(Messages
+				.getString("FilterDialog.AdvancedViewToolTip")); //$NON-NLS-1$
+		URL url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				advancedImageLocation);
+		advancedImage = ImageDescriptor.createFromURL(url).createImage();
+		advancedItem.setImage(advancedImage);
+	}
+
+	/**
+	 * Opens the search dialog
+	 */
+	public void openSearchDialog() {
+		TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+				.getSearchProcessor().getSearchDialog().openDialog();
+	}
+
+	/**
+	 * Closes the search dialog
+	 */
+	private void closeSearchDialog() {
+		// If search dialog is open, close it because data is going to
+		// change
+		if (TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+				.getSearchProcessor().disposeSearchDialog()) {
+			closedSearchDialog = true;
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseTreeDialog#processAddGroupAction()
+	 */
+	@Override
+	protected void processAddGroupAction() {
+		String name = Messages.getString("FilterDialog.NewGroupText"); //$NON-NLS-1$
+		InputDialog dialog = new InputDialog(getShell(), name, Messages
+				.getString("FilterDialog.NewGroupDialogInfo"), name, null); //$NON-NLS-1$
+		int ret = dialog.open();
+		if (ret == Window.OK) {
+			name = dialog.getValue();
+			// Get parent node
+
+			Object selection = getSelectedGroup();
+			FilterTreeItem item = new FilterTreeBaseItem(contentProvider,
+					selection, name, FilterTreeItem.Rule.GROUP);
+
+			((FilterTreeItem) selection).addChild(item);
+			viewer.expandToLevel(item, 0);
+
+			somethingChanged = true;
+		}
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.dialog.BaseTreeDialog#processApplyButtonAction()
+	 */
+	@Override
+	protected void processApplyButtonAction() {
+		// If advanced dialog exists, set its rules as not applied
+		if (advancedDialog != null) {
+			advancedDialog.exitStatus = ExitStatus.NORMAL;
+		}
+
+		// Remove advanced filter string from processor
+		TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+				.getFilterProcessor().setAdvancedFilterString(""); //$NON-NLS-1$
+
+		closedSearchDialog = false;
+		saveSettings();
+
+		int maxLines = TraceViewerGlobals.getTraceViewer()
+				.getDataReaderAccess().getMainDataReader().getTraceCount();
+
+		// Create new file from filters
+		if (TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+				.getFilterProcessor().hasRules()
+				&& somethingChanged) {
+			applyFilters(maxLines);
+
+			// All filters removed
+		} else if (somethingChanged
+				&& TraceViewerGlobals.getTraceViewer().getDataReaderAccess()
+						.getCurrentDataReader() != TraceViewerGlobals
+						.getTraceViewer().getDataReaderAccess()
+						.getMainDataReader()) {
+			removeFilters(maxLines);
+
+		}
+
+		// Open search dialog if it was closed
+		if (closedSearchDialog) {
+			openSearchDialog();
+		}
+
+		// Insert this to NOT run saveSettings again
+		somethingChanged = false;
+	}
+
+	/**
+	 * Remove filters
+	 * 
+	 * @param maxLines
+	 *            number of traces
+	 */
+	public void removeFilters(int maxLines) {
+		// If still using external filter or has other rules, apply filters
+		// instead of removing them
+		if (TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+				.getFilterProcessor().isFiltering()) {
+			applyFilters(maxLines);
+		} else {
+			// Close search dialog if it's necessary
+			closeSearchDialog();
+
+			// Empty the tree view of checked items
+			if (viewer != null && !viewer.getTree().isDisposed()) {
+				viewer.setCheckedElements(new Object[0]);
+			}
+
+			DataReaderAccess access = TraceViewerGlobals.getTraceViewer()
+					.getDataReaderAccess();
+
+			// If filter data reader exists, close the data reader
+			if (access.getCurrentDataReader() != access.getMainDataReader()) {
+
+				access.getCurrentDataReader().shutdown();
+			}
+
+			// Delete scroll reader and set main data reader as current data
+			// reader
+			access.deleteScrollReader();
+			access.setCurrentDataReader(access.getMainDataReader());
+
+			// Start reading data from the beginning
+			TraceViewerGlobals.getTraceViewer().readDataFileFromBeginning();
+			TraceViewerGlobals.getTraceViewer().getView().updateViewName();
+
+			// Hide dialog and open progressbar only if there is at least one
+			// trace
+			if (maxLines > 0) {
+				Shell shell = getShell();
+				if (shell != null && !shell.isDisposed()) {
+					shell.setVisible(false);
+				}
+				progressBarDialog = (ProgressBarDialog) TraceViewerGlobals
+						.getTraceViewer().getDialogs().createDialog(
+								Dialog.PROGRESSBAR);
+				progressBarDialog.open(maxLines, clearProcessReason);
+			}
+		}
+	}
+
+	/**
+	 * Apply filters
+	 * 
+	 * @param maxLines
+	 *            number of traces
+	 */
+	public void applyFilters(int maxLines) {
+		// Close search dialog if it's necessary
+		closeSearchDialog();
+
+		TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+				.getFilterProcessor().createFilteredFile();
+
+		TraceViewerGlobals.getTraceViewer().getView().updateViewName();
+
+		// Hide dialog and open progressbar only if there is at least one trace
+		if (maxLines > 0) {
+			Shell shell = getShell();
+			if (shell != null && !shell.isDisposed()) {
+				shell.setVisible(false);
+			}
+			progressBarDialog = (ProgressBarDialog) TraceViewerGlobals
+					.getTraceViewer().getDialogs().createDialog(
+							Dialog.PROGRESSBAR);
+
+			// Open progressbar
+			progressBarDialog.open(maxLines, filterProcessReason);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseDialog#createActionListeners()
+	 */
+	@Override
+	public void createActionListeners() {
+		super.createActionListeners();
+
+		// Add selection listener to advanced button
+		advancedItem.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				TraceViewerGlobals.postUiEvent("AdvancedButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+				if (getShell() != null) {
+					getShell().close();
+				}
+				changeToAdvancedView();
+				TraceViewerGlobals.postUiEvent("AdvancedButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+			}
+		});
+
+		// Add selection listener to OR radio button
+		orAndButton[0].addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				TraceViewerGlobals.postUiEvent("OrRadioButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+				somethingChanged = true;
+				TraceViewerGlobals.postUiEvent("OrRadioButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+			}
+		});
+
+		// Add selection listener to AND radio button
+		orAndButton[1].addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				TraceViewerGlobals.postUiEvent("AndRadioButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+				somethingChanged = true;
+				TraceViewerGlobals.postUiEvent("AndRadioButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+			}
+		});
+
+		// Add selection listener to SHOW radio button
+		showHideButton[0].addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				TraceViewerGlobals.postUiEvent("ShowRadioButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+				somethingChanged = true;
+				TraceViewerGlobals.postUiEvent("ShowRadioButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+			}
+		});
+
+		// Add selection listener to HIDE radio button
+		showHideButton[1].addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				TraceViewerGlobals.postUiEvent("HideRadioButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+				somethingChanged = true;
+				TraceViewerGlobals.postUiEvent("HideRadioButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+			}
+		});
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseTreeDialog#dispose()
+	 */
+	@Override
+	protected void dispose() {
+		super.dispose();
+		if (advancedImage != null) {
+			advancedImage.dispose();
+		}
+	}
+
+	/**
+	 * Gets advanced dialog
+	 * 
+	 * @return the advancedDialog
+	 */
+	public FilterAdvancedDialog getAdvancedDialog() {
+		if (advancedDialog == null) {
+			advancedDialog = (FilterAdvancedDialog) TraceViewerGlobals
+					.getTraceViewer().getDialogs().createDialog(
+							Dialog.ADVANCEDFILTER);
+		}
+		return advancedDialog;
+	}
+
+	/**
+	 * Change to advanced view
+	 */
+	private void changeToAdvancedView() {
+
+		// Create if doesn't exits
+		advancedDialog = getAdvancedDialog();
+		advancedDialog.openDialog();
+
+		// Check if apply button was clicked
+		if (advancedDialog.exitStatus == ExitStatus.APPLYBUTTON) {
+			TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+					.getFilterProcessor().setShowTracesContainingRule(
+							advancedDialog.isShowTracesContainingRule());
+			TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+					.getFilterProcessor().getFilterRules().getFilterRules()
+					.clear();
+
+			int maxLines = TraceViewerGlobals.getTraceViewer()
+					.getDataReaderAccess().getMainDataReader().getTraceCount();
+
+			// Check if there are rules set in the advanced dialog
+			if (advancedDialog.getRuleSet() != null) {
+				TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+						.getFilterProcessor().getFilterRules().addObject(
+								advancedDialog.getRuleSet());
+
+				// Apply filters
+				applyFilters(maxLines);
+
+				// Remove filters
+			} else {
+				removeFilters(maxLines);
+			}
+
+			// Open search dialog if it was closed
+			if (closedSearchDialog) {
+				openSearchDialog();
+			}
+
+			// Simple button clicked from advanced view
+		} else if (advancedDialog.exitStatus == ExitStatus.SIMPLEBUTTON) {
+			open();
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseDialog#open()
+	 */
+	@Override
+	public int open() {
+		int ret;
+
+		boolean openAdvanced = false;
+
+		// Check if filter dialog was closed from advanced view
+		if (advancedDialog != null) {
+			if (advancedDialog.exitStatus == ExitStatus.APPLYBUTTON
+					|| advancedDialog.exitStatus == ExitStatus.CANCELBUTTON) {
+				openAdvanced = true;
+			}
+		}
+
+		// Open normal view
+		if (!openAdvanced) {
+			ret = super.open();
+
+			// Open advanced view
+		} else {
+			ret = CANCEL;
+			changeToAdvancedView();
+		}
+
+		return ret;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.dialog.BaseTreeDialog#getPropertyDialog(java.lang
+	 * .Object)
+	 */
+	@Override
+	protected BasePropertyDialog getPropertyDialog(Object selection,
+			boolean editOldItem) {
+		FilterTreeItem oldItem = null;
+		if (editOldItem) {
+			oldItem = (FilterTreeItem) selection;
+		}
+		FilterPropertyDialog dialog = new FilterPropertyDialog(getShell(),
+				oldItem, contentProvider, selection, viewer);
+		return dialog;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/FilterPropertyDialog.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,415 @@
+/*
+ * 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:
+ *
+ * Filter Property Dialog class
+ *
+ */
+package com.nokia.traceviewer.dialog;
+
+import java.util.List;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Shell;
+
+import com.nokia.traceviewer.dialog.treeitem.FilterTreeComponentItem;
+import com.nokia.traceviewer.dialog.treeitem.FilterTreeItem;
+import com.nokia.traceviewer.dialog.treeitem.FilterTreeTextItem;
+import com.nokia.traceviewer.dialog.treeitem.TreeItem;
+import com.nokia.traceviewer.dialog.treeitem.TreeItemListener;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.activation.TraceActivationComponentItem;
+import com.nokia.traceviewer.engine.activation.TraceActivationGroupItem;
+
+/**
+ * Filter Property Dialog class
+ */
+public class FilterPropertyDialog extends BasePropertyDialog {
+
+	/**
+	 * Text to show when Text rule is selected
+	 */
+	private static final String TEXT_RULE_INFORMATION_TEXT = Messages
+			.getString("FilterPropertyDialog.TextRuleInformation"); //$NON-NLS-1$
+
+	/**
+	 * Text to show when Component rule is selected
+	 */
+	private static final String COMPONENT_RULE_INFORMATION_TEXT = Messages
+			.getString("FilterPropertyDialog.ComponentRuleInfoLine1") //$NON-NLS-1$
+			+ WILDCARD_STRING
+			+ Messages.getString("FilterPropertyDialog.ComponentRuleInfoLine2"); //$NON-NLS-1$
+
+	/**
+	 * Old item used when editing it
+	 */
+	private FilterTreeItem oldItem;
+
+	/**
+	 * Selected item in tree
+	 */
+	private final FilterTreeItem selectedItem;
+
+	/**
+	 * TreeItem listener
+	 */
+	private final TreeItemListener listener;
+
+	/**
+	 * TreeViewer from main filter dialog
+	 */
+	private final TreeViewer viewer;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parent
+	 *            Parent shell
+	 * @param newItem
+	 *            TreeItem to modify, null if creating new one
+	 * @param listener
+	 *            TreeItem listener
+	 * @param selected
+	 *            selected item in tree
+	 * @param viewer
+	 *            tree viewer from filter dialog
+	 */
+	public FilterPropertyDialog(Shell parent, FilterTreeItem newItem,
+			TreeItemListener listener, Object selected, TreeViewer viewer) {
+		super(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
+		this.newItem = newItem;
+		this.selectedItem = (FilterTreeItem) selected;
+		this.listener = listener;
+		this.viewer = viewer;
+
+		// If edit, save the old item to insert info to fields
+		if (newItem != null) {
+			oldItem = newItem;
+			textFieldTouched = true;
+			nameFieldTouched = true;
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseDialog#createDialogContents()
+	 */
+	@Override
+	protected void createDialogContents() {
+		getShell().setText(
+				Messages.getString("FilterPropertyDialog.ShellTitle")); //$NON-NLS-1$
+		createMainComposite();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.dialog.BasePropertyDialog#insertDataToUpperComposite
+	 * ()
+	 */
+	@Override
+	protected void insertDataToUpperComposite() {
+		nameLabel.setText(Messages
+				.getString("FilterPropertyDialog.FilterNameText")); //$NON-NLS-1$
+		// Set data from old item
+		if (oldItem != null) {
+			nameText.setText(oldItem.getName());
+			if (oldItem.getRule() == FilterTreeItem.Rule.TEXT_RULE) {
+				selectedRuleLabel.setText(TEXT_RULE_NAME);
+			} else if (oldItem.getRule() == FilterTreeItem.Rule.COMPONENT_RULE) {
+				selectedRuleLabel.setText(COMPONENT_RULE_NAME);
+			} else {
+				selectedRuleLabel.setText(TEXT_RULE_NAME);
+			}
+		} else {
+			selectedRuleLabel.setText(TEXT_RULE_NAME);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BasePropertyDialog#setListSelection()
+	 */
+	@Override
+	protected void setListSelection() {
+		ruleList.add(TEXT_RULE_NAME, TEXT_RULE_INDEX);
+		ruleList.add(COMPONENT_RULE_NAME, COMPONENT_RULE_INDEX);
+		// Set list selection
+		if (oldItem != null) {
+			if (oldItem.getRule() == FilterTreeItem.Rule.TEXT_RULE) {
+				ruleList.setSelection(TEXT_RULE_INDEX);
+			} else if (oldItem.getRule() == FilterTreeItem.Rule.COMPONENT_RULE) {
+				ruleList.setSelection(COMPONENT_RULE_INDEX);
+			}
+		} else {
+			ruleList.setSelection(TEXT_RULE_INDEX);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.dialog.BasePropertyDialog#insertDataToTextFields()
+	 */
+	@Override
+	protected void insertDataToTextFields() {
+		if (oldItem instanceof FilterTreeTextItem) {
+			FilterTreeTextItem item = (FilterTreeTextItem) oldItem;
+			if (item.getText() != null) {
+				textText.setText(item.getText());
+			}
+			matchCaseCheckBox.setSelection(item.isMatchCase());
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.dialog.BasePropertyDialog#insertDataToComponentFields
+	 * ()
+	 */
+	@Override
+	protected void insertDataToComponentFields() {
+		// Get component list
+		List<TraceActivationComponentItem> components = null;
+		if (TraceViewerGlobals.getDecodeProvider() != null) {
+			components = TraceViewerGlobals.getDecodeProvider()
+					.getActivationInformation(false);
+		}
+
+		// Insert data to fields
+		if (oldItem instanceof FilterTreeComponentItem) {
+			FilterTreeComponentItem item = (FilterTreeComponentItem) oldItem;
+			if (item.getComponentId() == WILDCARD_INTEGER) {
+				componentTextField.setText(WILDCARD_STRING);
+			} else {
+				componentTextField.setText(HEX_PREFIX
+						+ Integer.toHexString(item.getComponentId()));
+			}
+			if (item.getGroupId() == WILDCARD_INTEGER) {
+				groupTextField.setText(WILDCARD_STRING);
+			} else {
+				groupTextField.setText(HEX_PREFIX
+						+ Integer.toHexString(item.getGroupId()));
+			}
+
+			// Loop through components
+			if (components != null) {
+				for (int i = 0; i < components.size(); i++) {
+					if (components.get(i).getId() == item.getComponentId()) {
+						componentNameLabel.setText(components.get(i).getName());
+						// Get groups
+						List<TraceActivationGroupItem> groups = components.get(
+								i).getGroups();
+						// Loop through groups
+						for (int j = 0; j < groups.size(); j++) {
+							if (groups.get(j).getId() == item.getGroupId()) {
+								groupNameLabel.setText(groups.get(j).getName());
+								break;
+							}
+						}
+						break;
+					}
+				}
+			}
+		}
+
+		// Disable change component / group buttons if no components are
+		// available
+		if (components == null || components.size() <= 0) {
+			changeComponentButton.setEnabled(false);
+			changeGroupButton.setEnabled(false);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+	 */
+	@Override
+	protected void okPressed() {
+		TraceViewerGlobals.postUiEvent("OkButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+		// Save the position of this item to set it back after creation
+		// and remove the old child
+		int pos = 0;
+		FilterTreeItem parent = selectedItem;
+		if (oldItem != null) {
+			pos = getOldPosition();
+			parent = (FilterTreeItem) oldItem.getParent();
+			parent.removeChild(oldItem);
+		}
+
+		// Create new FilterTextItem
+		if (ruleList.getSelectionIndex() == TEXT_RULE_INDEX) {
+			newItem = new FilterTreeTextItem(listener, parent, nameText
+					.getText(), FilterTreeItem.Rule.TEXT_RULE, textText
+					.getText(), matchCaseCheckBox.getSelection());
+
+			// Create new FilterTreeComponentItem
+		} else if (ruleList.getSelectionIndex() == COMPONENT_RULE_INDEX) {
+			int componentId = WILDCARD_INTEGER;
+			int groupId = WILDCARD_INTEGER;
+
+			// Get component ID
+			try {
+				String cid = componentTextField.getText();
+				if (cid.substring(0, HEX_PREFIX.length()).equals(HEX_PREFIX)) {
+					cid = cid.substring(HEX_PREFIX.length());
+				}
+				componentId = Integer.parseInt(cid, HEX_RADIX);
+			} catch (Exception e) {
+			}
+
+			// Get group ID
+			try {
+				String gid = groupTextField.getText();
+				if (gid.substring(0, HEX_PREFIX.length()).equals(HEX_PREFIX)) {
+					gid = gid.substring(HEX_PREFIX.length());
+				}
+				groupId = Integer.parseInt(gid, HEX_RADIX);
+			} catch (Exception e) {
+			}
+
+			// Create new FilterTreeComponentItem
+			newItem = new FilterTreeComponentItem(listener, parent, nameText
+					.getText(), FilterTreeItem.Rule.COMPONENT_RULE,
+					componentId, groupId);
+		} else {
+			// No other rules defined yet
+		}
+
+		// Check for possible rule name conflicts
+		checkNameConflict(newItem);
+
+		// Add mode
+		if (parent.equals(selectedItem)) {
+			parent.addChild(newItem);
+
+			// Edit mode
+		} else {
+			parent.addChild(pos, newItem);
+		}
+
+		TraceViewerGlobals.postUiEvent("OkButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+		super.okPressed();
+	}
+
+	/**
+	 * Check that a item with the same name doesn't already exist
+	 * 
+	 * @param item
+	 *            item to check
+	 */
+	void checkNameConflict(TreeItem item) {
+		String originalName = item.getName();
+
+		// Change spaces to underscores
+		originalName = originalName.replace(' ', '_');
+
+		// Change AND to and and OR to or to not to conflict with logical
+		// operatations
+		originalName = originalName.replace("AND", "and"); //$NON-NLS-1$ //$NON-NLS-2$
+		originalName = originalName.replace("OR", "or"); //$NON-NLS-1$ //$NON-NLS-2$
+		originalName = originalName.replace("NOT", "not"); //$NON-NLS-1$ //$NON-NLS-2$
+
+		// Remove brackets
+		originalName = originalName.replace("(", ""); //$NON-NLS-1$ //$NON-NLS-2$
+		originalName = originalName.replace(")", ""); //$NON-NLS-1$ //$NON-NLS-2$
+
+		item.setName(originalName);
+
+		// Check that a item with the same name doesn't already exist
+		org.eclipse.swt.widgets.TreeItem oldItem = findItemWithName(
+				originalName, viewer.getTree().getTopItem());
+		int i = 1;
+
+		// Change the name until it can't be found again
+		while (oldItem != null) {
+			item.setName(originalName + "_" + ++i); //$NON-NLS-1$
+			oldItem = findItemWithName(item.getName(), viewer.getTree()
+					.getTopItem());
+		}
+	}
+
+	/**
+	 * Finds item from tree items
+	 * 
+	 * @param name
+	 *            the name to search for
+	 * @param item
+	 *            item to check for
+	 * @return item if found, null otherwise
+	 */
+	private org.eclipse.swt.widgets.TreeItem findItemWithName(String name,
+			org.eclipse.swt.widgets.TreeItem item) {
+		org.eclipse.swt.widgets.TreeItem retItem = null;
+
+		// Has children, recurse
+		if (item.getItemCount() > 0) {
+			for (int i = 0; i < item.getItemCount() && retItem == null; i++) {
+				retItem = findItemWithName(name, item.getItems()[i]);
+			}
+
+			// Check the rule
+		} else {
+			if (item.getText().equals(name)) {
+				retItem = item;
+			}
+		}
+
+		return retItem;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.dialog.BasePropertyDialog#setInformationLabel()
+	 */
+	@Override
+	protected void setInformationLabel() {
+		if (ruleList.getSelectionIndex() == TEXT_RULE_INDEX) {
+			informationLabel.setText(TEXT_RULE_INFORMATION_TEXT);
+			selectedRuleLabel.setText(TEXT_RULE_NAME);
+		} else if (ruleList.getSelectionIndex() == COMPONENT_RULE_INDEX) {
+			informationLabel.setText(COMPONENT_RULE_INFORMATION_TEXT);
+			selectedRuleLabel.setText(COMPONENT_RULE_NAME);
+		}
+	}
+
+	/**
+	 * Gets old position of this item
+	 * 
+	 * @return old position
+	 */
+	protected int getOldPosition() {
+		FilterTreeItem item = (FilterTreeItem) oldItem.getParent();
+		Object[] children = item.getChildren();
+		int pos = 0;
+		for (int i = 0; i < children.length; i++) {
+			if (children[i].equals(oldItem)) {
+				pos = i;
+				break;
+			}
+		}
+		return pos;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/LineCountDialog.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,404 @@
+/*
+ * 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:
+ *
+ * Line counting Dialog class
+ *
+ */
+package com.nokia.traceviewer.dialog;
+
+import java.util.List;
+
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Shell;
+
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.action.TraceViewerActionUtils;
+import com.nokia.traceviewer.dialog.treeitem.LineCountTreeBaseItem;
+import com.nokia.traceviewer.dialog.treeitem.LineCountTreeComponentItem;
+import com.nokia.traceviewer.dialog.treeitem.LineCountTreeItem;
+import com.nokia.traceviewer.dialog.treeitem.LineCountTreeTextItem;
+import com.nokia.traceviewer.dialog.treeitem.TreeItem;
+import com.nokia.traceviewer.dialog.treeitem.TreeItemContentProvider;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.TraceViewerPropertyViewInterface;
+import com.nokia.traceviewer.engine.TraceViewerDialogInterface.Dialog;
+import com.nokia.traceviewer.engine.dataprocessor.LineCountItem;
+import com.nokia.traceviewer.engine.preferences.PreferenceConstants;
+import com.nokia.traceviewer.engine.preferences.XMLLineCountConfigurationExporter;
+
+/**
+ * Line counting Dialog class
+ */
+public final class LineCountDialog extends BaseTreeDialog {
+
+	/**
+	 * Processing reason to give to progressBar dialog
+	 */
+	private static final String processReason = Messages
+			.getString("LineCountDialog.ProcessReason"); //$NON-NLS-1$
+
+	/**
+	 * Add item image
+	 */
+	private static final String itemAddImageLocation = "/icons/filteradd.gif"; //$NON-NLS-1$
+
+	/**
+	 * Edit item image
+	 */
+	private static final String itemEditImageLocation = "/icons/filteredit.gif"; //$NON-NLS-1$
+
+	/**
+	 * Remove item image
+	 */
+	private static final String itemRemoveImageLocation = "/icons/filterremove.gif"; //$NON-NLS-1$
+
+	/**
+	 * Dialog name
+	 */
+	private static final String dialogName = "Line Count Rules"; //$NON-NLS-1$
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parent
+	 *            parent shell
+	 * @param contentProvider
+	 *            contentprovider for the tree
+	 * @param treeRoot
+	 *            tree root
+	 */
+	public LineCountDialog(Shell parent,
+			TreeItemContentProvider contentProvider, TreeItem treeRoot) {
+		super(parent, contentProvider, treeRoot);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseTreeDialog#export()
+	 */
+	@Override
+	public void export() {
+
+		// Export rules to XML file
+		XMLLineCountConfigurationExporter exporter;
+
+		// Default configuration file
+		if (!TraceViewerPlugin.getDefault().getPreferenceStore().getString(
+				PreferenceConstants.CONFIGURATION_FILE).equals(
+				PreferenceConstants.DEFAULT_CONFIGURATION_FILE)) {
+			exporter = new XMLLineCountConfigurationExporter(root,
+					TraceViewerPlugin.getDefault().getPreferenceStore()
+							.getString(PreferenceConstants.CONFIGURATION_FILE),
+					false);
+		} else {
+			exporter = new XMLLineCountConfigurationExporter(root,
+					PreferenceConstants.DEFAULT_CONFIGURATION_FILE, true);
+		}
+
+		exporter.export();
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseTreeDialog#saveSettings()
+	 */
+	@Override
+	public void saveSettings() {
+		super.saveSettings();
+
+		// Save LineCountItems if something changed
+		if (somethingChanged && !viewer.getControl().isDisposed()) {
+			Object[] arr = viewer.getCheckedElements();
+
+			// Get and clear all old rules and items
+			List<LineCountItem> lineCountItems = TraceViewerGlobals
+					.getTraceViewer().getDataProcessorAccess()
+					.getLineCountProcessor().getLineCountItems();
+			List<LineCountTreeTextItem> textRules = TraceViewerGlobals
+					.getTraceViewer().getDataProcessorAccess()
+					.getLineCountProcessor().getTextRules();
+			List<LineCountTreeComponentItem> componentRules = TraceViewerGlobals
+					.getTraceViewer().getDataProcessorAccess()
+					.getLineCountProcessor().getComponentRules();
+			lineCountItems.clear();
+			textRules.clear();
+			componentRules.clear();
+
+			// Save rules
+			for (int i = 0; i < arr.length; i++) {
+				LineCountTreeItem listItem = (LineCountTreeItem) arr[i];
+				// Text rules
+				if (listItem.getRule() == LineCountTreeItem.Rule.TEXT_RULE) {
+					textRules.add((LineCountTreeTextItem) listItem);
+					// Component rules
+				} else if (listItem.getRule() == LineCountTreeItem.Rule.COMPONENT_RULE) {
+					componentRules.add((LineCountTreeComponentItem) listItem);
+				}
+			}
+
+			// Insert rules to LineCountItem lists starting from component rules
+			for (int i = 0; i < componentRules.size(); i++) {
+				LineCountItem item = new LineCountItem(componentRules.get(i)
+						.getName(), 0);
+				lineCountItems.add(item);
+			}
+			// Text rules
+			for (int i = 0; i < textRules.size(); i++) {
+				LineCountItem item = new LineCountItem(textRules.get(i)
+						.getName(), 0);
+				lineCountItems.add(item);
+			}
+
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseTreeDialog#restoreSettings()
+	 */
+	@Override
+	protected void restoreSettings() {
+		super.restoreSettings();
+
+		// Get rule arrays
+		List<LineCountTreeTextItem> textRules = TraceViewerGlobals
+				.getTraceViewer().getDataProcessorAccess()
+				.getLineCountProcessor().getTextRules();
+		List<LineCountTreeComponentItem> componentRules = TraceViewerGlobals
+				.getTraceViewer().getDataProcessorAccess()
+				.getLineCountProcessor().getComponentRules();
+
+		// Tree has to be re-checked
+		for (int i = 0; i < textRules.size(); i++) {
+			LineCountTreeTextItem item = textRules.get(i);
+			viewer.setChecked(item, true);
+			checkboxStateListener.checkStateChanged(item);
+		}
+		for (int i = 0; i < componentRules.size(); i++) {
+			LineCountTreeComponentItem item = componentRules.get(i);
+			viewer.setChecked(item, true);
+			checkboxStateListener.checkStateChanged(item);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseDialog#createDialogContents()
+	 */
+	@Override
+	protected void createDialogContents() {
+		super.createDialogContents(dialogName);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseTreeDialog#createToolBar()
+	 */
+	@Override
+	public void createToolBar() {
+		super.createToolBar(itemAddImageLocation, itemEditImageLocation,
+				itemRemoveImageLocation);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseTreeDialog#processAddGroupAction()
+	 */
+	@Override
+	protected void processAddGroupAction() {
+		String name = Messages.getString("LineCountDialog.NewGroupText"); //$NON-NLS-1$
+		InputDialog dialog = new InputDialog(getShell(), name, Messages
+				.getString("LineCountDialog.NewGroupDialogInfo"), name, null); //$NON-NLS-1$
+		int ret = dialog.open();
+		if (ret == Window.OK) {
+			name = dialog.getValue();
+			// Get parent node
+
+			Object selection = getSelectedGroup();
+			LineCountTreeItem item = new LineCountTreeBaseItem(contentProvider,
+					selection, name, LineCountTreeItem.Rule.GROUP);
+			((LineCountTreeItem) selection).addChild(item);
+			viewer.expandToLevel(item, 0);
+
+			somethingChanged = true;
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.dialog.BaseTreeDialog#processApplyButtonAction()
+	 */
+	@Override
+	protected void processApplyButtonAction() {
+		saveSettings();
+
+		List<LineCountItem> items = TraceViewerGlobals.getTraceViewer()
+				.getDataProcessorAccess().getLineCountProcessor()
+				.getLineCountItems();
+
+		// Start counting lines from beginning
+		if (!items.isEmpty() && somethingChanged) {
+			TraceViewerPropertyViewInterface propView = TraceViewerGlobals
+					.getTraceViewer().getPropertyView();
+
+			if (propView != null && !propView.isDisposed()) {
+				propView.clearAll();
+				propView.createNewPropertyTableItems();
+				// View is not open, empty items from processors
+			} else {
+				TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+						.getLineCountProcessor().emptyLineCountItems();
+
+				TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+						.getVariableTracingProcessor()
+						.emptyVariableTracingItems();
+			}
+
+			// Set traces not to be shown in the view
+			TraceViewerGlobals.getTraceViewer().getDataReaderAccess()
+					.getCurrentDataReader().getTraceConfiguration()
+					.setShowInView(false);
+
+			int maxLines = TraceViewerGlobals.getTraceViewer()
+					.getDataReaderAccess().getCurrentDataReader()
+					.getTraceCount();
+
+			TraceViewerGlobals.getTraceViewer().getDataReaderAccess()
+					.getCurrentDataReader().setFilePosition(0);
+
+			// Open property view
+			TraceViewerActionUtils.openPropertyView();
+
+			// Hide dialog and open progressbar only if there is at least one
+			// trace
+			if (maxLines > 0) {
+				getShell().setVisible(false);
+				progressBarDialog = (ProgressBarDialog) TraceViewerGlobals
+						.getTraceViewer().getDialogs().createDialog(
+								Dialog.PROGRESSBAR);
+				progressBarDialog.open(maxLines, processReason);
+			}
+
+			// Set traces back to be shown in the view
+			TraceViewerGlobals.getTraceViewer().getDataReaderAccess()
+					.getCurrentDataReader().getTraceConfiguration()
+					.setShowInView(true);
+
+			// Removed all count line rules
+		} else if (somethingChanged) {
+			TraceViewerPropertyViewInterface view = TraceViewerGlobals
+					.getTraceViewer().getPropertyView();
+
+			if (view != null && !view.isDisposed()) {
+				view.createNewPropertyTableItems();
+			}
+		}
+
+		// Insert this to NOT run saveSettings again
+		somethingChanged = false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseTreeDialog#okPressed()
+	 */
+	@Override
+	protected void okPressed() {
+		TraceViewerGlobals.postUiEvent("OkButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+		saveSettings();
+		super.okPressed();
+		TraceViewerGlobals.postUiEvent("OkButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.dialog.BaseTreeDialog#getPropertyDialog(java.lang
+	 * .Object, boolean)
+	 */
+	@Override
+	protected BasePropertyDialog getPropertyDialog(Object selection,
+			boolean editOldItem) {
+		LineCountTreeItem oldItem = null;
+		if (editOldItem) {
+			oldItem = (LineCountTreeItem) selection;
+		}
+		LineCountPropertyDialog dialog = new LineCountPropertyDialog(
+				getShell(), oldItem, contentProvider, selection);
+		return dialog;
+	}
+
+	/**
+	 * Edits existing item or adds new one
+	 * 
+	 * @param itemIndex
+	 *            item index to be edited. If -1, create new one
+	 */
+	public void editOrAddItem(int itemIndex) {
+		TreeItem item = null;
+
+		// Create the dialog
+		create();
+
+		// Restore selected items to the tree
+		restoreSettings();
+
+		// Create new item
+		if (itemIndex == -1) {
+			item = processAddItemAction();
+
+			// Edit old one
+		} else {
+
+			List<LineCountTreeTextItem> textRules = TraceViewerGlobals
+					.getTraceViewer().getDataProcessorAccess()
+					.getLineCountProcessor().getTextRules();
+			List<LineCountTreeComponentItem> componentRules = TraceViewerGlobals
+					.getTraceViewer().getDataProcessorAccess()
+					.getLineCountProcessor().getComponentRules();
+			if (itemIndex < componentRules.size()) {
+				viewer.setSelection(new StructuredSelection(componentRules
+						.get(itemIndex)));
+			} else {
+				itemIndex -= componentRules.size();
+				viewer.setSelection(new StructuredSelection(textRules
+						.get(itemIndex)));
+			}
+
+			item = processEditItemAction();
+		}
+
+		if (item != null) {
+			// Apply the changes
+			somethingChanged = true;
+			okPressed();
+		} else {
+			cancelPressed();
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/LineCountPropertyDialog.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,337 @@
+/*
+ * 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:
+ *
+ * Line Count Property Dialog class
+ *
+ */
+package com.nokia.traceviewer.dialog;
+
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Shell;
+
+import com.nokia.traceviewer.dialog.treeitem.LineCountTreeComponentItem;
+import com.nokia.traceviewer.dialog.treeitem.LineCountTreeItem;
+import com.nokia.traceviewer.dialog.treeitem.LineCountTreeTextItem;
+import com.nokia.traceviewer.dialog.treeitem.TreeItemListener;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.activation.TraceActivationComponentItem;
+import com.nokia.traceviewer.engine.activation.TraceActivationGroupItem;
+
+/**
+ * Line Count Property Dialog class
+ * 
+ */
+public class LineCountPropertyDialog extends BasePropertyDialog {
+
+	/**
+	 * Text to show when Text rule is selected
+	 */
+	private static final String TEXT_RULE_INFORMATION_TEXT = Messages
+			.getString("LineCountPropertyDialog.TextRuleInfo"); //$NON-NLS-1$
+
+	/**
+	 * Text to show when Component rule is selected
+	 */
+	private static final String COMPONENT_RULE_INFORMATION_TEXT = Messages
+			.getString("LineCountPropertyDialog.ComponentRuleInfoLine1") //$NON-NLS-1$
+			+ WILDCARD_STRING
+			+ Messages
+					.getString("LineCountPropertyDialog.ComponentRuleInfoLine2"); //$NON-NLS-1$
+
+	/**
+	 * Old item used when editing
+	 */
+	private LineCountTreeItem oldItem;
+
+	/**
+	 * Selected item in tree
+	 */
+	private final LineCountTreeItem selectedItem;
+
+	/**
+	 * TreeItem listener
+	 */
+	private final TreeItemListener listener;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parent
+	 *            Parent shell
+	 * @param newItem
+	 *            TreeItem to modify, null if creating new one
+	 * @param listener
+	 *            TreeItem listener
+	 * @param selected
+	 *            selected item in tree
+	 */
+	public LineCountPropertyDialog(Shell parent, LineCountTreeItem newItem,
+			TreeItemListener listener, Object selected) {
+		super(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
+		this.newItem = newItem;
+		this.selectedItem = (LineCountTreeItem) selected;
+		this.listener = listener;
+
+		// If edit, save the old item to insert info to fields
+		if (newItem != null) {
+			oldItem = newItem;
+			textFieldTouched = true;
+			nameFieldTouched = true;
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseDialog#createDialogContents()
+	 */
+	@Override
+	protected void createDialogContents() {
+		getShell().setText(
+				Messages.getString("LineCountPropertyDialog.ShellTitle")); //$NON-NLS-1$
+		composite.setLayout(new GridLayout());
+		createMainComposite();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.dialog.BasePropertyDialog#insertDataToUpperComposite
+	 * ()
+	 */
+	@Override
+	protected void insertDataToUpperComposite() {
+		// Set data from old item
+		if (oldItem != null) {
+			nameText.setText(oldItem.getName());
+			if (oldItem.getRule() == LineCountTreeItem.Rule.TEXT_RULE) {
+				selectedRuleLabel.setText(TEXT_RULE_NAME);
+			} else if (oldItem.getRule() == LineCountTreeItem.Rule.TEXT_RULE) {
+				selectedRuleLabel.setText(COMPONENT_RULE_NAME);
+			} else {
+				selectedRuleLabel.setText(TEXT_RULE_NAME);
+			}
+		} else {
+			selectedRuleLabel.setText(TEXT_RULE_NAME);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BasePropertyDialog#setListSelection()
+	 */
+	@Override
+	protected void setListSelection() {
+		ruleList.add(TEXT_RULE_NAME, TEXT_RULE_INDEX);
+		ruleList.add(COMPONENT_RULE_NAME, COMPONENT_RULE_INDEX);
+		// Set list selection
+		if (oldItem != null) {
+			if (oldItem.getRule() == LineCountTreeItem.Rule.TEXT_RULE) {
+				ruleList.setSelection(TEXT_RULE_INDEX);
+			} else if (oldItem.getRule() == LineCountTreeItem.Rule.COMPONENT_RULE) {
+				ruleList.setSelection(COMPONENT_RULE_INDEX);
+			}
+		} else {
+			ruleList.setSelection(TEXT_RULE_INDEX);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.dialog.BasePropertyDialog#insertDataToTextFields()
+	 */
+	@Override
+	protected void insertDataToTextFields() {
+		if (oldItem instanceof LineCountTreeTextItem) {
+			LineCountTreeTextItem item = (LineCountTreeTextItem) oldItem;
+			if (item.getText() != null) {
+				textText.setText(item.getText());
+			}
+			matchCaseCheckBox.setSelection(item.isMatchCase());
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.dialog.BasePropertyDialog#insertDataToComponentFields
+	 * ()
+	 */
+	@Override
+	protected void insertDataToComponentFields() {
+		// Get component list
+		List<TraceActivationComponentItem> components = null;
+		if (TraceViewerGlobals.getDecodeProvider() != null) {
+			components = TraceViewerGlobals.getDecodeProvider()
+					.getActivationInformation(false);
+		}
+
+		// Insert data to fields
+		if (oldItem instanceof LineCountTreeComponentItem) {
+			LineCountTreeComponentItem item = (LineCountTreeComponentItem) oldItem;
+			if (item.getComponentId() == WILDCARD_INTEGER) {
+				componentTextField.setText(WILDCARD_STRING);
+			} else {
+				componentTextField.setText(HEX_PREFIX
+						+ Integer.toHexString(item.getComponentId()));
+			}
+			if (item.getGroupId() == WILDCARD_INTEGER) {
+				groupTextField.setText(WILDCARD_STRING);
+			} else {
+				groupTextField.setText(HEX_PREFIX
+						+ Integer.toHexString(item.getGroupId()));
+			}
+
+			// Loop through components
+			if (components != null) {
+				for (int i = 0; i < components.size(); i++) {
+					if (components.get(i).getId() == item.getComponentId()) {
+						componentNameLabel.setText(components.get(i).getName());
+						// Get groups
+						List<TraceActivationGroupItem> groups = components.get(
+								i).getGroups();
+						// Loop through groups
+						for (int j = 0; j < groups.size(); j++) {
+							if (groups.get(j).getId() == item.getGroupId()) {
+								groupNameLabel.setText(groups.get(j).getName());
+								break;
+							}
+						}
+						break;
+					}
+				}
+			}
+		}
+
+		// Disable change component / group buttons if no components are
+		// available
+		if (components == null || components.size() <= 0) {
+			changeComponentButton.setEnabled(false);
+			changeGroupButton.setEnabled(false);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+	 */
+	@Override
+	protected void okPressed() {
+		TraceViewerGlobals.postUiEvent("OkButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+		// Save the position of this item to set it back after creation
+		// and remove the old child
+		int pos = 0;
+		LineCountTreeItem parent = selectedItem;
+		if (oldItem != null) {
+			pos = getOldPosition();
+			parent = (LineCountTreeItem) oldItem.getParent();
+			parent.removeChild(oldItem);
+		}
+
+		// Create new LineCountTreeTextItem
+		if (ruleList.getSelectionIndex() == TEXT_RULE_INDEX) {
+			newItem = new LineCountTreeTextItem(listener, parent, nameText
+					.getText(), LineCountTreeItem.Rule.TEXT_RULE, textText
+					.getText(), matchCaseCheckBox.getSelection());
+
+			// Create new LineCountTreeComponentItem
+		} else if (ruleList.getSelectionIndex() == COMPONENT_RULE_INDEX) {
+			int componentId = WILDCARD_INTEGER;
+			int groupId = WILDCARD_INTEGER;
+
+			// Get component ID
+			try {
+				String cid = componentTextField.getText();
+				if (cid.substring(0, HEX_PREFIX.length()).equals(HEX_PREFIX)) {
+					cid = cid.substring(HEX_PREFIX.length());
+				}
+				componentId = Integer.parseInt(cid, HEX_RADIX);
+			} catch (Exception e) {
+			}
+
+			// Get group ID
+			try {
+				String gid = groupTextField.getText();
+				if (gid.substring(0, HEX_PREFIX.length()).equals(HEX_PREFIX)) {
+					gid = gid.substring(HEX_PREFIX.length());
+				}
+				groupId = Integer.parseInt(gid, HEX_RADIX);
+			} catch (Exception e) {
+			}
+
+			// Create new item
+			newItem = new LineCountTreeComponentItem(listener, parent, nameText
+					.getText(), LineCountTreeItem.Rule.COMPONENT_RULE,
+					componentId, groupId);
+		}
+
+		// Add mode
+		if (parent.equals(selectedItem)) {
+			parent.addChild(newItem);
+
+			// Edit mode
+		} else {
+			parent.addChild(pos, newItem);
+		}
+
+		super.okPressed();
+		TraceViewerGlobals.postUiEvent("OkButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.dialog.BasePropertyDialog#setInformationLabel()
+	 */
+	@Override
+	protected void setInformationLabel() {
+		if (ruleList.getSelectionIndex() == TEXT_RULE_INDEX) {
+			informationLabel.setText(TEXT_RULE_INFORMATION_TEXT);
+			selectedRuleLabel.setText(TEXT_RULE_NAME);
+		} else if (ruleList.getSelectionIndex() == COMPONENT_RULE_INDEX) {
+			informationLabel.setText(COMPONENT_RULE_INFORMATION_TEXT);
+			selectedRuleLabel.setText(COMPONENT_RULE_NAME);
+		}
+	}
+
+	/**
+	 * Gets old position of this item
+	 * 
+	 * @return old position
+	 */
+	protected int getOldPosition() {
+		LineCountTreeItem item = (LineCountTreeItem) oldItem.getParent();
+		Object[] children = item.getChildren();
+		int pos = 0;
+		for (int i = 0; i < children.length; i++) {
+			if (children[i].equals(oldItem)) {
+				pos = i;
+				break;
+			}
+		}
+		return pos;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/LogAsciiOptionsSelectionDialog.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,221 @@
+/*
+ * 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:
+ *
+ * Ascii log options selection Dialog
+ *
+ */
+package com.nokia.traceviewer.dialog;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.preferences.PreferenceConstants;
+
+/**
+ * Ascii log options selection Dialog
+ */
+public final class LogAsciiOptionsSelectionDialog extends BaseDialog {
+
+	/**
+	 * Omit timestamps checkbox
+	 */
+	private Button omitTimestampCheckBox;
+
+	/**
+	 * Write machine readable log file checkbox
+	 */
+	private Button writeMachineReadableLogCheckBox;
+
+	/**
+	 * File path
+	 */
+	private final String filePath;
+
+	/**
+	 * Omit timestamp boolean value
+	 */
+	private static boolean omitTimestamp;
+
+	/**
+	 * Write machine readable log boolean value
+	 */
+	private static boolean writeMachineReadableLog;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parent
+	 *            parent shell
+	 * @param filePath
+	 *            file path of the ascii log
+	 */
+	public LogAsciiOptionsSelectionDialog(Shell parent, String filePath) {
+		super(parent, SWT.DIALOG_TRIM | SWT.MODELESS | SWT.RESIZE);
+		this.filePath = filePath;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseDialog#createDialogContents()
+	 */
+	@Override
+	protected void createDialogContents() {
+		// Shell
+		GridLayout shellGridLayout = new GridLayout();
+		String shellTitle = Messages
+				.getString("LogAsciiOptionsSelectionDialog.ShellTitle"); //$NON-NLS-1$
+		getShell().setText(shellTitle);
+		composite.setLayout(shellGridLayout);
+
+		// Omit timestamp checkbox
+		omitTimestampCheckBox = new Button(composite, SWT.CHECK);
+		omitTimestampCheckBox.setText(Messages
+				.getString("LogAsciiOptionsSelectionDialog.OmitTimestampText")); //$NON-NLS-1$
+		omitTimestampCheckBox
+				.setToolTipText(Messages
+						.getString("LogAsciiOptionsSelectionDialog.OmitTimestampToolTip")); //$NON-NLS-1$
+		omitTimestampCheckBox.setSelection(omitTimestamp);
+		omitTimestampCheckBox.setEnabled(!writeMachineReadableLog);
+
+		// Write machine readable log checkbox
+		writeMachineReadableLogCheckBox = new Button(composite, SWT.CHECK);
+		String text = Messages
+				.getString("LogAsciiOptionsSelectionDialog.WriteMachineReadableLogText"); //$NON-NLS-1$
+		String tooltip = Messages
+				.getString("LogAsciiOptionsSelectionDialog.WriteMachineReadableLogToolTip"); //$NON-NLS-1$
+		writeMachineReadableLogCheckBox.setText(text);
+		writeMachineReadableLogCheckBox.setToolTipText(tooltip);
+		writeMachineReadableLogCheckBox.setSelection(writeMachineReadableLog);
+		writeMachineReadableLogCheckBox.setEnabled(!omitTimestamp);
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(getShell(),
+				TraceViewerHelpContextIDs.LOGGING);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseDialog#createActionListeners()
+	 */
+	@Override
+	protected void createActionListeners() {
+		// Add selection listener to omit timestamp checkbox
+		omitTimestampCheckBox.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				boolean selected = omitTimestampCheckBox.getSelection();
+				TraceViewerGlobals.postUiEvent("OmitTimestampCheckBoxSelection" //$NON-NLS-1$
+						+ selected, "1"); //$NON-NLS-1$
+
+				writeMachineReadableLogCheckBox.setEnabled(!selected);
+				if (selected) {
+					writeMachineReadableLogCheckBox.setSelection(false);
+				}
+
+				TraceViewerGlobals.postUiEvent("OmitTimestampCheckBoxSelection" //$NON-NLS-1$
+						+ selected, "0"); //$NON-NLS-1$
+			}
+		});
+
+		// Add selection listener to write machine readable log checkbox
+		writeMachineReadableLogCheckBox
+				.addSelectionListener(new SelectionAdapter() {
+					@Override
+					public void widgetSelected(SelectionEvent event) {
+						boolean selected = writeMachineReadableLogCheckBox
+								.getSelection();
+						TraceViewerGlobals.postUiEvent(
+								"WriteMachineReadableLogCheckBoxSelection" //$NON-NLS-1$
+										+ selected, "1"); //$NON-NLS-1$
+
+						omitTimestampCheckBox.setEnabled(!selected);
+						if (selected) {
+							omitTimestampCheckBox.setSelection(false);
+						}
+
+						TraceViewerGlobals.postUiEvent(
+								"WriteMachineReadableLogCheckBoxSelection" //$NON-NLS-1$
+										+ selected, "0"); //$NON-NLS-1$
+					}
+				});
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+	 */
+	@Override
+	protected void okPressed() {
+		boolean machineReadableSettingChanged = (writeMachineReadableLog != writeMachineReadableLogCheckBox
+				.getSelection());
+		omitTimestamp = omitTimestampCheckBox.getSelection();
+		writeMachineReadableLog = writeMachineReadableLogCheckBox
+				.getSelection();
+
+		super.okPressed();
+
+		// If timestamp accuracy is milliseconds, ask if the user wants to
+		// change it to microseconds
+		if (writeMachineReadableLog
+				&& TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+						.getTimestampParser().isTimestampAccuracyMilliSecs()) {
+
+			// Get change timestamp accuracy confirmation from the user
+			String changeAccuracyConfirmation = Messages
+					.getString("LogAsciiOptionsSelectionDialog.ChangeTimestampAccuracyMsg"); //$NON-NLS-1$
+			boolean changeAccuracy = TraceViewerGlobals.getTraceViewer()
+					.getDialogs().showConfirmationDialog(
+							changeAccuracyConfirmation);
+
+			// Change the accuracy and save the new value to the preference
+			// store
+			if (changeAccuracy) {
+				TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+						.getTimestampParser().setTimestampAccuracyMilliSecs(
+								false);
+
+				TraceViewerPlugin.getDefault().getPreferenceStore().setValue(
+						PreferenceConstants.TIMESTAMP_ACCURACY,
+						PreferenceConstants.MICROSECOND_ACCURACY);
+
+			}
+		}
+
+		// Start logging
+		TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+				.getLogger().startPlainTextLogging(filePath, omitTimestamp,
+						writeMachineReadableLog);
+
+		// Insert CloseAndRestartLogging Action button
+		if (writeMachineReadableLog) {
+			TraceViewerGlobals.getTraceViewer().getView().getActionFactory()
+					.addCloseAndRestartLoggingButton(filePath);
+		} else if (machineReadableSettingChanged) {
+			TraceViewerGlobals.getTraceViewer().getView().getActionFactory()
+					.removeCloseAndRestartLoggingButton();
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/Messages.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,63 @@
+/*
+ * 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:
+ *
+ * String localization for dialog package.
+ *
+ */
+package com.nokia.traceviewer.dialog;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * String localization for dialog package.
+ * 
+ */
+final class Messages {
+
+	/**
+	 * Bundle name
+	 */
+	private static final String BUNDLE_NAME = "com.nokia.traceviewer.dialog.messages"; //$NON-NLS-1$
+
+	/**
+	 * Resource bundle
+	 */
+	private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
+			.getBundle(BUNDLE_NAME);
+
+	/**
+	 * Prevents construction.
+	 */
+	private Messages() {
+	}
+
+	/**
+	 * Maps a key to localized string.
+	 * 
+	 * @param key
+	 *            the key for the string
+	 * @return the localized string
+	 */
+	public static String getString(String key) {
+		String value;
+		try {
+			value = RESOURCE_BUNDLE.getString(key);
+		} catch (MissingResourceException e) {
+			value = '!' + key + '!';
+		}
+		return value;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/ProgressBarCloseHandler.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,163 @@
+/*
+ * 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:
+ *
+ * Handles surviving from manual closing of progressbar
+ *
+ */
+package com.nokia.traceviewer.dialog;
+
+import org.eclipse.swt.widgets.Shell;
+
+import com.nokia.traceviewer.action.LogSaveAsciiAction;
+import com.nokia.traceviewer.action.LogSaveBinaryAction;
+import com.nokia.traceviewer.action.PauseAction;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.dataprocessor.FilterProcessor;
+
+/**
+ * Handles surviving from manual closing of progressbar
+ * 
+ */
+public final class ProgressBarCloseHandler {
+
+	/**
+	 * Waiting time for dataprocessors to stop
+	 */
+	private static final int WAITING_TIME = 1500;
+
+	/**
+	 * Progressbar closed, handle it
+	 * 
+	 * @param maxLines
+	 *            max lines in progressbar
+	 * @return true if progressbar should be closed, false otherwise
+	 */
+	public boolean progressBarClosed(int maxLines) {
+		boolean closeDialog = true;
+
+		// Closing from Filtering
+		if (TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+				.getFilterProcessor().isProcessingFilter()) {
+			closeDialog = closeFiltering(closeDialog, maxLines);
+
+			// Closing from Counting or Variable Tracing
+		} else if (TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+				.getLineCountProcessor().isProcessingCounting()
+				|| TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+						.getVariableTracingProcessor().isProcessingTracing()) {
+			closeDialog = closeCountingOrVariableTracing(closeDialog);
+
+			// Closing when saving current traces to a log file
+		} else if (((LogSaveBinaryAction) TraceViewerGlobals.getTraceViewer()
+				.getView().getActionFactory().getLogSaveBinaryAction())
+				.isSavingFile()) {
+			closeDialog = closeSavingLog();
+
+		} else if (((LogSaveAsciiAction) TraceViewerGlobals.getTraceViewer()
+				.getView().getActionFactory().getLogSaveAsciiAction())
+				.isSavingFile()) {
+			closeDialog = closeSavingLog();
+		}
+		return closeDialog;
+	}
+
+	/**
+	 * Closes filtering
+	 * 
+	 * @param closeDialog
+	 *            boolean indicating are we closing the progressbar
+	 * @param maxLines
+	 *            maximum lines in progressbar
+	 * @return true if we are closing the progressbar
+	 */
+	private boolean closeFiltering(boolean closeDialog, int maxLines) {
+		FilterProcessor proc = TraceViewerGlobals.getTraceViewer()
+				.getDataProcessorAccess().getFilterProcessor();
+		if (proc.hasRules() || proc.isUsingExternalFilter()) {
+
+			// Get close confirmation from the user
+			String closeConfirmation = Messages
+					.getString("ProgressBarCloseHandler.CloseFilterConfirmation"); //$NON-NLS-1$
+			boolean close = TraceViewerGlobals.getTraceViewer().getDialogs()
+					.showConfirmationDialog(closeConfirmation);
+
+			Shell progressShell = TraceViewerGlobals.getTraceViewer()
+					.getDataProcessorAccess().getFilterProcessor()
+					.getFilterDialog().getProgressBar().getShell();
+
+			// Remove filtering if clicked OK and progressBar shell is still
+			// open
+			if (close && progressShell != null && !progressShell.isDisposed()) {
+				TraceViewerGlobals.getTraceViewer().getDataReaderAccess()
+						.getMainDataReader().pause(true);
+				TraceViewerGlobals.getTraceViewer().getDataReaderAccess()
+						.getCurrentDataReader().shutdown();
+				// Clear filters
+				proc.getFilterRules().getFilterRules().clear();
+
+				// Wait so dataProcessors have time to stop
+				try {
+					Thread.sleep(WAITING_TIME);
+				} catch (InterruptedException e) {
+					e.printStackTrace();
+				}
+
+				// Shut down possible external data processor
+				if (proc.isUsingExternalFilter()) {
+					proc.getExternalFilterProcessor().stopExternalApplication();
+					// Remove normal filters
+				} else {
+					proc.getFilterDialog().removeFilters(maxLines);
+				}
+
+				PauseAction action = (PauseAction) TraceViewerGlobals
+						.getTraceViewer().getView().getActionFactory()
+						.getPauseAction();
+				action.setPaused(false);
+			} else {
+				closeDialog = false;
+			}
+		}
+
+		return closeDialog;
+	}
+
+	/**
+	 * Closes line counting or variable tracing
+	 * 
+	 * @param closeDialog
+	 *            boolean indicating are we closing the progressbar
+	 * @return true if we are closing the progressbar
+	 */
+	private boolean closeCountingOrVariableTracing(boolean closeDialog) {
+		return closeDialog;
+	}
+
+	/**
+	 * Closes when saving log
+	 * 
+	 * @return true if we are closing the progressbar
+	 */
+	private boolean closeSavingLog() {
+
+		// Get close confirmation from the user
+		String closeConfirmation = Messages
+				.getString("ProgressBarCloseHandler.CloseSavingConfirmation"); //$NON-NLS-1$
+		boolean close = TraceViewerGlobals.getTraceViewer().getDialogs()
+				.showConfirmationDialog(closeConfirmation);
+
+		return close;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/ProgressBarDialog.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,333 @@
+/*
+ * 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:
+ *
+ * ProgressBar Dialog class
+ *
+ */
+package com.nokia.traceviewer.dialog;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.events.ShellEvent;
+import org.eclipse.swt.events.ShellListener;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontMetrics;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.ProgressBar;
+import org.eclipse.swt.widgets.Shell;
+
+import com.nokia.traceviewer.engine.TraceViewerDialog;
+
+/**
+ * ProgressBar Dialog class
+ */
+public final class ProgressBarDialog extends Dialog implements
+		TraceViewerDialog {
+
+	/**
+	 * Indication that shell is disposed
+	 */
+	private static final String DISPOSED_STR = "*Disposed*"; //$NON-NLS-1$
+
+	/**
+	 * Font size
+	 */
+	private static final int FONT_SIZE = 10;
+
+	/**
+	 * Maximum length of the message
+	 */
+	private static final int MAX_LENGTH = 50;
+
+	/**
+	 * ProgressBar
+	 */
+	private ProgressBar progressBar;
+
+	/**
+	 * Text to be shown inside progressBar
+	 */
+	private final StringBuffer processText;
+
+	/**
+	 * Process reason to show inside progressBar
+	 */
+	private String processReason;
+
+	/**
+	 * Indicates that progressbar is already closing
+	 */
+	private boolean alreadyClosing;
+
+	/**
+	 * Forces close
+	 */
+	private boolean forceClose;
+
+	/**
+	 * Shell
+	 */
+	private Shell shell;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parent
+	 *            parent shell
+	 */
+	public ProgressBarDialog(Shell parent) {
+		// Pass the default styles here
+		super(parent);
+		processText = new StringBuffer(MAX_LENGTH);
+	}
+
+	/**
+	 * This method opens the dialog shell
+	 * 
+	 * @param max
+	 *            maximum number of traces
+	 * @param processReason
+	 *            the process reason
+	 */
+	public void open(int max, String processReason) {
+		shell = new Shell(getParentShell(), getShellStyle());
+		setShellStyle(SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM);
+		Display display = getParentShell().getDisplay();
+
+		// Close listener
+		ShellListener listener = new ShellListener() {
+			public void shellActivated(ShellEvent e) {
+			}
+
+			public void shellClosed(ShellEvent e) {
+				Shell parent = getParentShell();
+				if (!forceClose) {
+					if (!alreadyClosing) {
+						alreadyClosing = true;
+						ProgressBarCloseHandler handler = new ProgressBarCloseHandler();
+
+						boolean close = handler.progressBarClosed(progressBar
+								.getMaximum());
+						if (!close) {
+							e.doit = false;
+							alreadyClosing = false;
+						}
+					} else {
+						e.doit = false;
+					}
+				} else {
+					e.doit = true;
+					forceClose = false;
+				}
+
+				// If progressbar is already closed, set parent visible
+				if (shell.isDisposed() && !parent.isDisposed()
+						&& !parent.getVisible()) {
+					parent.setVisible(true);
+				}
+			}
+
+			public void shellDeactivated(ShellEvent e) {
+			}
+
+			public void shellDeiconified(ShellEvent e) {
+			}
+
+			public void shellIconified(ShellEvent e) {
+			}
+		};
+
+		shell.addShellListener(listener);
+
+		createShell(max);
+
+		// Set the reason
+		this.processReason = processReason;
+		createActionListeners();
+
+		// Move the dialog to the center of the top level shell.
+		Rectangle shellBounds = getParentShell().getBounds();
+		Point dialogSize = shell.getSize();
+		int middleX = shellBounds.x + ((shellBounds.width - dialogSize.x) / 2);
+		int middleY = shellBounds.y + ((shellBounds.height - dialogSize.y) / 2);
+		shell.setLocation(middleX, middleY);
+
+		shell.open();
+
+		while (!shell.isDisposed()) {
+			if (!display.readAndDispatch()) {
+				display.sleep();
+			}
+		}
+
+		shell.dispose();
+	}
+
+	/**
+	 * This method initializes shell
+	 * 
+	 * @param max
+	 *            maximum number of traces
+	 */
+	public void createShell(int max) {
+		// Shell
+		GridLayout shellGridLayout = new GridLayout();
+		shellGridLayout.horizontalSpacing = 0;
+		shellGridLayout.marginWidth = 0;
+		shellGridLayout.marginHeight = 0;
+		shellGridLayout.verticalSpacing = 0;
+		shell.setText(Messages.getString("ProgressBarDialog.ShellTitle")); //$NON-NLS-1$
+		shell.setLayout(shellGridLayout);
+		shell.setSize(new Point(297, 54));
+
+		// Progressbar
+		GridData progressBarGridData = new GridData(SWT.FILL, SWT.FILL, true,
+				true);
+		progressBarGridData.heightHint = 22;
+		progressBarGridData.widthHint = 295;
+		progressBar = new ProgressBar(shell, SWT.SMOOTH);
+		progressBar.setSelection(0);
+		progressBar.setMaximum(max);
+		progressBar.setLayoutData(progressBarGridData);
+	}
+
+	/**
+	 * Gets progressbar
+	 * 
+	 * @return the progressbar
+	 */
+	public ProgressBar getProgressBar() {
+		return progressBar;
+	}
+
+	/**
+	 * Closes the progressBar by bypassing the shellClosed listener
+	 */
+	@Override
+	public boolean close() {
+		forceClose = true;
+		if (shell != null && !shell.isDisposed()) {
+			shell.close();
+		}
+		return true;
+	}
+
+	/**
+	 * Creates action listeners
+	 */
+	public void createActionListeners() {
+		progressBar.addPaintListener(new PaintListener() {
+			public void paintControl(PaintEvent e) {
+				// Count percents
+				double number = (progressBar.getSelection() * 1.0
+						/ (progressBar.getMaximum()) * 100);
+
+				// Round to 2 decimals
+				String numberString = String.format(
+						"%.2f", Double.valueOf(number)); //$NON-NLS-1$
+
+				processText.setLength(0);
+				processText.append(processReason);
+				processText.append(' ');
+				processText.append(numberString);
+				processText.append('%');
+
+				Point point = progressBar.getSize();
+				Font font = new Font(shell.getDisplay(), "Courier", FONT_SIZE, //$NON-NLS-1$
+						SWT.BOLD);
+				e.gc.setFont(font);
+				e.gc.setForeground(shell.getDisplay().getSystemColor(
+						SWT.COLOR_DARK_BLUE));
+
+				FontMetrics fontMetrics = e.gc.getFontMetrics();
+				int stringWidth = fontMetrics.getAverageCharWidth()
+						* processText.length();
+				int stringHeight = fontMetrics.getHeight();
+
+				e.gc.drawString(processText.toString(),
+						(point.x - stringWidth) / 2,
+						(point.y - stringHeight) / 2, true);
+				font.dispose();
+			}
+		});
+	}
+
+	/**
+	 * Update progressBar
+	 * 
+	 * @param num
+	 *            selection value
+	 * @return true if dialog was disposed, false otherwise
+	 */
+	public boolean updateProgressBar(final int num) {
+		boolean isDisposed = true;
+		if (shell != null && !shell.toString().contains(DISPOSED_STR)
+				&& shell.getDisplay() != null) {
+			isDisposed = false;
+			shell.getDisplay().asyncExec(new Runnable() {
+				public void run() {
+					if (progressBar != null && !progressBar.isDisposed()) {
+						progressBar.setSelection(num);
+					}
+				}
+			});
+		}
+		return isDisposed;
+	}
+
+	/**
+	 * Sets new max value
+	 * 
+	 * @param max
+	 *            new max value
+	 */
+	public void setMax(final int max) {
+		if (shell != null && !shell.toString().contains(DISPOSED_STR)
+				&& shell.getDisplay() != null) {
+			shell.getDisplay().asyncExec(new Runnable() {
+				public void run() {
+					if (progressBar != null && !progressBar.isDisposed()) {
+						progressBar.setMaximum(max);
+					}
+				}
+			});
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.TraceViewerDialog#openDialog()
+	 */
+	public void openDialog() {
+		// Empty, opened with open()
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.window.Window#getShell()
+	 */
+	@Override
+	public Shell getShell() {
+		return shell;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/SearchDialog.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,1116 @@
+/*
+ * 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:
+ *
+ * Search Dialog class
+ *
+ */
+package com.nokia.traceviewer.dialog;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.PatternSyntaxException;
+
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.FindReplaceDocumentAdapter;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.TextViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.ProgressBar;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.engine.StateHolder;
+import com.nokia.traceviewer.engine.TraceInformation;
+import com.nokia.traceviewer.engine.TraceProperties;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.TraceViewerTraceViewInterface;
+import com.nokia.traceviewer.engine.dataprocessor.SearchProperties;
+import com.nokia.traceviewer.engine.dataprocessor.SearchUtils;
+import com.nokia.traceviewer.engine.dataprocessor.TimestampParser;
+
+/**
+ * Search Dialog class
+ * 
+ */
+public final class SearchDialog extends BaseDialog {
+
+	/**
+	 * Display used to get UI thread
+	 */
+	private final Display display;
+
+	/**
+	 * UI Label for line count field
+	 */
+	private Label lineCountLabel;
+
+	/**
+	 * UI Combo box for find texts
+	 */
+	private Combo findCombo;
+
+	/**
+	 * UI Find button
+	 */
+	private Button searchButton;
+
+	/**
+	 * UI Checkbox for match whole word
+	 */
+	private Button matchWholeWordCheckBox;
+
+	/**
+	 * UI Checkbox for match case
+	 */
+	private Button matchCaseCheckBox;
+
+	/**
+	 * UI Checkbox for regular expression search
+	 */
+	private Button regularExpressionCheckBox;
+
+	/**
+	 * UI Radio button for up direction
+	 */
+	private Button upDirectionRadioButton;
+
+	/**
+	 * UI Radio button for down direction
+	 */
+	private Button downDirectionRadioButton;
+
+	/**
+	 * UI Button for stop search
+	 */
+	private Button stopSearchButton;
+
+	/**
+	 * Progressbar showing file position
+	 */
+	private ProgressBar progressBar;
+
+	/**
+	 * Reference to View
+	 */
+	private final TraceViewerTraceViewInterface view;
+
+	/**
+	 * Search properties used when searching
+	 */
+	private final SearchProperties searchProperties;
+
+	/**
+	 * Widget used in searching
+	 */
+	private StyledText widget;
+
+	/**
+	 * Document used by viewer
+	 */
+	private IDocument document;
+
+	/**
+	 * Contains combo list items that are saved and restored
+	 */
+	private String[] comboList;
+
+	/**
+	 * Finder object
+	 */
+	private FindReplaceDocumentAdapter finder;
+
+	/**
+	 * Checks if DataReader was paused when we entered dialog -> Don't pause
+	 * again and don't unpause in exit
+	 */
+	private boolean wasPausedWhenEntered;
+
+	/**
+	 * Key listener for this dialog
+	 */
+	private KeyAdapter searchDialogKeyListener;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parent
+	 *            parent shell
+	 * @param view
+	 *            view reference
+	 */
+	public SearchDialog(Shell parent, TraceViewerTraceViewInterface view) {
+		// Pass the default styles here
+		super(parent, SWT.DIALOG_TRIM | SWT.MODELESS | SWT.MIN);
+		this.view = view;
+		this.display = view.getViewer().getControl().getDisplay();
+		searchProperties = new SearchProperties();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseDialog#close()
+	 */
+	@Override
+	public boolean close() {
+		boolean close = super.close();
+
+		// Stop the search and kill the search data reader
+		TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+				.getSearchProcessor().stopSearch(true);
+		TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+				.getSearchProcessor().shutdownSearchReader();
+
+		// Unpause
+		if (!wasPausedWhenEntered) {
+			TraceViewerGlobals.getTraceViewer().getView().getActionFactory()
+					.getPauseAction().run();
+		}
+
+		return close;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseDialog#saveSettings()
+	 */
+	@Override
+	protected void saveSettings() {
+
+		// Save position
+		super.saveSettings();
+
+		// Save combo list items if dialog is not disposed
+		if (findCombo != null && !findCombo.isDisposed()) {
+			comboList = new String[findCombo.getItemCount()];
+			for (int i = 0; i < findCombo.getItemCount(); i++) {
+				comboList[i] = findCombo.getItem(i);
+			}
+			searchProperties
+					.setWholeWord(matchWholeWordCheckBox.getSelection());
+			searchProperties.setCaseSensitive(matchCaseCheckBox.getSelection());
+			searchProperties
+					.setRegExp(regularExpressionCheckBox.getSelection());
+			if (upDirectionRadioButton.getSelection()) {
+				searchProperties.setSearchingForward(false);
+			} else {
+				searchProperties.setSearchingForward(true);
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseDialog#restoreSettings()
+	 */
+	@Override
+	protected void restoreSettings() {
+		super.restoreSettings();
+
+		// Restore other settings
+		if (comboList != null) {
+			findCombo.setItems(comboList);
+		}
+		matchWholeWordCheckBox.setSelection(searchProperties.isWholeWord());
+		if (searchProperties.isWholeWord()) {
+			regularExpressionCheckBox.setEnabled(false);
+		}
+		matchCaseCheckBox.setSelection(searchProperties.isCaseSensitive());
+		regularExpressionCheckBox.setSelection(searchProperties.isRegExp());
+		if (searchProperties.isRegExp()) {
+			matchWholeWordCheckBox.setEnabled(false);
+		}
+		upDirectionRadioButton.setSelection(!searchProperties
+				.isSearchingForward());
+		downDirectionRadioButton.setSelection(searchProperties
+				.isSearchingForward());
+
+		// Set text to be what was last searched for
+		if (comboList != null && comboList.length > 0) {
+			findCombo.setText(comboList[0]);
+		}
+
+		// Set default button
+		getShell().setDefaultButton(searchButton);
+
+		// Set processor not to stop when next search is started
+		TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+				.getSearchProcessor().stopSearch(false);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseDialog#createShell()
+	 */
+	@Override
+	protected void createDialogContents() {
+		// Pause the datareader if it's not paused already
+		wasPausedWhenEntered = TraceViewerGlobals.getTraceViewer()
+				.getDataReaderAccess().getMainDataReader().isPaused();
+		if (!wasPausedWhenEntered) {
+			TraceViewerGlobals.getTraceViewer().getView().getActionFactory()
+					.getPauseAction().run();
+		}
+
+		// Create needed items
+		TextViewer viewer = view.getViewer();
+		widget = viewer.getTextWidget();
+		document = viewer.getDocument();
+		finder = new FindReplaceDocumentAdapter(document);
+
+		// Shell and Composite
+		GridLayout shellGridLayout = new GridLayout();
+		shellGridLayout.numColumns = 3;
+		getShell().setText(Messages.getString("SearchDialog.DialogTitle")); //$NON-NLS-1$
+		composite.setLayout(shellGridLayout);
+		Label findLabel = new Label(composite, SWT.NONE);
+		findLabel.setText(Messages.getString("SearchDialog.FindText")); //$NON-NLS-1$
+
+		// Create key listener
+		createKeyListener();
+
+		// Create find combo
+		GridData findComboGridData = new GridData();
+		findComboGridData.widthHint = 280;
+		findCombo = new Combo(composite, SWT.NONE);
+		findCombo.setLayoutData(findComboGridData);
+		findCombo.setToolTipText(Messages
+				.getString("SearchDialog.FindComboToolTip")); //$NON-NLS-1$
+		findCombo.addKeyListener(searchDialogKeyListener);
+
+		// Search Button
+		GridData searchButtonGridData = new GridData();
+		searchButtonGridData.widthHint = 75;
+		searchButtonGridData.heightHint = 25;
+		searchButtonGridData.horizontalAlignment = GridData.END;
+		searchButton = new Button(composite, SWT.NONE);
+		searchButton.setText(Messages
+				.getString("SearchDialog.SearchButtonText")); //$NON-NLS-1$
+		searchButton.setToolTipText(Messages
+				.getString("SearchDialog.SearchButtonToolTip")); //$NON-NLS-1$
+		searchButton.setLayoutData(searchButtonGridData);
+
+		// Match whole word Checkbox
+		GridData matchWholeWordGridData = new GridData();
+		matchWholeWordGridData.horizontalSpan = 2;
+		matchWholeWordGridData.verticalAlignment = GridData.END;
+		matchWholeWordGridData.horizontalAlignment = GridData.BEGINNING;
+		matchWholeWordCheckBox = new Button(composite, SWT.CHECK);
+		matchWholeWordCheckBox.setText(Messages
+				.getString("SearchDialog.MatchWholeWordText")); //$NON-NLS-1$
+		matchWholeWordCheckBox.setToolTipText(Messages
+				.getString("SearchDialog.MatchWholeWordToolTip")); //$NON-NLS-1$
+		matchWholeWordCheckBox.setLayoutData(matchWholeWordGridData);
+
+		// Stop Search Button
+		GridData stopSeachButtonGridData = new GridData();
+		stopSeachButtonGridData.widthHint = 75;
+		stopSeachButtonGridData.heightHint = 25;
+		stopSeachButtonGridData.horizontalAlignment = GridData.END;
+		stopSearchButton = new Button(composite, SWT.NONE);
+		stopSearchButton.setText(Messages
+				.getString("SearchDialog.StopButtonText")); //$NON-NLS-1$
+		stopSearchButton.setToolTipText(Messages
+				.getString("SearchDialog.StopButtonToolTip")); //$NON-NLS-1$
+		stopSearchButton.setLayoutData(stopSeachButtonGridData);
+		stopSearchButton.setEnabled(false);
+
+		// Match Case Checkbox
+		GridData matchCaseCheckBoxGridData = new GridData();
+		matchCaseCheckBoxGridData.horizontalSpan = 2;
+		matchCaseCheckBox = new Button(composite, SWT.CHECK);
+		matchCaseCheckBox.setText(Messages
+				.getString("SearchDialog.MatchCaseText")); //$NON-NLS-1$
+		matchCaseCheckBox.setToolTipText(Messages
+				.getString("SearchDialog.MatchCaseToolTip")); //$NON-NLS-1$
+		matchCaseCheckBox.setLayoutData(matchCaseCheckBoxGridData);
+
+		// Regular Expression CheckBox
+		GridData regularExpressionCheckBoxGridData = new GridData();
+		regularExpressionCheckBoxGridData.horizontalSpan = 2;
+		regularExpressionCheckBoxGridData.verticalAlignment = GridData.BEGINNING;
+		regularExpressionCheckBoxGridData.horizontalAlignment = GridData.BEGINNING;
+		regularExpressionCheckBox = new Button(composite, SWT.CHECK);
+		regularExpressionCheckBox.setText(Messages
+				.getString("SearchDialog.RegExpText")); //$NON-NLS-1$
+		regularExpressionCheckBox.setToolTipText(Messages
+				.getString("SearchDialog.RegExpToolTip")); //$NON-NLS-1$
+		regularExpressionCheckBox
+				.setLayoutData(regularExpressionCheckBoxGridData);
+		createDirectionGroup();
+
+		// Spacer label
+		new Label(composite, SWT.NONE);
+
+		// Line Count Label
+		GridData lineCountLabelGridData = new GridData();
+		lineCountLabelGridData.horizontalSpan = 2;
+		lineCountLabelGridData.widthHint = 300;
+		lineCountLabel = new Label(composite, SWT.NONE);
+
+		// Get the trace count for the label and set it
+		int traceCount = 0;
+		if (TraceViewerGlobals.getTraceViewer().getDataReaderAccess()
+				.getCurrentDataReader() != null) {
+			traceCount = TraceViewerGlobals.getTraceViewer()
+					.getDataReaderAccess().getCurrentDataReader()
+					.getTraceCount();
+		}
+		lineCountLabel.setText(Messages.getString("SearchDialog.LineViewText") //$NON-NLS-1$
+				+ traceCount);
+		lineCountLabel.setLayoutData(lineCountLabelGridData);
+
+		// ProgressBar
+		GridData progressBarGridData = new GridData();
+		progressBarGridData.heightHint = 22;
+		progressBarGridData.grabExcessVerticalSpace = false;
+		progressBarGridData.grabExcessHorizontalSpace = true;
+		progressBarGridData.horizontalAlignment = SWT.FILL;
+		progressBarGridData.horizontalSpan = 3;
+		progressBar = new ProgressBar(composite, SWT.SMOOTH);
+		progressBar.setLayoutData(progressBarGridData);
+		updateSearchProgressBar(view.getShowingTracesFrom()
+				+ widget.getLineAtOffset(widget.getCaretOffset()));
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(getShell(),
+				TraceViewerHelpContextIDs.SEARCHING);
+	}
+
+	/**
+	 * This method initializes findCombo
+	 */
+	private void createKeyListener() {
+		searchDialogKeyListener = new KeyAdapter() {
+
+			@Override
+			public void keyPressed(KeyEvent e) {
+
+				// ALT + d changes search direction
+				if (e.stateMask == SWT.ALT
+						&& (e.character == 'd' || e.character == 'D')) {
+					upDirectionRadioButton.setSelection(!upDirectionRadioButton
+							.getSelection());
+					downDirectionRadioButton
+							.setSelection(!downDirectionRadioButton
+									.getSelection());
+
+					// ALT + c changes "match case" value
+				} else if (e.stateMask == SWT.ALT
+						&& (e.character == 'c' || e.character == 'C')) {
+					matchCaseCheckBox.setSelection(!matchCaseCheckBox
+							.getSelection());
+
+					// ALT + w changes "whole word" value
+				} else if (e.stateMask == SWT.ALT
+						&& (e.character == 'w' || e.character == 'W')) {
+					matchWholeWordCheckBox.setSelection(!matchWholeWordCheckBox
+							.getSelection());
+
+					// Search again
+				} else if (e.keyCode == SWT.F3) {
+					findCombo.setText(getPreviousSearchString());
+					searchString();
+				}
+			}
+		};
+	}
+
+	/**
+	 * This method initializes directionGroup
+	 */
+	private void createDirectionGroup() {
+
+		// Direction Group
+		GridData directionGroupGridData = new GridData();
+		directionGroupGridData.horizontalSpan = 2;
+		GridLayout gridLayout1 = new GridLayout();
+		gridLayout1.numColumns = 2;
+		Group directionGroup = new Group(composite, SWT.NONE);
+		directionGroup.setText(Messages
+				.getString("SearchDialog.DirectionGroupName")); //$NON-NLS-1$
+		directionGroup.setLayoutData(directionGroupGridData);
+		directionGroup.setLayout(gridLayout1);
+		directionGroup.setText(Messages
+				.getString("SearchDialog.DirectionGroupName")); //$NON-NLS-1$
+		directionGroup.setToolTipText(Messages
+				.getString("SearchDialog.DirectionToolTip")); //$NON-NLS-1$
+
+		// Up direction Button
+		upDirectionRadioButton = new Button(directionGroup, SWT.RADIO);
+		upDirectionRadioButton.setText(Messages
+				.getString("SearchDialog.UpDirectionText")); //$NON-NLS-1$
+		upDirectionRadioButton.setToolTipText(Messages
+				.getString("SearchDialog.UpDirectionToolTip")); //$NON-NLS-1$
+
+		// Down direction Button
+		downDirectionRadioButton = new Button(directionGroup, SWT.RADIO);
+		downDirectionRadioButton.setText(Messages
+				.getString("SearchDialog.DownDirectionText")); //$NON-NLS-1$
+		downDirectionRadioButton.setToolTipText(Messages
+				.getString("SearchDialog.DownDirectionToolTip")); //$NON-NLS-1$
+		downDirectionRadioButton.setSelection(true);
+
+		// Add key listeners
+		downDirectionRadioButton.addKeyListener(searchDialogKeyListener);
+		upDirectionRadioButton.addKeyListener(searchDialogKeyListener);
+	}
+
+	/**
+	 * Starts searching with given string
+	 * 
+	 * @param searchString
+	 *            search string
+	 */
+	public void startSearch(String searchString) {
+		if (TraceViewerGlobals.getTraceViewer().getStateHolder().getState() != StateHolder.State.SEARCHING) {
+			TraceViewerGlobals.getTraceViewer().getStateHolder().setState(
+					StateHolder.State.SEARCHING);
+
+			// Has to be before search button is disabled because will
+			// enable it in modify listener
+			insertTextToComboBox(searchString);
+
+			searchButton.setEnabled(false);
+			stopSearchButton.setEnabled(true);
+
+			searchString();
+		}
+
+		// Save settings
+		saveSettings();
+	}
+
+	/**
+	 * Inserts text to combo box if necessary
+	 * 
+	 * @param newString
+	 *            new string to add to combo box
+	 */
+	private void insertTextToComboBox(String newString) {
+		// Insert new items to combo
+
+		int nIndex = findCombo.indexOf(newString);
+		if (nIndex > -1) {
+			findCombo.remove(nIndex);
+		}
+		findCombo.setText(newString);
+		findCombo.add(newString, 0);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseDialog#createActionListeners()
+	 */
+	@Override
+	protected void createActionListeners() {
+		// Add selection listener to search button
+		searchButton.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				TraceViewerGlobals.postUiEvent("SearchButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+				if (widget.getLineCount() > 1) {
+					startSearch(findCombo.getText());
+				}
+				TraceViewerGlobals.postUiEvent("SearchButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+			}
+		});
+
+		// Add selection listener to stop find button
+		stopSearchButton.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				TraceViewerGlobals.postUiEvent("StopSearchButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+				TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+						.getSearchProcessor().stopSearch(true);
+				searchButton.setEnabled(true);
+				stopSearchButton.setEnabled(false);
+				getButton(IDialogConstants.OK_ID).setEnabled(true);
+				TraceViewerGlobals.postUiEvent("StopSearchButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+			}
+		});
+
+		// Add selection listener to match whole word checkbox
+		matchWholeWordCheckBox.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				TraceViewerGlobals.postUiEvent("MatchWholeWordCheckBox" //$NON-NLS-1$
+						+ matchWholeWordCheckBox.getSelection(), "1"); //$NON-NLS-1$
+				if (matchWholeWordCheckBox.getSelection()) {
+					regularExpressionCheckBox.setEnabled(false);
+				} else {
+					regularExpressionCheckBox.setEnabled(true);
+				}
+				TraceViewerGlobals.postUiEvent("MatchWholeWordCheckBox" //$NON-NLS-1$
+						+ matchWholeWordCheckBox.getSelection(), "0"); //$NON-NLS-1$
+			}
+		});
+
+		// Add selection listener to regular expression checkbox
+		regularExpressionCheckBox.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				TraceViewerGlobals.postUiEvent("RegularExpressionCheckBox" //$NON-NLS-1$
+						+ regularExpressionCheckBox.getSelection(), "1"); //$NON-NLS-1$
+				if (regularExpressionCheckBox.getSelection()) {
+					matchWholeWordCheckBox.setEnabled(false);
+				} else {
+					matchWholeWordCheckBox.setEnabled(true);
+				}
+				TraceViewerGlobals.postUiEvent("RegularExpressionCheckBox" //$NON-NLS-1$
+						+ regularExpressionCheckBox.getSelection(), "0"); //$NON-NLS-1$
+			}
+		});
+
+		// Add selection listener to match case checkbox
+		matchCaseCheckBox.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				TraceViewerGlobals.postUiEvent("MatchCaseCheckBox" //$NON-NLS-1$
+						+ matchCaseCheckBox.getSelection(), "1"); //$NON-NLS-1$
+				TraceViewerGlobals.postUiEvent("MatchCaseCheckBox" //$NON-NLS-1$
+						+ matchCaseCheckBox.getSelection(), "0"); //$NON-NLS-1$
+			}
+		});
+
+		// Add modify listener to find combo box
+		findCombo.addModifyListener(new ModifyListener() {
+			public void modifyText(ModifyEvent e) {
+				if (findCombo.getText().length() > 0) {
+					searchButton.setEnabled(true);
+				} else {
+					searchButton.setEnabled(false);
+				}
+			}
+
+		});
+	}
+
+	/**
+	 * Gets progressBar
+	 * 
+	 * @return progressBar
+	 */
+	public ProgressBar getProgressBar() {
+		return progressBar;
+	}
+
+	/**
+	 * Sets search properties
+	 */
+	private void setVariablesToProperties() {
+
+		// Get variable statuses from the ui components
+		searchProperties.setSearchString(findCombo.getText());
+		searchProperties.setSearchingForward(!upDirectionRadioButton
+				.getSelection());
+		searchProperties.setCaseSensitive(matchCaseCheckBox.getSelection());
+		searchProperties.setWholeWord(matchWholeWordCheckBox.getSelection());
+		searchProperties.setRegExp(regularExpressionCheckBox.getSelection());
+		searchProperties.setOriginalSearchStartLine(TraceViewerGlobals
+				.getTraceViewer().getView().getShowingTracesFrom()
+				+ widget.getLineAtOffset(widget.getCaretOffset()));
+	}
+
+	/**
+	 * Searchs the occurrence of the String value and shows it in view
+	 */
+	private void searchString() {
+
+		// Set search variables
+		setVariablesToProperties();
+
+		// Check if this is a timestamp range search, jump straight to
+		// SearchProcessor
+		if (SearchUtils.containsTimestampQuery(searchProperties
+				.getSearchString())
+				&& SearchUtils.containsTimestampRangeQuery(searchProperties
+						.getSearchString())) {
+
+			// Do a timestamp range search
+			TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+					.getSearchProcessor().doTimestampRangeSearch(
+							searchProperties.getSearchString());
+
+			// Other searchs
+		} else {
+
+			try {
+
+				// Get the search start offset
+				int cursorOffset = getCursorOffset(searchProperties
+						.isSearchingForward());
+
+				// Find the trace and get the offset of it
+				int offset = findTrace(cursorOffset);
+
+				// String found
+				if (offset != SearchUtils.NOT_FOUND) {
+					processStringFound(offset);
+
+					// String was not found
+				} else {
+
+					// Start the search after or before this view
+					if (searchProperties.isSearchingForward()) {
+						processSearchingForward();
+					} else {
+						processSearchingBackward();
+					}
+
+				}
+
+			} catch (BadLocationException e) {
+				e.printStackTrace();
+				enableSearchButton();
+			} catch (PatternSyntaxException e) {
+				e.printStackTrace();
+				enableSearchButton();
+			}
+		}
+	}
+
+	/**
+	 * Finds the trace using search properties
+	 * 
+	 * @param searchStartOffset
+	 *            start offset where to start the search
+	 * @return offset of the trace found or -1 if not found
+	 * @throws BadLocationException
+	 */
+	private int findTrace(int searchStartOffset) throws BadLocationException {
+		int offset = SearchUtils.NOT_FOUND;
+
+		// Search using component, group and trace ID's
+		if (SearchUtils.containsIdQuery(searchProperties.getSearchString())) {
+			offset = findTraceIDSearch(searchStartOffset);
+
+			// Timestamp search
+		} else if (SearchUtils.containsTimestampQuery(searchProperties
+				.getSearchString())) {
+			offset = findTraceTimestampSearch(searchStartOffset);
+
+			// Create a normal text search
+		} else {
+			IRegion region = finder.find(searchStartOffset, searchProperties
+					.getSearchString(), searchProperties.isSearchingForward(),
+					searchProperties.isCaseSensitive(), searchProperties
+							.isWholeWord(), searchProperties.isRegExp());
+
+			if (region != null) {
+				offset = region.getOffset();
+			}
+		}
+
+		return offset;
+	}
+
+	/**
+	 * Finds the trace using ID search
+	 * 
+	 * @param searchStartOffset
+	 *            search start offset
+	 * @return found offset
+	 * @throws BadLocationException
+	 */
+	private int findTraceIDSearch(int searchStartOffset)
+			throws BadLocationException {
+		int offset;
+
+		// Parse ID's from the search string
+		TraceInformation inf = SearchUtils.parseIDsFromString(searchProperties
+				.getSearchString());
+
+		int startTrace = document.getLineOfOffset(searchStartOffset);
+
+		// Check which way we are searching and modify the start trace
+		// accordingly
+		boolean forward = searchProperties.isSearchingForward();
+		if (forward) {
+			startTrace++;
+		} else {
+			startTrace--;
+		}
+
+		List<TraceProperties> traces = null;
+		List<TraceInformation> informations = null;
+
+		// Get properties from the traces in the view. -2 comes from empty
+		// line in the end of widget and because traces start from offset 0,
+		// not 1
+		traces = TraceViewerGlobals.getTraceViewer().getTraces(
+				view.getShowingTracesFrom(),
+				view.getShowingTracesFrom() + widget.getLineCount() - 2);
+
+		// Get the informations array
+		if (traces != null) {
+			informations = new ArrayList<TraceInformation>(traces.size());
+			for (int i = 0; i < traces.size(); i++) {
+				informations.add(traces.get(i).information);
+			}
+		}
+
+		// Get the trace number that matches the ID's
+		int foundTrace = SearchUtils.findTraceOffsetFromInformations(
+				startTrace, inf, informations, forward);
+
+		if (foundTrace == SearchUtils.NOT_FOUND) {
+			offset = SearchUtils.NOT_FOUND;
+		} else {
+			offset = document.getLineOffset(foundTrace);
+		}
+		return offset;
+	}
+
+	/**
+	 * Finds the trace using timestamp search
+	 * 
+	 * @param searchStartOffset
+	 *            search start offset
+	 * @return found offset
+	 * @throws BadLocationException
+	 */
+	private int findTraceTimestampSearch(int searchStartOffset)
+			throws BadLocationException {
+		int offset;
+
+		// Parse timestamp from the search string
+		String timestamp = SearchUtils.parseTimestampFromString(
+				searchProperties.getSearchString(), true);
+
+		List<TraceProperties> traces = null;
+		List<String> timestamps = null;
+
+		// Get properties from the traces in the view. -2 comes from empty
+		// line in the end of widget and because traces start from offset 0,
+		// not 1
+		traces = TraceViewerGlobals.getTraceViewer().getTraces(
+				view.getShowingTracesFrom(),
+				view.getShowingTracesFrom() + widget.getLineCount() - 2);
+
+		int startTrace = document.getLineOfOffset(searchStartOffset);
+		String currentTraceTimestamp = null;
+
+		// Get the informations array
+		if (traces != null) {
+			TimestampParser parser = TraceViewerGlobals.getTraceViewer()
+					.getDataProcessorAccess().getTimestampParser();
+			timestamps = new ArrayList<String>(traces.size());
+			for (int i = 0; i < traces.size(); i++) {
+				TraceProperties trace = traces.get(i);
+				parser.processData(trace);
+				timestamps.add(trace.timestampString);
+			}
+
+			if (timestamps.size() >= startTrace) {
+				currentTraceTimestamp = timestamps.get(startTrace);
+			}
+		}
+
+		boolean forward = true;
+
+		// Check which way we are searching and modify the start trace
+		// accordingly
+		if (currentTraceTimestamp != null) {
+			if (currentTraceTimestamp.compareTo(timestamp) <= 0) {
+				startTrace++;
+			} else {
+				startTrace--;
+				forward = false;
+			}
+		} else {
+			startTrace++;
+		}
+		upDirectionRadioButton.setSelection(!forward);
+		downDirectionRadioButton.setSelection(forward);
+		searchProperties.setSearchingForward(forward);
+
+		// Get the trace number that matches the timestamp
+		int foundTrace = SearchUtils.findTraceOffsetFromTimestamps(startTrace,
+				timestamp, timestamps, forward);
+
+		if (foundTrace == SearchUtils.NOT_FOUND) {
+			offset = SearchUtils.NOT_FOUND;
+		} else {
+			offset = document.getLineOffset(foundTrace);
+		}
+		return offset;
+	}
+
+	/**
+	 * Processes searching forward
+	 */
+	private void processSearchingForward() {
+		// There is traces below this block
+		int traceCount = TraceViewerGlobals.getTraceViewer()
+				.getDataReaderAccess().getCurrentDataReader().getTraceCount();
+		if (view.getShowingTracesFrom() + widget.getLineCount() < traceCount) {
+
+			searchProperties.setCurrentSearchStartLine(view
+					.getShowingTracesFrom()
+					+ widget.getLineCount()
+					+ (TraceViewerGlobals.blockSize / 2));
+
+			TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+					.getSearchProcessor()
+					.processSearch(searchProperties, false);
+		} else { // End Of File
+			// Say EOF to searchProcessor
+			updateSearchProgressBar(traceCount);
+			searchHitEOF();
+		}
+	}
+
+	/**
+	 * Processes searching backwards
+	 */
+	private void processSearchingBackward() {
+		// There is traces above this block
+		if (view.getShowingTracesFrom() > 0) {
+			searchProperties.setCurrentSearchStartLine(view
+					.getShowingTracesFrom()
+					- (TraceViewerGlobals.blockSize / 2));
+			TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+					.getSearchProcessor()
+					.processSearch(searchProperties, false);
+		} else { // End (beginning) Of File
+			updateSearchProgressBar(0);
+			searchHitEOF();
+		}
+	}
+
+	/**
+	 * Processes situation where result is found
+	 * 
+	 * @param offset
+	 *            offset of result
+	 */
+	private void processStringFound(int offset) {
+		int line = widget.getLineAtOffset(offset);
+
+		// Update progressBar and linecount label
+		updateSearchProgressBar(view.getShowingTracesFrom() + line);
+
+		// Set search result line to the view
+		TraceViewerGlobals.getTraceViewer().getView().highlightLines(
+				view.getShowingTracesFrom() + line, 0, false);
+	}
+
+	/**
+	 * Gets cursor offset
+	 * 
+	 * @param searchingForward
+	 *            tells which way the search is going
+	 * @return cursor offset
+	 * @throws BadLocationException
+	 */
+	private int getCursorOffset(boolean searchingForward)
+			throws BadLocationException {
+		int cursorOffset;
+
+		if (searchingForward) {
+			cursorOffset = widget.getCaretOffset();
+		} else {
+			int lineNumber = widget.getLineAtOffset(widget.getCaretOffset());
+			int lineLength = document.getLineLength(lineNumber);
+			cursorOffset = widget.getCaretOffset() - lineLength + 1;
+		}
+		// To make sure cursor offset isn't anything stupid
+		if (cursorOffset < 0) {
+			cursorOffset = 0;
+		} else if (cursorOffset >= widget.getCharCount()) {
+			cursorOffset = widget.getCharCount() - 1;
+		}
+		return cursorOffset;
+	}
+
+	/**
+	 * Invokes search from EOF. Is called from view in EOF
+	 */
+	public void endOfFile() {
+		TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+				.getSearchProcessor().setHitEOFAlready(true);
+
+		setVariablesToProperties();
+
+		if (searchProperties.isSearchingForward()) { // Down
+			// Start new search from beginning of the file
+			searchProperties.setCurrentSearchStartLine(0);
+			TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+					.getSearchProcessor()
+					.processSearch(searchProperties, false);
+		} else { // Searching up
+			searchProperties.setCurrentSearchStartLine(TraceViewerGlobals
+					.getTraceViewer().getDataReaderAccess()
+					.getCurrentDataReader().getTraceCount());
+			TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+					.getSearchProcessor()
+					.processSearch(searchProperties, false);
+		}
+	}
+
+	/**
+	 * Enables search button
+	 */
+	public void enableSearchButton() {
+		display.asyncExec(new Runnable() {
+
+			public void run() {
+				if (getShell() != null && !getShell().isDisposed()) {
+
+					// Enable find button
+					if (!findCombo.getText().equals(SearchUtils.EMPTY)) {
+						searchButton.setEnabled(true);
+					}
+
+					// Disable stop button
+					stopSearchButton.setEnabled(false);
+
+					// Set state back to normal
+					TraceViewerGlobals.getTraceViewer().getStateHolder()
+							.setState(StateHolder.State.NORMAL);
+
+					TraceViewerGlobals.getTraceViewer()
+							.getDataProcessorAccess().getSearchProcessor()
+							.setHitEOFAlready(false);
+
+					getShell().setFocus();
+				}
+			}
+
+		});
+	}
+
+	/**
+	 * Sets search text to dialog. Must be called from UI thread!
+	 * 
+	 * @param findStr
+	 *            search text
+	 */
+	public void setSearchText(String findStr) {
+		findCombo.setText(findStr);
+	}
+
+	/**
+	 * Updates search progressBar
+	 * 
+	 * @param selectionPoint
+	 *            selection point where to update
+	 */
+	public void updateSearchProgressBar(int selectionPoint) {
+		display.asyncExec(new SearchDialogProgressBarUpdater(selectionPoint,
+				lineCountLabel));
+	}
+
+	/**
+	 * Search hit full round
+	 */
+	public void searchHitFullRound() {
+		display.asyncExec(new SearchHitFullRoundUpdater());
+	}
+
+	/**
+	 * Search hit EOF
+	 */
+	public void searchHitEOF() {
+		display.asyncExec(new SearchHitEOFUpdater());
+	}
+
+	/**
+	 * Tells is the search dialog open
+	 * 
+	 * @return true if dialog is open
+	 */
+	public boolean isOpen() {
+		boolean isOpen = false;
+		if (getShell() != null && !getShell().isDisposed()) {
+			isOpen = true;
+		}
+		return isOpen;
+	}
+
+	/**
+	 * Tells is the search dialog visible
+	 * 
+	 * @return true if dialog is visible
+	 */
+	public boolean isVisible() {
+		boolean isVisible = false;
+		if (isOpen() && getShell().isVisible()) {
+			isVisible = true;
+		}
+		return isVisible;
+	}
+
+	/**
+	 * Sets focus
+	 */
+	public void setFocus() {
+		Shell shell = getShell();
+		if (shell != null && !shell.isDisposed()) {
+			shell.setFocus();
+		}
+	}
+
+	/**
+	 * Check if dialog is open. If yes, close it
+	 * 
+	 * @return true if dialog was open and was now closed
+	 */
+	public boolean forceClose() {
+		boolean closed = false;
+		Shell shell = getShell();
+		if (shell != null && !shell.isDisposed()) {
+			shell.close();
+			closed = true;
+		}
+		return closed;
+	}
+
+	/**
+	 * Gets previous search string
+	 * 
+	 * @return previous search string or empty String if doesn't exist
+	 */
+	public String getPreviousSearchString() {
+		String previous = ""; //$NON-NLS-1$
+
+		if (comboList != null && comboList.length > 0) {
+			previous = comboList[0];
+		}
+		return previous;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/SearchDialogProgressBarUpdater.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,106 @@
+/*
+ * 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:
+ *
+ * SearchDialogProgressBar updater class
+ *
+ */
+package com.nokia.traceviewer.dialog;
+
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.ProgressBar;
+
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Updates search dialogs progressBar
+ * 
+ */
+final class SearchDialogProgressBarUpdater implements Runnable {
+
+	/**
+	 * Value of the progressbar
+	 */
+	private int value;
+
+	/**
+	 * Line count label to update
+	 */
+	private final Label lineCountLabel;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param value
+	 *            value of the selection
+	 * @param lineCountLabel
+	 *            line count label to update
+	 */
+	SearchDialogProgressBarUpdater(int value, Label lineCountLabel) {
+		this.value = value;
+		this.lineCountLabel = lineCountLabel;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Runnable#run()
+	 */
+	public void run() {
+		ProgressBar bar = TraceViewerGlobals.getTraceViewer()
+				.getDataProcessorAccess().getSearchProcessor()
+				.getSearchDialog().getProgressBar();
+
+		if (bar != null && !bar.isDisposed()) {
+			int max = 0;
+
+			// Get max value from data reader
+			if (TraceViewerGlobals.getTraceViewer().getDataReaderAccess()
+					.getCurrentDataReader() != null) {
+				max = TraceViewerGlobals.getTraceViewer().getDataReaderAccess()
+						.getCurrentDataReader().getTraceCount();
+			}
+			// Set maximum value to bar
+			bar.setMaximum(max);
+
+			// Set selection value
+			StringBuffer text = new StringBuffer();
+			text.append(Messages
+					.getString("SearchDialogProgressBarUpdater.LineText")); //$NON-NLS-1$
+			text.append(':');
+			text.append(' ');
+
+			if (value <= 0 && max > 0) {
+				value = 1;
+				text.append(value);
+			} else if (value >= max) {
+				value = max;
+				text.append(value);
+			} else if (max == 0) {
+				text.append(0);
+			} else {
+				text.append(value + 1);
+			}
+			bar.setSelection(value);
+
+			text.append(" / "); //$NON-NLS-1$
+			text.append(max);
+
+			// Change line text
+			if (!lineCountLabel.isDisposed()) {
+				lineCountLabel.setText(text.toString());
+			}
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/SearchHitEOFUpdater.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,53 @@
+/*
+ * 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:
+ *
+ * Search hit EOF updater class
+ *
+ */
+package com.nokia.traceviewer.dialog;
+
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Handles search hitting EOF
+ * 
+ */
+public class SearchHitEOFUpdater implements Runnable {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Runnable#run()
+	 */
+	public void run() {
+		// Show not found dialog to user and ask if continue
+		String notFoundStr = Messages
+				.getString("SearchHitEOFUpdater.TextNotFoundStr"); //$NON-NLS-1$
+		boolean ret = TraceViewerGlobals.getTraceViewer().getDialogs()
+				.showConfirmationDialog(notFoundStr);
+
+		// Ok
+		if (ret) {
+			// Start new search from EOF
+			TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+					.getSearchProcessor().getSearchDialog().endOfFile();
+		} else {
+			TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+					.getSearchProcessor().getSearchDialog()
+					.enableSearchButton();
+		}
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/SearchHitFullRoundUpdater.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,45 @@
+/*
+ * 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:
+ *
+ * Search hit full round updater class
+ *
+ */
+package com.nokia.traceviewer.dialog;
+
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Handles search hitting full round
+ */
+public class SearchHitFullRoundUpdater implements Runnable {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Runnable#run()
+	 */
+	public void run() {
+		// Show text not found dialog to the user
+		String textNotFound = Messages
+				.getString("SearchHitFullRoundUpdater.TextNotFound"); //$NON-NLS-1$
+		TraceViewerGlobals.getTraceViewer().getDialogs()
+				.showInformationMessage(textNotFound);
+
+		// Enable search button
+		TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+				.getSearchProcessor().getSearchDialog().enableSearchButton();
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/ShowTraceInfoDialog.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,141 @@
+/*
+ * 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:
+ *
+ * Show Trace Information Dialog class
+ *
+ */
+package com.nokia.traceviewer.dialog;
+
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyleRange;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+
+/**
+ * Show Trace Information Dialog class
+ * 
+ */
+public final class ShowTraceInfoDialog extends BaseDialog {
+
+	/**
+	 * Font to use
+	 */
+	private static final String FONT = "Courier New"; //$NON-NLS-1$
+
+	/**
+	 * View font size
+	 */
+	public static final int FONT_SIZE = 8;
+
+	/**
+	 * Contents of the dialog
+	 */
+	private final String contents;
+
+	/**
+	 * List containing style ranges
+	 */
+	private final List<StyleRange> styleRanges;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parent
+	 *            parent shell
+	 * @param text
+	 *            contents of the dialog
+	 * @param styleRanges
+	 *            style ranges
+	 */
+	public ShowTraceInfoDialog(Shell parent, String text,
+			List<StyleRange> styleRanges) {
+		super(parent, SWT.DIALOG_TRIM | SWT.MODELESS | SWT.RESIZE);
+		this.contents = text;
+		this.styleRanges = styleRanges;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseDialog#createDialogContents()
+	 */
+	@Override
+	protected void createDialogContents() {
+		// Shell
+		GridLayout shellGridLayout = new GridLayout();
+		getShell().setText(Messages.getString("ShowTraceInfoDialog.ShellName")); //$NON-NLS-1$
+		composite.setLayout(shellGridLayout);
+
+		// Text field
+		GridData textGridData = new GridData(SWT.FILL, SWT.FILL, true, true);
+		StyledText text = new StyledText(composite, SWT.MULTI | SWT.BORDER
+				| SWT.WRAP | SWT.V_SCROLL);
+		Font font = new Font(getShell().getDisplay(), new FontData(FONT,
+				FONT_SIZE, SWT.NORMAL));
+		text.setFont(font);
+		text.setBackground(getShell().getDisplay().getSystemColor(
+				SWT.COLOR_WHITE));
+		text.setEditable(false);
+		text.setText(contents);
+		text.setLayoutData(textGridData);
+
+		// Color header and data parts
+		StyleRange[] ranges = new StyleRange[styleRanges.size()];
+		for (int i = 0; i < styleRanges.size(); i++) {
+			ranges[i] = styleRanges.get(i);
+		}
+
+		// Run this inside try catch to still show dialog if style ranges are
+		// invalid
+		try {
+			text.setStyleRanges(ranges);
+		} catch (Exception e) {
+		}
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(getShell(),
+				TraceViewerHelpContextIDs.TRACE_INFO_DIALOG);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.dialogs.Dialog#initializeBounds()
+	 */
+	@Override
+	protected void initializeBounds() {
+		getShell().setSize(new Point(300, 360));
+		super.initializeBounds();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseDialog#createActionListeners()
+	 */
+	@Override
+	protected void createActionListeners() {
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/TraceActivationDialog.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,1503 @@
+/*
+ * 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:
+ *
+ * Trace Activation dialog
+ *
+ */
+package com.nokia.traceviewer.dialog;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DragDetectEvent;
+import org.eclipse.swt.events.DragDetectListener;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.MouseMoveListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Point;
+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.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+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.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.action.ReloadDecodeFilesAction;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.activation.TraceActivationComponentItem;
+import com.nokia.traceviewer.engine.activation.TraceActivationGroupItem;
+import com.nokia.traceviewer.engine.activation.TraceActivator;
+
+/**
+ * Trace activation dialog
+ * 
+ */
+public final class TraceActivationDialog extends BaseDialog {
+
+	/**
+	 * Lead zero string
+	 */
+	private static final String LEAD_ZERO = "0"; //$NON-NLS-1$
+
+	/**
+	 * Waiting time for model to be loaded
+	 */
+	private static final int WAITING_TIME = 50;
+
+	/**
+	 * Right mouse button ID
+	 */
+	private static final int RIGHT_MOUSE_BUTTON = 3;
+
+	/**
+	 * Load button ID
+	 */
+	private static final int LOAD_BUTTON_ID = IDialogConstants.CLIENT_ID + 1;
+
+	/**
+	 * Save button ID
+	 */
+	private static final int SAVE_BUTTON_ID = LOAD_BUTTON_ID + 1;
+
+	/**
+	 * Activate button ID
+	 */
+	private static final int ACTIVATE_BUTTON_ID = SAVE_BUTTON_ID + 1;
+
+	/**
+	 * Hex prefix
+	 */
+	private static final String HEX_PREFIX = "0x"; //$NON-NLS-1$
+
+	/**
+	 * String to be shown if same group is both on and off in different
+	 * Dictionaries
+	 */
+	private static final String STATE_BOTH_STRING = Messages
+			.getString("TraceActivationDialog.OnOff"); //$NON-NLS-1$
+
+	/**
+	 * String to be shown if group is on
+	 */
+	private static final String STATE_ON_STRING = Messages
+			.getString("TraceActivationDialog.On"); //$NON-NLS-1$
+
+	/**
+	 * String to be shown if group is off
+	 */
+	private static final String STATE_OFF_STRING = Messages
+			.getString("TraceActivationDialog.Off"); //$NON-NLS-1$
+
+	/**
+	 * Trace activation category text
+	 */
+	private static final String TRACE_ACTIVATION_CATEGORY = com.nokia.traceviewer.dialog.Messages
+			.getString("TraceActivationDialog.TraceActivationCategory"); //$NON-NLS-1$
+
+	/**
+	 * Color of group which is both on and off
+	 */
+	private final Color STATE_BOTH_COLOR = getParentShell().getDisplay()
+			.getSystemColor(SWT.COLOR_BLACK);
+
+	/**
+	 * Color of group which is on
+	 */
+	private final Color STATE_ON_COLOR = getParentShell().getDisplay()
+			.getSystemColor(SWT.COLOR_DARK_GREEN);
+
+	/**
+	 * Color of group which is off
+	 */
+	private final Color STATE_OFF_COLOR = getParentShell().getDisplay()
+			.getSystemColor(SWT.COLOR_RED);
+
+	/**
+	 * Save dialog
+	 */
+	private TraceConfigurationSaveDialog saveDialog;
+
+	/**
+	 * Load dialog
+	 */
+	private TraceConfigurationLoadDialog loadDialog;
+
+	/**
+	 * Main group
+	 */
+	private Group mainGroup;
+
+	/**
+	 * Open Dictionary file button
+	 */
+	private Button addDictionaryButton;
+
+	/**
+	 * Remove Dictionary file button
+	 */
+	private Button removeDictionaryButton;
+
+	/**
+	 * Text field for Dictionary filter
+	 */
+	private Text dictionaryFilterText;
+
+	/**
+	 * Dictionary table
+	 */
+	private Table dictionaryTable;
+
+	/**
+	 * Group table
+	 */
+	private Table groupTable;
+
+	/**
+	 * Text field for group filter
+	 */
+	private Text groupFilterText;
+
+	/**
+	 * List of all components
+	 */
+	private List<TraceActivationComponentItem> allComponents;
+
+	/**
+	 * List of current components
+	 */
+	private final List<TraceActivationComponentItem> currentComponents;
+
+	/**
+	 * List of changed components. Will be sent when Apply or Ok is clicked
+	 */
+	private final List<TraceActivationComponentItem> changedComponents;
+
+	/**
+	 * Index of the first dictionary selected when dragging with mouse
+	 */
+	private int firstDictionarySelected;
+
+	/**
+	 * Index of the first group selected when dragging with mouse
+	 */
+	private int firstGroupSelected;
+
+	/**
+	 * Tells that model has been changed and components should be loaded again
+	 */
+	private boolean modelChanged;
+
+	/**
+	 * Previously selected Dictionary index
+	 */
+	private int[] previousSelectedDictionaryIndices = { 0 };
+
+	/**
+	 * Saved component filter
+	 */
+	private String savedComponentFilter;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parent
+	 *            parent shell
+	 */
+	public TraceActivationDialog(Shell parent) {
+		// Pass the default styles here
+		super(parent, SWT.DIALOG_TRIM | SWT.MODELESS | SWT.RESIZE);
+		allComponents = new ArrayList<TraceActivationComponentItem>();
+		currentComponents = new ArrayList<TraceActivationComponentItem>();
+		changedComponents = new ArrayList<TraceActivationComponentItem>();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.dialog.BaseDialog#createDialogArea(org.eclipse.
+	 * swt.widgets.Composite)
+	 */
+	@Override
+	protected void createDialogContents() {
+		String shellTitle = Messages
+				.getString("TraceActivationDialog.ShellTitle"); //$NON-NLS-1$
+		getShell().setText(shellTitle);
+
+		// Set the minimum size for the shell
+		getShell().setMinimumSize(new Point(600, 400));
+
+		// Set gridlayout to composite
+		GridLayout compositeGridLayout = new GridLayout();
+		compositeGridLayout.numColumns = 1;
+		composite.setLayout(compositeGridLayout);
+
+		// Main group
+		GridLayout mainGroupGridLayout = new GridLayout();
+		mainGroupGridLayout.numColumns = 5;
+		mainGroup = new Group(composite, SWT.NONE);
+		mainGroup.setText(shellTitle);
+		mainGroup.setLayout(mainGroupGridLayout);
+		GridData mainGroupGridData = new GridData(SWT.FILL, SWT.FILL, true,
+				true);
+		mainGroup.setLayoutData(mainGroupGridData);
+
+		// Create component composite
+		createDictionaryComposite();
+
+		// Create group composite
+		createGroupComposite();
+
+		// Add dictionary button
+		GridData addDictionaryButtonGridData = new GridData();
+		addDictionaryButtonGridData.horizontalAlignment = GridData.BEGINNING;
+		addDictionaryButtonGridData.widthHint = 110;
+		addDictionaryButton = new Button(mainGroup, SWT.NONE);
+		addDictionaryButton.setText(Messages
+				.getString("TraceActivationDialog.AddDictionaryButton")); //$NON-NLS-1$
+		addDictionaryButton.setToolTipText(Messages
+				.getString("TraceActivationDialog.AddDictionaryButtonToolTip")); //$NON-NLS-1$
+		addDictionaryButton.setLayoutData(addDictionaryButtonGridData);
+
+		// Remove dictionary button
+		GridData removeDictionaryButtonGridData = new GridData();
+		removeDictionaryButtonGridData.horizontalAlignment = GridData.BEGINNING;
+		removeDictionaryButtonGridData.widthHint = 110;
+		removeDictionaryButton = new Button(mainGroup, SWT.NONE);
+		removeDictionaryButton.setText(Messages
+				.getString("TraceActivationDialog.RemoveDictionaryButton")); //$NON-NLS-1$
+		removeDictionaryButton
+				.setToolTipText(Messages
+						.getString("TraceActivationDialog.RemoveDictionaryButtonToolTip")); //$NON-NLS-1$
+		removeDictionaryButton.setEnabled(false);
+		removeDictionaryButton.setLayoutData(removeDictionaryButtonGridData);
+
+		// Create main composite
+		createMainComposite();
+
+		// Get activation information
+		getActivationInformation();
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(getShell(),
+				TraceViewerHelpContextIDs.ACTIVATION_DIALOG);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse
+	 * .swt.widgets.Composite)
+	 */
+	@Override
+	protected void createButtonsForButtonBar(Composite parent) {
+		// Create load button
+		Button loadButton = createButton(parent, LOAD_BUTTON_ID, Messages
+				.getString("TraceActivationDialog.LoadButtonText"), false); //$NON-NLS-1$
+		loadButton.setToolTipText(Messages
+				.getString("TraceActivationDialog.LoadButtonToolTip")); //$NON-NLS-1$
+
+		// Create save button
+		Button saveButton = createButton(parent, SAVE_BUTTON_ID, Messages
+				.getString("TraceActivationDialog.SaveButtonText"), false); //$NON-NLS-1$
+		saveButton.setToolTipText(Messages
+				.getString("TraceActivationDialog.SaveButtonToolTip")); //$NON-NLS-1$
+
+		// Activate button
+		Button activateButton = createButton(
+				parent,
+				ACTIVATE_BUTTON_ID,
+				Messages.getString("TraceActivationDialog.ActivateButtonText"), true); //$NON-NLS-1$
+		activateButton.setToolTipText(Messages
+				.getString("TraceActivationDialog.ActivateButtonToolTip")); //$NON-NLS-1$
+
+		// Close button
+		createButton(parent, IDialogConstants.CLOSE_ID, Messages
+				.getString("TraceActivationDialog.CloseButton"), false); //$NON-NLS-1$
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
+	 */
+	@Override
+	protected void buttonPressed(int buttonId) {
+		switch (buttonId) {
+
+		// Load button
+		case LOAD_BUTTON_ID:
+			TraceViewerGlobals.postUiEvent("LoadButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+			if (loadDialog == null) {
+				loadDialog = new TraceConfigurationLoadDialog(true, null);
+			}
+			loadDialog.openDialog(allComponents, changedComponents);
+			setGroupsToTable();
+			TraceViewerGlobals.postUiEvent("LoadButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+			break;
+
+		// Save button
+		case SAVE_BUTTON_ID:
+			TraceViewerGlobals.postUiEvent("SaveButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+			if (saveDialog == null) {
+				saveDialog = new TraceConfigurationSaveDialog();
+			}
+			saveDialog.openDialog(allComponents);
+			TraceViewerGlobals.postUiEvent("SaveButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+			break;
+
+		// Activate button
+		case ACTIVATE_BUTTON_ID:
+			TraceViewerGlobals.postUiEvent("ActivateButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+			sendActivationInformation();
+			TraceViewerGlobals.postUiEvent("ActivateButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+			break;
+
+		// Close button
+		case IDialogConstants.CLOSE_ID:
+			TraceViewerGlobals.postUiEvent("CloseButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+			previousSelectedDictionaryIndices = dictionaryTable
+					.getSelectionIndices();
+			okPressed();
+			TraceViewerGlobals.postUiEvent("CloseButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+			break;
+		default:
+			System.out.println(Messages
+					.getString("TraceActivationDialog.InvalidButton")); //$NON-NLS-1$
+		}
+	}
+
+	/**
+	 * Updates activation information
+	 * 
+	 * @param added
+	 *            if true, activation was added, otherwise it was removed
+	 */
+	private void updateActivationInformation(boolean added) {
+		modelChanged = true;
+
+		// Wait for model to be ready
+		if (added) {
+			int loopCount = 0;
+			int maxLoopCount = 100;
+			try {
+				Thread.sleep(WAITING_TIME);
+				while (!TraceViewerGlobals.getDecodeProvider()
+						.isModelLoadedAndValid()
+						&& loopCount < maxLoopCount) {
+
+					loopCount++;
+					Thread.sleep(WAITING_TIME);
+				}
+			} catch (InterruptedException e) {
+			}
+		}
+
+		getActivationInformation();
+	}
+
+	/**
+	 * Get new activation information from decode provider
+	 */
+	private void getActivationInformation() {
+		if (TraceViewerGlobals.getDecodeProvider() != null) {
+			if (modelChanged || allComponents.isEmpty()) {
+
+				List<TraceActivationComponentItem> newComponents = TraceViewerGlobals
+						.getDecodeProvider().getActivationInformation(false);
+				modelChanged = false;
+
+				// Merge components
+				mergeComponents(allComponents, newComponents);
+			}
+			copyItems(allComponents, currentComponents);
+
+			selectComponentsByFilter(true);
+		}
+	}
+
+	/**
+	 * Merges components from the model
+	 * 
+	 * @param oldComponents
+	 *            old components
+	 * @param newComponents
+	 *            new components
+	 */
+	private void mergeComponents(
+			List<TraceActivationComponentItem> oldComponents,
+			List<TraceActivationComponentItem> newComponents) {
+
+		// Loop through old components
+		for (int i = 0; i < oldComponents.size(); i++) {
+			TraceActivationComponentItem oldComponent = oldComponents.get(i);
+
+			// Check if the component is found among the new components
+			for (int j = 0; j < newComponents.size(); j++) {
+				TraceActivationComponentItem newComponent = newComponents
+						.get(j);
+
+				if (oldComponent.getId() == newComponent.getId()) {
+
+					// Merge groups
+					mergeGroups(oldComponent.getGroups(), newComponent
+							.getGroups());
+				}
+			}
+		}
+
+		// Set new components to be the one to be used
+		allComponents = newComponents;
+
+		// Sort component list
+		sortComponentList(allComponents);
+
+	}
+
+	/**
+	 * Merges groups from component
+	 * 
+	 * @param oldGroups
+	 *            old groups
+	 * @param newGroups
+	 *            new groups
+	 */
+	private void mergeGroups(List<TraceActivationGroupItem> oldGroups,
+			List<TraceActivationGroupItem> newGroups) {
+
+		// Loop through old groups
+		for (int i = 0; i < oldGroups.size(); i++) {
+			TraceActivationGroupItem oldGroup = oldGroups.get(i);
+
+			// Check if the group if found among the new groups
+			for (int j = 0; j < newGroups.size(); j++) {
+				TraceActivationGroupItem newGroup = newGroups.get(j);
+
+				if (oldGroup.getId() == newGroup.getId()) {
+					newGroup.setActivated(oldGroup.isActivated());
+				}
+			}
+		}
+	}
+
+	/**
+	 * Sorts component list
+	 * 
+	 * @param components
+	 *            component list
+	 */
+	private void sortComponentList(
+			List<TraceActivationComponentItem> componentList) {
+
+		// Sort component list
+		Collections.sort(componentList,
+				new Comparator<TraceActivationComponentItem>() {
+
+					/**
+					 * Compares two components
+					 * 
+					 * @param o1
+					 *            first component
+					 * @param o2
+					 *            second component
+					 * @return less than zero if first one is first in
+					 *         alphabetic order. More than zero if second is
+					 *         first.
+					 */
+					public int compare(TraceActivationComponentItem o1,
+							TraceActivationComponentItem o2) {
+						int val = o1.getName().toLowerCase().compareTo(
+								o2.getName().toLowerCase());
+						return val;
+					}
+				});
+	}
+
+	/**
+	 * This method initializes main composite
+	 * 
+	 */
+	private void createMainComposite() {
+		// Create new composite
+		Composite mainComposite = new Composite(composite, SWT.NONE);
+
+		// Set grid data to composite
+		GridData mainCompositeGridData = new GridData();
+		mainCompositeGridData.horizontalAlignment = GridData.FILL;
+		mainCompositeGridData.grabExcessHorizontalSpace = false;
+		mainCompositeGridData.grabExcessVerticalSpace = false;
+		// mainCompositeGridData.horizontalSpan = 5;
+		mainCompositeGridData.verticalAlignment = GridData.FILL;
+		mainComposite.setLayout(new GridLayout());
+
+		// Set layout data
+		mainComposite.setLayoutData(mainCompositeGridData);
+	}
+
+	/**
+	 * This method initializes dictionary Composite
+	 */
+	private void createDictionaryComposite() {
+		// Create new composite
+		Composite dictionaryComposite = new Composite(mainGroup, SWT.NONE);
+
+		// Set grid data to composite
+		GridData componentCompositeGridData = new GridData();
+		componentCompositeGridData.grabExcessHorizontalSpace = false;
+		componentCompositeGridData.grabExcessVerticalSpace = true;
+		componentCompositeGridData.horizontalSpan = 2;
+		componentCompositeGridData.horizontalAlignment = GridData.FILL;
+		componentCompositeGridData.verticalAlignment = GridData.FILL;
+		dictionaryComposite.setLayoutData(componentCompositeGridData);
+
+		// Set grid layout to composite
+		GridLayout componentCompositeGridLayout = new GridLayout();
+		componentCompositeGridLayout.numColumns = 2;
+		dictionaryComposite.setLayout(componentCompositeGridLayout);
+
+		// Create Dictionary table
+		dictionaryTable = new Table(dictionaryComposite, SWT.BORDER | SWT.MULTI
+				| SWT.FULL_SELECTION);
+		dictionaryTable.setHeaderVisible(true);
+		dictionaryTable.setLinesVisible(false);
+
+		// Set grid data to Dictionary table
+		GridData dictionaryTableGridData = new GridData();
+		dictionaryTableGridData.horizontalSpan = 2;
+		dictionaryTableGridData.heightHint = 250;
+		dictionaryTableGridData.widthHint = 200;
+		dictionaryTableGridData.grabExcessHorizontalSpace = true;
+		dictionaryTableGridData.grabExcessVerticalSpace = true;
+		dictionaryTableGridData.horizontalAlignment = GridData.FILL;
+		dictionaryTableGridData.verticalAlignment = GridData.FILL;
+		dictionaryTable.setLayoutData(dictionaryTableGridData);
+
+		// Create column for table
+		TableColumn column = new TableColumn(dictionaryTable, SWT.NONE);
+		column.setText(Messages
+				.getString("TraceActivationDialog.DictionaryColumnText")); //$NON-NLS-1$
+		column.setToolTipText(Messages
+				.getString("TraceActivationDialog.DictionaryColumnToolTip")); //$NON-NLS-1$
+		column.setWidth(200);
+
+		// Create filter label
+		Label dictionaryFilterLabel = new Label(dictionaryComposite, SWT.NONE);
+		dictionaryFilterLabel.setText(Messages
+				.getString("TraceActivationDialog.FilterInfoText")); //$NON-NLS-1$
+
+		// Create filter text field
+		dictionaryFilterText = new Text(dictionaryComposite, SWT.BORDER);
+		GridData componentFilterTextGridData = new GridData(SWT.FILL, SWT.FILL,
+				true, false);
+		dictionaryFilterText.setLayoutData(componentFilterTextGridData);
+		dictionaryFilterText.setToolTipText(Messages
+				.getString("TraceActivationDialog.DictionaryFilterToolTip")); //$NON-NLS-1$
+		if (savedComponentFilter != null && !savedComponentFilter.equals("")) { //$NON-NLS-1$
+			dictionaryFilterText.setText(savedComponentFilter);
+		}
+	}
+
+	/**
+	 * This method initializes group Composite
+	 */
+	private void createGroupComposite() {
+		// Create new composite
+		Composite groupComposite = new Composite(mainGroup, SWT.NONE);
+
+		// Set grid data to groupComposite
+		GridData groupCompositeGridData = new GridData();
+		groupCompositeGridData.horizontalSpan = 3;
+		groupCompositeGridData.grabExcessHorizontalSpace = true;
+		groupCompositeGridData.grabExcessVerticalSpace = true;
+		groupCompositeGridData.horizontalAlignment = GridData.FILL;
+		groupCompositeGridData.verticalAlignment = GridData.FILL;
+		groupComposite.setLayoutData(groupCompositeGridData);
+
+		// Set grid layout to groupComposite
+		GridLayout groupCompositeGridLayout = new GridLayout();
+		groupCompositeGridLayout.numColumns = 2;
+		groupComposite.setLayout(groupCompositeGridLayout);
+
+		// Create group table
+		groupTable = new Table(groupComposite, SWT.BORDER | SWT.FULL_SELECTION
+				| SWT.MULTI);
+		groupTable.setHeaderVisible(true);
+		groupTable.setLinesVisible(false);
+
+		// Set grid data to group table
+		GridData groupTableGridData = new GridData();
+		groupTableGridData.grabExcessHorizontalSpace = true;
+		groupTableGridData.grabExcessVerticalSpace = true;
+		groupTableGridData.horizontalAlignment = GridData.FILL;
+		groupTableGridData.verticalAlignment = GridData.FILL;
+		groupTableGridData.heightHint = 250;
+		groupTableGridData.widthHint = 450;
+		groupTableGridData.horizontalSpan = 2;
+		groupTable.setLayoutData(groupTableGridData);
+
+		// Group ID column
+		TableColumn groupIdColumn = new TableColumn(groupTable, SWT.NONE);
+		groupIdColumn.setText("ID"); //$NON-NLS-1$
+		groupIdColumn.setToolTipText(Messages
+				.getString("TraceActivationDialog.IdColumnToolTip")); //$NON-NLS-1$
+		groupIdColumn.setWidth(45);
+
+		// Group name column
+		TableColumn groupNameColumn = new TableColumn(groupTable, SWT.NONE);
+		groupNameColumn.setText(Messages
+				.getString("TraceActivationDialog.GroupColumnText")); //$NON-NLS-1$
+		groupNameColumn.setToolTipText(Messages
+				.getString("TraceActivationDialog.GroupColumnToolTip")); //$NON-NLS-1$
+		groupNameColumn.setWidth(355);
+
+		// State column
+		TableColumn stateColumn = new TableColumn(groupTable, SWT.NONE);
+		stateColumn.setText(Messages
+				.getString("TraceActivationDialog.StateColumnText")); //$NON-NLS-1$
+		stateColumn.setToolTipText(Messages
+				.getString("TraceActivationDialog.StateColumnToolTip")); //$NON-NLS-1$
+		stateColumn.setWidth(50);
+
+		// Create group filter label
+		Label groupFilterLabel = new Label(groupComposite, SWT.NONE);
+		groupFilterLabel.setText(Messages
+				.getString("TraceActivationDialog.FilterInfoText")); //$NON-NLS-1$
+
+		// Create group filter text field
+		groupFilterText = new Text(groupComposite, SWT.BORDER);
+		GridData groupFilterTextGridData = new GridData(SWT.FILL, SWT.CENTER,
+				true, false);
+		groupFilterText.setToolTipText(Messages
+				.getString("TraceActivationDialog.GroupFilterToolTip")); //$NON-NLS-1$
+		groupFilterText.setLayoutData(groupFilterTextGridData);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseDialog#createActionListeners()
+	 */
+	@Override
+	public void createActionListeners() {
+
+		// Add selection listener to component Table
+		dictionaryTable.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				TraceViewerGlobals.postUiEvent("ComponentTableSelection" //$NON-NLS-1$
+						+ dictionaryTable.getSelectionIndex(), "1"); //$NON-NLS-1$
+				setGroupsToTable();
+				TraceViewerGlobals.postUiEvent("ComponentTableSelection" //$NON-NLS-1$
+						+ dictionaryTable.getSelectionIndex(), "0"); //$NON-NLS-1$
+			}
+		});
+
+		// Add empty drag listener to remove annoyance
+		dictionaryTable.addDragDetectListener(new DragDetectListener() {
+			public void dragDetected(DragDetectEvent e) {
+			}
+		});
+
+		// Add mouse listener to component Table
+		dictionaryTable.addMouseListener(new MouseListener() {
+			public void mouseDoubleClick(MouseEvent e) {
+			}
+
+			public void mouseDown(MouseEvent e) {
+				if (e.button == RIGHT_MOUSE_BUTTON) {
+					Menu menu = new Menu(dictionaryTable.getShell(), SWT.POP_UP);
+
+					// Activate Dictionary item
+					MenuItem activateItem = new MenuItem(menu, SWT.PUSH);
+					String activateAllText = Messages
+							.getString("TraceActivationDialog.ActivateAllText"); //$NON-NLS-1$
+					activateItem.setText(activateAllText);
+					if (dictionaryTable.getSelectionCount() > 0) {
+						activateItem.setEnabled(true);
+					} else {
+						activateItem.setEnabled(false);
+					}
+					activateItem.addSelectionListener(new SelectionAdapter() {
+
+						@Override
+						public void widgetSelected(SelectionEvent e) {
+							activateSelectedComponents();
+						}
+					});
+
+					// Deactivate Dictionary item
+					MenuItem deactivateItem = new MenuItem(menu, SWT.PUSH);
+					String deActivateAllText = Messages
+							.getString("TraceActivationDialog.DeActivateAllText"); //$NON-NLS-1$
+					deactivateItem.setText(deActivateAllText);
+					if (dictionaryTable.getSelectionCount() > 0) {
+						deactivateItem.setEnabled(true);
+					} else {
+						deactivateItem.setEnabled(false);
+					}
+					deactivateItem.addSelectionListener(new SelectionAdapter() {
+
+						@Override
+						public void widgetSelected(SelectionEvent e) {
+							deactivateSelectedComponents();
+						}
+					});
+
+					// Draws pop up menu:
+					Point pt = new Point(e.x, e.y);
+					pt = dictionaryTable.toDisplay(pt);
+					menu.setLocation(pt.x, pt.y);
+					menu.setVisible(true);
+				} else {
+					firstDictionarySelected = dictionaryTable
+							.getSelectionIndex();
+				}
+			}
+
+			public void mouseUp(MouseEvent e) {
+			}
+		});
+
+		// Add mouse move listener to component Table
+		dictionaryTable.addMouseMoveListener(new MouseMoveListener() {
+			public void mouseMove(MouseEvent e) {
+				if ((e.stateMask & SWT.BUTTON1) != 0) {
+					TableItem selected = dictionaryTable.getItem(new Point(e.x,
+							e.y));
+
+					int oldSelectionLength = dictionaryTable
+							.getSelectionCount();
+
+					if (selected != null) {
+						int idx = dictionaryTable.indexOf(selected);
+
+						if (idx < firstDictionarySelected) {
+							dictionaryTable.setSelection(idx,
+									firstDictionarySelected);
+						} else {
+							dictionaryTable.setSelection(
+									firstDictionarySelected, idx);
+						}
+
+						// Selection is null, it means we can select everything
+					} else {
+						dictionaryTable.setSelection(firstDictionarySelected,
+								dictionaryTable.getItemCount() - 1);
+					}
+
+					// If selection count changed, insert new groups to the
+					// group table
+					if (oldSelectionLength != dictionaryTable
+							.getSelectionCount()) {
+						setGroupsToTable();
+					}
+				}
+			}
+
+		});
+
+		// Add selection listener to group Table
+		groupTable.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				TraceViewerGlobals.postUiEvent("GroupTableSelection" //$NON-NLS-1$
+						+ groupTable.getSelectionIndex(), "1"); //$NON-NLS-1$
+				TraceViewerGlobals.postUiEvent("GroupTableSelection" //$NON-NLS-1$
+						+ groupTable.getSelectionIndex(), "0"); //$NON-NLS-1$
+			}
+		});
+
+		// Add empty drag listener to remove annoyance
+		groupTable.addDragDetectListener(new DragDetectListener() {
+			public void dragDetected(DragDetectEvent e) {
+			}
+		});
+
+		// Add mouse listener to group Table
+		groupTable.addMouseListener(new MouseListener() {
+
+			@SuppressWarnings("unchecked")
+			public void mouseDoubleClick(MouseEvent e) {
+
+				// Get selected groups
+				TableItem[] selectedGroupItems = groupTable.getSelection();
+
+				// Save top index to jump back after recreation of group table
+				int topIndex = groupTable.getTopIndex();
+
+				for (int i = 0; i < selectedGroupItems.length; i++) {
+
+					// If state is both, activate all
+					boolean activateAll = false;
+					if (selectedGroupItems[i].getForeground().equals(
+							STATE_BOTH_COLOR)) {
+						activateAll = true;
+					}
+
+					// Activate from items
+					ArrayList groups = (ArrayList) selectedGroupItems[i]
+							.getData();
+					for (int j = 0; j < groups.size(); j++) {
+						if (activateAll) {
+							((TraceActivationGroupItem) groups.get(j))
+									.setActivated(true);
+						} else if (((TraceActivationGroupItem) groups.get(j))
+								.isActivated()) {
+							((TraceActivationGroupItem) groups.get(j))
+									.setActivated(false);
+						} else {
+							((TraceActivationGroupItem) groups.get(j))
+									.setActivated(true);
+						}
+
+						// Add corresponding component to the changed list
+						addToChangedList(((TraceActivationGroupItem) groups
+								.get(j)).getParent());
+
+					}
+				}
+				setGroupsToTable();
+
+				// Restore the top index
+				groupTable.setTopIndex(topIndex);
+			}
+
+			public void mouseDown(MouseEvent e) {
+				if (e.button == RIGHT_MOUSE_BUTTON) {
+					Menu menu = new Menu(groupTable.getShell(), SWT.POP_UP);
+
+					// Activate groups item
+					MenuItem activateItem = new MenuItem(menu, SWT.PUSH);
+					activateItem.setText(Messages
+							.getString("TraceActivationDialog.ActivateText")); //$NON-NLS-1$
+					if (groupTable.getSelectionCount() > 0) {
+						activateItem.setEnabled(true);
+					} else {
+						activateItem.setEnabled(false);
+					}
+					activateItem.addSelectionListener(new SelectionAdapter() {
+
+						@Override
+						public void widgetSelected(SelectionEvent e) {
+							activateSelectedGroups();
+						}
+					});
+
+					// Deactivate groups item
+					MenuItem deactivateItem = new MenuItem(menu, SWT.PUSH);
+					deactivateItem.setText(Messages
+							.getString("TraceActivationDialog.DeActivateText")); //$NON-NLS-1$
+					if (groupTable.getSelectionCount() > 0) {
+						deactivateItem.setEnabled(true);
+					} else {
+						deactivateItem.setEnabled(false);
+					}
+					deactivateItem.addSelectionListener(new SelectionAdapter() {
+
+						@Override
+						public void widgetSelected(SelectionEvent e) {
+							deactivateSelectedGroups();
+						}
+					});
+
+					// Draws pop up menu:
+					Point pt = new Point(e.x, e.y);
+					pt = groupTable.toDisplay(pt);
+					menu.setLocation(pt.x, pt.y);
+					menu.setVisible(true);
+				} else {
+					firstGroupSelected = groupTable.getSelectionIndex();
+				}
+			}
+
+			public void mouseUp(MouseEvent e) {
+			}
+		});
+
+		// Add mouse move listener to group Table
+		groupTable.addMouseMoveListener(new MouseMoveListener() {
+			public void mouseMove(MouseEvent e) {
+				if ((e.stateMask & SWT.BUTTON1) != 0) {
+					TableItem selected = groupTable
+							.getItem(new Point(e.x, e.y));
+					if (selected != null) {
+						int idx = groupTable.indexOf(selected);
+						if (idx < firstGroupSelected) {
+							groupTable.setSelection(idx, firstGroupSelected);
+						} else {
+							groupTable.setSelection(firstGroupSelected, idx);
+						}
+
+						// Selected is null, we can select all
+					} else {
+						groupTable.setSelection(firstGroupSelected, groupTable
+								.getItemCount() - 1);
+					}
+				}
+			}
+
+		});
+
+		// Add modify listener to component filter
+		dictionaryFilterText.addModifyListener(new ModifyListener() {
+			public void modifyText(ModifyEvent e) {
+				selectComponentsByFilter(false);
+				savedComponentFilter = dictionaryFilterText.getText();
+			}
+		});
+
+		// Add modify listener to group filter
+		groupFilterText.addModifyListener(new ModifyListener() {
+			public void modifyText(ModifyEvent e) {
+				setGroupsToTable();
+				if (groupFilterText.getText().length() > 0) {
+					groupTable.selectAll();
+				}
+			}
+		});
+
+		// Add Dictionary button
+		addDictionaryButton.addSelectionListener(new SelectionAdapter() {
+
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				TraceViewerGlobals.getTraceViewer().getView()
+						.getActionFactory().getAppendDecodeFileAction().run();
+				updateActivationInformation(true);
+			}
+		});
+
+		// Remove Dictionary button
+		removeDictionaryButton.addSelectionListener(new SelectionAdapter() {
+
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				int[] componentIds = dictionaryTable.getSelectionIndices();
+				String[] removedFilePaths = new String[componentIds.length];
+
+				// Loop through selected indices
+				for (int i = 0; i < componentIds.length; i++) {
+					TraceActivationComponentItem comp = currentComponents
+							.get(componentIds[i]);
+					int cid = comp.getId();
+					removedFilePaths[i] = comp.getFilePath();
+
+					// Remove component from the model
+					TraceViewerGlobals.getDecodeProvider()
+							.removeComponentFromModel(cid);
+
+					// Remove components from changed components list
+					for (int j = changedComponents.size() - 1; j >= 0; j--) {
+						if (changedComponents.get(j).getId() == cid) {
+							changedComponents.remove(j);
+						}
+					}
+
+				}
+				// Tell reload action to update files to be watched
+				ReloadDecodeFilesAction action = (ReloadDecodeFilesAction) TraceViewerGlobals
+						.getTraceViewer().getView().getActionFactory()
+						.getReloadDecodeFilesAction();
+				action.updateFilesToBeWatched();
+
+				// Update dialog information
+				updateActivationInformation(false);
+
+			}
+		});
+	}
+
+	/**
+	 * Activates selected components
+	 */
+	private void activateSelectedComponents() {
+		TraceViewerGlobals.postUiEvent("ComponentActivateButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+
+		// Get selected components
+		int[] selected = dictionaryTable.getSelectionIndices();
+		for (int i = 0; i < selected.length; i++) {
+
+			// Get all groups
+			List<TraceActivationGroupItem> groups = currentComponents.get(
+					selected[i]).getGroups();
+			for (int j = 0; j < groups.size(); j++) {
+				groups.get(j).setActivated(true);
+
+				// Add component to changed list
+				addToChangedList(groups.get(j).getParent());
+			}
+		}
+		setGroupsToTable();
+		TraceViewerGlobals.postUiEvent("ComponentActivateButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+
+	}
+
+	/**
+	 * Deactivates selected components
+	 */
+	private void deactivateSelectedComponents() {
+		TraceViewerGlobals.postUiEvent("ComponentDeactivateButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+		// Get selected components
+		int[] selected = dictionaryTable.getSelectionIndices();
+		for (int i = 0; i < selected.length; i++) {
+
+			// Get all groups
+			List<TraceActivationGroupItem> groups = currentComponents.get(
+					selected[i]).getGroups();
+			for (int j = 0; j < groups.size(); j++) {
+				groups.get(j).setActivated(false);
+
+				// Add component to changed list
+				addToChangedList(groups.get(j).getParent());
+			}
+		}
+		setGroupsToTable();
+		TraceViewerGlobals.postUiEvent("ComponentDeactivateButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+
+	}
+
+	/**
+	 * Activates selected groups
+	 */
+	private void activateSelectedGroups() {
+		// Save top index to jump back after recreation of group table
+		int topIndex = groupTable.getTopIndex();
+
+		TraceViewerGlobals.postUiEvent("GroupActivateButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+
+		// Get selection indices
+		int[] selectionIndeces = groupTable.getSelectionIndices();
+
+		// Get selected groups
+		TableItem[] selectedGroupItems = groupTable.getSelection();
+		for (int i = 0; i < selectedGroupItems.length; i++) {
+			// Activate from items
+			ArrayList<?> groups = (ArrayList<?>) selectedGroupItems[i]
+					.getData();
+			for (int j = 0; j < groups.size(); j++) {
+				TraceActivationGroupItem item = ((TraceActivationGroupItem) groups
+						.get(j));
+				item.setActivated(true);
+
+				// Add component to changed list
+				addToChangedList(item.getParent());
+			}
+		}
+
+		setGroupsToTable();
+		groupTable.setSelection(selectionIndeces);
+		groupTable.setFocus();
+
+		// Restore the top index
+		groupTable.setTopIndex(topIndex);
+
+		TraceViewerGlobals.postUiEvent("GroupActivateButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+
+	}
+
+	/**
+	 * Deactivates selected groups
+	 */
+	private void deactivateSelectedGroups() {
+		// Save top index to jump back after recreation of group table
+		int topIndex = groupTable.getTopIndex();
+
+		TraceViewerGlobals.postUiEvent("GroupDeactivateButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+		// Get selectionIndices
+		int[] selectionIndeces = groupTable.getSelectionIndices();
+
+		// Get selected groups
+		TableItem[] selectedGroupItems = groupTable.getSelection();
+		for (int i = 0; i < selectedGroupItems.length; i++) {
+			// Activate from items
+			ArrayList<?> groups = (ArrayList<?>) selectedGroupItems[i]
+					.getData();
+			for (int j = 0; j < groups.size(); j++) {
+				TraceActivationGroupItem item = ((TraceActivationGroupItem) groups
+						.get(j));
+				item.setActivated(false);
+
+				// Add component to changed list
+				addToChangedList(item.getParent());
+			}
+		}
+
+		setGroupsToTable();
+		groupTable.setSelection(selectionIndeces);
+		groupTable.setFocus();
+
+		// Restore the top index
+		groupTable.setTopIndex(topIndex);
+
+		TraceViewerGlobals.postUiEvent("GroupDeactivateButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+
+	}
+
+	/**
+	 * Sets components to the Dictionaries table
+	 * 
+	 * @param components
+	 *            list of components
+	 */
+	private void setComponentsToTable(
+			List<TraceActivationComponentItem> components) {
+
+		// Empty the table first
+		dictionaryTable.removeAll();
+
+		// Loop trough component list and create tableitems
+		for (int i = 0; i < components.size(); i++) {
+			TableItem item = new TableItem(dictionaryTable, SWT.NONE);
+			item.setText(components.get(i).getName());
+			item.setData(components.get(i));
+		}
+
+		// Select the previous one and set groups from that component
+		if (dictionaryTable.getItemCount() >= previousSelectedDictionaryIndices.length) {
+			dictionaryTable.setSelection(previousSelectedDictionaryIndices);
+			setGroupsToTable();
+		} else if (dictionaryTable.getItemCount() > 0) {
+			dictionaryTable.setSelection(0);
+			setGroupsToTable();
+		}
+	}
+
+	/**
+	 * Sets groups
+	 */
+	private void setGroupsToTable() {
+		groupTable.removeAll();
+		int[] selected = dictionaryTable.getSelectionIndices();
+
+		// Create TraceActivationGroupTableItems
+		List<TraceActivationGroupTableItem> items = createTraceActivationGroupTableItems(selected);
+
+		// Loop through all table items
+		for (int i = 0; i < items.size(); i++) {
+
+			StringBuffer text = new StringBuffer();
+			String id = "*"; //$NON-NLS-1$
+
+			// More than one components with the same group
+			if (items.get(i).getComponentCount() > 1) {
+
+				String multipleGroupsMsg1 = Messages
+						.getString("TraceActivationDialog.MultipleGroupsMessage1"); //$NON-NLS-1$
+				String multipleGroupsMsg2 = Messages
+						.getString("TraceActivationDialog.MultipleGroupsMessage2"); //$NON-NLS-1$
+
+				// Append texts to the buffer
+				text.append(items.get(i).getName());
+				text.append(multipleGroupsMsg1);
+				text.append(items.get(i).getComponentCount());
+				text.append(multipleGroupsMsg2);
+
+				// One component's group with many components selected
+			} else if (dictionaryTable.getSelectionCount() > 1) {
+				String idStr = Integer.toHexString(items.get(i).getId());
+				if (idStr.length() == 1) {
+					idStr = LEAD_ZERO + idStr;
+				}
+				id = HEX_PREFIX + idStr;
+				text.append(items.get(i).getName());
+				text.append(' ');
+				text.append('(');
+				text.append(items.get(i).getRealGroups().get(0).getParent()
+						.getName());
+				text.append(')');
+
+				// One component with one component selected
+			} else {
+				String idStr = Integer.toHexString(items.get(i).getId());
+				if (idStr.length() == 1) {
+					idStr = LEAD_ZERO + idStr;
+				}
+				id = HEX_PREFIX + idStr;
+				text.append(items.get(i).getName());
+			}
+
+			// Check if this group matches the filter
+			if (checkGroupFilter(items.get(i).getName())) {
+
+				TableItem item = new TableItem(groupTable, SWT.NONE);
+				item.setText(id);
+				item.setText(1, text.toString());
+				item.setData(items.get(i).getRealGroups());
+
+				String activated = ""; //$NON-NLS-1$
+				Color color;
+				if (items.get(i).isDifferentStates()) {
+					activated = STATE_BOTH_STRING;
+					color = STATE_BOTH_COLOR;
+				} else if (items.get(i).isActivated()) {
+					activated = STATE_ON_STRING;
+					color = STATE_ON_COLOR;
+				} else {
+					activated = STATE_OFF_STRING;
+					color = STATE_OFF_COLOR;
+				}
+
+				item.setText(2, activated);
+				item.setForeground(color);
+			}
+		}
+
+		// Set remove Dictionary button status
+		if (selected.length > 0) {
+			removeDictionaryButton.setEnabled(true);
+		} else {
+			removeDictionaryButton.setEnabled(false);
+		}
+	}
+
+	/**
+	 * Checks if this group name matches the set group filter
+	 * 
+	 * @param groupName
+	 *            group name
+	 * @return true if this group should be visible in the table
+	 */
+	private boolean checkGroupFilter(String groupName) {
+		boolean showGroup = true;
+		if (!groupFilterText.getText().equals("")) { //$NON-NLS-1$
+			if (groupName.toLowerCase().contains(
+					groupFilterText.getText().toLowerCase())
+					|| groupFilterText.getText().equals("*")) { //$NON-NLS-1$
+			} else {
+				showGroup = false;
+			}
+		}
+		return showGroup;
+	}
+
+	/**
+	 * Creates group table items
+	 * 
+	 * @param selected
+	 *            selected components
+	 * @return list of group table items to insert to table
+	 */
+	private List<TraceActivationGroupTableItem> createTraceActivationGroupTableItems(
+			int[] selected) {
+		List<TraceActivationGroupTableItem> tableItems = new ArrayList<TraceActivationGroupTableItem>();
+		List<TraceActivationGroupItem> realItems = new ArrayList<TraceActivationGroupItem>();
+		// Loop through selected components
+		for (int i = 0; i < selected.length; i++) {
+			// Get groups from this component
+			List<TraceActivationGroupItem> groups = currentComponents.get(
+					selected[i]).getGroups();
+			// Insert all groups
+			realItems.addAll(groups);
+		}
+
+		// Now we have list of all groups, start inserting to the tableItems
+		for (int k = 0; k < realItems.size(); k++) {
+
+			// Check that this groups is not in the array yet
+			boolean inArray = false;
+			for (int l = 0; l < tableItems.size(); l++) {
+				// Is in array
+				if (realItems.get(k).getName().equals(
+						tableItems.get(l).getName())) {
+					tableItems.get(l).setComponentCount(
+							tableItems.get(l).getComponentCount() + 1);
+
+					// Two different states
+					if (realItems.get(k).isActivated() != tableItems.get(l)
+							.isActivated()) {
+						tableItems.get(l).setDifferentStates(true);
+					}
+
+					tableItems.get(l).getRealGroups().add(realItems.get(k));
+					inArray = true;
+				}
+			}
+			// If not in array, put it there
+			if (!inArray) {
+				TraceActivationGroupTableItem newItem = new TraceActivationGroupTableItem();
+				newItem.setComponentCount(1);
+				newItem.setDifferentStates(false);
+				newItem.setId(realItems.get(k).getId());
+				newItem.setName(realItems.get(k).getName());
+				newItem.setActivated(realItems.get(k).isActivated());
+				newItem.getRealGroups().add(realItems.get(k));
+				tableItems.add(newItem);
+			}
+		}
+		return tableItems;
+	}
+
+	/**
+	 * Selects components by filter
+	 * 
+	 * @param firstTime
+	 *            if true, this is called when opening the dialog and not
+	 *            because the filter text changed
+	 */
+	private void selectComponentsByFilter(boolean firstTime) {
+
+		// Remove old components
+		if (!dictionaryFilterText.getText().equals("")) { //$NON-NLS-1$
+			dictionaryTable.removeAll();
+			currentComponents.clear();
+			for (int i = 0; i < allComponents.size(); i++) {
+				if (allComponents.get(i).getName().toLowerCase().contains(
+						dictionaryFilterText.getText().toLowerCase())
+						|| dictionaryFilterText.getText().equals("*")) { //$NON-NLS-1$
+					currentComponents.add(allComponents.get(i));
+				}
+			}
+			setComponentsToTable(currentComponents);
+			dictionaryTable.selectAll();
+		} else {
+			// Filter removed, copy all items
+			copyItems(allComponents, currentComponents);
+			setComponentsToTable(currentComponents);
+
+			if (!firstTime) {
+				dictionaryTable.deselectAll();
+			}
+		}
+
+		setGroupsToTable();
+	}
+
+	/**
+	 * Copies activation items from list to another. Empties the destination
+	 * list before copying.
+	 * 
+	 * @param fromList
+	 *            from array
+	 * @param toList
+	 *            destination array
+	 */
+	private void copyItems(List<TraceActivationComponentItem> fromList,
+			List<TraceActivationComponentItem> toList) {
+		toList.clear();
+		for (int i = 0; i < fromList.size(); i++) {
+			toList.add(fromList.get(i));
+		}
+
+	}
+
+	/**
+	 * Adds component item to changed list to wait for be sent as activation
+	 * message
+	 * 
+	 * @param item
+	 *            item to be added to list
+	 */
+	private void addToChangedList(TraceActivationComponentItem item) {
+
+		// Add to changed list if doesn't exist yet
+		if (!changedComponents.contains(item)) {
+
+			// If a component with same ID is found, remove old one
+			for (int i = 0; i < changedComponents.size(); i++) {
+				if (changedComponents.get(i).getId() == item.getId()) {
+					changedComponents.remove(i);
+					break;
+				}
+			}
+
+			changedComponents.add(item);
+		}
+	}
+
+	/**
+	 * Sets model changed
+	 * 
+	 * @param modelChanged
+	 *            the modelChanged to set
+	 */
+	public void setModelChanged(boolean modelChanged) {
+		this.modelChanged = modelChanged;
+
+		// Dialog open, update
+		if (getShell() != null && !getShell().isDisposed()) {
+			getActivationInformation();
+		}
+	}
+
+	/**
+	 * Sends activation information
+	 */
+	private void sendActivationInformation() {
+		if (TraceViewerGlobals.getTraceViewer().getConnection() != null
+				&& TraceViewerGlobals.getTraceViewer().getConnection()
+						.isConnected()) {
+
+			// Set all selected components to be changed
+			// Get selected components and add them to changed list
+			int[] selected = dictionaryTable.getSelectionIndices();
+			for (int i = 0; i < selected.length; i++) {
+				TraceActivationComponentItem component = currentComponents
+						.get(selected[i]);
+				addToChangedList(component);
+			}
+
+			// Activate
+			new TraceActivator().activate(changedComponents);
+
+			// No connection, post error to Trace Events
+		} else {
+			String notOpenMsg = Messages
+					.getString("TraceActivationDialog.CannotSendConnectionNotOpen"); //$NON-NLS-1$
+			TraceViewerGlobals.postErrorEvent(notOpenMsg,
+					TRACE_ACTIVATION_CATEGORY, null);
+		}
+	}
+
+	/**
+	 * Checks if the dialog is open
+	 * 
+	 * @return true if dialog is open
+	 */
+	public boolean isOpen() {
+		boolean isOpen = false;
+		if (getShell() != null && !getShell().isDisposed()) {
+			isOpen = true;
+		}
+		return isOpen;
+	}
+
+	/**
+	 * Sets focus to this dialog
+	 */
+	public void setFocus() {
+		if (!getShell().isDisposed()) {
+			getShell().setFocus();
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/TraceActivationGroupTableItem.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,181 @@
+/*
+ * 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:
+ *
+ * Trace Activation Group Table Item
+ *
+ */
+package com.nokia.traceviewer.dialog;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.nokia.traceviewer.engine.activation.TraceActivationGroupItem;
+
+/**
+ * Trace Activation Group Table Item
+ */
+public class TraceActivationGroupTableItem {
+
+	/**
+	 * ID of the item
+	 */
+	private int id;
+
+	/**
+	 * Name of the item
+	 */
+	private String name;
+
+	/**
+	 * Is item activated or not
+	 */
+	private boolean activated;
+
+	/**
+	 * Does item have two different states
+	 */
+	private boolean differentStates;
+
+	/**
+	 * How many components has this group
+	 */
+	private int componentCount;
+
+	/**
+	 * Reference to real group items
+	 */
+	private List<TraceActivationGroupItem> realGroups;
+
+	/**
+	 * Constructor
+	 */
+	public TraceActivationGroupTableItem() {
+		realGroups = new ArrayList<TraceActivationGroupItem>();
+	}
+
+	/**
+	 * Gets component count
+	 * 
+	 * @return the componentCount
+	 */
+	public int getComponentCount() {
+		return componentCount;
+	}
+
+	/**
+	 * Sets component count
+	 * 
+	 * @param componentCount
+	 *            the componentCount to set
+	 */
+	public void setComponentCount(int componentCount) {
+		this.componentCount = componentCount;
+	}
+
+	/**
+	 * Tells has this item two different states
+	 * 
+	 * @return the differentStates
+	 */
+	public boolean isDifferentStates() {
+		return differentStates;
+	}
+
+	/**
+	 * Sets this item to have two different states
+	 * 
+	 * @param differentStates
+	 *            the differentStates to set
+	 */
+	public void setDifferentStates(boolean differentStates) {
+		this.differentStates = differentStates;
+	}
+
+	/**
+	 * Gets ID
+	 * 
+	 * @return the id
+	 */
+	public int getId() {
+		return id;
+	}
+
+	/**
+	 * Sets ID
+	 * 
+	 * @param id
+	 *            the id to set
+	 */
+	public void setId(int id) {
+		this.id = id;
+	}
+
+	/**
+	 * Gets name of the item
+	 * 
+	 * @return the name
+	 */
+	public String getName() {
+		return name;
+	}
+
+	/**
+	 * Sets name of the item
+	 * 
+	 * @param name
+	 *            the name to set
+	 */
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	/**
+	 * Tells is this item activated
+	 * 
+	 * @return the activated
+	 */
+	public boolean isActivated() {
+		return activated;
+	}
+
+	/**
+	 * Sets this item activated
+	 * 
+	 * @param activated
+	 *            the activated to set
+	 */
+	public void setActivated(boolean activated) {
+		this.activated = activated;
+	}
+
+	/**
+	 * Gets real groups of this item
+	 * 
+	 * @return the realGroups
+	 */
+	public List<TraceActivationGroupItem> getRealGroups() {
+		return realGroups;
+	}
+
+	/**
+	 * Sets real groups of this item
+	 * 
+	 * @param realGroups
+	 *            the realGroups to set
+	 */
+	public void setRealGroups(List<TraceActivationGroupItem> realGroups) {
+		this.realGroups = realGroups;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/TraceConfigurationLoadDialog.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,395 @@
+/*
+ * 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:
+ *
+ * Trace configuration load dialog
+ *
+ */
+package com.nokia.traceviewer.dialog;
+
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.activation.TraceActivationComponentItem;
+import com.nokia.traceviewer.engine.activation.TraceActivationXMLImporter;
+
+/**
+ * Trace configuration load dialog
+ * 
+ */
+public final class TraceConfigurationLoadDialog extends BaseDialog {
+
+	/**
+	 * Filter names used in open configuration dialog
+	 */
+	private static final String[] FILTER_NAMES = { Messages
+			.getString("TraceConfigurationLoadDialog.FilterNames") }; //$NON-NLS-1$
+
+	/**
+	 * Filter extensions used in open configuration dialog
+	 */
+	private static final String[] FILTER_EXTS = { "*.xml", "*.*" }; //$NON-NLS-1$ //$NON-NLS-2$
+
+	/**
+	 * File text field
+	 */
+	private Text fileText;
+
+	/**
+	 * Previous file selected
+	 */
+	private String previousFile = ""; //$NON-NLS-1$
+
+	/**
+	 * Previous configuration loaded
+	 */
+	private String previousConfiguration = ""; //$NON-NLS-1$
+
+	/**
+	 * File browse button
+	 */
+	private Button fileBrowseButton;
+
+	/**
+	 * Configuration combo
+	 */
+	private Combo configurationCombo;
+
+	/**
+	 * All components from the Activation dialog
+	 */
+	private List<TraceActivationComponentItem> allComponents;
+
+	/**
+	 * Changed components from the Activation dialog
+	 */
+	private List<TraceActivationComponentItem> changedComponents;
+
+	/**
+	 * If true, given array already contains the possible components. If false,
+	 * components are gathered to the array while importing
+	 */
+	private boolean arraysAlreadyContainComponents;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param arraysAlreadyContainComponents
+	 *            if true, given arrays already contain components and only the
+	 *            status of those should be changed
+	 * @param previousConfigurationFile
+	 *            possible previous configuration file path. Can be null.
+	 */
+	public TraceConfigurationLoadDialog(boolean arraysAlreadyContainComponents,
+			String previousConfigurationFile) {
+		super(PlatformUI.getWorkbench().getDisplay().getActiveShell(),
+				SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.RESIZE);
+		this.arraysAlreadyContainComponents = arraysAlreadyContainComponents;
+		if (previousConfigurationFile != null) {
+			this.previousFile = previousConfigurationFile;
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseDialog#createDialogContents()
+	 */
+	@Override
+	protected void createDialogContents() {
+		// Shell
+		GridLayout shellGridLayout = new GridLayout();
+		getShell().setText(
+				Messages.getString("TraceConfigurationLoadDialog.ShellTitle")); //$NON-NLS-1$
+		composite.setLayout(shellGridLayout);
+
+		// File group
+		GridLayout fileGroupGridLayout = new GridLayout();
+		fileGroupGridLayout.numColumns = 2;
+		GridData fileGroupGridData = new GridData(SWT.FILL, SWT.FILL, true,
+				true);
+		Group fileGroup = new Group(composite, SWT.NONE);
+		fileGroup.setText(Messages
+				.getString("TraceConfigurationLoadDialog.FileGroupText")); //$NON-NLS-1$
+		fileGroup.setLayout(fileGroupGridLayout);
+		fileGroup.setLayoutData(fileGroupGridData);
+
+		// Current file Label
+		GridData currentFileLabelGridData = new GridData();
+		currentFileLabelGridData.horizontalSpan = 2;
+		Label currentFileLabel = new Label(fileGroup, SWT.NONE);
+		currentFileLabel.setText(Messages
+				.getString("TraceConfigurationLoadDialog.FileLabelText")); //$NON-NLS-1$
+		currentFileLabel.setLayoutData(currentFileLabelGridData);
+
+		// File Text field
+		GridData fileTextGridData = new GridData(SWT.FILL, SWT.FILL, true,
+				false);
+		fileText = new Text(fileGroup, SWT.BORDER);
+		fileText.setEditable(false);
+		fileText.setLayoutData(fileTextGridData);
+		if (previousFile != null) {
+			fileText.setText(previousFile);
+			fileText.setSelection(fileText.getText().length());
+		}
+
+		// Browse button
+		GridData fileBrowseButtonGridData = new GridData();
+		fileBrowseButtonGridData.widthHint = 75;
+		fileBrowseButton = new Button(fileGroup, SWT.PUSH);
+		fileBrowseButton.setText(Messages
+				.getString("TraceConfigurationLoadDialog.BrowseButtonText")); //$NON-NLS-1$
+		fileBrowseButton.setToolTipText(Messages
+				.getString("TraceConfigurationLoadDialog.BrowseButtonToolTip")); //$NON-NLS-1$
+		fileBrowseButton.setLayoutData(fileBrowseButtonGridData);
+
+		// Configuration group
+		GridLayout configurationGroupGridLayout = new GridLayout();
+		GridData configurationGroupGridData = new GridData(SWT.FILL, SWT.FILL,
+				true, true);
+		Group configurationGroup = new Group(composite, SWT.NONE);
+		configurationGroup.setText(Messages
+				.getString("TraceConfigurationLoadDialog.ConfGroupText")); //$NON-NLS-1$
+		configurationGroup.setLayout(configurationGroupGridLayout);
+		configurationGroup.setLayoutData(configurationGroupGridData);
+
+		// Current configuration Label
+		GridData currentConfigurationLabelGridData = new GridData();
+		currentConfigurationLabelGridData.widthHint = 350;
+		Label currentConfigurationLabel = new Label(configurationGroup,
+				SWT.NONE);
+		currentConfigurationLabel.setText(Messages
+				.getString("TraceConfigurationLoadDialog.LoadLabelText")); //$NON-NLS-1$
+		currentConfigurationLabel
+				.setLayoutData(currentConfigurationLabelGridData);
+
+		// Configuration Combo box
+		GridData configurationComboGridData = new GridData(SWT.FILL, SWT.FILL,
+				true, false);
+		configurationCombo = new Combo(configurationGroup, SWT.BORDER
+				| SWT.READ_ONLY);
+		configurationCombo.setToolTipText(Messages
+				.getString("TraceConfigurationLoadDialog.ConfComboToolTip")); //$NON-NLS-1$
+		configurationCombo.setLayoutData(configurationComboGridData);
+		if (previousFile == null || previousFile.equals("")) { //$NON-NLS-1$
+			configurationCombo.setEnabled(false);
+		}
+
+		getConfigurationNamesFromFile();
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(getShell(),
+				TraceViewerHelpContextIDs.ACTIVATION_CONFIGURATIONS);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseDialog#createActionListeners()
+	 */
+	@Override
+	protected void createActionListeners() {
+
+		// Add selection listener to file browse button
+		fileBrowseButton.addSelectionListener(new SelectionAdapter() {
+
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				FileDialog dlg = new FileDialog(PlatformUI.getWorkbench()
+						.getDisplay().getActiveShell(), SWT.OPEN);
+				dlg.setFilterNames(FILTER_NAMES);
+				dlg.setFilterExtensions(FILTER_EXTS);
+				String fn = dlg.open();
+				if (fn != null) {
+					if (!fn.endsWith(".xml")) { //$NON-NLS-1$
+						fn += ".xml"; //$NON-NLS-1$
+					}
+					fileText.setText(fn);
+					previousFile = fn;
+					configurationCombo.setEnabled(true);
+
+					getConfigurationNamesFromFile();
+				}
+			}
+		});
+
+		// Add modify listener to configuration combo box
+		configurationCombo.addModifyListener(new ModifyListener() {
+			public void modifyText(ModifyEvent e) {
+				checkEnableOkButton();
+			}
+		});
+
+		// Add modify listener to file text field
+		fileText.addModifyListener(new ModifyListener() {
+			public void modifyText(ModifyEvent e) {
+				checkEnableOkButton();
+			}
+		});
+
+	}
+
+	/**
+	 * Gets configuration names from XML file
+	 */
+	private void getConfigurationNamesFromFile() {
+		String filePath = fileText.getText();
+
+		// Load configurations from given file
+		TraceActivationXMLImporter importer = new TraceActivationXMLImporter(
+				filePath);
+
+		String[] configurationNames = importer.importConfigurationNames();
+		if (configurationNames != null && configurationNames.length > 0) {
+			configurationCombo.setItems(configurationNames);
+			configurationCombo.setText(configurationNames[0]);
+		} else {
+			configurationCombo.removeAll();
+		}
+	}
+
+	/**
+	 * Loads configuration
+	 */
+	private boolean loadConfiguration() {
+		boolean succeeded = false;
+		String filePath = fileText.getText();
+		String confName = configurationCombo.getText();
+
+		if (!confName.equals("")) { //$NON-NLS-1$
+			previousConfiguration = confName;
+
+			TraceActivationXMLImporter importer = new TraceActivationXMLImporter(
+					filePath);
+			boolean success = false;
+
+			// Change the "On / Off" values for already existing components
+			if (arraysAlreadyContainComponents) {
+				success = importer.importData(allComponents, confName,
+						changedComponents);
+			}
+
+			if (success) {
+				// Inform about load succesful
+				String loadMsg = Messages
+						.getString("TraceConfigurationLoadDialog.LoadMsg"); //$NON-NLS-1$
+				TraceViewerGlobals.getTraceViewer().getDialogs()
+						.showInformationMessage(loadMsg);
+				succeeded = true;
+			}
+		} else {
+			String emptyConfNameMsg = Messages
+					.getString("TraceConfigurationLoadDialog.ConfNameMsg"); //$NON-NLS-1$
+			TraceViewerGlobals.getTraceViewer().getDialogs()
+					.showInformationMessage(emptyConfNameMsg);
+		}
+
+		return succeeded;
+	}
+
+	/**
+	 * Opens the dialog
+	 * 
+	 * @param allComponents
+	 *            all the components
+	 * @param changedComponents
+	 *            list of changed components
+	 */
+	public void openDialog(List<TraceActivationComponentItem> allComponents,
+			List<TraceActivationComponentItem> changedComponents) {
+		this.allComponents = allComponents;
+		this.changedComponents = changedComponents;
+
+		open();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse
+	 * .swt.widgets.Composite)
+	 */
+	@Override
+	protected void createButtonsForButtonBar(Composite parent) {
+		super.createButtonsForButtonBar(parent);
+		if (configurationCombo == null || configurationCombo.getText() == null
+				|| configurationCombo.getText().equals("")) { //$NON-NLS-1$
+			getButton(OK).setEnabled(false);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+	 */
+	@Override
+	protected void okPressed() {
+		boolean succeeded = loadConfiguration();
+		if (!succeeded && arraysAlreadyContainComponents) {
+			// DO nothing, failed
+		} else {
+			super.okPressed();
+		}
+	}
+
+	/**
+	 * Check if OK button can be enabled and if yes, do it
+	 */
+	private void checkEnableOkButton() {
+		if (configurationCombo.getText().equals("")) { //$NON-NLS-1$
+			getButton(OK).setEnabled(false);
+
+			// Set OK button enabled
+		} else if (!fileText.getText().equals("")) { //$NON-NLS-1$
+			getButton(OK).setEnabled(true);
+		}
+	}
+
+	/**
+	 * Gets previously loaded file path
+	 * 
+	 * @return previously loaded file path
+	 */
+	public String getLoadedConfigurationFilePath() {
+		return previousFile;
+	}
+
+	/**
+	 * Gets previously loaded configuration name
+	 * 
+	 * @return previously loaded configuration name
+	 */
+	public String getLoadedConfigurationName() {
+		return previousConfiguration;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/TraceConfigurationSaveDialog.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,363 @@
+/*
+ * 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:
+ *
+ * Trace configuration save dialog
+ *
+ */
+package com.nokia.traceviewer.dialog;
+
+import java.io.File;
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.activation.TraceActivationComponentItem;
+import com.nokia.traceviewer.engine.activation.TraceActivationXMLExporter;
+import com.nokia.traceviewer.engine.activation.TraceActivationXMLImporter;
+
+/**
+ * Trace configuration save dialog
+ * 
+ */
+public final class TraceConfigurationSaveDialog extends BaseDialog {
+
+	/**
+	 * Filter names used in open configuration dialog
+	 */
+	private static final String[] FILTER_NAMES = { Messages
+			.getString("TraceConfigurationSaveDialog.FilterNames") }; //$NON-NLS-1$
+
+	/**
+	 * Filter extensions used in open configuration dialog
+	 */
+	private static final String[] FILTER_EXTS = { "*.xml", "*.*" }; //$NON-NLS-1$ //$NON-NLS-2$
+
+	/**
+	 * File text field
+	 */
+	private Text fileText;
+
+	/**
+	 * Previous file selected
+	 */
+	private String previousFile;
+
+	/**
+	 * File browse button
+	 */
+	private Button fileBrowseButton;
+
+	/**
+	 * Configuration combo
+	 */
+	private Combo configurationCombo;
+
+	/**
+	 * All components from the Activation dialog
+	 */
+	private List<TraceActivationComponentItem> allComponents;
+
+	/**
+	 * Constructor
+	 */
+	public TraceConfigurationSaveDialog() {
+		super(PlatformUI.getWorkbench().getDisplay().getActiveShell(),
+				SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.RESIZE);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseDialog#createDialogContents()
+	 */
+	@Override
+	protected void createDialogContents() {
+		// Shell
+		GridLayout shellGridLayout = new GridLayout();
+		getShell().setText(
+				Messages.getString("TraceConfigurationSaveDialog.ShellTitle")); //$NON-NLS-1$
+		composite.setLayout(shellGridLayout);
+
+		// File group
+		GridLayout fileGroupGridLayout = new GridLayout();
+		fileGroupGridLayout.numColumns = 2;
+		GridData fileGroupGridData = new GridData(SWT.FILL, SWT.FILL, true,
+				true);
+		Group fileGroup = new Group(composite, SWT.NONE);
+		fileGroup.setText(Messages
+				.getString("TraceConfigurationSaveDialog.FileGroupText")); //$NON-NLS-1$
+		fileGroup.setLayout(fileGroupGridLayout);
+		fileGroup.setLayoutData(fileGroupGridData);
+
+		// Current file Label
+		GridData currentFileLabelGridData = new GridData();
+		currentFileLabelGridData.horizontalSpan = 2;
+		Label currentFileLabel = new Label(fileGroup, SWT.NONE);
+		currentFileLabel
+				.setText(Messages
+						.getString("TraceConfigurationSaveDialog.CurrentFileLabelText")); //$NON-NLS-1$
+		currentFileLabel.setLayoutData(currentFileLabelGridData);
+
+		// File Text field
+		GridData fileTextGridData = new GridData(SWT.FILL, SWT.FILL, true,
+				false);
+		fileText = new Text(fileGroup, SWT.BORDER);
+		fileText.setLayoutData(fileTextGridData);
+		if (previousFile != null) {
+			fileText.setText(previousFile);
+			fileText.setSelection(fileText.getText().length());
+		}
+
+		// Browse button
+		GridData fileBrowseButtonGridData = new GridData();
+		fileBrowseButtonGridData.widthHint = 75;
+		fileBrowseButton = new Button(fileGroup, SWT.PUSH);
+		fileBrowseButton.setText(Messages
+				.getString("TraceConfigurationSaveDialog.BrowseButtonText")); //$NON-NLS-1$
+		fileBrowseButton.setToolTipText(Messages
+				.getString("TraceConfigurationSaveDialog.BrowseButtonToolTip")); //$NON-NLS-1$
+		fileBrowseButton.setLayoutData(fileBrowseButtonGridData);
+
+		// Configuration group
+		GridLayout configurationGroupGridLayout = new GridLayout();
+		GridData configurationGroupGridData = new GridData(SWT.FILL, SWT.FILL,
+				true, true);
+		Group configurationGroup = new Group(composite, SWT.NONE);
+		configurationGroup.setText(Messages
+				.getString("TraceConfigurationSaveDialog.ConfGroupText")); //$NON-NLS-1$
+		configurationGroup.setLayout(configurationGroupGridLayout);
+		configurationGroup.setLayoutData(configurationGroupGridData);
+
+		// Current configuration Label
+		GridData currentConfigurationLabelGridData = new GridData();
+		currentConfigurationLabelGridData.widthHint = 350;
+		Label currentConfigurationLabel = new Label(configurationGroup,
+				SWT.NONE);
+		currentConfigurationLabel.setText(Messages
+				.getString("TraceConfigurationSaveDialog.ConfLabelText")); //$NON-NLS-1$
+		currentConfigurationLabel
+				.setLayoutData(currentConfigurationLabelGridData);
+
+		// Configuration Combo box
+		GridData configurationComboGridData = new GridData(SWT.FILL, SWT.FILL,
+				true, false);
+		configurationCombo = new Combo(configurationGroup, SWT.BORDER);
+		configurationCombo.setToolTipText(Messages
+				.getString("TraceConfigurationSaveDialog.ConfComboToolTip")); //$NON-NLS-1$
+		configurationCombo.setLayoutData(configurationComboGridData);
+		if (previousFile == null || previousFile.equals("")) { //$NON-NLS-1$
+			configurationCombo.setEnabled(false);
+		}
+
+		getConfigurationNamesFromFile();
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(getShell(),
+				TraceViewerHelpContextIDs.ACTIVATION_CONFIGURATIONS);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseDialog#createActionListeners()
+	 */
+	@Override
+	protected void createActionListeners() {
+
+		// Add selection listener to file browse button
+		fileBrowseButton.addSelectionListener(new SelectionAdapter() {
+
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				FileDialog dlg = new FileDialog(PlatformUI.getWorkbench()
+						.getDisplay().getActiveShell(), SWT.OPEN);
+				dlg.setFilterNames(FILTER_NAMES);
+				dlg.setFilterExtensions(FILTER_EXTS);
+				String fn = dlg.open();
+				if (fn != null) {
+					if (!fn.endsWith(".xml")) { //$NON-NLS-1$
+						fn += ".xml"; //$NON-NLS-1$
+					}
+					fileText.setText(fn);
+					previousFile = fn;
+					configurationCombo.setEnabled(true);
+
+					getConfigurationNamesFromFile();
+				}
+			}
+		});
+
+		// Add modify listener to configuration combo box
+		configurationCombo.addModifyListener(new ModifyListener() {
+			public void modifyText(ModifyEvent e) {
+				checkEnableOkButton();
+			}
+		});
+
+		// Add modify listener to file text field
+		fileText.addModifyListener(new ModifyListener() {
+			public void modifyText(ModifyEvent e) {
+				if (!fileText.getText().equals("")) { //$NON-NLS-1$
+					configurationCombo.setEnabled(true);
+				} else {
+					configurationCombo.setEnabled(false);
+				}
+				checkEnableOkButton();
+			}
+		});
+
+	}
+
+	/**
+	 * Gets configuration names from XML file
+	 */
+	private void getConfigurationNamesFromFile() {
+		String filePath = fileText.getText();
+
+		// Load configurations from given file
+		TraceActivationXMLImporter importer = new TraceActivationXMLImporter(
+				filePath);
+
+		String[] configurationNames = importer.importConfigurationNames();
+		if (configurationNames != null && configurationNames.length > 0) {
+			configurationCombo.setItems(configurationNames);
+			configurationCombo.setText(configurationNames[0]);
+		} else {
+			configurationCombo.removeAll();
+		}
+	}
+
+	/**
+	 * Saves configuration
+	 * 
+	 * @return true if saving succeeded
+	 */
+	private boolean saveConfiguration() {
+		boolean success = false;
+		String filePath = fileText.getText();
+		String confName = configurationCombo.getText();
+		File file = new File(filePath);
+
+		// File must be absolute
+		if (file.isAbsolute()) {
+
+			if (!confName.equals("")) { //$NON-NLS-1$
+
+				TraceActivationXMLExporter exporter = new TraceActivationXMLExporter(
+						allComponents, filePath, confName);
+				success = exporter.export();
+
+				// Inform about save succesful
+				if (success) {
+					String saveMsg = Messages
+							.getString("TraceConfigurationSaveDialog.SaveMsg"); //$NON-NLS-1$
+					TraceViewerGlobals.getTraceViewer().getDialogs()
+							.showInformationMessage(saveMsg);
+
+					// Insert to combo box if not there
+					String[] oldConfs = configurationCombo.getItems();
+					boolean found = false;
+					for (int i = 0; i < oldConfs.length; i++) {
+						if (confName.equals(oldConfs[i])) {
+							found = true;
+						}
+					}
+					if (!found) {
+						configurationCombo.add(confName, 0);
+					}
+				}
+			} else {
+				String emptyConfNameMsg = Messages
+						.getString("TraceConfigurationSaveDialog.EmptyConfMsg"); //$NON-NLS-1$
+				TraceViewerGlobals.getTraceViewer().getDialogs()
+						.showInformationMessage(emptyConfNameMsg);
+			}
+		} else {
+			String notValidFileMsg = Messages
+					.getString("TraceConfigurationSaveDialog.NotValidFilePath"); //$NON-NLS-1$
+			TraceViewerGlobals.getTraceViewer().getDialogs().showErrorMessage(
+					notValidFileMsg);
+		}
+		return success;
+	}
+
+	/**
+	 * Opens the dialog
+	 * 
+	 * @param allComponents
+	 *            all the components
+	 */
+	public void openDialog(List<TraceActivationComponentItem> allComponents) {
+		this.allComponents = allComponents;
+		open();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse
+	 * .swt.widgets.Composite)
+	 */
+	@Override
+	protected void createButtonsForButtonBar(Composite parent) {
+		super.createButtonsForButtonBar(parent);
+		if (configurationCombo == null || configurationCombo.getText() == null
+				|| configurationCombo.getText().equals("")) { //$NON-NLS-1$
+			getButton(OK).setEnabled(false);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+	 */
+	@Override
+	protected void okPressed() {
+		if (saveConfiguration()) {
+			super.okPressed();
+		}
+	}
+
+	/**
+	 * Check if OK button can be enabled and if yes, do it
+	 */
+	private void checkEnableOkButton() {
+		if (configurationCombo.getText().equals("")) { //$NON-NLS-1$
+			getButton(OK).setEnabled(false);
+
+			// Set OK button enabled
+		} else if (!fileText.getText().equals("")) { //$NON-NLS-1$
+			getButton(OK).setEnabled(true);
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/TriggerDialog.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,327 @@
+/*
+ * 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:
+ *
+ * Trigger Dialog class
+ *
+ */
+package com.nokia.traceviewer.dialog;
+
+import java.util.List;
+
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.dialog.treeitem.TreeItem;
+import com.nokia.traceviewer.dialog.treeitem.TreeItemContentProvider;
+import com.nokia.traceviewer.dialog.treeitem.TriggerTreeBaseItem;
+import com.nokia.traceviewer.dialog.treeitem.TriggerTreeItem;
+import com.nokia.traceviewer.dialog.treeitem.TriggerTreeTextItem;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.preferences.PreferenceConstants;
+import com.nokia.traceviewer.engine.preferences.XMLTriggerConfigurationExporter;
+
+/**
+ * Trigger Dialog class
+ * 
+ */
+public final class TriggerDialog extends BaseTreeDialog {
+
+	/**
+	 * Add item image
+	 */
+	private static final String itemAddImageLocation = "/icons/filteradd.gif"; //$NON-NLS-1$
+
+	/**
+	 * Edit item image
+	 */
+	private static final String itemEditImageLocation = "/icons/filteredit.gif"; //$NON-NLS-1$
+
+	/**
+	 * Remove item image
+	 */
+	private static final String itemRemoveImageLocation = "/icons/filterremove.gif"; //$NON-NLS-1$
+
+	/**
+	 * Dialog name
+	 */
+	private static final String dialogName = Messages
+			.getString("TriggerDialog.DialogName"); //$NON-NLS-1$
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parent
+	 *            parent shell
+	 * @param contentProvider
+	 *            contentprovider for the tree
+	 * @param treeRoot
+	 *            tree root
+	 */
+	public TriggerDialog(Shell parent, TreeItemContentProvider contentProvider,
+			TreeItem treeRoot) {
+		super(parent, contentProvider, treeRoot);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseTreeDialog#export()
+	 */
+	@Override
+	public void export() {
+
+		// Export rules to XML file
+		XMLTriggerConfigurationExporter exporter;
+
+		// Default configuration file
+		if (!TraceViewerPlugin.getDefault().getPreferenceStore().getString(
+				PreferenceConstants.CONFIGURATION_FILE).equals(
+				PreferenceConstants.DEFAULT_CONFIGURATION_FILE)) {
+			exporter = new XMLTriggerConfigurationExporter(root,
+					TraceViewerPlugin.getDefault().getPreferenceStore()
+							.getString(PreferenceConstants.CONFIGURATION_FILE),
+					false);
+		} else {
+			exporter = new XMLTriggerConfigurationExporter(root,
+					PreferenceConstants.DEFAULT_CONFIGURATION_FILE, true);
+		}
+
+		exporter.export();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseTreeDialog#saveSettings()
+	 */
+	@Override
+	public void saveSettings() {
+		// Save the old location
+		super.saveSettings();
+
+		// Save Triggers if something changed
+		if (somethingChanged) {
+			Object[] arr = viewer.getCheckedElements();
+
+			// Get trigger arrays
+			List<TriggerTreeTextItem> startTriggers = TraceViewerGlobals
+					.getTraceViewer().getDataProcessorAccess()
+					.getTriggerProcessor().getStartTriggers();
+			List<TriggerTreeTextItem> stopTriggers = TraceViewerGlobals
+					.getTraceViewer().getDataProcessorAccess()
+					.getTriggerProcessor().getStopTriggers();
+			List<TriggerTreeTextItem> activationTriggers = TraceViewerGlobals
+					.getTraceViewer().getDataProcessorAccess()
+					.getTriggerProcessor().getActivationTriggers();
+
+			// Clear arrays
+			startTriggers.clear();
+			stopTriggers.clear();
+			activationTriggers.clear();
+
+			for (int i = 0; i < arr.length; i++) {
+				// Text rule
+				if (((TriggerTreeItem) arr[i]).getRule() == TriggerTreeItem.Rule.TEXT_RULE) {
+
+					// Start Trigger
+					if (((TriggerTreeItem) arr[i]).getType() == TriggerTreeItem.Type.STARTTRIGGER) {
+						startTriggers.add(((TriggerTreeTextItem) arr[i]));
+
+						// Stop Trigger
+					} else if (((TriggerTreeItem) arr[i]).getType() == TriggerTreeItem.Type.STOPTRIGGER) {
+						stopTriggers.add(((TriggerTreeTextItem) arr[i]));
+
+						// Activation Trigger
+					} else if (((TriggerTreeItem) arr[i]).getType() == TriggerTreeItem.Type.ACTIVATIONTRIGGER) {
+						activationTriggers.add(((TriggerTreeTextItem) arr[i]));
+					}
+				}
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseTreeDialog#restoreSettings()
+	 */
+	@Override
+	protected void restoreSettings() {
+		super.restoreSettings();
+
+		// Get trigger arrays
+		List<TriggerTreeTextItem> startTriggers = TraceViewerGlobals
+				.getTraceViewer().getDataProcessorAccess()
+				.getTriggerProcessor().getStartTriggers();
+		List<TriggerTreeTextItem> stopTriggers = TraceViewerGlobals
+				.getTraceViewer().getDataProcessorAccess()
+				.getTriggerProcessor().getStopTriggers();
+		List<TriggerTreeTextItem> activationTriggers = TraceViewerGlobals
+				.getTraceViewer().getDataProcessorAccess()
+				.getTriggerProcessor().getActivationTriggers();
+
+		// Tree has to be re-checked
+		for (int i = 0; i < startTriggers.size(); i++) {
+			TriggerTreeTextItem item = startTriggers.get(i);
+			viewer.setChecked(item, true);
+			checkboxStateListener.checkStateChanged(item);
+		}
+		for (int i = 0; i < stopTriggers.size(); i++) {
+			TriggerTreeTextItem item = stopTriggers.get(i);
+			viewer.setChecked(item, true);
+			checkboxStateListener.checkStateChanged(item);
+		}
+		for (int i = 0; i < activationTriggers.size(); i++) {
+			TriggerTreeTextItem item = activationTriggers.get(i);
+			viewer.setChecked(item, true);
+			checkboxStateListener.checkStateChanged(item);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseDialog#createDialogContents()
+	 */
+	@Override
+	protected void createDialogContents() {
+		super.createDialogContents(dialogName);
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(getShell(),
+				TraceViewerHelpContextIDs.TRIGGERING);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseTreeDialog#createToolBar()
+	 */
+	@Override
+	public void createToolBar() {
+		super.createToolBar(itemAddImageLocation, itemEditImageLocation,
+				itemRemoveImageLocation);
+	}
+
+	/**
+	 * Checks if start triggers are checked
+	 * 
+	 * @return true if at least one start trigger is checked
+	 */
+	private boolean startTriggerChecked() {
+		boolean startTriggerChecked = false;
+		Object[] arr = viewer.getCheckedElements();
+		for (int i = 0; i < arr.length; i++) {
+			if (((TriggerTreeItem) arr[i]).getType() == TriggerTreeItem.Type.STARTTRIGGER
+					&& ((TriggerTreeItem) arr[i]).getRule() != TriggerTreeItem.Rule.GROUP) {
+				startTriggerChecked = true;
+			}
+		}
+		return startTriggerChecked;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseTreeDialog#processAddGroupAction()
+	 */
+	@Override
+	protected void processAddGroupAction() {
+		String name = Messages.getString("TriggerDialog.NewGroupText"); //$NON-NLS-1$
+		InputDialog dialog = new InputDialog(
+				getParentShell(),
+				name,
+				Messages.getString("TriggerDialog.NewGroupDialogInformation"), name, null); //$NON-NLS-1$
+		int ret = dialog.open();
+		if (ret == Window.OK) {
+			name = dialog.getValue();
+
+			// Get parent node
+			Object selection = getSelectedGroup();
+			TriggerTreeItem item = new TriggerTreeBaseItem(contentProvider,
+					selection, name, TriggerTreeItem.Rule.GROUP,
+					TriggerTreeItem.Type.STARTTRIGGER);
+			((TriggerTreeItem) selection).addChild(item);
+			viewer.expandToLevel(item, 0);
+
+			somethingChanged = true;
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.dialog.BaseTreeDialog#processApplyButtonAction()
+	 */
+	@Override
+	protected void processApplyButtonAction() {
+		boolean triggerCanBeSet = true;
+		// Start trigger checked and traces in file
+		if (startTriggerChecked()
+				&& TraceViewerGlobals.getTraceViewer().getDataReaderAccess()
+						.getCurrentDataReader().getTraceCount() > 0) {
+
+			// Show confirmation message
+			String confirmationMsg = Messages
+					.getString("TriggerDialog.SetStartTriggerConfirmationMsg"); //$NON-NLS-1$
+			boolean ret = TraceViewerGlobals.getTraceViewer().getDialogs()
+					.showConfirmationDialog(confirmationMsg);
+
+			// Clicked OK
+			if (ret) {
+				TraceViewerGlobals.getTraceViewer().clearAllData();
+			} else {
+				triggerCanBeSet = false;
+			}
+		}
+
+		if (triggerCanBeSet) {
+			saveSettings();
+
+			// Remove pause as data is removed
+			if (wasPausedWhenEntered) {
+				wasPausedWhenEntered = false;
+			}
+			// Set the name of the view
+			TraceViewerGlobals.getTraceViewer().getView().updateViewName();
+
+			somethingChanged = false;
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.dialog.BaseTreeDialog#getPropertyDialog(java.lang
+	 * .Object, boolean)
+	 */
+	@Override
+	protected BasePropertyDialog getPropertyDialog(Object selection,
+			boolean editOldItem) {
+		TriggerTreeItem oldItem = null;
+		if (editOldItem) {
+			oldItem = (TriggerTreeItem) selection;
+		}
+		TriggerPropertyDialog dialog = new TriggerPropertyDialog(getShell(),
+				oldItem, contentProvider, selection);
+		return dialog;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/TriggerPropertyDialog.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,512 @@
+/*
+ * 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:
+ *
+ * Trigger Property Dialog class
+ *
+ */
+package com.nokia.traceviewer.dialog;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+import com.nokia.traceviewer.dialog.treeitem.TreeItemListener;
+import com.nokia.traceviewer.dialog.treeitem.TriggerTreeItem;
+import com.nokia.traceviewer.dialog.treeitem.TriggerTreeTextItem;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Trigger Property Dialog class
+ * 
+ */
+public class TriggerPropertyDialog extends BasePropertyDialog {
+
+	/**
+	 * Text to show when Text rule is selected
+	 */
+	private static final String TEXT_RULE_INFORMATION_TEXT = Messages
+			.getString("TriggerPropertyDialog.TextRuleInfo"); //$NON-NLS-1$
+
+	/**
+	 * Text to show when Activation rule is selected
+	 */
+	private static final String ACTIVATION_RULE_INFORMATION_TEXT = Messages
+			.getString("TriggerPropertyDialog.ActivationRuleInfo"); //$NON-NLS-1$
+
+	/**
+	 * Stop trigger text
+	 */
+	private static final String STOP_TRIGGER_TEXT = Messages
+			.getString("TriggerPropertyDialog.StopTrigger"); //$NON-NLS-1$
+
+	/**
+	 * Start trigger text
+	 */
+	private static final String START_TRIGGER_TEXT = Messages
+			.getString("TriggerPropertyDialog.StartTrigger"); //$NON-NLS-1$
+
+	/**
+	 * Activation trigger text
+	 */
+	private static final String ACTIVATION_TRIGGER_TEXT = Messages
+			.getString("TriggerPropertyDialog.ActivationTrigger"); //$NON-NLS-1$
+
+	/**
+	 * Activation rule index in the type array
+	 */
+	private static final int ACTIVATION_RULE_INDEX = 2;
+
+	/**
+	 * Old item when editing
+	 */
+	private TriggerTreeItem oldItem;
+
+	/**
+	 * Selected item in the tree
+	 */
+	private final TriggerTreeItem selectedItem;
+
+	/**
+	 * Combo box for trigger type
+	 */
+	private Combo typeCombo;
+
+	/**
+	 * Configuration file label
+	 */
+	private Label configurationFileLabel;
+
+	/**
+	 * Activation configuration text field
+	 */
+	private Text activationConfText;
+
+	/**
+	 * Load activation configuration button
+	 */
+	private Button loadActivationConfButton;
+
+	/**
+	 * Configuration file path
+	 */
+	private String configurationFilePath;
+
+	/**
+	 * Configuration name
+	 */
+	private String configurationName;
+
+	/**
+	 * TreeItem listener
+	 */
+	private final TreeItemListener listener;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parent
+	 *            Parent shell
+	 * @param newItem
+	 *            TreeItem to modify, null if creating new one
+	 * @param listener
+	 *            Tree item listener
+	 * @param selected
+	 *            selected object
+	 */
+	public TriggerPropertyDialog(Shell parent, TriggerTreeItem newItem,
+			TreeItemListener listener, Object selected) {
+		super(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
+		this.newItem = newItem;
+		this.selectedItem = (TriggerTreeItem) selected;
+		this.listener = listener;
+
+		// If edit, save the old item to insert info to fields
+		if (newItem != null) {
+			oldItem = newItem;
+			textFieldTouched = true;
+			nameFieldTouched = true;
+
+			if (oldItem instanceof TriggerTreeTextItem) {
+				configurationFilePath = ((TriggerTreeTextItem) oldItem)
+						.getConfigurationFilePath();
+				configurationName = ((TriggerTreeTextItem) oldItem)
+						.getConfigurationName();
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseDialog#createDialogContents()
+	 */
+	@Override
+	protected void createDialogContents() {
+		getShell().setText(
+				Messages.getString("TriggerPropertyDialog.TriggerDialogTitle")); //$NON-NLS-1$
+		composite.setLayout(new GridLayout());
+		createMainComposite();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.dialog.BasePropertyDialog#createRightUnderComposite
+	 * ()
+	 */
+	@Override
+	protected void createRightUnderComposite() {
+		// Dispose changeable elements
+		if (rightUnderComposite != null) {
+			disposeChangeableElements();
+		} else {
+			// Right under composite
+			GridLayout rightUnderCompositeGridLayout = new GridLayout();
+			rightUnderCompositeGridLayout.marginHeight = 14;
+			rightUnderCompositeGridLayout.numColumns = 3;
+			GridData rightUnderCompositeGridData = new GridData();
+			rightUnderCompositeGridData.heightHint = 114;
+			rightUnderCompositeGridData.verticalAlignment = GridData.BEGINNING;
+			rightUnderCompositeGridData.horizontalAlignment = SWT.FILL;
+			rightUnderComposite = new Composite(mainComposite, SWT.BORDER);
+			rightUnderComposite.setLayoutData(rightUnderCompositeGridData);
+			rightUnderComposite.setLayout(rightUnderCompositeGridLayout);
+
+			// Text label
+			textLabel = new Label(rightUnderComposite, SWT.NONE);
+			textLabel.setText(Messages
+					.getString("TriggerPropertyDialog.TextString")); //$NON-NLS-1$
+
+			// Text text
+			GridData textTextGridData = new GridData();
+			textTextGridData.horizontalIndent = 28;
+			textTextGridData.horizontalAlignment = SWT.FILL;
+			textTextGridData.horizontalSpan = 2;
+			textTextGridData.grabExcessHorizontalSpace = true;
+			textText = new Text(rightUnderComposite, SWT.BORDER);
+			textText.setLayoutData(textTextGridData);
+			if (oldItem instanceof TriggerTreeTextItem) {
+				TriggerTreeTextItem item = (TriggerTreeTextItem) oldItem;
+				textText.setText(item.getText());
+			}
+
+			// Spacer
+			spacer = new Label(rightUnderComposite, SWT.NONE);
+
+			// Match case checkbox
+			GridData matchCaseCheckBoxGridData = new GridData();
+			matchCaseCheckBoxGridData.horizontalIndent = 28;
+			matchCaseCheckBoxGridData.horizontalSpan = 2;
+			matchCaseCheckBox = new Button(rightUnderComposite, SWT.CHECK);
+			matchCaseCheckBox.setText(Messages
+					.getString("TriggerPropertyDialog.MatchCaseString")); //$NON-NLS-1$
+			matchCaseCheckBox.setLayoutData(matchCaseCheckBoxGridData);
+
+			// Set match case checkbox value
+			if (oldItem instanceof TriggerTreeTextItem) {
+				TriggerTreeTextItem item = (TriggerTreeTextItem) oldItem;
+				matchCaseCheckBox.setSelection(item.isMatchCase());
+			}
+
+			// Type label
+			Label typeLabel = new Label(rightUnderComposite, SWT.NONE);
+			typeLabel.setText(Messages
+					.getString("TriggerPropertyDialog.TypeString")); //$NON-NLS-1$
+			createTypeCombo();
+		}
+
+		// Activation trigger type
+		if (typeCombo.getSelectionIndex() == ACTIVATION_RULE_INDEX) {
+			// Add new UI component, create action listeners for opening a file
+			// Configuration file label
+			configurationFileLabel = new Label(rightUnderComposite, SWT.NONE);
+			configurationFileLabel.setText(Messages
+					.getString("TriggerPropertyDialog.ConfFileString")); //$NON-NLS-1$
+
+			GridData activationConfGridData = new GridData();
+			activationConfGridData.horizontalIndent = 28;
+			activationConfGridData.horizontalAlignment = SWT.FILL;
+			activationConfGridData.grabExcessHorizontalSpace = true;
+			activationConfText = new Text(rightUnderComposite, SWT.BORDER);
+			activationConfText.setEditable(false);
+			activationConfText.setLayoutData(activationConfGridData);
+			if (oldItem instanceof TriggerTreeTextItem) {
+				TriggerTreeTextItem item = (TriggerTreeTextItem) oldItem;
+				activationConfText.setText(item.getConfigurationName());
+			}
+
+			GridData loadActivationConfButtonGridData = new GridData();
+			loadActivationConfButtonGridData.heightHint = 25;
+			loadActivationConfButtonGridData.widthHint = 30;
+			loadActivationConfButton = new Button(rightUnderComposite, SWT.PUSH);
+			loadActivationConfButton.setText("..."); //$NON-NLS-1$
+			loadActivationConfButton
+					.setLayoutData(loadActivationConfButtonGridData);
+			loadActivationConfButton
+					.addSelectionListener(new SelectionAdapter() {
+						@Override
+						public void widgetSelected(SelectionEvent e) {
+
+							// Open "Load configuration" dialog
+							TraceConfigurationLoadDialog dialog = new TraceConfigurationLoadDialog(
+									false, configurationFilePath);
+							dialog.open();
+
+							configurationFilePath = dialog
+									.getLoadedConfigurationFilePath();
+							configurationName = dialog
+									.getLoadedConfigurationName();
+							activationConfText.setText(configurationName);
+						}
+					});
+
+		} else {
+			// Remove extra UI component
+			if (configurationFileLabel != null) {
+				configurationFileLabel.dispose();
+			}
+			if (activationConfText != null) {
+				activationConfText.dispose();
+			}
+			if (loadActivationConfButton != null) {
+				loadActivationConfButton.dispose();
+			}
+		}
+
+		// Layout again
+		rightUnderComposite.layout();
+	}
+
+	/**
+	 * This method initializes typeCombo
+	 * 
+	 */
+	private void createTypeCombo() {
+		GridData typeComboGridData = new GridData();
+		typeComboGridData.horizontalIndent = 28;
+		typeComboGridData.horizontalAlignment = SWT.FILL;
+		typeComboGridData.horizontalSpan = 2;
+		typeComboGridData.grabExcessHorizontalSpace = true;
+		typeCombo = new Combo(rightUnderComposite, SWT.READ_ONLY);
+		typeCombo.setLayoutData(typeComboGridData);
+
+		// Keep in this order
+		typeCombo.add(START_TRIGGER_TEXT);
+		typeCombo.add(STOP_TRIGGER_TEXT);
+		typeCombo.add(ACTIVATION_TRIGGER_TEXT);
+
+		// Set match case checkbox value
+		if (oldItem instanceof TriggerTreeTextItem) {
+			TriggerTreeTextItem item = (TriggerTreeTextItem) oldItem;
+			typeCombo.setText(typeCombo.getItem(item.getType().ordinal()));
+			matchCaseCheckBox.setSelection(item.isMatchCase());
+		} else {
+			typeCombo.setText(typeCombo.getItem(0));
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.dialog.BasePropertyDialog#insertDataToUpperComposite
+	 * ()
+	 */
+	@Override
+	protected void insertDataToUpperComposite() {
+		nameLabel.setText(Messages
+				.getString("TriggerPropertyDialog.RuleNameString")); //$NON-NLS-1$
+		// Set data from old item
+		if (oldItem != null) {
+			nameText.setText(oldItem.getName());
+			if (oldItem.getRule() == TriggerTreeItem.Rule.TEXT_RULE) {
+				selectedRuleLabel.setText(TEXT_RULE_NAME);
+			} else {
+				selectedRuleLabel.setText(TEXT_RULE_NAME);
+			}
+		} else {
+			selectedRuleLabel.setText(TEXT_RULE_NAME);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.dialog.BasePropertyDialog#insertDataToTextFields()
+	 */
+	@Override
+	protected void insertDataToTextFields() {
+		if (oldItem instanceof TriggerTreeTextItem) {
+			TriggerTreeTextItem item = (TriggerTreeTextItem) oldItem;
+			if (item.getText() != null) {
+				textText.setText(item.getText());
+			}
+			matchCaseCheckBox.setSelection(item.isMatchCase());
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.dialog.BasePropertyDialog#insertDataToComponentFields
+	 * ()
+	 */
+	@Override
+	protected void insertDataToComponentFields() {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BasePropertyDialog#setListSelection()
+	 */
+	@Override
+	protected void setListSelection() {
+		ruleList.add(TEXT_RULE_NAME, TEXT_RULE_INDEX);
+		// Set list selection
+		if (oldItem != null) {
+			if (oldItem.getRule() == TriggerTreeItem.Rule.TEXT_RULE) {
+				ruleList.setSelection(TEXT_RULE_INDEX);
+			}
+		} else {
+			ruleList.setSelection(TEXT_RULE_INDEX);
+		}
+	}
+
+	@Override
+	protected void okPressed() {
+		TraceViewerGlobals.postUiEvent("OkButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+		// Save the position of this item to set it back after creation
+		// and remove the old child
+		int pos = 0;
+		TriggerTreeItem parent = selectedItem;
+		if (oldItem != null) {
+			pos = getOldPosition();
+			parent = (TriggerTreeItem) oldItem.getParent();
+			parent.removeChild(oldItem);
+		}
+
+		// Create new TriggerTreeTextItem
+		if (ruleList.getSelectionIndex() == TEXT_RULE_INDEX) {
+			newItem = new TriggerTreeTextItem(
+					listener,
+					parent,
+					nameText.getText(),
+					TriggerTreeItem.Rule.TEXT_RULE,
+					textText.getText(),
+					matchCaseCheckBox.getSelection(),
+					TriggerTreeItem.Type.values()[typeCombo.getSelectionIndex()],
+					configurationFilePath, configurationName);
+
+			// Add mode
+			if (parent.equals(selectedItem)) {
+				parent.addChild(newItem);
+
+				// Edit mode
+			} else {
+				parent.addChild(pos, newItem);
+			}
+
+		} else {
+			// No other rules yet
+		}
+
+		super.okPressed();
+		TraceViewerGlobals.postUiEvent("OkButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.dialog.BasePropertyDialog#createActionListeners()
+	 */
+	@Override
+	protected void createActionListeners() {
+		super.createActionListeners();
+		super.createActionListenersForTextRule();
+
+		// Add selection listener to Trigger type combobox
+		typeCombo.addSelectionListener(new SelectionAdapter() {
+
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				// If type changes, we might need more or less UI components
+				createRightUnderComposite();
+				setInformationLabel();
+			}
+		});
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.dialog.BasePropertyDialog#setInformationLabel()
+	 */
+	@Override
+	protected void setInformationLabel() {
+		if (ruleList.getSelectionIndex() == TEXT_RULE_INDEX) {
+			informationLabel.setText(TEXT_RULE_INFORMATION_TEXT);
+			selectedRuleLabel.setText(TEXT_RULE_NAME);
+
+			// Activation configuration
+			if (typeCombo.getSelectionIndex() == ACTIVATION_RULE_INDEX) {
+				informationLabel.setText(TEXT_RULE_INFORMATION_TEXT
+						+ ACTIVATION_RULE_INFORMATION_TEXT);
+			}
+
+		}
+	}
+
+	/**
+	 * Gets old position of this item
+	 * 
+	 * @return old position
+	 */
+	protected int getOldPosition() {
+		TriggerTreeItem item = (TriggerTreeItem) oldItem.getParent();
+		Object[] children = item.getChildren();
+		int pos = 0;
+		for (int i = 0; i < children.length; i++) {
+			if (children[i].equals(oldItem)) {
+				pos = i;
+				break;
+			}
+		}
+
+		return pos;
+	}
+
+	/**
+	 * Disposes changeable elements if they exist. Is called when selection is
+	 * changed from the trigger type list and some ui components are changed
+	 */
+	private void disposeChangeableElements() {
+
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/VariableTracingDialog.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,376 @@
+/*
+ * 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:
+ *
+ * Variable tracing Dialog class
+ *
+ */
+package com.nokia.traceviewer.dialog;
+
+import java.util.List;
+
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Shell;
+
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.action.TraceViewerActionUtils;
+import com.nokia.traceviewer.dialog.treeitem.TreeItem;
+import com.nokia.traceviewer.dialog.treeitem.TreeItemContentProvider;
+import com.nokia.traceviewer.dialog.treeitem.VariableTracingTreeBaseItem;
+import com.nokia.traceviewer.dialog.treeitem.VariableTracingTreeItem;
+import com.nokia.traceviewer.dialog.treeitem.VariableTracingTreeTextItem;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.TraceViewerPropertyViewInterface;
+import com.nokia.traceviewer.engine.TraceViewerDialogInterface.Dialog;
+import com.nokia.traceviewer.engine.dataprocessor.VariableTracingItem;
+import com.nokia.traceviewer.engine.preferences.PreferenceConstants;
+import com.nokia.traceviewer.engine.preferences.XMLVariableTracingConfigurationExporter;
+
+/**
+ * Variable tracing Dialog class
+ */
+public final class VariableTracingDialog extends BaseTreeDialog {
+
+	/**
+	 * Processing reason to give to progressBar dialog
+	 */
+	private static final String processReason = Messages
+			.getString("VariableTracingDialog.ProcessReason"); //$NON-NLS-1$
+
+	/**
+	 * Add item image
+	 */
+	private static final String itemAddImageLocation = "/icons/filteradd.gif"; //$NON-NLS-1$
+
+	/**
+	 * Edit item image
+	 */
+	private static final String itemEditImageLocation = "/icons/filteredit.gif"; //$NON-NLS-1$
+
+	/**
+	 * Remove item image
+	 */
+	private static final String itemRemoveImageLocation = "/icons/filterremove.gif"; //$NON-NLS-1$
+
+	/**
+	 * Dialog name
+	 */
+	private static final String dialogName = Messages
+			.getString("VariableTracingDialog.DialogName"); //$NON-NLS-1$
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parent
+	 *            parent shell
+	 * @param contentProvider
+	 *            contentprovider for the tree
+	 * @param treeRoot
+	 *            tree root
+	 */
+	public VariableTracingDialog(Shell parent,
+			TreeItemContentProvider contentProvider, TreeItem treeRoot) {
+		super(parent, contentProvider, treeRoot);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseTreeDialog#export()
+	 */
+	@Override
+	public void export() {
+
+		// Export rules to XML file
+		XMLVariableTracingConfigurationExporter exporter;
+
+		// Default configuration file
+		if (!TraceViewerPlugin.getDefault().getPreferenceStore().getString(
+				PreferenceConstants.CONFIGURATION_FILE).equals(
+				PreferenceConstants.DEFAULT_CONFIGURATION_FILE)) {
+			exporter = new XMLVariableTracingConfigurationExporter(root,
+					TraceViewerPlugin.getDefault().getPreferenceStore()
+							.getString(PreferenceConstants.CONFIGURATION_FILE),
+					false);
+		} else {
+			exporter = new XMLVariableTracingConfigurationExporter(root,
+					PreferenceConstants.DEFAULT_CONFIGURATION_FILE, true);
+		}
+
+		exporter.export();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseTreeDialog#saveSettings()
+	 */
+	@Override
+	public void saveSettings() {
+		// Save the old location
+		super.saveSettings();
+
+		// Save VariableTracingItems if something changed
+		if (somethingChanged && !viewer.getControl().isDisposed()) {
+			Object[] arr = viewer.getCheckedElements();
+
+			// Get arrays and empty them
+			List<VariableTracingItem> variableTracingItems = TraceViewerGlobals
+					.getTraceViewer().getDataProcessorAccess()
+					.getVariableTracingProcessor().getVariableTracingItems();
+			List<VariableTracingTreeTextItem> textRules = TraceViewerGlobals
+					.getTraceViewer().getDataProcessorAccess()
+					.getVariableTracingProcessor().getTextRules();
+
+			variableTracingItems.clear();
+			textRules.clear();
+
+			// Create new items
+			for (int i = 0; i < arr.length; i++) {
+				VariableTracingTreeItem listItem = (VariableTracingTreeItem) arr[i];
+
+				// Text rule
+				if (listItem.getRule() == VariableTracingTreeItem.Rule.TEXT_RULE) {
+					VariableTracingTreeTextItem listItem2 = (VariableTracingTreeTextItem) listItem;
+					textRules.add(listItem2);
+					VariableTracingItem item = new VariableTracingItem(
+							listItem2.getName(), listItem2.getText(), listItem2
+									.isMatchCase(), listItem2.getHistoryCount());
+					variableTracingItems.add(item);
+				}
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseTreeDialog#restoreSettings()
+	 */
+	@Override
+	protected void restoreSettings() {
+		super.restoreSettings();
+
+		// Get text rule array
+		List<VariableTracingTreeTextItem> textRules = TraceViewerGlobals
+				.getTraceViewer().getDataProcessorAccess()
+				.getVariableTracingProcessor().getTextRules();
+
+		// Tree has to be re-checked
+		for (int i = 0; i < textRules.size(); i++) {
+			VariableTracingTreeItem item = textRules.get(i);
+			viewer.setChecked(item, true);
+			checkboxStateListener.checkStateChanged(item);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseDialog#createDialogContents()
+	 */
+	@Override
+	protected void createDialogContents() {
+		super.createDialogContents(dialogName);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseTreeDialog#createToolBar()
+	 */
+	@Override
+	public void createToolBar() {
+		super.createToolBar(itemAddImageLocation, itemEditImageLocation,
+				itemRemoveImageLocation);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseTreeDialog#processAddGroupAction()
+	 */
+	@Override
+	protected void processAddGroupAction() {
+		String name = Messages.getString("VariableTracingDialog.NewGroupText"); //$NON-NLS-1$
+		InputDialog dialog = new InputDialog(
+				getShell(),
+				name,
+				Messages.getString("VariableTracingDialog.NewGroupDialogInfo"), name, null); //$NON-NLS-1$
+		int ret = dialog.open();
+		if (ret == Window.OK) {
+			name = dialog.getValue();
+
+			// Get parent node
+			Object selection = getSelectedGroup();
+			VariableTracingTreeItem item = new VariableTracingTreeBaseItem(
+					contentProvider, selection, name,
+					VariableTracingTreeItem.Rule.GROUP, 0);
+			((VariableTracingTreeItem) selection).addChild(item);
+			viewer.expandToLevel(item, 0);
+
+			somethingChanged = true;
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.dialog.BaseTreeDialog#processApplyButtonAction()
+	 */
+	@Override
+	protected void processApplyButtonAction() {
+		saveSettings();
+
+		List<VariableTracingItem> items = TraceViewerGlobals.getTraceViewer()
+				.getDataProcessorAccess().getVariableTracingProcessor()
+				.getVariableTracingItems();
+
+		// Start variable tracing from beginning
+		if (!items.isEmpty() && somethingChanged) {
+
+			TraceViewerPropertyViewInterface propView = TraceViewerGlobals
+					.getTraceViewer().getPropertyView();
+			if (propView != null && !propView.isDisposed()) {
+				propView.clearAll();
+				propView.createNewPropertyTableItems();
+				// View is not open, empty items from processors
+			} else {
+				TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+						.getLineCountProcessor().emptyLineCountItems();
+
+				TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+						.getVariableTracingProcessor()
+						.emptyVariableTracingItems();
+			}
+
+			// Set traces not to be shown in the view
+			TraceViewerGlobals.getTraceViewer().getDataReaderAccess()
+					.getCurrentDataReader().getTraceConfiguration()
+					.setShowInView(false);
+
+			int maxLines = TraceViewerGlobals.getTraceViewer()
+					.getDataReaderAccess().getCurrentDataReader()
+					.getTraceCount();
+
+			TraceViewerGlobals.getTraceViewer().getDataReaderAccess()
+					.getCurrentDataReader().setFilePosition(0);
+
+			// Open property view
+			TraceViewerActionUtils.openPropertyView();
+
+			// Hide dialog and open progressbar only if there is at least one
+			// trace
+			if (maxLines > 0) {
+				getShell().setVisible(false);
+				progressBarDialog = (ProgressBarDialog) TraceViewerGlobals
+						.getTraceViewer().getDialogs().createDialog(
+								Dialog.PROGRESSBAR);
+				progressBarDialog.open(maxLines, processReason);
+			}
+
+			// Set traces back to be shown in the view
+			TraceViewerGlobals.getTraceViewer().getDataReaderAccess()
+					.getCurrentDataReader().getTraceConfiguration()
+					.setShowInView(true);
+
+			// Removed all count line rules
+		} else if (somethingChanged) {
+			TraceViewerPropertyViewInterface view = TraceViewerGlobals
+					.getTraceViewer().getPropertyView();
+
+			if (view != null && !view.isDisposed()) {
+				view.createNewPropertyTableItems();
+			}
+		}
+
+		// Insert this to NOT run saveSettings again
+		somethingChanged = false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseTreeDialog#okPressed()
+	 */
+	@Override
+	protected void okPressed() {
+		TraceViewerGlobals.postUiEvent("OkButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+		saveSettings();
+		super.okPressed();
+		TraceViewerGlobals.postUiEvent("OkButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.dialog.BaseTreeDialog#getPropertyDialog(java.lang
+	 * .Object, boolean)
+	 */
+	@Override
+	protected BasePropertyDialog getPropertyDialog(Object selection,
+			boolean editOldItem) {
+		VariableTracingTreeItem oldItem = null;
+		if (editOldItem) {
+			oldItem = (VariableTracingTreeItem) selection;
+		}
+		VariableTracingPropertyDialog dialog = new VariableTracingPropertyDialog(
+				getShell(), oldItem, contentProvider, selection);
+		return dialog;
+	}
+
+	/**
+	 * Edits existing item or adds new one
+	 * 
+	 * @param itemIndex
+	 *            item index to be edited. If -1, create new one
+	 */
+	public void editOrAddItem(int itemIndex) {
+		TreeItem item = null;
+
+		// Create the dialog
+		create();
+
+		// Restore selected items to the tree
+		restoreSettings();
+
+		// Create new item
+		if (itemIndex == -1) {
+			item = processAddItemAction();
+
+			// Edit old one
+		} else {
+			List<VariableTracingTreeTextItem> textRules = TraceViewerGlobals
+					.getTraceViewer().getDataProcessorAccess()
+					.getVariableTracingProcessor().getTextRules();
+
+			viewer.setSelection(new StructuredSelection(textRules
+					.get(itemIndex)));
+
+			item = processEditItemAction();
+		}
+
+		if (item != null) {
+			// Apply the changes
+			somethingChanged = true;
+			okPressed();
+		} else {
+			cancelPressed();
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/VariableTracingHistoryDialog.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,463 @@
+/*
+ * 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:
+ *
+ * Variable Tracing History Dialog
+ *
+ */
+package com.nokia.traceviewer.dialog;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Point;
+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.Event;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+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.ui.PlatformUI;
+
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.action.OpenTraceLocationAction;
+import com.nokia.traceviewer.engine.TraceMetaData;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.dataprocessor.VariableTracingEvent;
+import com.nokia.traceviewer.engine.dataprocessor.VariableTracingItem;
+
+/**
+ * Variable Tracing History Dialog
+ * 
+ */
+public final class VariableTracingHistoryDialog extends BaseDialog {
+
+	/**
+	 * Main UI Composite
+	 */
+	private Composite mainComposite;
+
+	/**
+	 * Top UI Composite
+	 */
+	private Composite topComposite;
+
+	/**
+	 * Table containing all the information
+	 */
+	private Table table;
+
+	/**
+	 * Checkbox for activating trace when doubleclicking
+	 */
+	private Button activateTraceCheckBox;
+
+	/**
+	 * Checkbox for activating codeline when doubleclicking
+	 */
+	private Button activateCodeLineCheckBox;
+
+	/**
+	 * Tells whether we will activate trace when doubleclicking line
+	 */
+	private boolean activateTrace = true;
+
+	/**
+	 * Tells whether we will activate codeline when doubleclicking line
+	 */
+	private boolean activateCodeLine = true;
+
+	/**
+	 * Checks if DataReader was paused when we entered dialog -> Don't pause
+	 * again and don't unpause in exit
+	 */
+	private boolean wasPausedWhenEntered = true;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parent
+	 *            parent shell
+	 */
+	public VariableTracingHistoryDialog(Shell parent) {
+		super(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.RESIZE);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.dialogs.TrayDialog#close()
+	 */
+	@Override
+	public boolean close() {
+		boolean close = super.close();
+		if (!wasPausedWhenEntered) {
+			// Unpause
+			TraceViewerGlobals.getTraceViewer().getView().getActionFactory()
+					.getPauseAction().run();
+		}
+		return close;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseDialog#createShell()
+	 */
+	@Override
+	protected void createDialogContents() {
+		// Pause the datareader if it's not paused already
+		wasPausedWhenEntered = TraceViewerGlobals.getTraceViewer()
+				.getDataReaderAccess().getMainDataReader().isPaused();
+		if (!wasPausedWhenEntered) {
+			TraceViewerGlobals.getTraceViewer().getView().getActionFactory()
+					.getPauseAction().run();
+		}
+
+		// Contents
+		GridLayout gridLayout = new GridLayout();
+		getShell().setText(
+				Messages.getString("VariableTracingHistoryDialog.ShellTitle")); //$NON-NLS-1$
+		composite.setLayout(gridLayout);
+		getShell().setMinimumSize(new Point(400, 250));
+
+		// Create main composite
+		createMainComposite();
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(getShell(),
+				TraceViewerHelpContextIDs.VARIABLE_TRACING_HISTORY);
+	}
+
+	/**
+	 * This method initializes mainComposite
+	 * 
+	 */
+	private void createMainComposite() {
+		// Main composite
+		GridData mainCompositeGridData = new GridData();
+		mainCompositeGridData.horizontalAlignment = GridData.FILL;
+		mainCompositeGridData.grabExcessHorizontalSpace = true;
+		mainCompositeGridData.grabExcessVerticalSpace = true;
+		mainCompositeGridData.verticalAlignment = GridData.FILL;
+		mainComposite = new Composite(composite, SWT.NONE);
+		mainComposite.setLayout(new GridLayout());
+		mainComposite.setLayoutData(mainCompositeGridData);
+
+		// Create top composite
+		createTopComposite();
+
+		// Create the table
+		createTable();
+
+		// Create bottom composite
+		createBottomComposite();
+	}
+
+	/**
+	 * Creates and initializes table
+	 */
+	private void createTable() {
+		// Layout data for table
+		GridData tableGridData = new GridData();
+		tableGridData.horizontalAlignment = GridData.FILL;
+		tableGridData.verticalAlignment = GridData.FILL;
+		tableGridData.grabExcessHorizontalSpace = true;
+		tableGridData.grabExcessVerticalSpace = true;
+		tableGridData.heightHint = 300;
+
+		// Create table
+		table = new Table(mainComposite, SWT.BORDER | SWT.FULL_SELECTION);
+		table.setHeaderVisible(true);
+		table.setLayoutData(tableGridData);
+		table.setLinesVisible(true);
+
+		// Add double click support
+		table.addListener(SWT.DefaultSelection, new Listener() {
+			public void handleEvent(Event e) {
+				handleDoubleClick();
+			}
+		});
+
+		// Create columns
+		TableColumn timestampColumn = new TableColumn(table, SWT.NONE);
+		timestampColumn.setWidth(110);
+		timestampColumn.setText(Messages
+				.getString("VariableTracingHistoryDialog.TimestampColumnName")); //$NON-NLS-1$
+		TableColumn valueColumn = new TableColumn(table, SWT.NONE);
+		valueColumn.setWidth(405);
+		valueColumn.setText(Messages
+				.getString("VariableTracingHistoryDialog.ValueColumnName")); //$NON-NLS-1$
+		TableColumn lineColumn = new TableColumn(table, SWT.NONE);
+		lineColumn.setAlignment(SWT.CENTER);
+		lineColumn.setWidth(65);
+		lineColumn.setText(Messages
+				.getString("VariableTracingHistoryDialog.LineNrText")); //$NON-NLS-1$
+		TableColumn hasCodeLineColumn = new TableColumn(table, SWT.NONE);
+		hasCodeLineColumn.setAlignment(SWT.CENTER);
+		hasCodeLineColumn
+				.setText(Messages
+						.getString("VariableTracingHistoryDialog.HasCodeLineColumnName")); //$NON-NLS-1$
+		hasCodeLineColumn.setWidth(80);
+
+		// Insert data
+		insertData();
+	}
+
+	/**
+	 * Inserts data to table
+	 */
+	private void insertData() {
+		// First get indices selected in the table
+		int[] indices = TraceViewerGlobals.getTraceViewer().getPropertyView()
+				.getSelectedVariableIndices();
+
+		// Get items from VariableTracingProcessor
+		List<VariableTracingItem> variableItems = TraceViewerGlobals
+				.getTraceViewer().getDataProcessorAccess()
+				.getVariableTracingProcessor().getVariableTracingItems();
+
+		// Create a ArrayList of all events from selected items
+		List<VariableTracingEvent> events = new ArrayList<VariableTracingEvent>();
+		for (int i = 0; i < indices.length; i++) {
+			events.addAll(variableItems.get(indices[i]).getEventList());
+		}
+
+		// Sort the list by line numbers
+		Collections.sort(events, new Comparator<VariableTracingEvent>() {
+			public int compare(VariableTracingEvent o1, VariableTracingEvent o2) {
+				int val = o1.getLine();
+				int val2 = o2.getLine();
+				return val > val2 ? 1 : val < val2 ? -1 : 0;
+			}
+		});
+
+		// Null own timestamp from TimestampParser
+		TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+				.getTimestampParser().nullPreviousOwnTimestamp();
+
+		// Insert items
+		for (int j = 0; j < events.size(); j++) {
+			TableItem item = new TableItem(table, SWT.NONE);
+			VariableTracingEvent event = events.get(j);
+			String hasMetadata = Messages
+					.getString("VariableTracingHistoryDialog.YesText"); //$NON-NLS-1$
+
+			// Calculate new timestamp
+			String timestamp = TraceViewerGlobals.getTraceViewer()
+					.getDataProcessorAccess().getTimestampParser()
+					.processTimestampFromPlainText(event.getTimestamp(), false);
+
+			// No metaData
+			if (event.getTraceInformation() == null
+					|| TraceViewerGlobals.getDecodeProvider().getTraceMetaData(
+							event.getTraceInformation()) == null
+					|| TraceViewerGlobals.getDecodeProvider().getTraceMetaData(
+							event.getTraceInformation()).getLineNumber() == 0) {
+				hasMetadata = Messages
+						.getString("VariableTracingHistoryDialog.NoText"); //$NON-NLS-1$
+			}
+
+			item.setText(new String[] { timestamp,
+					(j + 1) + ". " + event.getParent().getName() //$NON-NLS-1$
+							+ event.getValue(),
+					String.valueOf(event.getLine()), hasMetadata });
+
+			// Attach event to the data part of the TableItem for easy get
+			item.setData(event);
+		}
+	}
+
+	/**
+	 * Handles double clicks
+	 */
+	void handleDoubleClick() {
+		VariableTracingEvent event = (VariableTracingEvent) table
+				.getSelection()[0].getData();
+
+		// Activate trace
+		if (activateTrace) {
+
+			// Set the line highlighted
+			TraceViewerGlobals.getTraceViewer().getView().highlightLines(
+					event.getLine() - 1, 0, false);
+		}
+
+		// Activate code line
+		if (activateCodeLine) {
+			if (event.getTraceInformation() != null) {
+				TraceMetaData metaData = TraceViewerGlobals.getDecodeProvider()
+						.getTraceMetaData(event.getTraceInformation());
+
+				if (metaData.getLineNumber() != 0) {
+					// Get Action used to open trace line
+					OpenTraceLocationAction action = (OpenTraceLocationAction) TraceViewerGlobals
+							.getTraceViewer().getView().getActionFactory()
+							.getOpenTraceLocationAction();
+					action.setMetaData(metaData, true);
+					action.run();
+				}
+			}
+		}
+
+	}
+
+	/**
+	 * This method initializes topComposite
+	 * 
+	 */
+	private void createTopComposite() {
+		// Top composite
+		GridData topCompositeGridData = new GridData();
+		topCompositeGridData.horizontalAlignment = GridData.FILL;
+		topCompositeGridData.grabExcessHorizontalSpace = true;
+		topCompositeGridData.heightHint = 90;
+		topCompositeGridData.verticalSpan = 2;
+		topCompositeGridData.verticalAlignment = GridData.CENTER;
+		topComposite = new Composite(mainComposite, SWT.NONE);
+		topComposite.setLayout(new GridLayout());
+		topComposite.setLayoutData(topCompositeGridData);
+
+		// Create settings group
+		createSettingsGroup();
+	}
+
+	/**
+	 * This method initializes bottomComposite
+	 * 
+	 */
+	private void createBottomComposite() {
+		// Bottom composite
+		GridData bottomCompositeGridData = new GridData();
+		bottomCompositeGridData.horizontalAlignment = GridData.END;
+		bottomCompositeGridData.verticalAlignment = GridData.CENTER;
+		Composite bottomComposite = new Composite(mainComposite, SWT.NONE);
+		bottomComposite.setLayout(new GridLayout());
+		bottomComposite.setLayoutData(bottomCompositeGridData);
+	}
+
+	/**
+	 * This method initializes settingsGroup
+	 * 
+	 */
+	private void createSettingsGroup() {
+		// Settings group
+		GridLayout settingsGroupGridLayout = new GridLayout();
+		settingsGroupGridLayout.numColumns = 2;
+		settingsGroupGridLayout.horizontalSpacing = 15;
+		Group settingsGroup = new Group(topComposite, SWT.NONE);
+		settingsGroup.setText(Messages
+				.getString("VariableTracingHistoryDialog.SettingsGroupText")); //$NON-NLS-1$
+		settingsGroup.setLayout(settingsGroupGridLayout);
+
+		// Information label
+		Label informationLabel = new Label(settingsGroup, SWT.NONE);
+		informationLabel
+				.setText(Messages
+						.getString("VariableTracingHistoryDialog.InformationLabelText")); //$NON-NLS-1$
+
+		// Activate Trace checkbox
+		activateTraceCheckBox = new Button(settingsGroup, SWT.CHECK);
+		activateTraceCheckBox.setText(Messages
+				.getString("VariableTracingHistoryDialog.ActivateTraceText")); //$NON-NLS-1$
+		activateTraceCheckBox.setSelection(activateTrace);
+
+		// Filler
+		new Label(settingsGroup, SWT.NONE);
+
+		// Activate Codeline checkbox
+		activateCodeLineCheckBox = new Button(settingsGroup, SWT.CHECK);
+		activateCodeLineCheckBox
+				.setText(Messages
+						.getString("VariableTracingHistoryDialog.ActivateCodelineText")); //$NON-NLS-1$
+		activateCodeLineCheckBox.setSelection(true);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseDialog#createActionListeners()
+	 */
+	@Override
+	public void createActionListeners() {
+		// Add listener to ActivateTrace checkbox
+		activateTraceCheckBox.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				activateTrace = activateTraceCheckBox.getSelection();
+			}
+		});
+
+		// Add listener to ActivateCodeLine checkbox
+		activateCodeLineCheckBox.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent event) {
+				activateCodeLine = activateCodeLineCheckBox.getSelection();
+			}
+		});
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.dialogs.Dialog#cancelPressed()
+	 */
+	@Override
+	protected void cancelPressed() {
+		table.removeAll();
+		super.cancelPressed();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+	 */
+	@Override
+	protected void okPressed() {
+		table.removeAll();
+		super.okPressed();
+	}
+
+	/**
+	 * Tells is the search dialog open
+	 * 
+	 * @return true if dialog is open
+	 */
+	public boolean isOpen() {
+		boolean isOpen = false;
+		if (getShell() != null && !getShell().isDisposed()) {
+			isOpen = true;
+		}
+		return isOpen;
+	}
+
+	/**
+	 * Sets focus
+	 */
+	public void setFocus() {
+		getShell().setFocus();
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/VariableTracingPropertyDialog.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,361 @@
+/*
+ * 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:
+ *
+ * Variable Tracing Property Dialog class
+ *
+ */
+package com.nokia.traceviewer.dialog;
+
+import org.eclipse.swt.SWT;
+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.Shell;
+import org.eclipse.swt.widgets.Text;
+
+import com.nokia.traceviewer.dialog.treeitem.TreeItemListener;
+import com.nokia.traceviewer.dialog.treeitem.VariableTracingTreeBaseItem;
+import com.nokia.traceviewer.dialog.treeitem.VariableTracingTreeItem;
+import com.nokia.traceviewer.dialog.treeitem.VariableTracingTreeTextItem;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Variable Tracing Property Dialog class
+ */
+public final class VariableTracingPropertyDialog extends BasePropertyDialog {
+
+	/**
+	 * Text to show when Text rule is selected
+	 */
+	private static final String TEXT_RULE_INFORMATION_TEXT = Messages
+			.getString("VariableTracingPropertyDialog.TextRuleInfo"); //$NON-NLS-1$
+
+	/**
+	 * Default number of history steps to save
+	 */
+	private static final String DEFAULT_HISTORY_COUNT = "100"; //$NON-NLS-1$
+
+	/**
+	 * Old item when editing
+	 */
+	private VariableTracingTreeItem oldItem;
+
+	/**
+	 * Selected item
+	 */
+	private final VariableTracingTreeItem selectedItem;
+
+	/**
+	 * Text field for history text
+	 */
+	private Text historyText;
+
+	/**
+	 * TreeItem listener
+	 */
+	private final TreeItemListener listener;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parent
+	 *            Parent shell
+	 * @param newItem
+	 *            TreeItem to modify, null if creating new one
+	 * @param listener
+	 *            Tree item listener
+	 * @param selected
+	 *            selected object
+	 */
+	public VariableTracingPropertyDialog(Shell parent,
+			VariableTracingTreeItem newItem, TreeItemListener listener,
+			Object selected) {
+		super(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
+		this.newItem = newItem;
+		this.selectedItem = (VariableTracingTreeItem) selected;
+		this.listener = listener;
+
+		// If edit, save the old item to insert info to fields
+		if (newItem != null) {
+			oldItem = newItem;
+			textFieldTouched = true;
+			nameFieldTouched = true;
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BaseDialog#createDialogContents()
+	 */
+	@Override
+	protected void createDialogContents() {
+		getShell().setText(
+				Messages.getString("VariableTracingPropertyDialog.ShellTitle")); //$NON-NLS-1$
+		composite.setLayout(new GridLayout());
+		createMainComposite();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.dialog.BasePropertyDialog#createRightUnderComposite
+	 * ()
+	 */
+	@Override
+	protected void createRightUnderComposite() {
+		// Right under composite
+		GridLayout rightUnderCompositeLayout = new GridLayout();
+		rightUnderCompositeLayout.marginHeight = 14;
+		rightUnderCompositeLayout.numColumns = 3;
+		GridData rightUnderCompositeGridData = new GridData();
+		rightUnderCompositeGridData.heightHint = 110;
+		rightUnderCompositeGridData.verticalAlignment = GridData.BEGINNING;
+		rightUnderCompositeGridData.widthHint = 250;
+		rightUnderCompositeGridData.horizontalAlignment = GridData.CENTER;
+		rightUnderComposite = new Composite(mainComposite, SWT.BORDER);
+		rightUnderComposite.setLayoutData(rightUnderCompositeGridData);
+		rightUnderComposite.setLayout(rightUnderCompositeLayout);
+
+		// Text label
+		textLabel = new Label(rightUnderComposite, SWT.NONE);
+		textLabel.setText(Messages
+				.getString("VariableTracingPropertyDialog.TextLabelText")); //$NON-NLS-1$
+
+		// Text text
+		GridData textTextGridData = new GridData();
+		textTextGridData.widthHint = 150;
+		textTextGridData.horizontalSpan = 2;
+		textText = new Text(rightUnderComposite, SWT.BORDER);
+		textText.setLayoutData(textTextGridData);
+
+		if (oldItem instanceof VariableTracingTreeTextItem) {
+			VariableTracingTreeTextItem item = (VariableTracingTreeTextItem) oldItem;
+			textText.setText(item.getText());
+		}
+
+		// Spacer label
+		new Label(rightUnderComposite, SWT.NONE);
+
+		// Match case checkbox
+		GridData matchCaseCheckBoxGridData = new GridData();
+		matchCaseCheckBoxGridData.horizontalSpan = 2;
+		matchCaseCheckBox = new Button(rightUnderComposite, SWT.CHECK);
+		matchCaseCheckBox.setText(Messages
+				.getString("VariableTracingPropertyDialog.MatchCaseText")); //$NON-NLS-1$
+		matchCaseCheckBox.setLayoutData(matchCaseCheckBoxGridData);
+
+		if (oldItem instanceof VariableTracingTreeTextItem) {
+			VariableTracingTreeTextItem item = (VariableTracingTreeTextItem) oldItem;
+			matchCaseCheckBox.setSelection(item.isMatchCase());
+		}
+
+		// History label
+		GridData historyLabelGridData = new GridData();
+		historyLabelGridData.verticalIndent = 10;
+		Label historyLabel = new Label(rightUnderComposite, SWT.NONE);
+		historyLabel.setText(Messages
+				.getString("VariableTracingPropertyDialog.SaveHistoryText")); //$NON-NLS-1$
+		historyLabel.setLayoutData(historyLabelGridData);
+
+		// History text
+		historyText = new Text(rightUnderComposite, SWT.BORDER);
+		GridData historyTextGridData = new GridData();
+		historyTextGridData.widthHint = 20;
+		historyTextGridData.verticalIndent = 10;
+		historyText.setLayoutData(historyTextGridData);
+		historyText.setTextLimit(3);
+
+		if (oldItem instanceof VariableTracingTreeBaseItem) {
+			VariableTracingTreeBaseItem item = (VariableTracingTreeBaseItem) oldItem;
+			historyText.setText(String.valueOf(item.getHistoryCount()));
+		} else {
+			historyText.setText(DEFAULT_HISTORY_COUNT);
+		}
+
+		// History label 2
+		Label historyLabel2 = new Label(rightUnderComposite, SWT.NONE);
+		historyLabel2.setText(Messages
+				.getString("VariableTracingPropertyDialog.SaveHistoryText2")); //$NON-NLS-1$
+		historyLabel2.setLayoutData(historyLabelGridData);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.dialog.BasePropertyDialog#insertDataToUpperComposite
+	 * ()
+	 */
+	@Override
+	protected void insertDataToUpperComposite() {
+		nameLabel.setText(Messages
+				.getString("VariableTracingPropertyDialog.RuleNameText")); //$NON-NLS-1$
+		// Set data from old item
+		if (oldItem != null) {
+			nameText.setText(oldItem.getName());
+			if (oldItem.getRule() == VariableTracingTreeItem.Rule.TEXT_RULE) {
+				selectedRuleLabel.setText(TEXT_RULE_NAME);
+			} else {
+				selectedRuleLabel.setText(TEXT_RULE_NAME);
+			}
+		} else {
+			selectedRuleLabel.setText(TEXT_RULE_NAME);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.dialog.BasePropertyDialog#insertDataToTextFields()
+	 */
+	@Override
+	protected void insertDataToTextFields() {
+		if (oldItem instanceof VariableTracingTreeTextItem) {
+			VariableTracingTreeTextItem item = (VariableTracingTreeTextItem) oldItem;
+			if (item.getText() != null) {
+				textText.setText(item.getText());
+			}
+			matchCaseCheckBox.setSelection(item.isMatchCase());
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.dialog.BasePropertyDialog#insertDataToComponentFields
+	 * ()
+	 */
+	@Override
+	protected void insertDataToComponentFields() {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.BasePropertyDialog#setListSelection()
+	 */
+	@Override
+	protected void setListSelection() {
+		ruleList.add(TEXT_RULE_NAME, TEXT_RULE_INDEX);
+		// Set list selection
+		if (oldItem != null) {
+			if (oldItem.getRule() == VariableTracingTreeItem.Rule.TEXT_RULE) {
+				ruleList.setSelection(TEXT_RULE_INDEX);
+			}
+		} else {
+			ruleList.setSelection(TEXT_RULE_INDEX);
+		}
+	}
+
+	@Override
+	protected void okPressed() {
+		TraceViewerGlobals.postUiEvent("OkButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+		// Save the position of this item to set it back after creation
+		// and remove the old child
+		int pos = 0;
+		VariableTracingTreeItem parent = selectedItem;
+		if (oldItem != null) {
+			pos = getOldPosition();
+			parent = (VariableTracingTreeItem) oldItem.getParent();
+			parent.removeChild(oldItem);
+		}
+
+		// Create new VariableTracingTreeTextItem
+		if (ruleList.getSelectionIndex() == TEXT_RULE_INDEX) {
+			int history;
+			try {
+				history = Integer.parseInt(historyText.getText());
+			} catch (Exception e) {
+				history = 1;
+			}
+			if (history < 1) {
+				history = 1;
+			}
+
+			newItem = new VariableTracingTreeTextItem(listener, parent,
+					nameText.getText(), VariableTracingTreeItem.Rule.TEXT_RULE,
+					textText.getText(), matchCaseCheckBox.getSelection(),
+					history);
+
+			// Add mode
+			if (parent.equals(selectedItem)) {
+				parent.addChild(newItem);
+
+				// Edit mode
+			} else {
+				parent.addChild(pos, newItem);
+			}
+
+		} else {
+			// No other rules yet
+		}
+
+		super.okPressed();
+		TraceViewerGlobals.postUiEvent("OkButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.dialog.BasePropertyDialog#createActionListeners()
+	 */
+	@Override
+	protected void createActionListeners() {
+		super.createActionListeners();
+		super.createActionListenersForTextRule();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.dialog.BasePropertyDialog#setInformationLabel()
+	 */
+	@Override
+	protected void setInformationLabel() {
+		if (ruleList.getSelectionIndex() == TEXT_RULE_INDEX) {
+			informationLabel.setText(TEXT_RULE_INFORMATION_TEXT);
+			selectedRuleLabel.setText(TEXT_RULE_NAME);
+		}
+	}
+
+	/**
+	 * Gets old position of this item
+	 * 
+	 * @return old position
+	 */
+	protected int getOldPosition() {
+		VariableTracingTreeItem item = (VariableTracingTreeItem) oldItem
+				.getParent();
+		Object[] children = item.getChildren();
+		int pos = 0;
+		for (int i = 0; i < children.length; i++) {
+			if (children[i].equals(oldItem)) {
+				pos = i;
+				break;
+			}
+		}
+
+		return pos;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/messages.properties	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,231 @@
+SearchHitEOFUpdater.TextNotFoundStr=Text was not found. Continue search from the beginning?
+SearchHitFullRoundUpdater.TextNotFound=Text was not found
+SearchDialogProgressBarUpdater.LineText=line
+SearchDialog.SearchButtonText=Find Next
+SearchDialog.SearchButtonToolTip=Find next occurrence
+SearchDialog.MatchWholeWordText=Match whole word only
+SearchDialog.MatchWholeWordToolTip=If checked, search will only find whole words
+SearchDialog.DirectionGroupName=Direction
+SearchDialog.DirectionToolTip=Search direction
+ColorPropertyDialog.TextRuleInfo=Use text rules to color by plain text.
+ColorPropertyDialog.ComponentRuleInfo1=Use component / group rules to color by component /  group ID. Use
+ColorPropertyDialog.ComponentRuleInfo2=as a wildcard of any component / group.
+ColorPropertyDialog.ColorDefinition=Color Definition
+ColorPropertyDialog.ColorCodingName=Color Coding Name:
+ColorDialog.NewGroupInputText=Enter a name for the new group
+ColorPropertyDialog.SelectedRule=Selected rule:
+ColorDialog.NewGroupName=New Group
+ColorPropertyDialog.ForegroundColor=Foreground Color:
+ColorPropertyDialog.BackgroundColor=Background Color:
+ColorPropertyDialog.ChooseForegroundColor=Choose foreground color
+ColorPropertyDialog.ChooseBackgroundColor=Choose background color
+ColorPropertyDialog.NameFieldToolTip=Name for this rule
+ColorPropertyDialog.RuleLabelToolTip=Selected rule type
+ColorDialog.DialogName=Color Rules
+TriggerPropertyDialog.TextRuleInfo=Use text rules to trigger from plain text. 
+TriggerPropertyDialog.ActivationRuleInfo=Activation rule is used to send activation message when specific trace text is received. You can create activation configurations from "Trace Activation" dialog.
+TriggerPropertyDialog.StopTrigger=Stop trace trigger
+TriggerPropertyDialog.StartTrigger=Start trace trigger
+TriggerPropertyDialog.ActivationTrigger=Activation trigger
+TriggerPropertyDialog.TriggerDialogTitle=Trigger Rule Definition
+TriggerDialog.NewGroupDialogInformation=Enter a name for the new group
+TriggerDialog.SetStartTriggerConfirmationMsg=Setting start trigger will erase current data. Do you want to continue?
+TraceActivationDialog.ActivateButtonText=Send Activation
+TraceActivationDialog.ActivateButtonToolTip=Sends activation message to the device
+TriggerPropertyDialog.TextString=Text:
+TriggerPropertyDialog.MatchCaseString=Match Case
+TraceActivationDialog.CannotSendConnectionNotOpen=Cannot send message because connection is not established\!
+TraceActivationDialog.CloseButton=Close
+TraceActivationDialog.GroupColumnText=Group
+TraceActivationDialog.GroupColumnToolTip=Group name
+TraceActivationDialog.GroupFilterToolTip=Type text from Group name to filter the list
+TraceActivationDialog.StateColumnText=State
+TraceActivationDialog.StateColumnToolTip=State of activation for the group
+TriggerPropertyDialog.TypeString=Type:
+TriggerPropertyDialog.ConfFileString=Conf:
+TraceActivationDialog.ShellTitle=Trace Activation
+TriggerPropertyDialog.RuleNameString=Rule Name:
+TraceActivationDialog.FilterInfoText=Filter: (* for all)
+TraceActivationDialog.LoadButtonText=Load Configuration...
+TraceActivationDialog.LoadButtonToolTip=Load activation configuration
+TraceActivationDialog.SaveButtonText=Save Current...
+TraceActivationDialog.SaveButtonToolTip=Save current activation information to a configuration
+BaseTreeDialog.DialogName=Rules
+BasePropertyDialog.GroupBrowseToolTip=Select group ID from a list
+BasePropertyDialog.GroupFieldToolTip=Group ID to be searched
+BasePropertyDialog.GroupIdText=Group ID:
+BaseTreeDialog.GroupItemText=\ Group
+BaseTreeDialog.AddGroupToolTip=Create a new group folder
+BaseTreeDialog.AddItemText=\ \ Add  
+BaseTreeDialog.AddItemToolTip=Create a new rule
+BaseTreeDialog.EditItemText=\ \ Edit  
+BaseTreeDialog.EditItemToolTip=Edit the selected rule
+BaseTreeDialog.RemoveItemText=Remove
+BaseTreeDialog.RemoveItemToolTip=Remove the selected rule
+BaseTreeDialog.ClearItemText=\ Clear
+BaseTreeDialog.ClearItemToolTip=Clear all the rules
+BaseTreeDialog.GroupMenuItemText=Create group
+BaseTreeDialog.AddRuleText=Add Rule
+BaseTreeDialog.EditRuleText=Edit
+BaseTreeDialog.RemoveRuleText=Remove
+BaseTreeDialog.RenameRuleText=Rename
+BaseTreeDialog.ClearAllConfirmation=Do you really want to clear all the rules?
+BasePropertyDialog.ComponentBrowseTooltip=Select component ID from a list
+BasePropertyDialog.ComponentFieldToolTip=Component ID to be searched
+BasePropertyDialog.ComponentRuleName=Component / Group Rule
+BasePropertyDialog.SearchTooltip=Text to be searched from the traces
+BasePropertyDialog.SelectedRuleText=Selected rule:
+BaseTreeDialog.ClearAllDialogTitle=Really clear
+BasePropertyDialog.ComponentIDText=Component ID:
+BaseTreeDialog.RenameDialogTitle=Rename
+BasePropertyDialog.TextLabelText=Text:
+BasePropertyDialog.MatchCaseText=Match Case
+BasePropertyDialog.MatchCaseToolTip=If checked, text must be in same case that in the trace
+BasePropertyDialog.NameTexToolTip=Name for this rule
+BaseTreeDialog.RenameDialogText=Enter a new name for the item
+BasePropertyDialog.TextRuleName=Text Rule
+BasePropertyDialog.RuleLabelToolTip=Selected rule type
+BasePropertyDialog.RuleListToolTip=List of available rule types
+BasePropertyDialog.RuleNameText=Rule Name:
+FilterPropertyDialog.TextRuleInformation=Use text rules to filter by plain text.
+FilterAdvancedDialog.ANDToolTip=AND
+FilterAdvancedDialog.StartSetButtonText=Start Set
+FilterAdvancedDialog.StartSetToolTip=Start new rule set
+FilterAdvancedDialog.SettingsGroupName=Settings
+FilterPropertyDialog.ComponentRuleInfoLine1=Use component / group rules to filter by component /  group ID. Use 
+FilterPropertyDialog.ComponentRuleInfoLine2=\ as a wildcard of any component / group.
+FilterAdvancedDialog.MultipleOperatorsErrorMsg=Advanced Filter error! There are either both or non AND and OR operators inside the same rule set (between same brackets).
+FilterAdvancedDialog.InvalidSyntaxErrorMsg=Rule text field contains something else than logical operations and filter rules\! Please remove extra words/characters\!
+FilterPropertyDialog.ShellTitle=Message Filter Definition
+FilterDialog.ClearProcessReason=Clearing filters
+FilterDialog.SettingsGroupName=Settings
+FilterDialog.ShowButtonText=Show
+FilterDialog.ShowButtonToolTip=Show traces matching selected rules
+FilterDialog.HideButtonText=Hide
+FilterDialog.HideButtonToolTip=Hide traces matching selected rules
+FilterDialog.AdvancedItemText=\ Advanced
+FilterDialog.AdvancedViewToolTip=Switch to advanced view
+FilterDialog.NewGroupDialogInfo=Enter a name for the new group
+FilterDialog.NewGroupText=New Group
+FilterPropertyDialog.FilterNameText=Filter Name:
+FilterAdvancedDialog.EndSetButtonText=End Set
+FilterAdvancedDialog.EndSetToolTip=End rule set
+FilterAdvancedDialog.BackButtonText=Back
+FilterAdvancedDialog.BackToolTip=Erase previous rule / operand
+FilterAdvancedDialog.ClearButtonText=Clear
+FilterAdvancedDialog.ClearToolTip=Clear the whole rule
+FilterAdvancedDialog.SimpleButtonText=Simple
+FilterAdvancedDialog.SimpleViewToolTip=Change to simple view
+FilterAdvancedDialog.ShowButtonText=Show
+FilterAdvancedDialog.ShowButtonToolTip=Show traces matching selected rules
+FilterAdvancedDialog.HideButtonText=Hide
+FilterAdvancedDialog.HideButtonToolTip=Hide traces matching selected rules
+FilterAdvancedDialog.NOTToolTip=NOT
+FilterAdvancedDialog.ORToolTip=OR
+ProgressBarCloseHandler.CloseFilterConfirmation=Closing progressbar now removes all filters. Do you still want to close it?
+ProgressBarCloseHandler.CloseSavingConfirmation=Closing progressbar now stops log saving. Do you still want to close it?
+LogAsciiOptionsSelectionDialog.ChangeTimestampAccuracyMsg=Timestamp accuracy is currently milliseconds. Machine readable log might be better with more accurate timestamp. Do you want to change the accuracy to microseconds?
+LogAsciiOptionsSelectionDialog.OmitTimestampText=Omit timestamps from the log
+LogAsciiOptionsSelectionDialog.OmitTimestampToolTip=Do not write timestamp to the log
+LogAsciiOptionsSelectionDialog.ShellTitle=Select logging options
+LogAsciiOptionsSelectionDialog.WriteMachineReadableLogText=Write machine readable ASCII log
+LogAsciiOptionsSelectionDialog.WriteMachineReadableLogToolTip=Write machine readable ASCII log
+ComponentSelectionDialog.GroupColumnText=Group
+ComponentSelectionDialog.ComponentColumnText=Component
+ComponentSelectionDialog.GroupShellText=Select group
+ComponentSelectionDialog.ComponentShellText=Select component
+LineCountDialog.ProcessReason=Counting
+LineCountDialog.NewGroupText=New Group
+LineCountDialog.NewGroupDialogInfo=Enter a name for the new group
+LineCountPropertyDialog.TextRuleInfo=Use text rules to count occurrences from plain text.
+LineCountPropertyDialog.ShellTitle=Line Count Rule Definition
+ProgressBarDialog.ShellTitle=Processing...
+VariableTracingDialog.ProcessReason=Tracing
+VariableTracingHistoryDialog.YesText=Yes
+VariableTracingHistoryDialog.NoText=No
+VariableTracingDialog.DialogName=Variable Tracing Rules
+VariableTracingDialog.NewGroupText=New Group
+VariableTracingDialog.NewGroupDialogInfo=Enter a name for the new group
+VariableTracingPropertyDialog.TextRuleInfo=Use text rules to trace variables from plain text.
+VariableTracingPropertyDialog.ShellTitle=Variable Tracing Rule Definition
+VariableTracingHistoryDialog.ShellTitle=Variable Tracing History
+VariableTracingHistoryDialog.LineNrText=LineNr
+VariableTracingPropertyDialog.TextLabelText=Text:
+VariableTracingPropertyDialog.MatchCaseText=Match Case
+VariableTracingPropertyDialog.SaveHistoryText=Save history: 
+VariableTracingHistoryDialog.ValueColumnName=Value
+VariableTracingPropertyDialog.SaveHistoryText2=\ steps
+VariableTracingHistoryDialog.TimestampColumnName=Timestamp
+VariableTracingHistoryDialog.HasCodeLineColumnName=Has codeline
+VariableTracingHistoryDialog.SettingsGroupText=Settings
+VariableTracingHistoryDialog.InformationLabelText=When doubleclicking:
+VariableTracingHistoryDialog.ActivateTraceText=Activate corresponding trace
+VariableTracingHistoryDialog.ActivateCodelineText=Activate corresponding codeline
+VariableTracingPropertyDialog.RuleNameText=Rule Name:
+TraceActivationDialog.OnOff=On/Off
+TraceActivationDialog.On=On 
+TriggerDialog.DialogName=Trigger Rules
+TraceActivationDialog.Off=Off
+TraceActivationDialog.DictionaryColumnText=Dictionary
+TraceActivationDialog.ActivateText=Activate
+TraceActivationDialog.ActivateAllText=Activate all groups
+TraceActivationDialog.AddDictionaryButton=Add Dictionary
+TraceActivationDialog.AddDictionaryButtonToolTip=Add new Dictionaries
+TraceActivationDialog.DeActivateText=Deactivate
+TraceActivationDialog.DeActivateAllText=Deactivate all groups
+TraceActivationDialog.DictionaryColumnToolTip=Dictionary
+TraceActivationDialog.DictionaryFilterToolTip=Type text from Dictionary name to filter the list
+TraceActivationDialog.IdColumnToolTip=ID of the group
+TraceActivationDialog.InvalidButton=Invalid button
+TraceActivationDialog.RemoveDictionaryButton=Remove Dictionary
+TraceActivationDialog.RemoveDictionaryButtonToolTip=Remove selected Dictionaries from decoding model
+TraceActivationDialog.MultipleGroupsMessage1=\ (in 
+TraceActivationDialog.MultipleGroupsMessage2=\ components)
+TraceActivationDialog.TraceActivationCategory=Trace Activation
+TraceConfigurationLoadDialog.BrowseButtonText=Browse...
+TraceConfigurationLoadDialog.BrowseButtonToolTip=Browse for a file
+TraceConfigurationLoadDialog.ConfComboToolTip=List of saved configurations found from the current file
+TraceConfigurationLoadDialog.ConfGroupText=Configuration
+TraceConfigurationLoadDialog.ConfNameMsg=Please give a name for this activation configuration\!
+TraceConfigurationLoadDialog.FileGroupText=File
+TraceConfigurationLoadDialog.FileLabelText=Activation file:
+TraceConfigurationLoadDialog.FilterNames=Configuration files (*.xml)
+TraceConfigurationLoadDialog.LoadLabelText=Load configuration:
+TraceConfigurationLoadDialog.LoadMsg=Activation information loaded\! Remember to send the activation message\!
+TraceConfigurationLoadDialog.ShellTitle=Load Configuration
+TraceConfigurationSaveDialog.BrowseButtonText=Browse...
+TraceConfigurationSaveDialog.BrowseButtonToolTip=Browse for a file
+TraceConfigurationSaveDialog.ConfComboToolTip=Write a new configuration name or overwrite an old one
+TraceConfigurationSaveDialog.ConfGroupText=Configuration
+TraceConfigurationSaveDialog.ConfLabelText=Save current configuration as:
+TraceConfigurationSaveDialog.CurrentFileLabelText=Activation file:
+TraceConfigurationSaveDialog.EmptyConfMsg=Please give a name for this activation configuration\!
+TraceConfigurationSaveDialog.FileGroupText=File
+TraceConfigurationSaveDialog.FilterNames=Configuration files (*.xml)
+TraceConfigurationSaveDialog.NotValidFilePath=Given file path is not valid or absolute\!
+TraceConfigurationSaveDialog.SaveMsg=Activation information saved\!
+TraceConfigurationSaveDialog.ShellTitle=Save Configuration
+SearchDialog.DialogTitle=Search
+SearchDialog.FindComboToolTip=Type in the text you want to search
+SearchDialog.FindText=Find what:
+SearchDialog.StopButtonText=Stop search
+SearchDialog.StopButtonToolTip=Stops the currently ongoing search
+SearchDialog.MatchCaseText=Match case
+SearchDialog.MatchCaseToolTip=If checked, the case of the searchable text must match
+SearchDialog.RegExpText=Regular expression search
+SearchDialog.RegExpToolTip=If checked, search will assume that the searchable text is in regular expression syntax
+SearchDialog.LineViewText=line: 0 / 
+SearchDialog.UpDirectionText=Up
+SearchDialog.UpDirectionToolTip=Search up
+SearchDialog.DownDirectionText=Down
+SearchDialog.DownDirectionToolTip=Search down
+TriggerDialog.NewGroupText=New Group
+FilterDialog.ProcessReason=Filtering
+FilterDialog.DialogName=Filter Rules
+FilterDialog.OrButtonText=OR
+FilterDialog.ORRuleToolTip=Any of the selected rules can match
+FilterDialog.AndButtonText=AND
+FilterDialog.ANDRuleToolTip=All of the selected rules must match
+LineCountPropertyDialog.ComponentRuleInfoLine1=Use component / group rules to count occurrences by component /  group ID. Use 
+LineCountPropertyDialog.ComponentRuleInfoLine2=\ as a wildcard of any component / group.
+ShowTraceInfoDialog.ShellName=Trace information
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/ColorTreeBaseItem.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,93 @@
+/*
+ * 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:
+ *
+ * Color Tree Base item class
+ *
+ */
+package com.nokia.traceviewer.dialog.treeitem;
+
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * Color Tree Base item class
+ */
+public class ColorTreeBaseItem extends TreeItemImpl implements ColorTreeItem {
+
+	/**
+	 * Rule type
+	 */
+	private final Rule rule;
+
+	/**
+	 * Foreground color of the item
+	 */
+	private final Color foregroundColor;
+
+	/**
+	 * Background color of the item
+	 */
+	private final Color backgroundColor;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param listener
+	 *            TreeItemListener
+	 * @param parent
+	 *            parent object
+	 * @param name
+	 *            name of the item
+	 * @param rule
+	 *            rule for the item
+	 * @param foreground
+	 *            foreground color
+	 * @param background
+	 *            background color
+	 */
+	public ColorTreeBaseItem(TreeItemListener listener, Object parent,
+			String name, Rule rule, Color foreground, Color background) {
+		super(name, parent, listener, (rule == Rule.GROUP));
+		this.rule = rule;
+		this.foregroundColor = foreground;
+		this.backgroundColor = background;
+	}
+
+	/**
+	 * Gets the type of the rule
+	 * 
+	 * @return the rule
+	 */
+	public Rule getRule() {
+		return rule;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.ColorItem#getBackgroundColor()
+	 */
+	public Color getBackgroundColor() {
+		return backgroundColor;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.ColorItem#getForegroundColor()
+	 */
+	public Color getForegroundColor() {
+		return foregroundColor;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/ColorTreeComponentItem.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,83 @@
+/*
+ * 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:
+ *
+ * Color Tree Component Item
+ *
+ */
+package com.nokia.traceviewer.dialog.treeitem;
+
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * Color Tree Component Item
+ */
+public class ColorTreeComponentItem extends ColorTreeBaseItem {
+
+	/**
+	 * Component ID of this item
+	 */
+	private final int componentId;
+
+	/**
+	 * Group ID of this item
+	 */
+	private final int groupId;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param listener
+	 *            TreeItem listener
+	 * @param parent
+	 *            parent object
+	 * @param name
+	 *            name of the rule
+	 * @param rule
+	 *            Rule of this item
+	 * @param foreground
+	 *            foreground color for this item
+	 * @param background
+	 *            background color for this item
+	 * @param componentId
+	 *            component ID
+	 * @param groupId
+	 *            group ID
+	 */
+	public ColorTreeComponentItem(TreeItemListener listener, Object parent,
+			String name, Rule rule, Color foreground, Color background,
+			int componentId, int groupId) {
+		super(listener, parent, name, rule, foreground, background);
+		this.componentId = componentId;
+		this.groupId = groupId;
+	}
+
+	/**
+	 * Gets component ID
+	 * 
+	 * @return the componentId
+	 */
+	public int getComponentId() {
+		return componentId;
+	}
+
+	/**
+	 * Gets group ID
+	 * 
+	 * @return the groupId
+	 */
+	public int getGroupId() {
+		return groupId;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/ColorTreeItem.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,69 @@
+/*
+ * 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:
+ *
+ * Color Tree item interface
+ *
+ */
+package com.nokia.traceviewer.dialog.treeitem;
+
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * Color Tree item interface
+ */
+public interface ColorTreeItem extends TreeItem {
+
+	/**
+	 * Rule type for color items
+	 */
+	public enum Rule {
+
+		/**
+		 * Text rule
+		 */
+		TEXT_RULE,
+
+		/**
+		 * Component rule
+		 */
+		COMPONENT_RULE,
+
+		/**
+		 * Group rule
+		 */
+		GROUP;
+	}
+
+	/**
+	 * Gets the type of the rule
+	 * 
+	 * @return the rule
+	 */
+	public Rule getRule();
+
+	/**
+	 * Gets the foreground color of the rule
+	 * 
+	 * @return foreground color
+	 */
+	public Color getForegroundColor();
+
+	/**
+	 * Gets the background color of the rule
+	 * 
+	 * @return background color
+	 */
+	public Color getBackgroundColor();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/ColorTreeTextItem.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,105 @@
+/*
+ * 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:
+ *
+ * Color Tree Text Item class
+ *
+ */
+package com.nokia.traceviewer.dialog.treeitem;
+
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * Color Tree Text Item class
+ */
+public class ColorTreeTextItem extends ColorTreeBaseItem {
+
+	/**
+	 * Text of the item
+	 */
+	private final String text;
+
+	/**
+	 * Match case boolean
+	 */
+	private final boolean matchCase;
+
+	/**
+	 * Text to be compared
+	 */
+	private final String textToCompare;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param listener
+	 *            TreeItem listener
+	 * @param parent
+	 *            parent object
+	 * @param name
+	 *            name of the item
+	 * @param rule
+	 *            rule of the item
+	 * @param foreground
+	 *            foreground color
+	 * @param background
+	 *            background color
+	 * @param text
+	 *            text of the item
+	 * @param matchCase
+	 *            matching case or not
+	 */
+	public ColorTreeTextItem(TreeItemListener listener, Object parent,
+			String name, Rule rule, Color foreground, Color background,
+			String text, boolean matchCase) {
+		super(listener, parent, name, rule, foreground, background);
+		this.text = text;
+		this.matchCase = matchCase;
+
+		// Save text to compare
+		if (matchCase || text == null) {
+			textToCompare = text;
+		} else {
+			textToCompare = text.toLowerCase();
+		}
+	}
+
+	/**
+	 * Gets match case status
+	 * 
+	 * @return the matchCase
+	 */
+	public boolean isMatchCase() {
+		return matchCase;
+	}
+
+	/**
+	 * Gets text
+	 * 
+	 * @return the text
+	 */
+	public String getText() {
+		return text;
+	}
+
+	/**
+	 * Gets text to compare
+	 * 
+	 * @return the text to compare
+	 */
+	public String getTextToCompare() {
+		return textToCompare;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/FilterTreeBaseItem.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,97 @@
+/*
+ * 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:
+ *
+ * Filter Tree Base item class
+ *
+ */
+package com.nokia.traceviewer.dialog.treeitem;
+
+import com.nokia.traceviewer.engine.TraceProperties;
+
+/**
+ * Filter Tree Base item class
+ */
+public class FilterTreeBaseItem extends TreeItemImpl implements FilterTreeItem {
+
+	/**
+	 * Rule of the item
+	 */
+	private final Rule rule;
+
+	/**
+	 * Indicates if this rule is inside logical NOT
+	 */
+	private boolean notRule;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param listener
+	 *            TreeItemListener
+	 * @param parent
+	 *            parent object
+	 * @param name
+	 *            name for the item
+	 * @param rule
+	 *            rule for the item
+	 */
+	public FilterTreeBaseItem(TreeItemListener listener, Object parent,
+			String name, Rule rule) {
+		super(name, parent, listener, (rule == Rule.GROUP));
+		this.rule = rule;
+	}
+
+	/**
+	 * Gets the type of the rule
+	 * 
+	 * @return the rule
+	 */
+	public Rule getRule() {
+		return rule;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.dataprocessor.FilterRuleObject#isLogicalNotRule
+	 * ()
+	 */
+	public boolean isLogicalNotRule() {
+		return notRule;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.dataprocessor.FilterRuleObject#setLogicalNotRule
+	 * (boolean)
+	 */
+	public void setLogicalNotRule(boolean notRule) {
+		this.notRule = notRule;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.dataprocessor.FilterRuleObject
+	 * #processRule(com.nokia.traceviewer.engine.TraceProperties)
+	 */
+	public boolean processRule(TraceProperties properties) {
+		// Method implemented in subclassses
+		return false;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/FilterTreeComponentItem.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,116 @@
+/*
+ * 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:
+ *
+ * Filter Tree Component Item
+ *
+ */
+package com.nokia.traceviewer.dialog.treeitem;
+
+import com.nokia.traceviewer.dialog.BasePropertyDialog;
+import com.nokia.traceviewer.engine.TraceInformation;
+import com.nokia.traceviewer.engine.TraceProperties;
+
+/**
+ * Filter Tree Component Item
+ */
+public class FilterTreeComponentItem extends FilterTreeBaseItem {
+
+	/**
+	 * Component ID of this item
+	 */
+	private final int componentId;
+
+	/**
+	 * Group ID of this item
+	 */
+	private final int groupId;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param listener
+	 *            TreeItem listener
+	 * @param parent
+	 *            parent object
+	 * @param name
+	 *            name of the rule
+	 * @param rule
+	 *            rule of the rule
+	 * @param componentId
+	 *            component Id
+	 * @param groupId
+	 *            group Id
+	 */
+	public FilterTreeComponentItem(TreeItemListener listener, Object parent,
+			String name, Rule rule, int componentId, int groupId) {
+		super(listener, parent, name, rule);
+		this.componentId = componentId;
+		this.groupId = groupId;
+	}
+
+	/**
+	 * Gets component ID
+	 * 
+	 * @return the componentId
+	 */
+	public int getComponentId() {
+		return componentId;
+	}
+
+	/**
+	 * Gets group ID
+	 * 
+	 * @return the groupId
+	 */
+	public int getGroupId() {
+		return groupId;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.dialog.treeitem.FilterTreeBaseItem#processRule(
+	 * com.nokia.traceviewer.engine.TraceProperties)
+	 */
+	@Override
+	public boolean processRule(TraceProperties properties) {
+		boolean filterHit = false;
+		TraceInformation information = properties.information;
+
+		// Information must be defined
+		if (information != null && information.isDefined()) {
+
+			// Component ID matches
+			if (componentId == BasePropertyDialog.WILDCARD_INTEGER
+					|| componentId == information.getComponentId()) {
+
+				// Group ID matches
+				if (groupId == BasePropertyDialog.WILDCARD_INTEGER
+						|| groupId == information.getGroupId()) {
+
+					filterHit = true;
+				}
+			}
+		}
+
+		// If logical NOT, change the result to opposite
+		if (isLogicalNotRule()) {
+			filterHit = !filterHit;
+		}
+
+		return filterHit;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/FilterTreeItem.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,55 @@
+/*
+ * 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:
+ *
+ * Filter tree item interface
+ *
+ */
+package com.nokia.traceviewer.dialog.treeitem;
+
+import com.nokia.traceviewer.engine.dataprocessor.FilterRuleObject;
+
+/**
+ * Filter tree item interface
+ */
+public interface FilterTreeItem extends TreeItem, FilterRuleObject {
+
+	/**
+	 * Rule type for filter items
+	 */
+	public enum Rule {
+
+		/**
+		 * Text rule
+		 */
+		TEXT_RULE,
+
+		/**
+		 * Component rule
+		 */
+		COMPONENT_RULE,
+
+		/**
+		 * Group rule
+		 */
+		GROUP;
+	}
+
+	/**
+	 * Gets the type of the rule
+	 * 
+	 * @return the rule
+	 */
+	public Rule getRule();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/FilterTreeTextItem.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,134 @@
+/*
+ * 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:
+ *
+ * Filter Tree Text Item class
+ *
+ */
+
+package com.nokia.traceviewer.dialog.treeitem;
+
+import com.nokia.traceviewer.action.TraceViewerActionUtils;
+import com.nokia.traceviewer.engine.TraceProperties;
+
+/**
+ * Filter Tree Text Item class
+ * 
+ */
+public class FilterTreeTextItem extends FilterTreeBaseItem {
+
+	/**
+	 * Text of the item
+	 */
+	private final String text;
+
+	/**
+	 * Text to be compared when filtering
+	 */
+	private final String textToCompare;
+
+	/**
+	 * Indicates match case
+	 */
+	private final boolean matchCase;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param listener
+	 *            Treeitem listener
+	 * @param parent
+	 *            parent object
+	 * @param name
+	 *            name of the item
+	 * @param rule
+	 *            rule of the item
+	 * @param text
+	 *            text of the item
+	 * @param matchCase
+	 *            match case of the item
+	 */
+	public FilterTreeTextItem(TreeItemListener listener, Object parent,
+			String name, Rule rule, String text, boolean matchCase) {
+		super(listener, parent, name, rule);
+		this.text = text;
+		this.matchCase = matchCase;
+
+		// Save text to compare
+		if (matchCase || text == null) {
+			textToCompare = text;
+		} else {
+			textToCompare = text.toLowerCase();
+		}
+	}
+
+	/**
+	 * Gets match case status
+	 * 
+	 * @return the matchCase
+	 */
+	public boolean isMatchCase() {
+		return matchCase;
+	}
+
+	/**
+	 * Gets text
+	 * 
+	 * @return the text
+	 */
+	public String getText() {
+		return text;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.dialog.treeitem.FilterTreeBaseItem#processRule(
+	 * com.nokia.traceviewer.engine.TraceProperties)
+	 */
+	@Override
+	public boolean processRule(TraceProperties properties) {
+		boolean filterHit = false;
+
+		// Filter hits
+		String traceLine = ""; //$NON-NLS-1$
+
+		// Traces missing
+		if (properties.bTraceInformation.isTraceMissing()) {
+			traceLine = TraceViewerActionUtils.TRACES_DROPPED_MSG;
+		}
+		if (properties.traceString != null) {
+			traceLine += properties.traceString;
+		}
+
+		// Check that filter is not null
+		if (textToCompare != null) {
+			if (!isMatchCase()) {
+				traceLine = traceLine.toLowerCase();
+			}
+			if (traceLine.contains(textToCompare)) {
+				filterHit = true;
+			}
+		}
+
+		// If logical NOT, change the result to opposite
+		if (isLogicalNotRule()) {
+			filterHit = !filterHit;
+		}
+
+		return filterHit;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/LineCountTreeBaseItem.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,58 @@
+/*
+ * 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:
+ *
+ * LineCount Tree Base item class
+ *
+ */
+package com.nokia.traceviewer.dialog.treeitem;
+
+/**
+ * LineCount Tree Base item class
+ */
+public class LineCountTreeBaseItem extends TreeItemImpl implements
+		LineCountTreeItem {
+
+	/**
+	 * Rule of the item
+	 */
+	private final Rule rule;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param listener
+	 *            TreeItemListener
+	 * @param parent
+	 *            parent object
+	 * @param name
+	 *            name of the item
+	 * @param rule
+	 *            rule of the item
+	 */
+	public LineCountTreeBaseItem(TreeItemListener listener, Object parent,
+			String name, Rule rule) {
+		super(name, parent, listener, (rule == Rule.GROUP));
+		this.rule = rule;
+	}
+
+	/**
+	 * Gets the type of the rule
+	 * 
+	 * @return the rule
+	 */
+	public Rule getRule() {
+		return rule;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/LineCountTreeComponentItem.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,74 @@
+/*
+ * 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:
+ *
+ * LineCount Tree Component Item
+ *
+ */
+package com.nokia.traceviewer.dialog.treeitem;
+
+/**
+ * LineCount Tree Component Item
+ */
+public class LineCountTreeComponentItem extends LineCountTreeBaseItem {
+
+	/**
+	 * Component ID of this item
+	 */
+	private final int componentId;
+
+	/**
+	 * Group ID of this item
+	 */
+	private final int groupId;
+
+	/**
+	 * @param listener
+	 *            TreeItemListener
+	 * @param parent
+	 *            parent object
+	 * @param name
+	 *            name of the item
+	 * @param rule
+	 *            rule of the item
+	 * @param componentId
+	 *            component ID
+	 * @param groupId
+	 *            group ID
+	 */
+	public LineCountTreeComponentItem(TreeItemListener listener, Object parent,
+			String name, Rule rule, int componentId, int groupId) {
+		super(listener, parent, name, rule);
+		this.componentId = componentId;
+		this.groupId = groupId;
+	}
+
+	/**
+	 * Gets component ID
+	 * 
+	 * @return the componentId
+	 */
+	public int getComponentId() {
+		return componentId;
+	}
+
+	/**
+	 * Gets group ID
+	 * 
+	 * @return the groupId
+	 */
+	public int getGroupId() {
+		return groupId;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/LineCountTreeItem.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,53 @@
+/*
+ * 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:
+ *
+ * Line Count tree item interface
+ *
+ */
+package com.nokia.traceviewer.dialog.treeitem;
+
+/**
+ * Line Count tree item interface
+ */
+public interface LineCountTreeItem extends TreeItem {
+
+	/**
+	 * Rule type for linecount items
+	 */
+	public enum Rule {
+
+		/**
+		 * Text rule
+		 */
+		TEXT_RULE,
+
+		/**
+		 * Component rule
+		 */
+		COMPONENT_RULE,
+
+		/**
+		 * Group rule
+		 */
+		GROUP;
+	}
+
+	/**
+	 * Gets the type of the rule
+	 * 
+	 * @return the rule
+	 */
+	public Rule getRule();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/LineCountTreeTextItem.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,97 @@
+/*
+ * 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:
+ *
+ * Line count tree Text Item class
+ *
+ */
+package com.nokia.traceviewer.dialog.treeitem;
+
+/**
+ * Line count tree Text Item class
+ */
+public class LineCountTreeTextItem extends LineCountTreeBaseItem {
+
+	/**
+	 * Text of the item
+	 */
+	private final String text;
+
+	/**
+	 * Text to be compared
+	 */
+	private final String textToCompare;
+
+	/**
+	 * Indicates if the item case should match
+	 */
+	private final boolean matchCase;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param listener
+	 *            TreeItemListener
+	 * @param parent
+	 *            parent object
+	 * @param name
+	 *            name of the item
+	 * @param rule
+	 *            rule of the item
+	 * @param text
+	 *            text for this item
+	 * @param matchCase
+	 *            match case boolean for this item
+	 */
+	public LineCountTreeTextItem(TreeItemListener listener, Object parent,
+			String name, Rule rule, String text, boolean matchCase) {
+		super(listener, parent, name, rule);
+		this.text = text;
+		this.matchCase = matchCase;
+
+		// Save text to compare
+		if (matchCase || text == null) {
+			textToCompare = text;
+		} else {
+			textToCompare = text.toLowerCase();
+		}
+	}
+
+	/**
+	 * Gets match case status
+	 * 
+	 * @return the matchCase
+	 */
+	public boolean isMatchCase() {
+		return matchCase;
+	}
+
+	/**
+	 * Gets text
+	 * 
+	 * @return the text
+	 */
+	public String getText() {
+		return text;
+	}
+
+	/**
+	 * Gets text to compare
+	 * 
+	 * @return the text to compare
+	 */
+	public String getTextToCompare() {
+		return textToCompare;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/TreeCheckboxStateListener.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,173 @@
+/*
+ * 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:
+ *
+ * Tree Checkbox State Listener class
+ *
+ */
+package com.nokia.traceviewer.dialog.treeitem;
+
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTreeViewer;
+import org.eclipse.jface.viewers.ICheckStateListener;
+
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Tree Checkbox State Listener class
+ */
+public class TreeCheckboxStateListener implements ICheckStateListener {
+
+	/**
+	 * CheckboxTreeViewer
+	 */
+	private final CheckboxTreeViewer viewer;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param viewer
+	 *            checkboxviewer
+	 */
+	public TreeCheckboxStateListener(CheckboxTreeViewer viewer) {
+		this.viewer = viewer;
+	}
+
+	public void checkStateChanged(CheckStateChangedEvent event) {
+		// Check and uncheck children
+		if (event.getChecked()) {
+			viewer.setSubtreeChecked(event.getElement(), true);
+		} else {
+			viewer.setSubtreeChecked(event.getElement(), false);
+		}
+		viewer.setGrayed(event.getElement(), false);
+
+		// Set something changed variable to color dialog
+		if (event.getElement() instanceof ColorTreeItem) {
+			TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+					.getColorer().getColorDialog().setSomethingChanged(true);
+
+			// Set something changed variable to filter dialog
+		} else if (event.getElement() instanceof FilterTreeItem) {
+			TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+					.getFilterProcessor().getFilterDialog()
+					.setSomethingChanged(true);
+
+			// Set something changed variable to linecount dialog
+		} else if (event.getElement() instanceof LineCountTreeItem) {
+			TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+					.getLineCountProcessor().getLineCountDialog()
+					.setSomethingChanged(true);
+
+			// Set something changed variable to variableTracing dialog
+		} else if (event.getElement() instanceof VariableTracingTreeItem) {
+			TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+					.getVariableTracingProcessor().getVariableTracingDialog()
+					.setSomethingChanged(true);
+
+			// Set something changed variable to trigger dialog
+		} else if (event.getElement() instanceof TriggerTreeItem) {
+			TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+					.getTriggerProcessor().getTriggerDialog()
+					.setSomethingChanged(true);
+		}
+
+		// Check parents if needed
+		checkStateChanged((TreeItem) event.getElement());
+	}
+
+	/**
+	 * Makes needed changes to viewer if checked state was changed manually
+	 * 
+	 * @param item
+	 *            item which has checked state changed
+	 */
+	public void checkStateChanged(TreeItem item) {
+		TreeItem parent = (TreeItem) item.getParent();
+		// Item checked
+		if (viewer.getChecked(item) && !viewer.getGrayed(item)
+				&& parent != null) {
+
+			// If all children checked, check parent also
+			if (allChildrenChecked(parent)) {
+				viewer.setChecked(parent, true);
+				viewer.setGrayed(parent, false);
+				// Only grey check
+			} else {
+				viewer.setGrayChecked(parent, true);
+			}
+
+			checkStateChanged(parent);
+
+			// Item unchecked
+		} else if (!viewer.getChecked(item) && parent != null) {
+
+			// If any children still checked
+			if (anyChildrenChecked(parent)) {
+				viewer.setGrayChecked(parent, true);
+			} else {
+				viewer.setGrayChecked(parent, false);
+			}
+			checkStateChanged(parent);
+		} else if (viewer.getChecked(item) && viewer.getGrayed(item)
+				&& parent != null) {
+
+			viewer.setGrayChecked(parent, true);
+			checkStateChanged(parent);
+		}
+	}
+
+	/**
+	 * Tells if given item has any children checked
+	 * 
+	 * @param item
+	 *            item to investigate
+	 * @return true if this item has any children checked
+	 */
+	public boolean anyChildrenChecked(TreeItem item) {
+		boolean isAnyChecked = false;
+
+		Object[] children = item.getChildren();
+
+		for (int i = 0; i < children.length; i++) {
+			if (viewer.getChecked(children[i])) {
+				isAnyChecked = true;
+				break;
+			}
+		}
+		return isAnyChecked;
+	}
+
+	/**
+	 * Tells if given item has all children checked
+	 * 
+	 * @param item
+	 *            item to investigate
+	 * @return true if this item has all children checked
+	 */
+	public boolean allChildrenChecked(TreeItem item) {
+		boolean isAllChecked = true;
+
+		Object[] children = item.getChildren();
+
+		for (int i = 0; i < children.length; i++) {
+			if (!viewer.getChecked(children[i])
+					&& !viewer.getGrayed(children[i])) {
+				isAllChecked = false;
+				break;
+			}
+		}
+		return isAllChecked;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/TreeItem.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,97 @@
+/*
+ * 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:
+ *
+ * Tree item interface
+ *
+ */
+package com.nokia.traceviewer.dialog.treeitem;
+
+/**
+ * Tree item interface
+ * 
+ */
+public interface TreeItem {
+
+	/**
+	 * Gets the name of the rule
+	 * 
+	 * @return the name
+	 */
+	public String getName();
+
+	/**
+	 * Sets the name of the rule
+	 * 
+	 * @param name
+	 *            the name to set
+	 */
+	public void setName(String name);
+
+	/**
+	 * Tells if this TreeItem is group
+	 * 
+	 * @return true if TreeItem is group
+	 */
+	public boolean isGroup();
+
+	/**
+	 * Gets children from this tree item
+	 * 
+	 * @return children
+	 */
+	public Object[] getChildren();
+
+	/**
+	 * Set parent
+	 * 
+	 * @param parent
+	 *            the new parent
+	 */
+	public void setParent(Object parent);
+
+	/**
+	 * Get parent
+	 * 
+	 * @return parent
+	 */
+	public Object getParent();
+
+	/**
+	 * Adds child
+	 * 
+	 * @param index
+	 *            index where to add item
+	 * @param treeItem
+	 *            new child
+	 */
+	public void addChild(int index, TreeItem treeItem);
+
+	/**
+	 * Adds child
+	 * 
+	 * @param treeItem
+	 *            new child
+	 */
+	public void addChild(TreeItem treeItem);
+
+	/**
+	 * Removes child
+	 * 
+	 * @param treeItem
+	 *            child to be removed
+	 */
+	public void removeChild(TreeItem treeItem);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/TreeItemContentProvider.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,121 @@
+/*
+ * 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:
+ *
+ * TreeItem Content Provider
+ *
+ */
+package com.nokia.traceviewer.dialog.treeitem;
+
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+/**
+ * TreeItem Content Provider
+ */
+public class TreeItemContentProvider implements ITreeContentProvider,
+		TreeItemListener {
+
+	/**
+	 * Root item
+	 */
+	private Object root;
+
+	/**
+	 * Viewer to provide content to
+	 */
+	private Viewer viewer;
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.
+	 * Object)
+	 */
+	public Object[] getChildren(Object parentElement) {
+		return ((TreeItem) parentElement).getChildren();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object
+	 * )
+	 */
+	public Object getParent(Object element) {
+		return ((TreeItem) element).getParent();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.
+	 * Object)
+	 */
+	public boolean hasChildren(Object element) {
+		boolean hasChildren = false;
+		TreeItem treeItem = ((TreeItem) element);
+		if (treeItem.getChildren() != null && treeItem.getChildren().length > 0) {
+			hasChildren = true;
+		}
+		return hasChildren;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java
+	 * .lang.Object)
+	 */
+	public Object[] getElements(Object inputElement) {
+		return getChildren(root);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+	 */
+	public void dispose() {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface
+	 * .viewers.Viewer, java.lang.Object, java.lang.Object)
+	 */
+	public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+		// First time set as root
+		this.viewer = viewer;
+		this.root = newInput;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.FilterItemListener#modelChanged()
+	 */
+	public void modelChanged() {
+		if (root != null) {
+			viewer.refresh();
+		}
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/TreeItemImpl.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,173 @@
+/*
+ * 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:
+ *
+ * Tree Item Implementation
+ *
+ */
+package com.nokia.traceviewer.dialog.treeitem;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Tree Item Implementation
+ */
+public abstract class TreeItemImpl implements TreeItem {
+
+	/**
+	 * Children list of this tree item
+	 */
+	private List<TreeItem> children;
+
+	/**
+	 * Parent item of this tree item
+	 */
+	private Object parent;
+
+	/**
+	 * Listener
+	 */
+	private final TreeItemListener listener;
+
+	/**
+	 * Indicates is this item a group item or not
+	 */
+	private final boolean groupItem;
+
+	/**
+	 * Name of the item
+	 */
+	private String name;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param name
+	 *            name of the item
+	 * @param parent
+	 *            parent object of this TreeItem
+	 * @param listener
+	 *            TreeItemListener
+	 * @param groupItem
+	 *            group item indicator
+	 */
+	public TreeItemImpl(String name, Object parent, TreeItemListener listener,
+			boolean groupItem) {
+		this.name = name;
+		this.parent = parent;
+		this.listener = listener;
+		this.groupItem = groupItem;
+		if (groupItem) {
+			children = new ArrayList<TreeItem>();
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.TreeItem#getName()
+	 */
+	public String getName() {
+		return name;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.TreeItem#setName(java.lang.String)
+	 */
+	public void setName(String name) {
+		this.name = name;
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.TreeItem#getChildren()
+	 */
+	public Object[] getChildren() {
+		Object[] childrenArr = null;
+		// Return children if item is group
+		if (groupItem) {
+			childrenArr = children.toArray();
+		} else {
+			// Return empty array
+			childrenArr = new Object[0];
+		}
+		return childrenArr;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.dialog.TreeItem#addChild(com.nokia.traceviewer.
+	 * dialog.TreeItem)
+	 */
+	public void addChild(TreeItem treeItem) {
+		addChild(children.size(), treeItem);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.TreeItem#addChild(int,
+	 * com.nokia.traceviewer.dialog.TreeItem)
+	 */
+	public void addChild(int index, TreeItem treeItem) {
+		children.add(index, treeItem);
+		listener.modelChanged();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.dialog.TreeItem#removeChild(com.nokia.traceviewer
+	 * .dialog.TreeItem)
+	 */
+	public void removeChild(TreeItem treeItem) {
+		children.remove(treeItem);
+		listener.modelChanged();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.ColorItem#getParent()
+	 */
+	public Object getParent() {
+		return parent;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.TreeItem#isGroup()
+	 */
+	public boolean isGroup() {
+		return groupItem;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.TreeItem#setParent(java.lang.Object)
+	 */
+	public void setParent(Object parent) {
+		this.parent = parent;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/TreeItemLabelProvider.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,203 @@
+/*
+ * 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:
+ *
+ * TreeItem Label Provider
+ *
+ */
+package com.nokia.traceviewer.dialog.treeitem;
+
+import java.net.URL;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.swt.graphics.Image;
+
+import com.nokia.traceviewer.TraceViewerPlugin;
+
+/**
+ * TreeItem Label Provider
+ * 
+ */
+public class TreeItemLabelProvider implements ILabelProvider {
+
+	/**
+	 * Group image
+	 */
+	private final Image groupImage;
+
+	/**
+	 * Tree item image
+	 */
+	private final Image treeItemImage;
+
+	/**
+	 * Tree Component item image
+	 */
+	private final Image treeComponentItemImage;
+
+	/**
+	 * Stop trigger tree item image
+	 */
+	private final Image stopTriggerItemImage;
+
+	/**
+	 * Activation trigger tree item image
+	 */
+	private final Image activationTriggerItemImage;
+
+	/**
+	 * Constructor
+	 */
+	public TreeItemLabelProvider() {
+		// Create group icon
+		URL url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				"/icons/folder.gif"); //$NON-NLS-1$
+		groupImage = ImageDescriptor.createFromURL(url).createImage();
+
+		// Create tree item icon
+		url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				"/icons/listitem.gif"); //$NON-NLS-1$
+		treeItemImage = ImageDescriptor.createFromURL(url).createImage();
+
+		// Create tree Component item icon
+		url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				"/icons/listcomponentitem.gif"); //$NON-NLS-1$
+		treeComponentItemImage = ImageDescriptor.createFromURL(url)
+				.createImage();
+
+		// Create stop trigger item icon
+		url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				"/icons/stoptrigger.gif"); //$NON-NLS-1$
+		stopTriggerItemImage = ImageDescriptor.createFromURL(url).createImage();
+
+		// Create activation trigger item icon
+		url = TraceViewerPlugin.getDefault().getBundle().getEntry(
+				"/icons/activationtrigger.gif"); //$NON-NLS-1$
+		activationTriggerItemImage = ImageDescriptor.createFromURL(url)
+				.createImage();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
+	 */
+	public Image getImage(Object element) {
+		Image image;
+		if (((TreeItem) element).isGroup()) {
+			image = groupImage;
+		} else {
+			// Stop trigger image
+			if (element instanceof TriggerTreeItem
+					&& ((TriggerTreeItem) element).getType() == TriggerTreeItem.Type.STOPTRIGGER) {
+				image = stopTriggerItemImage;
+
+				// Activation trigger image
+			} else if (element instanceof TriggerTreeItem
+					&& ((TriggerTreeItem) element).getType() == TriggerTreeItem.Type.ACTIVATIONTRIGGER) {
+				image = activationTriggerItemImage;
+
+				// Component rule tree images
+			} else if (componentRuleSelected(element)) {
+				image = treeComponentItemImage;
+
+				// Text rule tree images
+			} else {
+				image = treeItemImage;
+			}
+		}
+		return image;
+	}
+
+	/**
+	 * Checks if the element is component rule
+	 * 
+	 * @param element
+	 *            the element to check
+	 * @return true if the element is component rule
+	 */
+	private boolean componentRuleSelected(Object element) {
+		boolean isComponent = false;
+		if (element instanceof ColorTreeComponentItem
+				|| element instanceof FilterTreeComponentItem
+				|| element instanceof LineCountTreeComponentItem) {
+			isComponent = true;
+		}
+		return isComponent;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
+	 */
+	public String getText(Object element) {
+		String text = ((TreeItem) element).getName();
+		return text;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.
+	 * jface.viewers.ILabelProviderListener)
+	 */
+	public void addListener(ILabelProviderListener listener) {
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
+	 */
+	public void dispose() {
+		// Dispose images
+		if (groupImage != null) {
+			groupImage.dispose();
+		}
+		if (treeItemImage != null) {
+			treeItemImage.dispose();
+		}
+		if (stopTriggerItemImage != null) {
+			stopTriggerItemImage.dispose();
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang
+	 * .Object, java.lang.String)
+	 */
+	public boolean isLabelProperty(Object element, String property) {
+		return false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse
+	 * .jface.viewers.ILabelProviderListener)
+	 */
+	public void removeListener(ILabelProviderListener listener) {
+
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/TreeItemListener.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,31 @@
+/*
+ * 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:
+ *
+ * Tree Item Listener
+ *
+ */
+package com.nokia.traceviewer.dialog.treeitem;
+
+/**
+ * Tree Item Listener
+ * 
+ */
+public interface TreeItemListener {
+
+	/**
+	 * Model changed
+	 */
+	public void modelChanged();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/TriggerTreeBaseItem.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,75 @@
+/*
+ * 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:
+ *
+ * Trigger Tree Base item class
+ *
+ */
+package com.nokia.traceviewer.dialog.treeitem;
+
+/**
+ * Trigger Tree Base item class
+ */
+public class TriggerTreeBaseItem extends TreeItemImpl implements
+		TriggerTreeItem {
+
+	/**
+	 * Rule of the item
+	 */
+	private final Rule rule;
+
+	/**
+	 * Type of the trigger
+	 */
+	private final Type type;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param listener
+	 *            TreeItemListener
+	 * @param parent
+	 *            parent object
+	 * @param name
+	 *            name of the item
+	 * @param rule
+	 *            rule of the item
+	 * @param type
+	 *            type of the trigger
+	 */
+	public TriggerTreeBaseItem(TreeItemListener listener, Object parent,
+			String name, Rule rule, Type type) {
+		super(name, parent, listener, (rule == Rule.GROUP));
+		this.rule = rule;
+		this.type = type;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.TriggerTreeItem#getRule()
+	 */
+	public Rule getRule() {
+		return rule;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.dialog.TriggerTreeItem#getType()
+	 */
+	public Type getType() {
+		return type;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/TriggerTreeItem.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,77 @@
+/*
+ * 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:
+ *
+ * Trigger Tree item interface
+ *
+ */
+package com.nokia.traceviewer.dialog.treeitem;
+
+/**
+ * Trigger Tree item interface
+ * 
+ */
+public interface TriggerTreeItem extends TreeItem {
+
+	/**
+	 * Rule type for trigger items
+	 */
+	public enum Rule {
+
+		/**
+		 * Text rule
+		 */
+		TEXT_RULE,
+
+		/**
+		 * Group rule
+		 */
+		GROUP;
+	}
+
+	/**
+	 * Type of the trigger
+	 */
+	public enum Type {
+
+		/**
+		 * Start trigger
+		 */
+		STARTTRIGGER,
+
+		/**
+		 * Stop trigger
+		 */
+		STOPTRIGGER,
+
+		/**
+		 * Activation trigger
+		 */
+		ACTIVATIONTRIGGER;
+	}
+
+	/**
+	 * Gets the type of the rule
+	 * 
+	 * @return the rule
+	 */
+	public Rule getRule();
+
+	/**
+	 * Gets the type of the trigger
+	 * 
+	 * @return Type of the trigger
+	 */
+	public Type getType();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/TriggerTreeTextItem.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,135 @@
+/*
+ * 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:
+ *
+ * Trigger tree Text Item class
+ *
+ */
+package com.nokia.traceviewer.dialog.treeitem;
+
+/**
+ * Trigger tree Text Item class
+ * 
+ */
+public class TriggerTreeTextItem extends TriggerTreeBaseItem {
+
+	/**
+	 * Text of the item
+	 */
+	private final String text;
+
+	/**
+	 * Text to be compared
+	 */
+	private final String textToCompare;
+
+	/**
+	 * Indicates if the case should match in the item
+	 */
+	private final boolean matchCase;
+
+	/**
+	 * Configuration file path
+	 */
+	private String configurationFilePath = ""; //$NON-NLS-1$
+
+	/**
+	 * Configuration name
+	 */
+	private String configurationName = ""; //$NON-NLS-1$
+
+	/**
+	 * Constructor
+	 * 
+	 * @param listener
+	 *            TreeItemListener
+	 * @param parent
+	 *            parent object
+	 * @param name
+	 *            name of the item
+	 * @param rule
+	 *            rule of the item
+	 * @param text
+	 *            text of the item
+	 * @param matchCase
+	 *            match case indication of the item
+	 * @param type
+	 *            type of the trigger
+	 * @param configurationFilePath
+	 *            configuration file path
+	 * @param configurationName
+	 *            configuration name
+	 */
+	public TriggerTreeTextItem(TreeItemListener listener, Object parent,
+			String name, Rule rule, String text, boolean matchCase, Type type,
+			String configurationFilePath, String configurationName) {
+		super(listener, parent, name, rule, type);
+		this.text = text;
+		this.matchCase = matchCase;
+		this.configurationFilePath = configurationFilePath;
+		this.configurationName = configurationName;
+
+		// Save text to compare
+		if (matchCase || text == null) {
+			textToCompare = text;
+		} else {
+			textToCompare = text.toLowerCase();
+		}
+	}
+
+	/**
+	 * Gets match case status
+	 * 
+	 * @return the matchCase
+	 */
+	public boolean isMatchCase() {
+		return matchCase;
+	}
+
+	/**
+	 * Gets text
+	 * 
+	 * @return the text
+	 */
+	public String getText() {
+		return text;
+	}
+
+	/**
+	 * Gets text to compare
+	 * 
+	 * @return the text to compare
+	 */
+	public String getTextToCompare() {
+		return textToCompare;
+	}
+
+	/**
+	 * Gets configuration file path
+	 * 
+	 * @return configuration file path
+	 */
+	public String getConfigurationFilePath() {
+		return configurationFilePath;
+	}
+
+	/**
+	 * Gets configuration name
+	 * 
+	 * @return configuration name
+	 */
+	public String getConfigurationName() {
+		return configurationName;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/VariableTracingTreeBaseItem.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,99 @@
+/*
+ * 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:
+ *
+ * VariableTracing Tree Base item class
+ *
+ */
+package com.nokia.traceviewer.dialog.treeitem;
+
+/**
+ * VariableTracing Tree Base item class
+ */
+public class VariableTracingTreeBaseItem extends TreeItemImpl implements
+		VariableTracingTreeItem {
+
+	/**
+	 * Rule of the item
+	 */
+	private final Rule rule;
+
+	/**
+	 * Number of historyItems to save
+	 */
+	private final int historyCount;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param listener
+	 *            TreeItemListener
+	 * @param parent
+	 *            parent object
+	 * @param name
+	 *            name of the item
+	 * @param rule
+	 *            rule for the item
+	 * @param historyCount
+	 *            count for the item
+	 */
+	public VariableTracingTreeBaseItem(TreeItemListener listener,
+			Object parent, String name, Rule rule, int historyCount) {
+		super(name, parent, listener, (rule == Rule.GROUP));
+		this.rule = rule;
+		this.historyCount = historyCount;
+
+		// Always save at least 1
+		if (historyCount < 1) {
+			historyCount = 1;
+		}
+	}
+
+	/**
+	 * Constructor without history count
+	 * 
+	 * @param listener
+	 *            TreeItemListener
+	 * @param parent
+	 *            parent object
+	 * @param name
+	 *            name of the item
+	 * @param rule
+	 *            rule for the item
+	 */
+	public VariableTracingTreeBaseItem(TreeItemListener listener,
+			Object parent, String name, Rule rule) {
+		super(name, parent, listener, (rule == Rule.GROUP));
+		this.rule = rule;
+		this.historyCount = 1;
+	}
+
+	/**
+	 * Gets the type of the rule
+	 * 
+	 * @return the rule
+	 */
+	public Rule getRule() {
+		return rule;
+	}
+
+	/**
+	 * Gets history count
+	 * 
+	 * @return the historyCount
+	 */
+	public int getHistoryCount() {
+		return historyCount;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/VariableTracingTreeItem.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,48 @@
+/*
+ * 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:
+ *
+ * Variable Tracing Tree item interface
+ *
+ */
+package com.nokia.traceviewer.dialog.treeitem;
+
+/**
+ * Variable Tracing Tree item interface
+ */
+public interface VariableTracingTreeItem extends TreeItem {
+
+	/**
+	 * Rule type for variable tracing items
+	 */
+	public enum Rule {
+
+		/**
+		 * Text rule
+		 */
+		TEXT_RULE,
+
+		/**
+		 * Group rule
+		 */
+		GROUP;
+	}
+
+	/**
+	 * Gets the type of the rule
+	 * 
+	 * @return the rule
+	 */
+	public Rule getRule();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/dialog/treeitem/VariableTracingTreeTextItem.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,79 @@
+/*
+ * 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:
+ *
+ * Variable Tracing tree Text Item class
+ *
+ */
+package com.nokia.traceviewer.dialog.treeitem;
+
+/**
+ * Variable Tracing tree Text Item class
+ */
+public class VariableTracingTreeTextItem extends VariableTracingTreeBaseItem {
+
+	/**
+	 * Text of the item
+	 */
+	private final String text;
+
+	/**
+	 * Indicates if the item is case sensitive
+	 */
+	private final boolean matchCase;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param listener
+	 *            TreeItemListener
+	 * @param parent
+	 *            Parent object
+	 * @param name
+	 *            Name of the rule
+	 * @param rule
+	 *            Rule type
+	 * @param text
+	 *            Text of the item
+	 * @param matchCase
+	 *            match case boolean
+	 * @param historyCount
+	 *            history count
+	 */
+	public VariableTracingTreeTextItem(TreeItemListener listener,
+			Object parent, String name, Rule rule, String text,
+			boolean matchCase, int historyCount) {
+		super(listener, parent, name, rule, historyCount);
+		this.text = text;
+		this.matchCase = matchCase;
+	}
+
+	/**
+	 * Gets match case status
+	 * 
+	 * @return the matchCase
+	 */
+	public boolean isMatchCase() {
+		return matchCase;
+	}
+
+	/**
+	 * Gets text
+	 * 
+	 * @return the text
+	 */
+	public String getText() {
+		return text;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/BTraceConstants.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,96 @@
+/*
+ * 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:
+ *
+ * TraceViewer Constants
+ *
+ */
+package com.nokia.traceviewer.engine;
+
+/**
+ * BTrace Constants
+ */
+public interface BTraceConstants {
+
+	/**
+	 * Header 2 present bit
+	 */
+	static final int HEADER2_PRESENT_BIT = 0;
+
+	/**
+	 * Timestamp present bit
+	 */
+	static final int TIMESTAMP_PRESENT_BIT = 1;
+
+	/**
+	 * Timestamp2 present bit
+	 */
+	static final int TIMESTAMP2_PRESENT_BIT = 2;
+
+	/**
+	 * Context ID present bit
+	 */
+	static final int CONTEXT_ID_PRESENT_BIT = 3;
+
+	/**
+	 * Program counter present bit
+	 */
+	static final int PROGRAM_COUNTER_PRESENT_BIT = 4;
+
+	/**
+	 * Extra value present bit
+	 */
+	static final int EXTRA_VALUE_PRESENT_BIT = 5;
+
+	/**
+	 * Record truncated bit
+	 */
+	static final int RECORD_TRUNCATED_BIT = 6;
+
+	/**
+	 * Record missing bit
+	 */
+	static final int RECORD_MISSING_BIT = 7;
+
+	/**
+	 * Length of a single variable
+	 */
+	static final int BTRACE_VARIABLE_LENGTH = 4;
+
+	/**
+	 * Length of BTrace header
+	 */
+	static final int BTRACE_HEADER_LENGTH = 4;
+
+	/**
+	 * Number of flags
+	 */
+	static final int FLAGS_LENGTH = 8;
+
+	/**
+	 * Mask to get CPU ID from BTrace Header 2
+	 */
+	static final int CPU_ID_MASK = 0xfff << 20;
+
+	/**
+	 * Shift to get CPU ID from BTrace Header 2
+	 */
+	static final int CPU_ID_SHIFT = 20;
+
+	/**
+	 * Mask to get MultiPart ID from BTrace Header 2
+	 */
+	static final int MULTIPART_MASK = 3 << 0;
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/BTraceInformation.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,519 @@
+/*
+ * 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:
+ *
+ * BTrace information contains BTrace variables
+ *
+ */
+package com.nokia.traceviewer.engine;
+
+/**
+ * BTrace information contains BTrace variables
+ */
+public class BTraceInformation {
+
+	/**
+	 * Size of the record in bytes. (Maximum value is KMaxBTraceRecordSize.)
+	 */
+	private byte recordSize;
+
+	/**
+	 * Flags.
+	 */
+	private byte flags;
+
+	/**
+	 * Category. Category value from enum BTrace::TCategory.
+	 */
+	private byte category;
+
+	/**
+	 * Sub-category. The meaning of this is dependant on the value of Category.
+	 */
+	private byte subCategory;
+
+	/**
+	 * Tells if the trace has header 2 present
+	 */
+	private boolean header2Present;
+
+	/**
+	 * Tells if the trace has BTrace timestamp present
+	 */
+	private boolean timestampPresent;
+
+	/**
+	 * Tells if the trace has BTrace timestamp 2 present
+	 */
+	private boolean timestamp2Present;
+
+	/**
+	 * Tells if the trace has Context ID (Thread ID) present
+	 */
+	private boolean contextIdPresent;
+
+	/**
+	 * Tells if the trace has Program counter present
+	 */
+	private boolean programCounterPresent;
+
+	/**
+	 * Tells if the trace has BTrace Extra field present
+	 */
+	private boolean extraPresent;
+
+	/**
+	 * Trace data for this record was truncated to keep the size within the
+	 * maximum permissible
+	 */
+	private boolean traceTruncated;
+
+	/**
+	 * Indicates that trace record(s) before this one are missing. This can
+	 * happen if the trace buffer was full when a trace output was attempted
+	 */
+	private boolean traceMissing;
+
+	/**
+	 * Tells if the trace is multipart trace. 0 = non multipart, 1 = First part,
+	 * 2 = Middle part, 3 = Last part
+	 */
+	private int multiPartTrace;
+
+	/**
+	 * Contains multipart trace parts
+	 */
+	private MultiPartItem multiPartItem;
+
+	/**
+	 * CPU ID
+	 */
+	private int cpuId = -1;
+
+	/**
+	 * Timestamp value
+	 */
+	private int timestamp;
+
+	/**
+	 * Timestamp2 value
+	 */
+	private int timestamp2;
+
+	/**
+	 * Context ID
+	 */
+	private int contextId;
+
+	/**
+	 * Program counter value
+	 */
+	private int programCounter;
+
+	/**
+	 * Extra value
+	 */
+	private int extraValue;
+
+	/**
+	 * Sets record size
+	 * 
+	 * @param size
+	 *            record size
+	 */
+	public void setRecordSize(byte size) {
+		this.recordSize = size;
+	}
+
+	/**
+	 * Gets this records size
+	 * 
+	 * @return record size
+	 */
+	public byte getRecordSize() {
+		return recordSize;
+	}
+
+	/**
+	 * Sets record flags
+	 * 
+	 * @param flags
+	 *            the flags
+	 */
+	public void setFlags(byte flags) {
+		this.flags = flags;
+	}
+
+	/**
+	 * Gets this records flags
+	 * 
+	 * @return flags
+	 */
+	public byte getFlags() {
+		return flags;
+	}
+
+	/**
+	 * Sets record category
+	 * 
+	 * @param category
+	 *            the category
+	 */
+	public void setCategory(byte category) {
+		this.category = category;
+	}
+
+	/**
+	 * Gets this records category
+	 * 
+	 * @return category
+	 */
+	public byte getCategory() {
+		return category;
+	}
+
+	/**
+	 * Sets record sub-category
+	 * 
+	 * @param subCategory
+	 *            the sub category
+	 */
+	public void setSubCategory(byte subCategory) {
+		this.subCategory = subCategory;
+	}
+
+	/**
+	 * Gets this records sub-category
+	 * 
+	 * @return sub Category
+	 */
+	public byte getSubCategory() {
+		return subCategory;
+	}
+
+	/**
+	 * Sets header2 present
+	 * 
+	 * @param present
+	 *            new value of header2 present
+	 */
+	public void setHeader2Present(boolean present) {
+		this.header2Present = present;
+	}
+
+	/**
+	 * Tells if header2 is present
+	 * 
+	 * @return true if header2 is present, false otherwise
+	 */
+	public boolean isHeader2Present() {
+		return header2Present;
+	}
+
+	/**
+	 * Sets timestamp present
+	 * 
+	 * @param present
+	 *            new value of timestamp present
+	 */
+	public void setTimestampPresent(boolean present) {
+		this.timestampPresent = present;
+	}
+
+	/**
+	 * Tells if timestamp is present
+	 * 
+	 * @return true if timestamp is present, false otherwise
+	 */
+	public boolean isTimestampPresent() {
+		return timestampPresent;
+	}
+
+	/**
+	 * Sets timestamp2 present
+	 * 
+	 * @param present
+	 *            new value of timestamp2 present
+	 */
+	public void setTimestamp2Present(boolean present) {
+		this.timestamp2Present = present;
+	}
+
+	/**
+	 * Tells if timestamp2 is present
+	 * 
+	 * @return true if timestamp2 is present, false otherwise
+	 */
+	public boolean isTimestamp2Present() {
+		return timestamp2Present;
+	}
+
+	/**
+	 * Sets context ID present
+	 * 
+	 * @param present
+	 *            new value of context ID present
+	 */
+	public void setContextIdPresent(boolean present) {
+		this.contextIdPresent = present;
+	}
+
+	/**
+	 * Tells if context ID is present
+	 * 
+	 * @return true if context ID is present, false otherwise
+	 */
+	public boolean isContextIdPresent() {
+		return contextIdPresent;
+	}
+
+	/**
+	 * Sets program counter present
+	 * 
+	 * @param present
+	 *            new value of program counter present
+	 */
+	public void setProgramCounterPresent(boolean present) {
+		this.programCounterPresent = present;
+	}
+
+	/**
+	 * Tells if program counter is present
+	 * 
+	 * @return true if program counter is present, false otherwise
+	 */
+	public boolean isProgramCounterPresent() {
+		return programCounterPresent;
+	}
+
+	/**
+	 * Sets extra value present
+	 * 
+	 * @param present
+	 *            new value of extra value present
+	 */
+	public void setExtraValuePresent(boolean present) {
+		this.extraPresent = present;
+	}
+
+	/**
+	 * Tells if extra value is present
+	 * 
+	 * @return true if extra value is present, false otherwise
+	 */
+	public boolean isExtraValuePresent() {
+		return extraPresent;
+	}
+
+	/**
+	 * Gets the CPU ID
+	 * 
+	 * @return the CPU Id
+	 */
+	public int getCpuId() {
+		return cpuId;
+	}
+
+	/**
+	 * Sets the CPU ID
+	 * 
+	 * @param cpuId
+	 *            the cpuId to set
+	 */
+	public void setCpuId(int cpuId) {
+		this.cpuId = cpuId;
+	}
+
+	/**
+	 * Gets the timestamp value
+	 * 
+	 * @return the timestamp value
+	 */
+	public int getTimestamp() {
+		return timestamp;
+	}
+
+	/**
+	 * Sets the timestamp value
+	 * 
+	 * @param timestamp
+	 *            timestamp value
+	 */
+	public void setTimestamp(int timestamp) {
+		this.timestamp = timestamp;
+	}
+
+	/**
+	 * Gets the timestamp2 value
+	 * 
+	 * @return the timestamp2 value
+	 */
+	public int getTimestamp2() {
+		return timestamp2;
+	}
+
+	/**
+	 * Sets the timestamp2 value
+	 * 
+	 * @param timestamp2
+	 *            timestamp2 value
+	 */
+	public void setTimestamp2(int timestamp2) {
+		this.timestamp2 = timestamp2;
+	}
+
+	/**
+	 * Gets the thread ID
+	 * 
+	 * @return the thread Id
+	 */
+	public int getThreadId() {
+		return contextId;
+	}
+
+	/**
+	 * Sets the Thread ID
+	 * 
+	 * @param threadId
+	 *            the threadId to set
+	 */
+	public void setThreadId(int threadId) {
+		this.contextId = threadId;
+	}
+
+	/**
+	 * Gets the program counter
+	 * 
+	 * @return the program counter
+	 */
+	public int getProgramCounter() {
+		return programCounter;
+	}
+
+	/**
+	 * Sets the program counter
+	 * 
+	 * @param programCounter
+	 *            the program counter to set
+	 */
+	public void setProgramCounter(int programCounter) {
+		this.programCounter = programCounter;
+	}
+
+	/**
+	 * Gets the extra value
+	 * 
+	 * @return the extra value
+	 */
+	public int getExtraValue() {
+		return extraValue;
+	}
+
+	/**
+	 * Sets the extra value
+	 * 
+	 * @param extraValue
+	 *            the extra value to set
+	 */
+	public void setExtraValue(int extraValue) {
+		this.extraValue = extraValue;
+	}
+
+	/**
+	 * Sets the multipart value
+	 * 
+	 * @param multiPartTrace
+	 *            the multiPart value to set
+	 */
+	public void setMultiPart(int multiPartTrace) {
+		this.multiPartTrace = multiPartTrace;
+	}
+
+	/**
+	 * Tells if the trace is multipart trace
+	 * 
+	 * @return 0 = non multipart, 1 = First part, 2 = Middle part, 3 = Last part
+	 */
+	public int getMultiPart() {
+		return multiPartTrace;
+	}
+
+	/**
+	 * Sets the multipart trace parts
+	 * 
+	 * @param multiPartItem
+	 *            the multiPart item
+	 */
+	public void setMultiPartTraceParts(MultiPartItem multiPartItem) {
+		this.multiPartItem = multiPartItem;
+	}
+
+	/**
+	 * Gets the multipart trace parts
+	 * 
+	 * @return multipart trace parts
+	 */
+	public MultiPartItem getMultiPartTraceParts() {
+		return multiPartItem;
+	}
+
+	/**
+	 * Sets the truncated value
+	 * 
+	 * @param truncated
+	 *            the truncated value to set
+	 */
+	public void setTruncated(boolean truncated) {
+		this.traceTruncated = truncated;
+	}
+
+	/**
+	 * Tells if the trace is truncated trace
+	 * 
+	 * @return true if trace is truncated, false otherwise
+	 */
+	public boolean isTruncated() {
+		return traceTruncated;
+	}
+
+	/**
+	 * Sets the trace missing value
+	 * 
+	 * @param missing
+	 *            the missing value to set
+	 */
+	public void setTraceMissing(boolean missing) {
+		this.traceMissing = missing;
+	}
+
+	/**
+	 * Tells if the trace before this one is missing
+	 * 
+	 * @return true if trace before this one is missing, false otherwise
+	 */
+	public boolean isTraceMissing() {
+		return traceMissing;
+	}
+
+	/**
+	 * Indicates if this trace has BTrace information that needs to be displayed
+	 * in it (meaning Thread ID and CPU ID at this time)
+	 * 
+	 * @return true if there is BTrace information that needs to be displayed in
+	 *         this trace
+	 */
+	public boolean hasInformation() {
+		return (contextId != 0 || cpuId != -1);
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/BaseDataReader.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,485 @@
+/*
+ * 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:
+ *
+ * Base DataReader class
+ *
+ */
+package com.nokia.traceviewer.engine;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.nio.ByteBuffer;
+import java.nio.channels.FileChannel;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * Base DataReader class
+ */
+public abstract class BaseDataReader extends Thread implements DataReader,
+		TraceViewerConst, BTraceConstants {
+
+	/**
+	 * Sleeping time
+	 */
+	protected static final int SLEEP_TIME = 200;
+
+	/**
+	 * Pause waiting time
+	 */
+	protected static final int PAUSE_TIME = 300;
+
+	/**
+	 * Trace configuration to be used in this Reader
+	 */
+	protected TraceConfiguration traceConfiguration;
+
+	/**
+	 * Trace properties, passed to MediaCallback
+	 */
+	protected TraceProperties trace;
+
+	/**
+	 * Data source
+	 */
+	protected FileChannel sourceChannel;
+
+	/**
+	 * Buffer for data received from data source
+	 */
+	protected ByteBuffer receiveBuffer;
+
+	/**
+	 * Media processor
+	 */
+	protected MediaCallback mediaCallback;
+
+	/**
+	 * File path from where to read
+	 */
+	protected String filePath;
+
+	/**
+	 * Random access file we use to read the binary
+	 */
+	protected RandomAccessFile readFile;
+
+	/**
+	 * Filemap that hold the trace block positions
+	 */
+	protected FileMap fileMap;
+
+	/**
+	 * Trace count in this file
+	 */
+	protected int traceCount;
+
+	/**
+	 * File start offset
+	 */
+	protected long fileStartOffset;
+
+	/**
+	 * Multipart trace array
+	 */
+	protected static Map<Integer, MultiPartItem> multiPartTraceArray;
+
+	/**
+	 * Constructor
+	 */
+	public BaseDataReader() {
+		fileMap = new FileMap();
+	}
+
+	/**
+	 * Creates file channel
+	 */
+	protected void createFileChannel() {
+		try {
+			if (readFile != null) {
+				// Close previous file channel
+				readFile.close();
+			}
+			readFile = new RandomAccessFile(filePath, "r"); //$NON-NLS-1$
+		} catch (FileNotFoundException e) {
+			e.printStackTrace();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		if (readFile != null) {
+			sourceChannel = readFile.getChannel();
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.DataReader#getFilePath()
+	 */
+	public String getFilePath() {
+		return filePath;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.DataReader#setFilePath(java.lang.String)
+	 */
+	public void setFilePath(String filePath) {
+		this.filePath = filePath;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.DataReader#setFileStartOffset(long)
+	 */
+	public void setFileStartOffset(long fileStartOffset) {
+		this.fileStartOffset = fileStartOffset;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.DataReader#getFileStartOffset()
+	 */
+	public long getFileStartOffset() {
+		return fileStartOffset;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.DataReader#getFileMap()
+	 */
+	public FileMap getFileMap() {
+		return fileMap;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.DataReader#clearFile()
+	 */
+	public void clearFile() {
+		fileMap.clearMap();
+		traceCount = 0;
+		fileStartOffset = 0;
+		if (readFile != null) {
+			createFileChannel();
+
+			// Set everything to zero
+			setFilePosition(0);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.DataReader#getTraceCount()
+	 */
+	public int getTraceCount() {
+		return traceCount;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.DataReader#createScrollReader(com.nokia.
+	 * traceviewer.engine.MediaCallback,
+	 * com.nokia.traceviewer.engine.TraceConfiguration)
+	 */
+	public DataScrollReader createScrollReader(MediaCallback mediaCallback,
+			TraceConfiguration conf) {
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.DataReader#getTraceConfiguration()
+	 */
+	public TraceConfiguration getTraceConfiguration() {
+		return traceConfiguration;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.DataReader#setFilePosition(long)
+	 */
+	public void setFilePosition(long filePos) {
+		try {
+			if (readFile != null) {
+				readFile.seek(filePos);
+			}
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+	}
+
+	/**
+	 * Parses BTrace variables
+	 * 
+	 * @param buf
+	 *            buffer where the data is located
+	 * @param bTraceHeaderOffset
+	 *            BTrace header offset
+	 * @param trace
+	 *            trace where the variables are inserted
+	 */
+	protected void parseBTraceVariables(ByteBuffer buf, int bTraceHeaderOffset,
+			TraceProperties trace) {
+		int variablesFound = 0;
+
+		// Get BTrace header bytes
+		byte recordSize = buf.get(bTraceHeaderOffset);
+		byte flags = buf.get(bTraceHeaderOffset + 1);
+		byte category = buf.get(bTraceHeaderOffset + 2);
+		byte subCategory = buf.get(bTraceHeaderOffset + 3);
+
+		// Set BTrace header bytes
+		trace.bTraceInformation.setRecordSize(recordSize);
+		trace.bTraceInformation.setFlags(flags);
+		trace.bTraceInformation.setCategory(category);
+		trace.bTraceInformation.setSubCategory(subCategory);
+
+		// Loop through flags
+		for (int i = 0; i < FLAGS_LENGTH; i++) {
+			if ((flags & (1 << i)) != 0) {
+
+				switch (i) {
+
+				// Header2 present (bit number 0)
+				case HEADER2_PRESENT_BIT:
+					trace.bTraceInformation.setHeader2Present(true);
+
+					// CPU Id
+					int cpuId = buf.getInt(bTraceHeaderOffset
+							+ BTRACE_HEADER_LENGTH);
+					cpuId = Integer.reverseBytes(cpuId);
+					cpuId = (cpuId & CPU_ID_MASK) >> CPU_ID_SHIFT;
+					trace.bTraceInformation.setCpuId(cpuId);
+
+					// Multipart trace
+					int multipart = 0;
+					multipart |= buf.getInt(bTraceHeaderOffset
+							+ BTRACE_HEADER_LENGTH);
+					multipart = Integer.reverseBytes(multipart);
+					multipart = multipart & MULTIPART_MASK;
+					trace.bTraceInformation.setMultiPart(multipart);
+					break;
+
+				// Timestamp present (bit number 1)
+				case TIMESTAMP_PRESENT_BIT:
+					int timestamp = buf.getInt(bTraceHeaderOffset
+							+ BTRACE_HEADER_LENGTH
+							+ (variablesFound * BTRACE_VARIABLE_LENGTH));
+
+					timestamp = Integer.reverseBytes(timestamp);
+					trace.bTraceInformation.setTimestampPresent(true);
+					trace.bTraceInformation.setTimestamp(timestamp);
+					break;
+
+				// Timestamp2 present (bit number 2)
+				case TIMESTAMP2_PRESENT_BIT:
+					int timestamp2 = buf.getInt(bTraceHeaderOffset
+							+ BTRACE_HEADER_LENGTH
+							+ (variablesFound * BTRACE_VARIABLE_LENGTH));
+
+					timestamp2 = Integer.reverseBytes(timestamp2);
+					trace.bTraceInformation.setTimestamp2Present(true);
+					trace.bTraceInformation.setTimestamp2(timestamp2);
+					break;
+
+				// Context ID present (bit number 3)
+				case CONTEXT_ID_PRESENT_BIT:
+					int contextId = buf.getInt(bTraceHeaderOffset
+							+ BTRACE_HEADER_LENGTH
+							+ (variablesFound * BTRACE_VARIABLE_LENGTH));
+
+					contextId = Integer.reverseBytes(contextId);
+					trace.bTraceInformation.setContextIdPresent(true);
+					trace.bTraceInformation.setThreadId(contextId);
+					break;
+
+				// Program counter present (bit number 4)
+				case PROGRAM_COUNTER_PRESENT_BIT:
+					int programCounter = buf.getInt(bTraceHeaderOffset
+							+ BTRACE_HEADER_LENGTH
+							+ (variablesFound * BTRACE_VARIABLE_LENGTH));
+
+					programCounter = Integer.reverseBytes(programCounter);
+					trace.bTraceInformation.setProgramCounterPresent(true);
+					trace.bTraceInformation.setProgramCounter(programCounter);
+					break;
+
+				// Extra value present (bit number 5)
+				case EXTRA_VALUE_PRESENT_BIT:
+					int extraValue = buf.getInt(bTraceHeaderOffset
+							+ BTRACE_HEADER_LENGTH
+							+ (variablesFound * BTRACE_VARIABLE_LENGTH));
+
+					extraValue = Integer.reverseBytes(extraValue);
+					trace.bTraceInformation.setExtraValuePresent(true);
+					trace.bTraceInformation.setExtraValue(extraValue);
+					break;
+
+				// Record truncated (bit number 6)
+				case RECORD_TRUNCATED_BIT:
+					trace.bTraceInformation.setTruncated(true);
+					variablesFound--;
+					break;
+
+				// Record missing (bit number 7)
+				case RECORD_MISSING_BIT:
+					trace.bTraceInformation.setTraceMissing(true);
+					variablesFound--;
+					break;
+				}
+
+				// Add variable count for each found flag
+				variablesFound++;
+			}
+		}
+
+		// Data starts after BTrace header + possible variables
+		trace.dataStart = bTraceHeaderOffset + BTRACE_HEADER_LENGTH
+				+ (variablesFound * BTRACE_VARIABLE_LENGTH);
+
+		// Get length of the BTrace data
+		int btraceDataLength = buf.get(bTraceHeaderOffset) & BYTE_MASK;
+
+		// If length is FF, use the length from header instead
+		if (btraceDataLength == BYTE_MASK) {
+			trace.dataLength = trace.messageLength
+					- (trace.dataStart - trace.messageStart);
+		} else {
+			trace.dataLength = btraceDataLength
+					- ((variablesFound + 1) * BTRACE_VARIABLE_LENGTH);
+		}
+	}
+
+	/**
+	 * Handles multipart trace
+	 * 
+	 * @param trace
+	 *            trace properties
+	 * @param multiPartValue
+	 *            multi part value
+	 * @param bTraceHeaderOffset
+	 *            BTrace header offset
+	 * @return true if trace should be given to DataProcessors
+	 */
+	protected boolean handleMultiPart(TraceProperties trace,
+			int multiPartValue, int bTraceHeaderOffset) {
+		boolean valid = true;
+		if (multiPartTraceArray == null) {
+			multiPartTraceArray = Collections
+					.synchronizedMap(new HashMap<Integer, MultiPartItem>());
+		}
+
+		Integer key = Integer.valueOf(trace.bTraceInformation.getExtraValue());
+		MultiPartItem item = multiPartTraceArray.get(key);
+
+		// First or middle part
+		if (multiPartValue == 1 || multiPartValue == 2) {
+			valid = false;
+
+			// Add trace to array
+			if (item == null) {
+				MultiPartItem newItem = new MultiPartItem();
+				newItem.addPart(trace, false);
+				multiPartTraceArray.put(key, newItem);
+
+				// Don't add parts if trace is already completed
+			} else if (!item.isCompleted()) {
+				item.addPart(trace, false);
+			}
+
+			// Last part
+		} else if (multiPartValue == 3 && item != null) {
+			if (!item.isCompleted()) {
+				item.addPart(trace, true);
+				item.setCompleted(true);
+			}
+
+			// Create byte array
+			int totalMessageLength = item.getTotalMessageLength();
+			byte byteArr[] = new byte[totalMessageLength];
+
+			// First copy the header from the last trace part
+			int initialHeaderSize = trace.dataStart - trace.messageStart;
+			trace.byteBuffer.position(trace.messageStart);
+			trace.byteBuffer.get(byteArr, 0, initialHeaderSize);
+
+			// Then the old data
+			Iterator<Integer> headerLenIterator = item
+					.getTracePartHeaderSizes().iterator();
+			Iterator<byte[]> byteIterator = item.getTraceParts().iterator();
+			int startOffset = initialHeaderSize;
+
+			// Copy all the stuff from parts
+			while (headerLenIterator.hasNext()) {
+				int headerLen = headerLenIterator.next().intValue();
+				byte[] partBytes = byteIterator.next();
+				System.arraycopy(partBytes, headerLen, byteArr, startOffset,
+						partBytes.length - headerLen);
+				startOffset += (partBytes.length - headerLen);
+			}
+
+			// Set multipart item to the trace
+			trace.bTraceInformation.setMultiPartTraceParts(item);
+
+			// Set record size
+			int recordSize = totalMessageLength;
+			if (recordSize > 0xFF) {
+				recordSize = 0xFF;
+			}
+			bTraceHeaderOffset -= trace.messageStart;
+			byteArr[bTraceHeaderOffset] = (byte) recordSize;
+			trace.bTraceInformation.setRecordSize((byte) recordSize);
+
+			// Remove multipart info from BTrace header
+			int bTraceHeader2Offset = bTraceHeaderOffset + BTRACE_HEADER_LENGTH;
+			byteArr[bTraceHeader2Offset] &= ~MULTIPART_MASK;
+
+			// Set protocol specific stuff to multi part trace
+			byteArr = setProtocolSpecificStuffToMultiPartTrace(byteArr, trace);
+
+			trace.byteBuffer = ByteBuffer.wrap(byteArr);
+		}
+
+		return valid;
+	}
+
+	/**
+	 * Sets protocol specific stuff to multi part trace
+	 * 
+	 * @param byteArr
+	 *            byte array containing the multi part trace
+	 * @param trace
+	 *            Trace properties
+	 * @return byte array containing the trace after procotol specific stuff is
+	 *         added
+	 */
+	protected abstract byte[] setProtocolSpecificStuffToMultiPartTrace(
+			byte[] byteArr, TraceProperties trace);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/Connection.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,75 @@
+/*
+ * 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:
+ *
+ * Connection interface
+ *
+ */
+package com.nokia.traceviewer.engine;
+
+/**
+ * Connection interface
+ */
+public interface Connection {
+
+	/**
+	 * Connect to media
+	 * 
+	 * @return true if connection succeeded, false otherwise
+	 */
+	public boolean connect();
+
+	/**
+	 * Creates a connection for given connection type. Types are taken from
+	 * com.nokia.traceviewer.engine.preferences.PreferenceConstants.java
+	 * 
+	 * @param connectionType
+	 *            connection type from
+	 *            com.nokia.traceviewer.engine.preferences.PreferenceConstants
+	 *            .java
+	 * @param parameters
+	 *            connection parameters. When using TCP connection, parameters
+	 *            are IP address, port number and channel number in this order.
+	 *            When using USB serial connection, the only parameter is the
+	 *            COM port number.
+	 * @param filePath
+	 *            file path where the binary file is created
+	 * @return true if connection was succesfully created, false otherwise
+	 */
+	public boolean createConnection(String connectionType, String[] parameters,
+			String filePath);
+
+	/**
+	 * Disconnect from media
+	 * 
+	 * @return true if disconnect succeeded, false otherwise
+	 */
+	public boolean disconnect();
+
+	/**
+	 * Indicates the status of the connection
+	 * 
+	 * @return true if connection is up, false otherwise
+	 */
+	public boolean isConnected();
+
+	/**
+	 * Writes message to connection
+	 * 
+	 * @param byteArray
+	 *            byte array containing data
+	 * @return true if writing succeeded, false otherwise
+	 */
+	public boolean write(byte[] byteArray);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/ConnectionChangedListener.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,195 @@
+/*
+ * 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:
+ *
+ * Connection changed listener
+ *
+ */
+package com.nokia.traceviewer.engine;
+
+import java.util.Collection;
+
+import org.eclipse.swt.widgets.Display;
+
+import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator;
+import com.nokia.carbide.remoteconnections.interfaces.IConnection;
+import com.nokia.carbide.remoteconnections.interfaces.IConnectionTypeProvider;
+import com.nokia.carbide.remoteconnections.interfaces.IService;
+import com.nokia.carbide.remoteconnections.interfaces.IConnectionsManager.IConnectionListener;
+import com.nokia.carbide.remoteconnections.internal.api.IConnection2;
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.action.ConnectAction;
+import com.nokia.traceviewer.engine.preferences.PreferenceConstants;
+import com.nokia.traceviewer.internal.api.TraceViewerAPI2Impl;
+
+/**
+ * Connection changed listener
+ */
+class ConnectionChangedListener implements IConnectionListener {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @seecom.nokia.carbide.remoteconnections.interfaces.IConnectionsManager.
+	 * IConnectionListener
+	 * #connectionAdded(com.nokia.carbide.remoteconnections.interfaces
+	 * .IConnection)
+	 */
+	public void connectionAdded(IConnection arg0) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @seecom.nokia.carbide.remoteconnections.interfaces.IConnectionsManager.
+	 * IConnectionListener
+	 * #connectionRemoved(com.nokia.carbide.remoteconnections.
+	 * interfaces.IConnection)
+	 */
+	public void connectionRemoved(IConnection arg0) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @seecom.nokia.carbide.remoteconnections.interfaces.IConnectionsManager.
+	 * IConnectionListener
+	 * #currentConnectionSet(com.nokia.carbide.remoteconnections
+	 * .interfaces.IConnection)
+	 */
+	public void currentConnectionSet(IConnection newConnection) {
+		if (ConnectionHelper.isCurrentConnectionSelected
+				&& newConnection != null
+				&& supportsTracingService(newConnection)) {
+
+			// Save new settings
+			if (TraceViewerGlobals.getTraceViewer().getConnection() == null
+					|| !TraceViewerGlobals.getTraceViewer().getConnection()
+							.isConnected()) {
+				saveNewSettings();
+
+				// Notify about connection preferences changed to listeners
+				TraceViewerAPI2Impl.notifyConnPrefsChanged(newConnection);
+
+				// If auto connect is on
+				if (TraceViewerPlugin
+						.getDefault()
+						.getPreferenceStore()
+						.getBoolean(
+								PreferenceConstants.AUTO_CONNECT_DYNAMIC_CONNECTIONS_CHECKBOX)) {
+
+					// IConnection2 object, dynamic connection and TraceViewer
+					// view exists
+					if (newConnection instanceof IConnection2) {
+						if (((IConnection2) newConnection).isDynamic()
+								&& TraceViewerGlobals.getTraceViewer()
+										.getView() != null) {
+							connect();
+						}
+					}
+				}
+			}
+		}
+	}
+
+	/**
+	 * Saves new settings
+	 */
+	private void saveNewSettings() {
+		// Change connect tooltip
+		final ConnectAction action = (ConnectAction) TraceViewerGlobals
+				.getTraceViewer().getView().getActionFactory()
+				.getConnectAction();
+
+		// UI thread
+		if (Display.getCurrent() != null) {
+			ConnectionHelper.saveConnectionSettingsToPreferenceStore(true);
+			action.changeConnectToolTip();
+
+			// Not in UI thread, sync
+		} else {
+			Display.getDefault().syncExec(new Runnable() {
+
+				/*
+				 * (non-Javadoc)
+				 * 
+				 * @see java.lang.Runnable#run()
+				 */
+				public void run() {
+					ConnectionHelper
+							.saveConnectionSettingsToPreferenceStore(true);
+					action.changeConnectToolTip();
+				}
+
+			});
+		}
+
+	}
+
+	/**
+	 * Connects
+	 */
+	private void connect() {
+
+		// Change connect tooltip
+		final ConnectAction action = (ConnectAction) TraceViewerGlobals
+				.getTraceViewer().getView().getActionFactory()
+				.getConnectAction();
+
+		// UI thread
+		if (Display.getCurrent() != null) {
+			action.run();
+
+			// Not in UI thread, sync
+		} else {
+			Display.getDefault().syncExec(new Runnable() {
+
+				/*
+				 * (non-Javadoc)
+				 * 
+				 * @see java.lang.Runnable#run()
+				 */
+				public void run() {
+					action.run();
+				}
+
+			});
+		}
+	}
+
+	/**
+	 * Checks if the connection supports tracing service
+	 * 
+	 * @param connection
+	 *            connection
+	 * @return true if the connection supports tracing service
+	 */
+	private boolean supportsTracingService(IConnection connection) {
+		boolean supports = false;
+		IConnectionTypeProvider provider = RemoteConnectionsActivator
+				.getConnectionTypeProvider();
+		Collection<IService> services = provider
+				.getCompatibleServices(connection.getConnectionType());
+		for (IService service : services) {
+			if (service.getIdentifier().equals(
+					"com.nokia.carbide.trk.support.service.TracingService")) { //$NON-NLS-1$	
+				supports = true;
+				break;
+			}
+		}
+
+		return supports;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/ConnectionCreator.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,135 @@
+/*
+ * 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:
+ *
+ * Connection Creator based on preferences
+ *
+ */
+package com.nokia.traceviewer.engine;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.engine.preferences.PreferenceConstants;
+
+/**
+ * Creates and returns a connection based on preferences
+ * 
+ */
+public final class ConnectionCreator {
+
+	/**
+	 * Trace file path
+	 */
+	private final String traceFilePath;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param traceFilePath
+	 *            trace file path
+	 */
+	public ConnectionCreator(String traceFilePath) {
+		this.traceFilePath = traceFilePath;
+	}
+
+	/**
+	 * Creates and returns a connection
+	 * 
+	 * @return created connection
+	 */
+	public Connection getConnection() {
+		Connection connection = null;
+		IPreferenceStore store = TraceViewerPlugin.getDefault()
+				.getPreferenceStore();
+
+		// TCP connection
+		if (store.getString(PreferenceConstants.CONNECTION_TYPE).equals(
+				PreferenceConstants.CONNECTION_TYPE_TCPIP)) {
+
+			connection = createTcpConnection(store);
+
+			// USB Serial connection
+		} else if (store.getString(PreferenceConstants.CONNECTION_TYPE).equals(
+				PreferenceConstants.CONNECTION_TYPE_USB_SERIAL)) {
+			connection = createUsbSerialConnection(store);
+		}
+
+		return connection;
+	}
+
+	/**
+	 * Creates TCP connection
+	 * 
+	 * @param store
+	 *            preference store
+	 * @return created connection
+	 */
+	private Connection createTcpConnection(IPreferenceStore store) {
+		Connection connection;
+
+		// Close the old file from file handler
+		TraceViewerGlobals.getTraceViewer().getFileHandler().closeFile();
+
+		// Set parameters to array
+		String[] parameters = new String[3];
+		parameters[0] = store.getString(PreferenceConstants.IP_ADDRESS);
+		parameters[1] = store.getString(PreferenceConstants.TCPIP_PORT);
+		parameters[2] = store.getString(PreferenceConstants.TCPIP_CHANNEL);
+
+		// Create connection
+		connection = TraceViewerGlobals.getTraceProvider()
+				.getConnectionHandler();
+		connection.createConnection(PreferenceConstants.CONNECTION_TYPE_TCPIP,
+				parameters, traceFilePath);
+
+		// Set TCF connection as file handler
+		TraceViewerGlobals.getTraceViewer().setFileHandler(
+				(TraceFileHandler) connection);
+
+		return connection;
+	}
+
+	/**
+	 * Creates Serial connection
+	 * 
+	 * @param store
+	 *            preference store
+	 * @return created connection
+	 */
+	private Connection createUsbSerialConnection(IPreferenceStore store) {
+		Connection connection = null;
+
+		// Close the old file from file handler
+		TraceViewerGlobals.getTraceViewer().getFileHandler().closeFile();
+
+		// Set parameters to array
+		String[] parameters = new String[1];
+		parameters[0] = store
+				.getString(PreferenceConstants.USB_SERIAL_COM_PORT);
+
+		// Create connection
+		connection = TraceViewerGlobals.getTraceProvider()
+				.getConnectionHandler();
+		connection.createConnection(
+				PreferenceConstants.CONNECTION_TYPE_USB_SERIAL, parameters,
+				traceFilePath);
+
+		// Set TCF connection as file handler
+		TraceViewerGlobals.getTraceViewer().setFileHandler(
+				(TraceFileHandler) connection);
+
+		return connection;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/ConnectionHelper.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,338 @@
+/*
+ * 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:
+ *
+ * Connection Helper class
+ *
+ */
+package com.nokia.traceviewer.engine;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.preference.IPreferenceNode;
+import org.eclipse.jface.preference.IPreferencePage;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceDialog;
+import org.eclipse.jface.preference.PreferenceManager;
+import org.eclipse.jface.preference.PreferenceNode;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator;
+import com.nokia.carbide.remoteconnections.interfaces.IClientServiceSiteUI2;
+import com.nokia.carbide.remoteconnections.interfaces.IConnection;
+import com.nokia.carbide.remoteconnections.interfaces.IService;
+import com.nokia.carbide.remoteconnections.interfaces.IConnectionsManager.ISelectedConnectionInfo;
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.action.ConnectAction;
+import com.nokia.traceviewer.engine.preferences.PreferenceConstants;
+import com.nokia.traceviewer.engine.preferences.TraceViewerConnectionPreferencesPage;
+
+/**
+ * Connection Helper class
+ */
+public class ConnectionHelper {
+
+	/**
+	 * Current connection identifier
+	 */
+	public static String CURRENT_CONNECTION_ID = "com.nokia.carbide.remoteConnections.currentConnection"; //$NON-NLS-1$
+
+	/**
+	 * Client service UI
+	 */
+	private static IClientServiceSiteUI2 clientServiceUI = getClientServiceUI();
+
+	/**
+	 * Tells if "Current connection" is selected from TraceViewer preferences
+	 */
+	public static boolean isCurrentConnectionSelected;
+
+	static {
+
+		// Current connection is selected if ID is CURRENT_CONNECTION_ID or
+		// empty
+		String currConn = TraceViewerPlugin.getDefault().getPreferenceStore()
+				.getString(PreferenceConstants.SELECTED_CONNECTION_ID);
+		isCurrentConnectionSelected = currConn.equals(CURRENT_CONNECTION_ID)
+				|| currConn.equals(""); //$NON-NLS-1$
+	}
+
+	/**
+	 * The current connection ensured
+	 */
+	public static IConnection currentEnsuredConnection;
+
+	/**
+	 * Gets tracing service
+	 * 
+	 * @return tracing service
+	 */
+	public static IService getTracingService() {
+		IService service = RemoteConnectionsActivator
+				.getConnectionTypeProvider().findServiceByID(
+						"com.nokia.carbide.trk.support.service.TracingService"); //$NON-NLS-1$	
+		return service;
+	}
+
+	/**
+	 * Gets selected connection object
+	 * 
+	 * @return selected connection object
+	 */
+	public static IConnection getSelectedConnection() {
+		String selectedConnId = clientServiceUI.getSelectedConnection();
+
+		IConnection conn = null;
+
+		// Current connection selected
+		if (selectedConnId != null
+				&& selectedConnId.equals(CURRENT_CONNECTION_ID)) {
+			isCurrentConnectionSelected = true;
+		} else {
+			isCurrentConnectionSelected = false;
+			conn = getConnectionWithID(selectedConnId);
+
+			// If connection doesn't exist, create ClientUI and select the
+			// connection
+			if (conn == null) {
+				createClientUI();
+
+				// Select connection with ID
+				selectedConnId = TraceViewerPlugin.getDefault()
+						.getPreferenceStore().getString(
+								PreferenceConstants.SELECTED_CONNECTION_ID);
+				clientServiceUI.selectConnection(selectedConnId);
+				conn = getConnectionWithID(selectedConnId);
+			}
+		}
+
+		return conn;
+	}
+
+	/**
+	 * Gets connection with current ID
+	 * 
+	 * @return connection
+	 */
+	public static IConnection getConnectionWithCurrentID() {
+		String selectedConnId = TraceViewerPlugin.getDefault()
+				.getPreferenceStore().getString(
+						PreferenceConstants.SELECTED_CONNECTION_ID);
+		IConnection ret = getConnectionWithID(selectedConnId);
+
+		return ret;
+	}
+
+	/**
+	 * Gets connection with ID
+	 * 
+	 * @param id
+	 *            the ID
+	 * @return connection
+	 */
+	public static IConnection getConnectionWithID(String id) {
+		IConnection ret = RemoteConnectionsActivator.getConnectionsManager()
+				.findConnection(id);
+
+		return ret;
+	}
+
+	/**
+	 * Gets client service UI
+	 * 
+	 * @return client service UI
+	 */
+	public static IClientServiceSiteUI2 getClientServiceUI() {
+		IClientServiceSiteUI2 ui = null;
+		IService service = getTracingService();
+
+		if (service != null) {
+			ui = RemoteConnectionsActivator.getConnectionsManager()
+					.getClientSiteUI2(service);
+		}
+		return ui;
+	}
+
+	/**
+	 * Select connection from client UI with ID
+	 * 
+	 * @param id
+	 *            the ID
+	 */
+	public static void selectConnectionFromUIWithID(String id) {
+		if (clientServiceUI != null) {
+			clientServiceUI.selectConnection(id);
+		}
+	}
+
+	/**
+	 * Creates client service UI
+	 * 
+	 * @param composite
+	 *            composite
+	 * @return composite or null if client service UI couldn't be constructed
+	 */
+	public static Composite createClientServiceUI(Composite composite) {
+		Composite ret = null;
+		if (clientServiceUI != null) {
+			clientServiceUI.createComposite(composite);
+			ret = composite;
+		}
+		return ret;
+	}
+
+	/**
+	 * Creates Client UI
+	 */
+	private static void createClientUI() {
+		PreferenceManager mgr = new PreferenceManager();
+
+		// Create connection preference page
+		IPreferencePage connectionPage = new TraceViewerConnectionPreferencesPage();
+		IPreferenceNode connectionNode = new PreferenceNode("1", connectionPage); //$NON-NLS-1$
+		mgr.addToRoot(connectionNode);
+
+		// Create the dialog
+		PreferenceDialog dialog = new PreferenceDialog(PlatformUI
+				.getWorkbench().getDisplay().getActiveShell(), mgr);
+		dialog.create();
+	}
+
+	/**
+	 * Saves connection settings to preference store
+	 * 
+	 * @param ensureConnection
+	 *            if true, connection is ensured. It means that if the saved ID
+	 *            is not a ID of a "real" connection, we must find a real
+	 *            connection for this virtual ID
+	 * @return found IConnection object
+	 */
+	public static IConnection saveConnectionSettingsToPreferenceStore(
+			boolean ensureConnection) {
+
+		IPreferenceStore store = TraceViewerPlugin.getDefault()
+				.getPreferenceStore();
+
+		IConnection conn = null;
+
+		if (ensureConnection) {
+			String selectedConnId = clientServiceUI.getSelectedConnection();
+			if (selectedConnId == null && isCurrentConnectionSelected) {
+				selectedConnId = CURRENT_CONNECTION_ID;
+			} else if (selectedConnId == null) {
+				selectedConnId = store
+						.getString(PreferenceConstants.SELECTED_CONNECTION_ID);
+			}
+
+			try {
+				ISelectedConnectionInfo ret = RemoteConnectionsActivator
+						.getConnectionsManager().ensureConnection(
+								selectedConnId, getTracingService());
+				conn = ret.getConnection();
+			} catch (CoreException e) {
+				e.printStackTrace();
+			}
+
+		} else {
+			conn = ConnectionHelper.getSelectedConnection();
+		}
+
+		// Save the currently ensured connection object
+		currentEnsuredConnection = conn;
+
+		if (conn != null
+				&& PlatformUI.getWorkbench().getDisplay().getActiveShell() != null
+				&& !PlatformUI.getWorkbench().getDisplay().getActiveShell()
+						.isDisposed()) {
+
+			String connectionTypeId = conn.getConnectionType().getIdentifier();
+			boolean isMusti = connectionTypeId
+					.equals("com.nokia.carbide.trk.support.connection.TCPIPConnectionType"); //$NON-NLS-1$
+
+			boolean isPlatsim = connectionTypeId
+					.equals("com.nokia.carbide.trk.support.connection.PlatSimConnectionType"); //$NON-NLS-1$
+
+			// TCP / IP connection
+			if (isMusti || isPlatsim) {
+				String address = conn.getSettings().get("ipAddress"); //$NON-NLS-1$
+				String port = conn.getSettings().get("port"); //$NON-NLS-1$
+				int channel = PreferenceConstants.TCPIP_DEFAULT_CHANNEL;
+				if (isMusti) {
+					try {
+						channel = Integer.parseInt(conn.getSettings().get(
+								"mustiChannel")); //$NON-NLS-1$
+					} catch (NumberFormatException e) {
+						channel = 1;
+					}
+				}
+
+				// Save Connection type, IP address, port number and channel
+				store.setValue(PreferenceConstants.CONNECTION_TYPE,
+						PreferenceConstants.CONNECTION_TYPE_TCPIP);
+				store.setValue(PreferenceConstants.IP_ADDRESS, address);
+				store.setValue(PreferenceConstants.TCPIP_PORT, port);
+				store.setValue(PreferenceConstants.TCPIP_CHANNEL, channel);
+
+				// USB connection
+			} else if (connectionTypeId
+					.equals("com.nokia.carbide.trk.support.connection.USBConnectionType")) { //$NON-NLS-1$
+				String portNumStr = conn.getSettings().get("port"); //$NON-NLS-1$
+				int portNum = Integer.parseInt(portNumStr);
+
+				// Save Connection type and port number
+				store.setValue(PreferenceConstants.CONNECTION_TYPE,
+						PreferenceConstants.CONNECTION_TYPE_USB_SERIAL);
+				store
+						.setValue(PreferenceConstants.USB_SERIAL_COM_PORT,
+								portNum);
+
+			}
+
+			// Save selected connection name. Only save the identifier if we
+			// have not selected the "current connection"
+			store.setValue(PreferenceConstants.SELECTED_CONNECTION_NAME, conn
+					.getDisplayName());
+
+			if (!isCurrentConnectionSelected) {
+				store.setValue(PreferenceConstants.SELECTED_CONNECTION_ID, conn
+						.getIdentifier());
+			}
+
+			// Current connection selected
+		} else if (isCurrentConnectionSelected) {
+			store.setValue(PreferenceConstants.CONNECTION_TYPE,
+					CURRENT_CONNECTION_ID);
+			store.setValue(PreferenceConstants.SELECTED_CONNECTION_ID,
+					CURRENT_CONNECTION_ID);
+			store.setValue(PreferenceConstants.SELECTED_CONNECTION_NAME,
+					CURRENT_CONNECTION_ID);
+
+			// Couldn't find connection
+		} else {
+			store.setValue(PreferenceConstants.CONNECTION_TYPE, ""); //$NON-NLS-1$
+
+			// Resetting selected connection identifier
+			store.setValue(PreferenceConstants.SELECTED_CONNECTION_ID, ""); //$NON-NLS-1$
+			store.setValue(PreferenceConstants.SELECTED_CONNECTION_NAME, ""); //$NON-NLS-1$
+		}
+
+		// Change connection button tooltip
+		ConnectAction action = (ConnectAction) TraceViewerGlobals
+				.getTraceViewer().getView().getActionFactory()
+				.getConnectAction();
+		action.changeConnectToolTip();
+
+		return conn;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/ConnectionStatusListener.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,79 @@
+/*
+ * 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:
+ *
+ * Connection status listener
+ *
+ */
+package com.nokia.traceviewer.engine;
+
+import org.eclipse.swt.widgets.Display;
+
+import com.nokia.carbide.remoteconnections.internal.api.IConnection2.IConnectionStatus;
+import com.nokia.carbide.remoteconnections.internal.api.IConnection2.IConnectionStatusChangedListener;
+import com.nokia.carbide.remoteconnections.internal.api.IConnection2.IConnectionStatus.EConnectionStatus;
+
+/**
+ * Connection status listener
+ */
+public class ConnectionStatusListener implements
+		IConnectionStatusChangedListener {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @seecom.nokia.carbide.remoteconnections.internal.api.IConnection2.
+	 * IConnectionStatusChangedListener
+	 * #statusChanged(com.nokia.carbide.remoteconnections
+	 * .internal.api.IConnection2.IConnectionStatus)
+	 */
+	public void statusChanged(IConnectionStatus status) {
+
+		// Connection disconnected
+		if (status.getEConnectionStatus().equals(
+				EConnectionStatus.IN_USE_DISCONNECTED)) {
+			if (TraceViewerGlobals.getTraceViewer().getConnection() != null
+					&& TraceViewerGlobals.getTraceViewer().getConnection()
+							.isConnected()) {
+				runDisconnect();
+			}
+		}
+	}
+
+	/**
+	 * Runs disconnect
+	 */
+	private void runDisconnect() {
+
+		// Ensure UI thread
+		if (Display.getCurrent() != null) {
+			TraceViewerGlobals.getTraceViewer().getView().getActionFactory()
+					.getConnectAction().run();
+		} else {
+			Display.getDefault().syncExec(new Runnable() {
+
+				/*
+				 * (non-Javadoc)
+				 * 
+				 * @see java.lang.Runnable#run()
+				 */
+				public void run() {
+					TraceViewerGlobals.getTraceViewer().getView()
+							.getActionFactory().getConnectAction().run();
+				}
+
+			});
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/DataProcessorAccess.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,366 @@
+/*
+ * 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:
+ *
+ * Data Processor Access class
+ *
+ */
+package com.nokia.traceviewer.engine;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.action.OpenDecodeFileAction;
+import com.nokia.traceviewer.engine.dataprocessor.ColorProcessor;
+import com.nokia.traceviewer.engine.dataprocessor.DataProcessor;
+import com.nokia.traceviewer.engine.dataprocessor.Decoder;
+import com.nokia.traceviewer.engine.dataprocessor.DummyView;
+import com.nokia.traceviewer.engine.dataprocessor.FilterProcessor;
+import com.nokia.traceviewer.engine.dataprocessor.LineCountProcessor;
+import com.nokia.traceviewer.engine.dataprocessor.Logger;
+import com.nokia.traceviewer.engine.dataprocessor.SearchProcessor;
+import com.nokia.traceviewer.engine.dataprocessor.TimestampParser;
+import com.nokia.traceviewer.engine.dataprocessor.TraceCommentHandler;
+import com.nokia.traceviewer.engine.dataprocessor.TriggerProcessor;
+import com.nokia.traceviewer.engine.dataprocessor.VariableTracingProcessor;
+
+/**
+ * Data Processor Access class
+ */
+public final class DataProcessorAccess {
+
+	/**
+	 * Linked list of DataProcessors
+	 */
+	private List<DataProcessor> dataProcessors;
+
+	/**
+	 * DataProcessor Trigger
+	 */
+	private DataProcessor trigger;
+
+	/**
+	 * DataProcessor TimestampParser
+	 */
+	private DataProcessor timestampParser;
+
+	/**
+	 * DataProcessor Logger
+	 */
+	private DataProcessor logger;
+
+	/**
+	 * ColorProcessor. Is not DataProcessor as it doesn't do anything with the
+	 * traces
+	 */
+	private ColorProcessor colorProcessor;
+
+	/**
+	 * DataProcessor SearchProcessor
+	 */
+	private DataProcessor searchProcessor;
+
+	/**
+	 * DataProcessor FilterProcessor
+	 */
+	private DataProcessor filterProcessor;
+
+	/**
+	 * DataProcessor LineCountProcessor
+	 */
+	private DataProcessor lineCountProcessor;
+
+	/**
+	 * DataProcessor VariableTracingProcessor
+	 */
+	private DataProcessor variableTracingProcessor;
+
+	/**
+	 * DataProcessor Decoder
+	 */
+	private DataProcessor decoder;
+
+	/**
+	 * Trace comment handler
+	 */
+	private DataProcessor traceCommentHandler;
+
+	/**
+	 * Dummy view
+	 */
+	private DataProcessor dummyView;
+
+	/**
+	 * Last index of view
+	 */
+	private int lastIndexOfView;
+
+	/**
+	 * Creates DataProcessors
+	 */
+	public void createDataProcessors() {
+		// Creation of dataProcessors
+		dataProcessors = new ArrayList<DataProcessor>();
+		decoder = new Decoder();
+		trigger = new TriggerProcessor();
+		timestampParser = new TimestampParser();
+		traceCommentHandler = new TraceCommentHandler();
+		logger = new Logger();
+		colorProcessor = new ColorProcessor();
+		searchProcessor = new SearchProcessor();
+		filterProcessor = new FilterProcessor();
+		lineCountProcessor = new LineCountProcessor();
+		variableTracingProcessor = new VariableTracingProcessor();
+		dummyView = new DummyView();
+
+		// Add dataprocessors to list
+		dataProcessors.add(decoder);
+		dataProcessors.add(trigger);
+		dataProcessors.add(timestampParser);
+		dataProcessors.add(filterProcessor);
+		dataProcessors.add(traceCommentHandler);
+		dataProcessors.add(logger);
+		dataProcessors.add(lineCountProcessor);
+		dataProcessors.add(variableTracingProcessor);
+		dataProcessors.add(dummyView);
+	}
+
+	/**
+	 * Gets dataProcessor list
+	 * 
+	 * @return list of DataProcessors
+	 */
+	public List<DataProcessor> getDataProcessorList() {
+		return dataProcessors;
+	}
+
+	/**
+	 * Gets trigger processor
+	 * 
+	 * @return the trigger processor
+	 */
+	public TriggerProcessor getTriggerProcessor() {
+		return (TriggerProcessor) trigger;
+	}
+
+	/**
+	 * Gets decoder
+	 * 
+	 * @return the decoder
+	 */
+	public Decoder getDecoder() {
+		return (Decoder) decoder;
+	}
+
+	/**
+	 * Gets timestamp parser
+	 * 
+	 * @return the timestamp parser
+	 */
+	public TimestampParser getTimestampParser() {
+		return (TimestampParser) timestampParser;
+	}
+
+	/**
+	 * Gets logger
+	 * 
+	 * @return the logger
+	 */
+	public Logger getLogger() {
+		return (Logger) logger;
+	}
+
+	/**
+	 * Gets colorer
+	 * 
+	 * @return the colorer
+	 */
+	public ColorProcessor getColorer() {
+		return colorProcessor;
+	}
+
+	/**
+	 * Gets searchProcessor
+	 * 
+	 * @return the searchProcessor
+	 */
+	public SearchProcessor getSearchProcessor() {
+		return (SearchProcessor) searchProcessor;
+	}
+
+	/**
+	 * Gets filterProcessor
+	 * 
+	 * @return the filterProcessor
+	 */
+	public FilterProcessor getFilterProcessor() {
+		return (FilterProcessor) filterProcessor;
+	}
+
+	/**
+	 * Gets lineCountProcessor
+	 * 
+	 * @return the lineCountProcessor
+	 */
+	public LineCountProcessor getLineCountProcessor() {
+		return (LineCountProcessor) lineCountProcessor;
+	}
+
+	/**
+	 * Gets variableTracingProcessor
+	 * 
+	 * @return the variableTracingProcessor
+	 */
+	public VariableTracingProcessor getVariableTracingProcessor() {
+		return (VariableTracingProcessor) variableTracingProcessor;
+	}
+
+	/**
+	 * Gets trace comment handler
+	 * 
+	 * @return trace comment handler
+	 */
+	public TraceCommentHandler getTraceCommentHandler() {
+		return (TraceCommentHandler) traceCommentHandler;
+	}
+
+	/**
+	 * Tells if progressbar is visible
+	 * 
+	 * @return true if progressbar is visible
+	 */
+	public boolean processingWithProgressBar() {
+		// Check if we are decoding traces
+		boolean decodingTraces = ((TraceViewerGlobals.getTraceViewer()
+				.getView() != null) && ((OpenDecodeFileAction) TraceViewerGlobals
+				.getTraceViewer().getView().getActionFactory()
+				.getOpenDecodeFileAction()).isDecodingTraces());
+
+		// Check that some processor is processing or we are decoding traces
+		boolean processing = getFilterProcessor().isProcessingFilter()
+				|| getLineCountProcessor().isProcessingCounting()
+				|| getVariableTracingProcessor().isProcessingTracing()
+				|| decodingTraces;
+
+		return processing;
+	}
+
+	/**
+	 * Closes progressbar which is visible
+	 */
+	public void closeProgressBar() {
+		TraceViewerTraceViewInterface view = TraceViewerGlobals
+				.getTraceViewer().getView();
+
+		if (view != null) {
+
+			// Check if we are decoding traces
+			boolean decodingTraces = ((OpenDecodeFileAction) view
+					.getActionFactory().getOpenDecodeFileAction())
+					.isDecodingTraces();
+
+			// Close decode progressbar
+			if (decodingTraces) {
+				view.closeProgressBar(((OpenDecodeFileAction) view
+						.getActionFactory().getOpenDecodeFileAction())
+						.getProgressBarDialog());
+
+				// Close filter progressbar
+			} else if (getFilterProcessor().isProcessingFilter()) {
+				view.closeProgressBar(getFilterProcessor().getFilterDialog()
+						.getProgressBar());
+
+				// Close line count progressbar
+			} else if (getLineCountProcessor().isProcessingCounting()) {
+				view.closeProgressBar(getLineCountProcessor()
+						.getLineCountDialog().getProgressBar());
+
+				// Close variable tracing progressbar
+			} else if (getVariableTracingProcessor().isProcessingTracing()) {
+				view.closeProgressBar(getVariableTracingProcessor()
+						.getVariableTracingDialog().getProgressBar());
+			}
+		}
+	}
+
+	/**
+	 * Imports configurations
+	 */
+	public void importConfiguration() {
+		// Run imports in UI thread to ensure access to dialogs
+		PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+			public void run() {
+				getFilterProcessor().importFilterRules();
+				getLineCountProcessor().importLineCountRules();
+				getVariableTracingProcessor().importVariableTracingRules();
+				getTriggerProcessor().importTriggerRules();
+				getColorer().importColorRules();
+			}
+		});
+	}
+
+	/**
+	 * Adds Trace View to the DataProcessor list
+	 * 
+	 * @param traceView
+	 *            the trace view
+	 */
+	public void addTraceViewToList(DataProcessor traceView) {
+
+		// Replace Dummy view when first real view is registered
+		int indexOfDummyView = dataProcessors.indexOf(dummyView);
+		if (indexOfDummyView != -1) {
+			dataProcessors.remove(indexOfDummyView);
+			dataProcessors.add(indexOfDummyView, traceView);
+			lastIndexOfView = indexOfDummyView;
+
+			// Dummy view is already replaced by real one
+		} else {
+			int indexOfView = 0;
+
+			// Get the index of the already registered view and insert the new
+			// one after it
+			if (TraceViewerGlobals.getTraceViewer().getView() != null) {
+				indexOfView = dataProcessors.indexOf(TraceViewerGlobals
+						.getTraceViewer().getView()) + 1;
+			}
+
+			// If not found yet, check another view
+			if (indexOfView == 0
+					&& TraceViewerGlobals.getTraceViewer().getPropertyView() != null) {
+				indexOfView = dataProcessors.indexOf(TraceViewerGlobals
+						.getTraceViewer().getPropertyView());
+			}
+
+			// If views were not found, it should mean that view is set to null
+			if (indexOfView == 0 && traceView == null) {
+
+				// Insert DummyView back
+				dataProcessors.add(lastIndexOfView, dummyView);
+
+				// Add the view to list
+			} else if (traceView != null) {
+
+				// Save last view index
+				if (lastIndexOfView == 0 || lastIndexOfView > indexOfView) {
+					lastIndexOfView = indexOfView;
+				}
+
+				dataProcessors.add(indexOfView, traceView);
+			}
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/DataReader.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,133 @@
+/*
+ * 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:
+ *
+ * DataReader interface
+ *
+ */
+package com.nokia.traceviewer.engine;
+
+/**
+ * DataReader interface
+ */
+public interface DataReader {
+
+	/**
+	 * Clears file
+	 */
+	public void clearFile();
+
+	/**
+	 * Creates scroll reader
+	 * 
+	 * @param mediaCallback
+	 *            callback
+	 * @param conf
+	 *            TraceConfiguration to use with this scroll reader
+	 * @return new scroll reader
+	 */
+	public DataScrollReader createScrollReader(MediaCallback mediaCallback,
+			TraceConfiguration conf);
+
+	/**
+	 * Gets file map
+	 * 
+	 * @return file map
+	 */
+	public FileMap getFileMap();
+
+	/**
+	 * Gets file path
+	 * 
+	 * @return file path
+	 */
+	public String getFilePath();
+
+	/**
+	 * Gets file start offset
+	 * 
+	 * @return file start offset
+	 */
+	public long getFileStartOffset();
+
+	/**
+	 * Gets trace count
+	 * 
+	 * @return trace count
+	 */
+	public int getTraceCount();
+
+	/**
+	 * Gets current trace position in file
+	 * 
+	 * @return current trace position in file
+	 */
+	public long getTracePositionInFile();
+
+	/**
+	 * Gets trace configuration
+	 * 
+	 * @return trace configuration
+	 */
+	public TraceConfiguration getTraceConfiguration();
+
+	/**
+	 * Tells if this reader is paused
+	 * 
+	 * @return pause status
+	 */
+	public boolean isPaused();
+
+	/**
+	 * Pauses the reader
+	 * 
+	 * @param pause
+	 *            pause status
+	 */
+	public void pause(boolean pause);
+
+	/**
+	 * Sets file path
+	 * 
+	 * @param filePath
+	 *            file path
+	 */
+	public void setFilePath(String filePath);
+
+	/**
+	 * Sets file position
+	 * 
+	 * @param filePos
+	 *            the new file position
+	 */
+	public void setFilePosition(long filePos);
+
+	/**
+	 * Sets file start offset
+	 * 
+	 * @param fileStartOffset
+	 *            file start offset
+	 */
+	public void setFileStartOffset(long fileStartOffset);
+
+	/**
+	 * Shuts down this DataReader
+	 */
+	public void shutdown();
+
+	/**
+	 * Read data from file
+	 */
+	public void start();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/DataReaderAccess.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,511 @@
+/*
+ * 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:
+ *
+ * Data Reader Access class
+ *
+ */
+package com.nokia.traceviewer.engine;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.nokia.traceviewer.engine.dataprocessor.FilterProcessor;
+
+/**
+ * DataReader Access class
+ */
+public class DataReaderAccess {
+
+	/**
+	 * Main file path
+	 */
+	private final String filePath;
+
+	/**
+	 * Callback where dataReaders return data
+	 */
+	private final MediaCallback mediaCallback;
+
+	/**
+	 * The Main dataReader which is always reading the binary file
+	 */
+	private DataReader mainDataReader;
+
+	/**
+	 * Reference to the current dataReader reading data to view
+	 */
+	private DataReader currentDataReader;
+
+	/**
+	 * DataReader which handles scrolling
+	 */
+	private DataScrollReader scrollReader;
+
+	/**
+	 * Datareader which reads only the filter file
+	 */
+	private DataReader filterDataReader;
+
+	/**
+	 * List of media callbacks which should be informed when file handle is
+	 * changed
+	 */
+	private List<MediaCallback> ownMediaCallbacks;
+
+	/**
+	 * File start offset. Is non-zero when triggering was on.
+	 */
+	private long fileStartOffset;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param mediaCallback
+	 *            media callback
+	 * @param fileName
+	 *            file name
+	 */
+	public DataReaderAccess(MediaCallback mediaCallback, String fileName) {
+		this.mediaCallback = mediaCallback;
+		this.filePath = fileName;
+	}
+
+	/**
+	 * Creates the main DataReader
+	 */
+	public void createMainDataReader() {
+		// Create Main reader
+		TraceConfiguration conf = new TraceConfiguration();
+		conf.setScrolledTrace(false);
+		conf.setFilteredOut(false);
+		conf.setReadFromFilterFile(false);
+
+		if (mainDataReader != null) {
+			mainDataReader.shutdown();
+		}
+		mainDataReader = TraceViewerGlobals.getTraceProvider()
+				.createDataReader(mediaCallback, conf);
+
+		mainDataReader.setFilePath(filePath);
+		mainDataReader.setFileStartOffset(fileStartOffset);
+		mainDataReader.start();
+
+		// Not filtering
+		if (!TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+				.getFilterProcessor().isFiltering()) {
+			setCurrentDataReader(mainDataReader);
+			// Filtering, create filter data reader
+		} else {
+			TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+					.getFilterProcessor().buildFilterFileWriter();
+		}
+
+		if (scrollReader != null) {
+			scrollReader.shutdown();
+			scrollReader = null;
+		}
+	}
+
+	/**
+	 * Gets current data reader
+	 * 
+	 * @return the current data reader
+	 */
+	public DataReader getCurrentDataReader() {
+		return currentDataReader;
+	}
+
+	/**
+	 * Sets current data reader
+	 * 
+	 * @param reader
+	 *            new current data reader
+	 */
+	public void setCurrentDataReader(DataReader reader) {
+		currentDataReader = reader;
+		notifyOwnCallbacks();
+	}
+
+	/**
+	 * Gets the main data reader
+	 * 
+	 * @return main data reader
+	 */
+	public DataReader getMainDataReader() {
+		return mainDataReader;
+	}
+
+	/**
+	 * Sets the main data reader
+	 * 
+	 * @param reader
+	 *            new main data reader
+	 */
+	public void setMainDataReader(DataReader reader) {
+		if (mainDataReader != null) {
+			mainDataReader.shutdown();
+		}
+		mainDataReader = reader;
+	}
+
+	/**
+	 * Gets the scroll reader
+	 * 
+	 * @return scroll reader
+	 */
+	public DataScrollReader getScrollReader() {
+		return scrollReader;
+	}
+
+	/**
+	 * Sets the scroll reader
+	 * 
+	 * @param scrollReader
+	 *            new scroll reader
+	 */
+	public void setScrollReader(DataScrollReader scrollReader) {
+		this.scrollReader = scrollReader;
+	}
+
+	/**
+	 * Deletes current scroll reader
+	 */
+	public void deleteScrollReader() {
+		if (scrollReader != null) {
+			scrollReader.shutdown();
+			scrollReader = null;
+		}
+	}
+
+	/**
+	 * Deletes current filter reader
+	 */
+	public void deleteFilterReader() {
+		if (filterDataReader != null) {
+			filterDataReader.shutdown();
+			filterDataReader = null;
+		}
+	}
+
+	/**
+	 * Sets the file start offset
+	 * 
+	 * @param offset
+	 *            file start offset
+	 */
+	public void setFileStartOffset(long offset) {
+		this.fileStartOffset = offset;
+	}
+
+	/**
+	 * Start scroll reader
+	 * 
+	 * @param offset
+	 *            start offset
+	 * @param numberOfBlocks
+	 *            number of blocks
+	 */
+	public void startScrollReader(int offset, int numberOfBlocks) {
+		// Get the file position having given offset
+		int index = currentDataReader.getFileMap().getIndexFromOffset(offset);
+		long pos = currentDataReader.getFileMap().getItem(index).longValue();
+		int startTrace = index * TraceViewerGlobals.blockSize;
+		boolean scrollReadedExisted = true;
+
+		if (scrollReader == null) {
+			scrollReadedExisted = false;
+			// Sets this reader to read only blocks
+			TraceConfiguration conf = new TraceConfiguration();
+			conf.setScrolledTrace(true);
+			// Check if filtering
+			if (TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+					.getFilterProcessor().isFiltering()) {
+				conf.setReadFromFilterFile(true);
+			}
+
+			// Create scroll reader the same type as current data reader is
+			scrollReader = currentDataReader.createScrollReader(mediaCallback,
+					conf);
+		}
+
+		scrollReader.setBlockReader(numberOfBlocks, startTrace, true);
+		scrollReader.setFilePosition(pos);
+
+		// Synchronize the threads
+		synchronized (scrollReader) {
+			if (!scrollReadedExisted) {
+				// Start the new thread
+				scrollReader.start();
+			} else {
+				// Wake the thread if it exists
+				scrollReader.notifyAll();
+			}
+			// Put caller thread waiting. Must be careful here because the
+			// caller thread is usually the UI thread. If syncExec call happens
+			// during the fetching of the data, UI will be blocked forever!
+			try {
+				scrollReader.wait();
+			} catch (InterruptedException e) {
+				e.printStackTrace();
+			}
+		}
+	}
+
+	/**
+	 * Creates and starts own data reader. When reader is no longer needed, call
+	 * shutdown method and set the reader to null.
+	 * 
+	 * @param reader
+	 *            own data reader to start. Should be null when calling this
+	 *            method for the first time. Then the return value of this
+	 *            method should be inserted to the reader object in the calling
+	 *            class
+	 * @param callback
+	 *            callback class where to return traces read
+	 * @param numberOfBlocks
+	 *            number of blocks to read
+	 * @param pos
+	 *            file position to set
+	 * @param startTrace
+	 *            trace number where to start reading
+	 * @param blocking
+	 *            if true, blocks the calling thread until all the traces are
+	 *            read. Use with caution. If the amount of traces is big,
+	 *            program may hang or the stack could get full. Only use
+	 *            blocking when reading couple of blocks!
+	 * @return reference to the reader
+	 */
+	public DataScrollReader startOwnDataReader(DataScrollReader reader,
+			MediaCallback callback, int numberOfBlocks, long pos,
+			int startTrace, boolean blocking) {
+		boolean dataReadedExisted = true;
+
+		// Create new general data reader if it doesn't exist or the callback is
+		// different
+		if (reader == null) {
+			dataReadedExisted = false;
+			// Sets this reader to read only blocks
+			TraceConfiguration conf = new TraceConfiguration();
+			conf.setScrolledTrace(true);
+			// Check if filtering
+			if (TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+					.getFilterProcessor().isFiltering()) {
+				conf.setReadFromFilterFile(true);
+			}
+
+			// Create own data reader the same type as current data reader is
+			reader = currentDataReader.createScrollReader(callback, conf);
+			addMediaCallbackToList(callback);
+		}
+
+		reader.setBlockReader(numberOfBlocks, startTrace, blocking);
+		reader.setFilePosition(pos);
+
+		// Synchronize the threads
+		synchronized (reader) {
+			if (!dataReadedExisted) {
+				// Start the new thread
+				reader.start();
+			} else {
+				// Wake the thread if it exists
+				reader.notifyAll();
+			}
+			if (blocking) {
+				// Put caller thread waiting
+				try {
+					reader.wait();
+				} catch (InterruptedException e) {
+					e.printStackTrace();
+				}
+			}
+		}
+		return reader;
+	}
+
+	/**
+	 * Creates filter data reader
+	 */
+	public void createFilterDataReader() {
+		// Configuration for filter file reader
+		TraceConfiguration conf = new TraceConfiguration();
+		conf.setScrolledTrace(false);
+		conf.setReadFromFilterFile(true);
+
+		// Shut down possible old one
+		deleteFilterReader();
+
+		// Create binary filter file data reader
+		if (!TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+				.getFilterProcessor().isUsingExternalFilter()
+				&& !(mainDataReader instanceof PlainTextReader)) {
+			filterDataReader = TraceViewerGlobals.getTraceProvider()
+					.createDataReader(mediaCallback, conf);
+
+			// Create plain text filter file data reader
+		} else {
+			filterDataReader = new PlainTextReader(mediaCallback, conf);
+		}
+
+		filterDataReader.setFilePath(FilterProcessor.DEFAULT_FILTER_FILE_PATH);
+
+		// Set as current datareader. Will also notify own callbacks.
+		setCurrentDataReader(filterDataReader);
+
+		// Delete old scrollReader
+		deleteScrollReader();
+
+		// Start the reader
+		filterDataReader.start();
+	}
+
+	/**
+	 * Creates log file data reader
+	 * 
+	 * @param file
+	 *            file name
+	 * @param binary
+	 *            is the log file binary
+	 */
+	public void createLogFileReader(String file, boolean binary) {
+		// Configuration for log file reader
+		TraceConfiguration conf = new TraceConfiguration();
+		conf.setScrolledTrace(false);
+		conf.setReadFromFilterFile(false);
+		conf.setFilteredOut(false);
+
+		// New main reader
+		DataReader newReader = null;
+
+		// Binary file
+		if (binary) {
+			// Create new DataReader
+			newReader = TraceViewerGlobals.getTraceProvider().createDataReader(
+					mediaCallback, conf);
+
+			// Plain text file
+		} else {
+			newReader = new PlainTextReader(mediaCallback, conf);
+		}
+		newReader.setFilePath(file);
+
+		// Set the new reader to main reader
+		setMainDataReader(newReader);
+
+		// If not filtering, set as currentDataReader
+		if (!TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+				.getFilterProcessor().isFiltering()) {
+			setCurrentDataReader(newReader);
+
+			// If filtering, empty old filter file and create new filter data
+			// reader
+		} else {
+			TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+					.getFilterProcessor().buildFilterFileWriter();
+			createFilterDataReader();
+		}
+
+		TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+				.getLogger().setLogFileOpened(true);
+
+		// Import possible trace comments first
+		TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+				.getTraceCommentHandler().importTraceComments(file);
+
+		// Start the reader
+		newReader.start();
+	}
+
+	/**
+	 * Opens log file
+	 * 
+	 * @param file
+	 *            file to be opened
+	 * @param binary
+	 *            is this binary file
+	 */
+	public void openLogFile(String file, boolean binary) {
+		// Delete old scrollReader and generalReader
+		deleteScrollReader();
+		notifyOwnCallbacks();
+
+		// Stop reader if it exists
+		if (getMainDataReader() != null) {
+
+			// If paused, unpause
+			boolean paused = getMainDataReader().isPaused();
+			getMainDataReader().shutdown();
+
+			if (paused) {
+				TraceViewerGlobals.getTraceViewer().getView()
+						.getActionFactory().getPauseAction().run();
+			}
+		}
+
+		// Clear everything
+		TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+				.getLogger().setLogFileOpened(false);
+		TraceViewerGlobals.getTraceViewer().clearAllData();
+
+		// Disconnect
+		if (TraceViewerGlobals.getTraceViewer().getConnection() != null
+				&& TraceViewerGlobals.getTraceViewer().getConnection()
+						.isConnected()) {
+			TraceViewerGlobals.getTraceViewer().getView().getActionFactory()
+					.getConnectAction().run();
+		}
+
+		// Remove possible triggers
+		TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+				.getTriggerProcessor().removeTriggers();
+
+		// Create and start log file reader
+		createLogFileReader(file, binary);
+	}
+
+	/**
+	 * Notifies own callbacks that file handle has changed. They should shutdown
+	 * the reader and set it null.
+	 */
+	private void notifyOwnCallbacks() {
+		if (ownMediaCallbacks != null) {
+			for (int i = 0; i < ownMediaCallbacks.size(); i++) {
+				MediaCallback callback = ownMediaCallbacks.get(i);
+				if (callback != null) {
+					callback.dataHandleChanged();
+				}
+			}
+			ownMediaCallbacks.clear();
+		}
+	}
+
+	/**
+	 * Adds own callback to the list
+	 * 
+	 * @param callback
+	 *            own callback to be added
+	 */
+	private void addMediaCallbackToList(MediaCallback callback) {
+
+		// Create the array
+		if (ownMediaCallbacks == null) {
+			ownMediaCallbacks = new ArrayList<MediaCallback>();
+		}
+
+		// Add to the list
+		if (!ownMediaCallbacks.contains(callback)) {
+			ownMediaCallbacks.add(callback);
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/DataScrollReader.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,66 @@
+/*
+ * 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:
+ *
+ * DataScrollReader interface
+ *
+ */
+package com.nokia.traceviewer.engine;
+
+/**
+ * DataScrollReader interface
+ * 
+ */
+public interface DataScrollReader {
+
+	/**
+	 * Read data from file
+	 */
+	public void start();
+
+	/**
+	 * Pauses the reader
+	 * 
+	 * @param pause
+	 *            pause status
+	 */
+	public void pause(boolean pause);
+
+	/**
+	 * Shuts down this DataReader
+	 */
+	public void shutdown();
+
+	/**
+	 * Sets this DataReader to read block(s)
+	 * 
+	 * @param numberOfBlocks
+	 *            number of blocks to read
+	 * @param startingTrace
+	 *            number of first trace to read
+	 * @param blocking
+	 *            should this reader be blocking. Caller thread is waiting until
+	 *            all data is gathered
+	 */
+	public void setBlockReader(int numberOfBlocks, int startingTrace,
+			boolean blocking);
+
+	/**
+	 * Sets file position
+	 * 
+	 * @param filePos
+	 *            file position
+	 */
+	public void setFilePosition(long filePos);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/DataWriter.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,44 @@
+/*
+ * 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:
+ *
+ * Data Writer interface
+ *
+ */
+package com.nokia.traceviewer.engine;
+
+import java.nio.ByteBuffer;
+
+/**
+ * Data Writer Interface
+ */
+public interface DataWriter {
+
+	/**
+	 * Writes message
+	 * 
+	 * @param sourceBuffer
+	 *            sourceBuffer where to write the message
+	 * @param msgStart
+	 *            message start offset
+	 * @param msgLen
+	 *            message length
+	 */
+	public void writeMessage(ByteBuffer sourceBuffer, int msgStart, int msgLen);
+
+	/**
+	 * Closes writing
+	 */
+	public void closeChannel();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/DecodeProvider.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,166 @@
+/*
+ * 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:
+ *
+ * DecodeProvider provides decoding to the TraceViewer engine
+ *
+ */
+package com.nokia.traceviewer.engine;
+
+import java.io.InputStream;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+
+import com.nokia.traceviewer.engine.activation.TraceActivationComponentItem;
+
+/**
+ * DecodeProvider interface
+ */
+public interface DecodeProvider {
+
+	/**
+	 * Decodes trace from dataBuffer and returns properties
+	 * 
+	 * @param dataBuffer
+	 *            dataBuffer
+	 * @param properties
+	 *            trace properties
+	 * @return trace properties
+	 */
+	public TraceProperties decodeTrace(ByteBuffer dataBuffer,
+			TraceProperties properties);
+
+	/**
+	 * Gets trace activation information (list of components having groups)
+	 * 
+	 * @param getAlsoTraces
+	 *            if true, also traces are added to the activation model. If
+	 *            false, traces arrays in groups are empty.
+	 * @return trace activation information
+	 */
+	public ArrayList<TraceActivationComponentItem> getActivationInformation(
+			boolean getAlsoTraces);
+
+	/**
+	 * Gets component name with component ID
+	 * 
+	 * @param componentId
+	 *            component ID
+	 * @return component name or null if not found
+	 */
+	public String getComponentName(int componentId);
+
+	/**
+	 * Gets group ID with component ID and group name
+	 * 
+	 * @param componentId
+	 *            component ID
+	 * @param groupName
+	 *            group name
+	 * @return group ID or -1 if not found
+	 */
+	public int getGroupId(int componentId, String groupName);
+
+	/**
+	 * Gets group name with component and group IDs
+	 * 
+	 * @param componentId
+	 *            component ID
+	 * @param groupId
+	 *            group ID
+	 * @return group name or null if not found
+	 */
+	public String getGroupName(int componentId, int groupId);
+
+	/**
+	 * Gets group name with component and group IDs
+	 * 
+	 * @param componentId
+	 *            component ID
+	 * @param groupId
+	 *            group ID
+	 * @param traceId
+	 *            trace ID
+	 * @return trace name or null if not found
+	 */
+	public String getTraceName(int componentId, int groupId, int traceId);
+
+	/**
+	 * Gets list containing component, group and trace names in this order
+	 * 
+	 * @param componentId
+	 *            component ID
+	 * @param groupId
+	 *            group ID
+	 * @param traceId
+	 *            trace ID
+	 * @return list containing component, group and trace name. If some name is
+	 *         not found, it's null
+	 */
+	public String[] getComponentGroupTraceName(int componentId, int groupId,
+			int traceId);
+
+	/**
+	 * Gets trace metadata
+	 * 
+	 * @param information
+	 *            trace information
+	 * @return trace metadata
+	 */
+	public TraceMetaData getTraceMetaData(TraceInformation information);
+
+	/**
+	 * Tells if the model if loaded and valid
+	 * 
+	 * @return true if model is loaded and valid
+	 */
+	public boolean isModelLoadedAndValid();
+
+	/**
+	 * Opens decode file
+	 * 
+	 * @param filePath
+	 *            decode file path. If fileStream is not null, this is only used
+	 *            in error situations to tell the user the name of the file
+	 *            having problems.
+	 * @param inputStream
+	 *            input stream of the decode file. If null, filePath is used to
+	 *            open the file.
+	 * @param createNew
+	 *            true if creating new model. False if appending to old model.
+	 */
+	public void openDecodeFile(String filePath, InputStream inputStream,
+			boolean createNew);
+
+	/**
+	 * Removes component from model
+	 * 
+	 * @param componentId
+	 *            component ID
+	 * @return true if component was found and removed, false otherwise
+	 */
+	public boolean removeComponentFromModel(int componentId);
+
+	/**
+	 * Sets if Decoder should add certain prefixes to the traces
+	 * 
+	 * @param addClassAndFunctionName
+	 *            if true, add class and function name to the traces
+	 * @param addComponentAndGroupName
+	 *            if true, add component and group name to the traces
+	 */
+	public void setAddPrefixesToTrace(boolean addClassAndFunctionName,
+			boolean addComponentAndGroupName);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/DummyDialogs.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,85 @@
+/*
+ * 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:
+ *
+ * Dummy Dialog class
+ *
+ */
+package com.nokia.traceviewer.engine;
+
+/**
+ * Dummy Dialog class
+ * 
+ */
+public final class DummyDialogs implements TraceViewerDialogInterface {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.TraceViewerDialogInterface#openPreferencePage
+	 * (
+	 * com.nokia.traceviewer.engine.TraceViewerDialogInterface.TVPreferencePage)
+	 */
+	public boolean openPreferencePage(TVPreferencePage page) {
+		return false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @seecom.nokia.traceviewer.engine.TraceViewerDialogInterface#
+	 * showConfirmationDialog(java.lang.String)
+	 */
+	public boolean showConfirmationDialog(String message) {
+		return false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.TraceViewerDialogInterface#showErrorMessage
+	 * (java.lang.String)
+	 */
+	public void showErrorMessage(String error) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @seecom.nokia.traceviewer.engine.TraceViewerDialogInterface#
+	 * showInformationMessage(java.lang.String)
+	 */
+	public void showInformationMessage(String message) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.TraceViewerDialogInterface
+	 * #createDialog
+	 * (com.nokia.traceviewer.engine.TraceViewerDialogInterface.Dialog)
+	 */
+	public TraceViewerDialog createDialog(Dialog name) {
+		// Return dummy TraceViewerDialog to prevent null pointer exception
+		return new TraceViewerDialog() {
+
+			public void openDialog() {
+			}
+
+		};
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/DummyTrim.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,36 @@
+/*
+ * 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:
+ *
+ * Dummy Dialog class
+ *
+ */
+package com.nokia.traceviewer.engine;
+
+/**
+ * Dummy TrimProvider class
+ */
+public final class DummyTrim implements TrimProvider {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.TrimProvider#updateText(java.lang.String)
+	 */
+	public void updateText(String text) {
+		// Do nothing
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/FileMap.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,98 @@
+/*
+ * 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:
+ *
+ * FileMap class
+ *
+ */
+package com.nokia.traceviewer.engine;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Hold information about trace block positions in file
+ * 
+ */
+public class FileMap {
+
+	/**
+	 * Map which holds the file pointers to messages
+	 */
+	private final List<Long> map;
+
+	/**
+	 * Constructor
+	 */
+	public FileMap() {
+		map = new ArrayList<Long>();
+	}
+
+	/**
+	 * Insert item to map
+	 * 
+	 * @param item
+	 *            item
+	 */
+	public void insert(Long item) {
+		map.add(item);
+	}
+
+	/**
+	 * Gets item from map
+	 * 
+	 * @param index
+	 *            index of item
+	 * @return item
+	 */
+	public Long getItem(int index) {
+		long item = 0;
+		if (index < 0) {
+			item = 0;
+		} else if (index > map.size() - 1) {
+			item = 0;
+		} else {
+			item = map.get(index).longValue();
+		}
+		return Long.valueOf(item);
+	}
+
+	/**
+	 * Gets index from map from specific offset
+	 * 
+	 * @param offset
+	 *            offset of item
+	 * @return index
+	 */
+	public int getIndexFromOffset(int offset) {
+		int index = (offset / TraceViewerGlobals.blockSize);
+		return index;
+	}
+
+	/**
+	 * Empties map
+	 */
+	public void clearMap() {
+		map.clear();
+	}
+
+	/**
+	 * Gets size of this map
+	 * 
+	 * @return size
+	 */
+	public int size() {
+		return map.size();
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/InternalFileHandler.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,112 @@
+/*
+ * 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:
+ *
+ * Internal Trace File Handler
+ *
+ */
+package com.nokia.traceviewer.engine;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.nio.channels.FileChannel;
+
+/**
+ * Internal Trace File Handler
+ * 
+ */
+final class InternalFileHandler implements TraceFileHandler {
+
+	/**
+	 * File path
+	 */
+	private final String filePath;
+
+	/**
+	 * Trace File
+	 */
+	private RandomAccessFile file;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param filePath
+	 *            trace file path
+	 */
+	public InternalFileHandler(String filePath) {
+		this.filePath = filePath;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.TraceFileHandler#clearFile()
+	 */
+	public void clearFile() {
+		if (file != null) {
+			try {
+				file.setLength(0);
+			} catch (IOException e) {
+				e.printStackTrace();
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.TraceFileHandler#openFile()
+	 */
+	public void openFile() {
+		if (filePath != null) {
+			// Create new RandomAccessFile
+			try {
+				if (getChannel() == null || !getChannel().isOpen()) {
+					this.file = new RandomAccessFile(filePath, "rw"); //$NON-NLS-1$
+				}
+			} catch (FileNotFoundException e) {
+				e.printStackTrace();
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.TraceFileHandler#closeFile()
+	 */
+	public void closeFile() {
+		if (file != null) {
+			try {
+				file.close();
+			} catch (IOException e) {
+				e.printStackTrace();
+			}
+		}
+	}
+
+	/**
+	 * Gets file channel
+	 * 
+	 * @return file channel
+	 */
+	private FileChannel getChannel() {
+		FileChannel channel = null;
+		if (file != null) {
+			channel = file.getChannel();
+		}
+		return channel;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/MediaCallback.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,51 @@
+/*
+ * 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:
+ *
+ * Media Callback interface
+ *
+ */
+package com.nokia.traceviewer.engine;
+
+/**
+ * Media Callback interface
+ * 
+ */
+public interface MediaCallback {
+
+	/**
+	 * Processes data
+	 * 
+	 * @param properties
+	 *            trace properties
+	 * 
+	 */
+	public void processTrace(TraceProperties properties);
+
+	/**
+	 * Informs that Reader has reached EOF
+	 * 
+	 * @param reader
+	 *            reader hit the EOF
+	 */
+	public void endOfFile(DataReader reader);
+
+	/**
+	 * Notifies that data handle has changed. MediaCallback should shutdown the
+	 * reader and set it to null so that it will be created again when started
+	 * next time.
+	 */
+	public void dataHandleChanged();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/Messages.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,63 @@
+/*
+ * 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:
+ *
+ * String localization for engine package.
+ *
+ */
+package com.nokia.traceviewer.engine;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * String localization for engine dataprocessor package.
+ * 
+ */
+final class Messages {
+
+	/**
+	 * Bundle name
+	 */
+	private static final String BUNDLE_NAME = "com.nokia.traceviewer.engine.messages"; //$NON-NLS-1$
+
+	/**
+	 * Resource bundle
+	 */
+	private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
+			.getBundle(BUNDLE_NAME);
+
+	/**
+	 * Prevents construction.
+	 */
+	private Messages() {
+	}
+
+	/**
+	 * Maps a key to localized string.
+	 * 
+	 * @param key
+	 *            the key for the string
+	 * @return the localized string
+	 */
+	public static String getString(String key) {
+		String value;
+		try {
+			value = RESOURCE_BUNDLE.getString(key);
+		} catch (MissingResourceException e) {
+			value = '!' + key + '!';
+		}
+		return value;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/MultiPartItem.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,121 @@
+/*
+ * 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:
+ *
+ * Base class for Isi Readers
+ *
+ */
+package com.nokia.traceviewer.engine;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Multipart item
+ */
+public class MultiPartItem {
+
+	/**
+	 * Tells if this multipart trace is completed
+	 */
+	private boolean isCompleted;
+
+	/**
+	 * Total message length after assembling the parts
+	 */
+	private int totalMessageLength;
+
+	/**
+	 * Trace header size list containing header sizes
+	 */
+	private final List<Integer> tracePartHeaderSizeList = new ArrayList<Integer>();
+
+	/**
+	 * Trace part list containing whole messages as byte arrays
+	 */
+	private final List<byte[]> tracePartList = new ArrayList<byte[]>();
+
+	/**
+	 * Sets this trace to be completed
+	 * 
+	 * @param completed
+	 */
+	public void setCompleted(boolean completed) {
+		this.isCompleted = completed;
+	}
+
+	/**
+	 * Tells if the trace is completed
+	 * 
+	 * @return true if completed
+	 */
+	public boolean isCompleted() {
+		return isCompleted;
+	}
+
+	/**
+	 * Gets trace parts
+	 * 
+	 * @return trace parts list
+	 */
+	public List<byte[]> getTraceParts() {
+		return tracePartList;
+	}
+
+	/**
+	 * Gets trace part header sizes list
+	 * 
+	 * @return trace part header sizes list
+	 */
+	public List<Integer> getTracePartHeaderSizes() {
+		return tracePartHeaderSizeList;
+	}
+
+	/**
+	 * Gets total message length
+	 * 
+	 * @return total message length
+	 */
+	public int getTotalMessageLength() {
+		return totalMessageLength;
+	}
+
+	/**
+	 * Adds trace part
+	 * 
+	 * @param trace
+	 *            trace part
+	 * @param lastPart
+	 *            if true, is the last part of the trace
+	 */
+	public void addPart(TraceProperties trace, boolean lastPart) {
+		byte[] byteArr = new byte[trace.messageLength];
+
+		// First copy the header
+		int headerSize = trace.dataStart - trace.messageStart;
+		trace.byteBuffer.position(trace.messageStart);
+		trace.byteBuffer.get(byteArr, 0, trace.messageLength);
+
+		// Insert header length and byte array to the map
+		tracePartHeaderSizeList.add(Integer.valueOf(headerSize));
+		tracePartList.add(byteArr);
+
+		// Add total message length
+		if (lastPart) {
+			totalMessageLength += trace.messageLength;
+		} else {
+			totalMessageLength += trace.dataLength;
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/PlainTextReader.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,378 @@
+/*
+ * 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:
+ *
+ * Plain Text Reader
+ *
+ */
+package com.nokia.traceviewer.engine;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.nio.CharBuffer;
+
+/**
+ * Plain Text Reader
+ */
+public class PlainTextReader extends BaseDataReader {
+
+	/**
+	 * Running boolean
+	 */
+	private boolean running;
+
+	/**
+	 * Position of file
+	 */
+	private long filePos;
+
+	/**
+	 * File reader
+	 */
+	private BufferedReader input;
+
+	/**
+	 * File to read from
+	 */
+	private File file;
+
+	/**
+	 * Character buffer where chars are read
+	 */
+	private final CharBuffer cbuf;
+
+	/**
+	 * Remaining characters from the last read
+	 */
+	private int remainingChars;
+
+	/**
+	 * Temporary buffer for data
+	 */
+	private final CharBuffer tempBuffer;
+
+	/**
+	 * Paused boolean
+	 */
+	private boolean paused;
+
+	/**
+	 * Indicates that traces can be processed
+	 */
+	private boolean canProcessTraces;
+
+	/**
+	 * Possible middle of line break
+	 */
+	private boolean middleOfLineBreak;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param mediaCallback
+	 *            callback
+	 * @param configuration
+	 *            trace configuration used in this reader
+	 */
+	public PlainTextReader(MediaCallback mediaCallback,
+			TraceConfiguration configuration) {
+		super();
+		this.mediaCallback = mediaCallback;
+		trace = new TraceProperties(configuration);
+		traceConfiguration = configuration;
+		cbuf = CharBuffer.allocate(RECEIVE_BUFFER_SIZE);
+		tempBuffer = CharBuffer.allocate(MAX_MESSAGE_SIZE);
+
+		running = true;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.DataReader#start()
+	 */
+	@Override
+	public void run() {
+		try {
+			file = new File(filePath);
+			input = new BufferedReader(new FileReader(file));
+			while (running) {
+				canProcessTraces = true;
+				if (!paused) {
+					// Read from the file
+					int chars = input.read(cbuf);
+					if (chars > 0) {
+						cbuf.limit(chars + remainingChars);
+						remainingChars = 0;
+						processBuffer();
+					} else {
+						// Inform callback for EOF
+						mediaCallback.endOfFile(this);
+						Thread.sleep(PAUSE_TIME);
+					}
+				} else {
+					Thread.sleep(PAUSE_TIME);
+				}
+			}
+
+		} catch (Throwable t) {
+			t.printStackTrace();
+		}
+
+	}
+
+	/**
+	 * Process character buffer
+	 */
+	private void processBuffer() {
+		canProcessTraces = true;
+		cbuf.position(0);
+		StringBuffer buf = new StringBuffer();
+		int extra = 0;
+		boolean traceReady = false;
+
+		// Loop until there is characters left
+		while (cbuf.hasRemaining()) {
+			char c = cbuf.get();
+
+			// If in the middle of a line break from previous buffer, skip first
+			// character
+			if (middleOfLineBreak && c == '\n' && cbuf.hasRemaining()) {
+				c = cbuf.get();
+			}
+			middleOfLineBreak = false;
+
+			// Check the character
+			switch (c) {
+			case '\n':
+				extra = 1;
+				traceReady = true;
+				break;
+			case '\r':
+				if (!cbuf.hasRemaining()) {
+					extra = 1;
+					middleOfLineBreak = true;
+				} else if ((cbuf.get()) == '\n') {
+					extra = 2;
+				} else {
+					cbuf.position(cbuf.position() - 1);
+					extra = 1;
+				}
+
+				traceReady = true;
+				break;
+			default:
+				buf.append(c);
+				traceReady = false;
+			}
+
+			// Trace is ready, insert it
+			if (traceReady) {
+				String traceString = buf.toString();
+				buf.setLength(0);
+				if (canProcessTraces) {
+					processTrace(extra, traceString);
+				}
+				extra = 0;
+				traceReady = false;
+			}
+		}
+		remainingChars = buf.length();
+
+		// If the end of the file and there is characters in the buffer, process
+		// the remaining trace
+		if ((filePos + remainingChars) >= file.length()
+				&& buf.length() > 0
+				&& !TraceViewerGlobals.getTraceViewer()
+						.getDataProcessorAccess().getFilterProcessor()
+						.isProcessingFilter()) {
+			String traceString = buf.toString();
+			if (canProcessTraces) {
+				processTrace(extra, traceString);
+			}
+			remainingChars = 0;
+		}
+
+		// Copy the remaining characters to the start of the buffer
+		copyRemainingToBufferStart();
+	}
+
+	/**
+	 * Copy remaining characters to the start of the buffer
+	 */
+	private void copyRemainingToBufferStart() {
+		if (remainingChars > 0 && canProcessTraces) {
+			cbuf.position(cbuf.limit() - remainingChars);
+			cbuf.limit(cbuf.limit());
+			tempBuffer.position(0);
+			tempBuffer.limit(MAX_MESSAGE_SIZE);
+			tempBuffer.put(cbuf);
+
+			cbuf.position(0);
+			cbuf.limit(RECEIVE_BUFFER_SIZE);
+			tempBuffer.position(0);
+			tempBuffer.limit(remainingChars);
+
+			cbuf.put(tempBuffer);
+			cbuf.position(remainingChars);
+		} else {
+			remainingChars = 0;
+			cbuf.position(0);
+			cbuf.limit(RECEIVE_BUFFER_SIZE);
+		}
+	}
+
+	/**
+	 * Process trace
+	 * 
+	 * @param extra
+	 *            number of extra linefeed characters to add to file position
+	 * @param traceString
+	 *            trace string
+	 */
+	private void processTrace(int extra, String traceString) {
+		traceCount++;
+		trace = new TraceProperties(traceConfiguration);
+		trace.traceString = traceString;
+		trace.traceNumber = traceCount;
+
+		// Count the file position if trace is dividable by
+		// blockSize
+		if (traceCount % TraceViewerGlobals.blockSize == 1) {
+			fileMap.insert(Long.valueOf(filePos));
+		}
+		filePos += trace.traceString.length() + extra;
+
+		// Check if last trace
+		checkLastTrace();
+
+		mediaCallback.processTrace(trace);
+
+	}
+
+	/**
+	 * Checks if last trace
+	 */
+	private void checkLastTrace() {
+		if (filePos >= file.length()) {
+			trace.lastTrace = true;
+		} else {
+			trace.lastTrace = false;
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.DataReader#pause(boolean)
+	 */
+	public void pause(boolean pause) {
+		paused = pause;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.DataReader#shutdown()
+	 */
+	public void shutdown() {
+		running = false;
+		// Close the stream
+		try {
+			if (input != null) {
+				input.close();
+			}
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.DataReader#setFilePosition(long)
+	 */
+	@Override
+	public void setFilePosition(long filePos) {
+		// Start from the beginning
+		if (filePos == 0) {
+			try {
+				canProcessTraces = false;
+				input.close();
+				this.filePos = 0;
+				remainingChars = 0;
+				fileMap.clearMap();
+				traceCount = 0;
+				cbuf.clear();
+				file = new File(filePath);
+				input = new BufferedReader(new FileReader(file));
+				paused = false;
+			} catch (Exception e) {
+				e.printStackTrace();
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.DataReader#clearFile()
+	 */
+	@Override
+	public void clearFile() {
+		super.clearFile();
+		setFilePosition(0);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.BaseDataReader#createScrollReader(com.nokia
+	 * .traceviewer.engine.MediaCallback,
+	 * com.nokia.traceviewer.engine.TraceConfiguration)
+	 */
+	@Override
+	public DataScrollReader createScrollReader(MediaCallback mediaCallback,
+			TraceConfiguration conf) {
+		return new PlainTextScrollReader(mediaCallback, conf);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.DataReader#isPaused()
+	 */
+	public boolean isPaused() {
+		return paused;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.DataReader#getTracePositionInFile()
+	 */
+	public long getTracePositionInFile() {
+		return filePos;
+	}
+
+	@Override
+	protected byte[] setProtocolSpecificStuffToMultiPartTrace(byte[] byteArr,
+			TraceProperties trace) {
+		// There isn't any multipart traces in plain text
+		return byteArr;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/PlainTextScrollReader.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,374 @@
+/*
+ * 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:
+ *
+ * PlainTextScrollReader class
+ *
+ */
+package com.nokia.traceviewer.engine;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
+/**
+ * PlainText Scroll Reader class
+ * 
+ */
+public class PlainTextScrollReader extends BaseDataReader implements
+		DataScrollReader {
+
+	/**
+	 * Running boolean
+	 */
+	private boolean running;
+
+	/**
+	 * Number of blocks to process when reader is block-reader
+	 */
+	private int numberOfBlocks = 1;
+
+	/**
+	 * Starting offset when reader is block-reader
+	 */
+	private int startReadingTracesFrom;
+
+	/**
+	 * Number of traces read when reader is block-reader
+	 */
+	private int numberOfTracesRead;
+
+	/**
+	 * Indicates that not all traces can be fit in one buffer
+	 */
+	private boolean tracesDontFitInBuffer;
+
+	/**
+	 * Is this reader blocking
+	 */
+	private boolean blocking;
+
+	/**
+	 * Possible middle of line break
+	 */
+	private boolean middleOfLineBreak;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param mediaCallback
+	 *            callback
+	 * @param configuration
+	 *            trace configuration used in this reader
+	 */
+	public PlainTextScrollReader(MediaCallback mediaCallback,
+			TraceConfiguration configuration) {
+		filePath = TraceViewerGlobals.getTraceViewer().getDataReaderAccess()
+				.getCurrentDataReader().getFilePath();
+		createFileChannel();
+		this.mediaCallback = mediaCallback;
+		trace = new TraceProperties(configuration);
+		traceConfiguration = configuration;
+
+		receiveBuffer = ByteBuffer.allocateDirect(RECEIVE_BUFFER_SIZE);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Thread#run()
+	 */
+	@Override
+	public synchronized void run() {
+		try {
+			running = true;
+			receiveBuffer.position(0);
+			while (running) {
+
+				// Set buffer limit
+				if (!tracesDontFitInBuffer) {
+					tracesDontFitInBuffer = setBufferLimit();
+				}
+
+				// Reads data to buffer. ReceiveBuffer position is always zero
+				// here so readBytes will read until the limit or to the end of
+				// file
+				int readBytes = readFile.getChannel().read(receiveBuffer);
+				if (readBytes <= 0) {
+					putToSleep();
+					// If data is found, process buffer
+				} else {
+					// If file is at end, set limit according
+					if (readBytes < receiveBuffer.limit()) {
+						receiveBuffer.limit(readBytes);
+					}
+					// Start processing
+					processBuffer();
+				}
+			}
+		} catch (Throwable t) {
+			t.printStackTrace();
+		}
+	}
+
+	/**
+	 * Sets buffer limit
+	 * 
+	 * @return true if traces fitted into the buffer
+	 * @throws IOException
+	 */
+	private boolean setBufferLimit() throws IOException {
+		boolean tracesDontFitInBuffer = false;
+		FileMap fileMap = TraceViewerGlobals.getTraceViewer()
+				.getDataReaderAccess().getCurrentDataReader().getFileMap();
+		int index = startReadingTracesFrom / TraceViewerGlobals.blockSize;
+
+		// Filemap must have the offset for end trace
+		if (fileMap.size() > index + numberOfBlocks) {
+
+			// Get positions and the difference
+			long pos = readFile.getFilePointer();
+			long pos2 = fileMap.getItem(index + numberOfBlocks).longValue();
+			long limit = pos2 - pos;
+
+			// If difference is smaller than capacity, set as limit
+			if (limit < receiveBuffer.capacity()) {
+				receiveBuffer.limit((int) limit);
+			} else {
+				receiveBuffer.limit(receiveBuffer.capacity());
+				tracesDontFitInBuffer = true;
+			}
+		} else {
+			receiveBuffer.limit(receiveBuffer.capacity());
+			tracesDontFitInBuffer = true;
+		}
+		return tracesDontFitInBuffer;
+	}
+
+	/**
+	 * Process character buffer
+	 */
+	private void processBuffer() {
+		receiveBuffer.position(0);
+		StringBuffer buf = new StringBuffer();
+		boolean traceReady = false;
+
+		// Loop until there is characters left
+		while (receiveBuffer.hasRemaining()) {
+			byte c = receiveBuffer.get();
+
+			// If in the middle of a line break from previous buffer, skip first
+			// character
+			if (middleOfLineBreak && c == '\n' && receiveBuffer.hasRemaining()) {
+				c = receiveBuffer.get();
+			}
+			middleOfLineBreak = false;
+
+			// Check the character
+			switch ((char) c) {
+			case '\n':
+				traceReady = true;
+				break;
+			case '\r':
+				if (!receiveBuffer.hasRemaining()) {
+					middleOfLineBreak = true;
+				} else if (((char) receiveBuffer.get()) == '\n') {
+				} else {
+					receiveBuffer.position(receiveBuffer.position() - 1);
+				}
+				traceReady = true;
+				break;
+			default:
+				buf.append((char) c);
+				traceReady = false;
+			}
+
+			// Trace is ready, insert it
+			if (traceReady) {
+				String traceString = buf.toString();
+				buf.setLength(0);
+				processTrace(traceString);
+				traceReady = false;
+			}
+		}
+
+		// File at end, process last trace
+		try {
+			if (readFile.getFilePointer() >= readFile.length()) {
+				String traceString = buf.toString();
+				buf.setLength(0);
+				processTrace(traceString);
+				traceReady = false;
+			}
+
+			// If data left in buffer, move file backwards the same amount
+			else if (buf.length() > 0) {
+				setFilePosition(readFile.getFilePointer() - buf.length());
+
+			}
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		receiveBuffer.position(0);
+	}
+
+	/**
+	 * Process plain text trace line
+	 * 
+	 * @param traceString
+	 *            trace string
+	 */
+	private void processTrace(String traceString) {
+		numberOfTracesRead++;
+		trace = new TraceProperties(traceConfiguration);
+		trace.traceString = traceString;
+		trace.traceNumber = startReadingTracesFrom + numberOfTracesRead;
+
+		// Not the last trace yet
+		if (!lastTrace()) {
+			trace.lastTrace = false;
+			mediaCallback.processTrace(trace);
+
+			// Last trace
+		} else {
+			tracesDontFitInBuffer = false;
+			trace.lastTrace = true;
+			blocking = true;
+			numberOfTracesRead = 0;
+
+			mediaCallback.processTrace(trace);
+
+			putToSleep();
+		}
+	}
+
+	/**
+	 * Tells if this is the last trace
+	 * 
+	 * @return indication of if this is the last trace or not
+	 */
+	public boolean lastTrace() {
+		boolean lastTrace = false;
+
+		// 1 or 2 blocks read
+		if (numberOfTracesRead >= TraceViewerGlobals.blockSize * numberOfBlocks) {
+			lastTrace = true;
+			// Last block
+		} else if (startReadingTracesFrom + numberOfTracesRead >= TraceViewerGlobals
+				.getTraceViewer().getDataReaderAccess().getCurrentDataReader()
+				.getTraceCount()) {
+			lastTrace = true;
+		}
+		return lastTrace;
+	}
+
+	/**
+	 * Puts this thread to sleep
+	 */
+	public void putToSleep() {
+		try {
+			// Null variables if this reader is only for blocks
+			if (TraceViewerGlobals.getTraceViewer().getStateHolder()
+					.isScrolling()) {
+				numberOfTracesRead = 0;
+				receiveBuffer.limit(receiveBuffer.capacity());
+				receiveBuffer.position(receiveBuffer.capacity());
+			}
+			if (blocking) {
+				this.notifyAll();
+				this.wait();
+			}
+
+		} catch (InterruptedException e) {
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.DataReader#shutdown()
+	 */
+	public void shutdown() {
+		running = false;
+		try {
+			sourceChannel.close();
+			readFile.close();
+		} catch (IOException e) {
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.DataScrollReader#setBlockReader(int,
+	 * int, boolean)
+	 */
+	public void setBlockReader(int numberOfBlocks, int startingTrace,
+			boolean blocking) {
+		this.numberOfBlocks = numberOfBlocks;
+		this.startReadingTracesFrom = startingTrace;
+		this.blocking = blocking;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.DataScrollReader#setFilePosition(long)
+	 */
+	@Override
+	public void setFilePosition(long filePos) {
+		try {
+			readFile.seek(filePos);
+
+			if (filePos == fileStartOffset) {
+				receiveBuffer.limit(receiveBuffer.capacity());
+				receiveBuffer.position(receiveBuffer.capacity());
+			}
+
+		} catch (IOException e) {
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.DataReader#pause(boolean)
+	 */
+	public void pause(boolean pause) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.DataReader#isPaused()
+	 */
+	public boolean isPaused() {
+		return false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.DataReader#getTracePositionInFile()
+	 */
+	public long getTracePositionInFile() {
+		return 0;
+	}
+
+	@Override
+	protected byte[] setProtocolSpecificStuffToMultiPartTrace(byte[] byteArr,
+			TraceProperties trace) {
+		// There isn't any multipart traces in plain text
+		return byteArr;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/StateHolder.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,104 @@
+/*
+ * 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:
+ *
+ * State Holder class
+ *
+ */
+package com.nokia.traceviewer.engine;
+
+/**
+ * Holds view's states
+ */
+public class StateHolder {
+
+	/**
+	 * Enum indicating the current state of the view
+	 */
+	public enum State {
+
+		/**
+		 * Scrolling with scrollbar
+		 */
+		SCROLLING_WITH_SCROLLBAR,
+
+		/**
+		 * Scrolling with arrow keys
+		 */
+		SCROLLING_WITH_ARROWS,
+
+		/**
+		 * Scrolling with page up / down
+		 */
+		SCROLLING_WITH_PAGEUPDOWN,
+
+		/**
+		 * Searching
+		 */
+		SEARCHING,
+
+		/**
+		 * Search completed
+		 */
+		SEARCHED,
+
+		/**
+		 * Normal state
+		 */
+		NORMAL;
+	}
+
+	/**
+	 * Current state
+	 */
+	private State state;
+
+	/**
+	 * Get state
+	 * 
+	 * @return current state
+	 */
+	public State getState() {
+		return state;
+	}
+
+	/**
+	 * Set state
+	 * 
+	 * @param state
+	 *            state to set
+	 */
+	public void setState(State state) {
+		this.state = state;
+	}
+
+	/**
+	 * Tells if scrolling or not
+	 * 
+	 * @return scrolling or not
+	 */
+	public boolean isScrolling() {
+		boolean scrolling;
+		if (state == State.SCROLLING_WITH_SCROLLBAR
+				|| state == State.SCROLLING_WITH_ARROWS
+				|| state == State.SCROLLING_WITH_PAGEUPDOWN
+				|| state == State.SEARCHING || state == State.SEARCHED) {
+			scrolling = true;
+		} else {
+			scrolling = false;
+		}
+		return scrolling;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/TraceConfiguration.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,155 @@
+/*
+ * 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:
+ *
+ * Trace Configuration class
+ *
+ */
+package com.nokia.traceviewer.engine;
+
+/**
+ * Trace Configuration class
+ * 
+ */
+public class TraceConfiguration {
+
+	/**
+	 * This trace is from scroller datareader. IMPORTANT: While scrolling, UI
+	 * thread is put to wait until the trace block is read. This means that you
+	 * cannot syncExec to the display when scrolled traces are coming. If you do
+	 * so, the UI will block forever!
+	 */
+	private boolean scrolledTrace;
+
+	/**
+	 * This trace is filtered out -> don't show it. Can only be set true if
+	 * filtering is actually enabled and datareaders are reading the filtered
+	 * trace file.
+	 */
+	private boolean filteredOut;
+
+	/**
+	 * Start trigger is not found yet -> don't show this trace in the view. Can
+	 * only be set true if triggering is actually enabled.
+	 */
+	private boolean triggeredOut;
+
+	/**
+	 * Show this trace in the view. If set to false, trace won't be processed by
+	 * the view. However, if this is used as a filter, it will mess up the
+	 * scrolling in the view. This should be only used when processing data that
+	 * is already in the view
+	 */
+	private boolean showInView = true;
+
+	/**
+	 * This trace is read from filter file.
+	 */
+	private boolean readFromFilterFile;
+
+	/**
+	 * Gets scrolled trace status
+	 * 
+	 * @return true if this trace is a scrolled trace
+	 */
+	public boolean isScrolledTrace() {
+		return scrolledTrace;
+	}
+
+	/**
+	 * Sets scrolled trace status
+	 * 
+	 * @param scrolledTrace
+	 */
+	public void setScrolledTrace(boolean scrolledTrace) {
+		this.scrolledTrace = scrolledTrace;
+	}
+
+	/**
+	 * Gets filtered status
+	 * 
+	 * @return filtering status
+	 */
+	public boolean isFilteredOut() {
+		return filteredOut;
+	}
+
+	/**
+	 * Sets filtered status
+	 * 
+	 * @param filtered
+	 *            filtering status
+	 */
+	public void setFilteredOut(boolean filtered) {
+		this.filteredOut = filtered;
+	}
+
+	/**
+	 * Gets triggered out status
+	 * 
+	 * @return triggered out status
+	 */
+	public boolean isTriggeredOut() {
+		return triggeredOut;
+	}
+
+	/**
+	 * Sets triggered status
+	 * 
+	 * @param triggered
+	 *            triggering status
+	 */
+	public void setTriggeredOut(boolean triggered) {
+		this.triggeredOut = triggered;
+	}
+
+	/**
+	 * Gets readFromFilterFile status
+	 * 
+	 * @return readFromFilterFile status
+	 */
+	public boolean isReadFromFilterFile() {
+		return readFromFilterFile;
+	}
+
+	/**
+	 * Sets readFromFilterFile status
+	 * 
+	 * @param readFromFilterFile
+	 *            status
+	 */
+	public void setReadFromFilterFile(boolean readFromFilterFile) {
+		this.readFromFilterFile = readFromFilterFile;
+	}
+
+	/**
+	 * Gets showInView status
+	 * 
+	 * @return the showInView
+	 */
+	public boolean isShowInView() {
+		return showInView;
+	}
+
+	/**
+	 * Sets showInView status
+	 * 
+	 * @param showInView
+	 *            the showInView to set
+	 */
+	public void setShowInView(boolean showInView) {
+		this.showInView = showInView;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/TraceFetcher.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,168 @@
+/*
+ * 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:
+ *
+ * Trace Fetcher gets traces from file to a arraylist and returns it
+ *
+ */
+package com.nokia.traceviewer.engine;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.nokia.traceviewer.engine.DataReader;
+import com.nokia.traceviewer.engine.MediaCallback;
+import com.nokia.traceviewer.engine.TraceProperties;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Trace Fetcher gets traces from file to a arraylist and returns it
+ */
+public final class TraceFetcher implements MediaCallback {
+
+	/**
+	 * Max number of traces to get
+	 */
+	private static int MAX_TRACES_TO_GET = TraceViewerGlobals.blockSize * 5;
+
+	/**
+	 * Array to gather traces to
+	 */
+	private List<TraceProperties> traceArray;
+
+	/**
+	 * Tells how many traces to drop from the beginning
+	 */
+	private int tracesToDrop;
+
+	/**
+	 * Tells how many traces to get totally
+	 */
+	private int tracesToGet;
+
+	/**
+	 * Trace count by this far
+	 */
+	private int traceCount;
+
+	/**
+	 * Data reader
+	 */
+	private DataScrollReader dataReader;
+
+	/**
+	 * Constructor
+	 */
+	public TraceFetcher() {
+		traceCount = 0;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.MediaCallback#processTrace(com.nokia.traceviewer
+	 * .engine.TraceProperties)
+	 */
+	public void processTrace(TraceProperties properties) {
+		traceCount++;
+		int tracesSaved = traceCount - tracesToDrop;
+
+		// Save traces we want to trace array
+		if (traceCount > tracesToDrop && tracesSaved <= tracesToGet) {
+			traceArray.add(properties);
+		}
+	}
+
+	/**
+	 * Starts gathering traces
+	 * 
+	 * @param start
+	 *            start trace
+	 * @param end
+	 *            end trace
+	 * @return the trace array or null if there is no current data reader
+	 */
+	public List<TraceProperties> startGatheringData(int start, int end) {
+		traceArray = null;
+
+		// Check that current data reader exists
+		DataReader currentDataReader = TraceViewerGlobals.getTraceViewer()
+				.getDataReaderAccess().getCurrentDataReader();
+
+		if (currentDataReader != null) {
+
+			// Get the file position having given offset
+			int index = currentDataReader.getFileMap()
+					.getIndexFromOffset(start);
+			long pos = currentDataReader.getFileMap().getItem(index)
+					.longValue();
+			int startTrace = index * TraceViewerGlobals.blockSize;
+
+			// Calculate how many traces to drop from start
+			traceCount = 0;
+			tracesToDrop = start - startTrace;
+			tracesToGet = end - start + 1;
+			if (tracesToGet > MAX_TRACES_TO_GET) {
+				tracesToGet = MAX_TRACES_TO_GET;
+			}
+
+			// Number of blocks
+			int numberOfBlocks = (tracesToGet / TraceViewerGlobals.blockSize);
+
+			// If modulo is not zero, we will need one block more
+			if (tracesToGet % TraceViewerGlobals.blockSize != 0) {
+				numberOfBlocks++;
+			}
+
+			// If We are dropping traces from the first block we are reading, we
+			// might need to take one block more
+			if (numberOfBlocks * TraceViewerGlobals.blockSize - tracesToDrop < tracesToGet) {
+				numberOfBlocks++;
+			}
+
+			traceArray = new ArrayList<TraceProperties>();
+
+			// Create own data reader if it doesn't exist and start it. Put it
+			// to blocking mode.
+			dataReader = TraceViewerGlobals.getTraceViewer()
+					.getDataReaderAccess().startOwnDataReader(dataReader, this,
+							numberOfBlocks, pos, startTrace, true);
+		}
+		return traceArray;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.MediaCallback#endOfFile(com.nokia.traceviewer
+	 * .engine.DataReader)
+	 */
+	public void endOfFile(DataReader reader) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.MediaCallback#dataHandleChanged()
+	 */
+	public void dataHandleChanged() {
+		if (dataReader != null) {
+			dataReader.shutdown();
+			dataReader = null;
+		}
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/TraceFileHandler.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,41 @@
+/*
+ * 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:
+ *
+ * Trace file handler interface
+ *
+ */
+package com.nokia.traceviewer.engine;
+
+/**
+ * Trace file handler interface
+ * 
+ */
+public interface TraceFileHandler {
+
+	/**
+	 * Clears the file
+	 */
+	public void clearFile();
+
+	/**
+	 * Closes the file
+	 */
+	public void closeFile();
+
+	/**
+	 * Opens the file
+	 */
+	public void openFile();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/TraceInformation.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,112 @@
+/*
+ * 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:
+ *
+ * Trace Information contains ID's to identify this trace
+ *
+ */
+package com.nokia.traceviewer.engine;
+
+/**
+ * Trace Information contains ID's to identify this trace
+ * 
+ */
+public class TraceInformation {
+
+	/**
+	 * Component Id
+	 */
+	private int componentId;
+
+	/**
+	 * Group Id
+	 */
+	private int groupId;
+
+	/**
+	 * Trace Id
+	 */
+	private int traceId;
+
+	/**
+	 * Gets component Id
+	 * 
+	 * @return the componentId
+	 */
+	public int getComponentId() {
+		return componentId;
+	}
+
+	/**
+	 * Sets component Id
+	 * 
+	 * @param componentId
+	 *            the componentId to set
+	 */
+	public void setComponentId(int componentId) {
+		this.componentId = componentId;
+	}
+
+	/**
+	 * Gets group Id
+	 * 
+	 * @return the groupId
+	 */
+	public int getGroupId() {
+		return groupId;
+	}
+
+	/**
+	 * Sets group Id
+	 * 
+	 * @param groupId
+	 *            the groupId to set
+	 */
+	public void setGroupId(int groupId) {
+		this.groupId = groupId;
+	}
+
+	/**
+	 * Gets trace Id
+	 * 
+	 * @return the traceId
+	 */
+	public int getTraceId() {
+		return traceId;
+	}
+
+	/**
+	 * Sets trace Id
+	 * 
+	 * @param traceId
+	 *            the traceId to set
+	 */
+	public void setTraceId(int traceId) {
+		this.traceId = traceId;
+	}
+
+	/**
+	 * Tells is this Trace Information defined
+	 * 
+	 * @return true if trace information is defined
+	 */
+	public boolean isDefined() {
+		boolean isDefined = false;
+		if (componentId != 0 || groupId != 0 || traceId != 0) {
+			isDefined = true;
+		}
+		return isDefined;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/TraceMetaData.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,148 @@
+/*
+ * 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:
+ *
+ * Trace Metadata contains metadata for this trace
+ *
+ */
+package com.nokia.traceviewer.engine;
+
+import java.util.HashMap;
+
+/**
+ * Trace Metadata contains metadata for this trace
+ * 
+ */
+public class TraceMetaData {
+
+	/**
+	 * Path to this trace
+	 */
+	private String path;
+
+	/**
+	 * Line number where trace is defined
+	 */
+	private int lineNumber;
+
+	/**
+	 * Class name
+	 */
+	private String className;
+
+	/**
+	 * Method name
+	 */
+	private String methodName;
+
+	/**
+	 * Metadata
+	 */
+	private HashMap<String, HashMap<String, Object>> metaData;
+
+	/**
+	 * Gets the line number
+	 * 
+	 * @return the lineNumber
+	 */
+	public int getLineNumber() {
+		return lineNumber;
+	}
+
+	/**
+	 * Sets the line number
+	 * 
+	 * @param lineNumber
+	 *            the lineNumber to set
+	 */
+	public void setLineNumber(int lineNumber) {
+		this.lineNumber = lineNumber;
+	}
+
+	/**
+	 * Gets the path
+	 * 
+	 * @return the path
+	 */
+	public String getPath() {
+		return path;
+	}
+
+	/**
+	 * Sets the path
+	 * 
+	 * @param path
+	 *            the path to set
+	 */
+	public void setPath(String path) {
+		this.path = path;
+	}
+
+	/**
+	 * Gets class name
+	 * 
+	 * @return the className
+	 */
+	public String getClassName() {
+		return className;
+	}
+
+	/**
+	 * Sets class name
+	 * 
+	 * @param className
+	 *            the className to set
+	 */
+	public void setClassName(String className) {
+		this.className = className;
+	}
+
+	/**
+	 * Gets method name
+	 * 
+	 * @return the method Name
+	 */
+	public String getMethodName() {
+		return methodName;
+	}
+
+	/**
+	 * Sets method name
+	 * 
+	 * @param methodName
+	 *            the methodName to set
+	 */
+	public void setMethodName(String methodName) {
+		this.methodName = methodName;
+	}
+
+	/**
+	 * Gets metadata map
+	 * 
+	 * @return the metaData map
+	 */
+	public HashMap<String, HashMap<String, Object>> getMetaData() {
+		return metaData;
+	}
+
+	/**
+	 * Sets metadata map
+	 * 
+	 * @param metaData
+	 *            the metaData map
+	 */
+	public void setMetaData(HashMap<String, HashMap<String, Object>> metaData) {
+		this.metaData = metaData;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/TraceProperties.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,128 @@
+/*
+ * 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:
+ *
+ * Trace Properties
+ *
+ */
+package com.nokia.traceviewer.engine;
+
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+
+/**
+ * Trace Properties
+ */
+public class TraceProperties {
+
+	/**
+	 * Constructor
+	 * 
+	 * @param configuration
+	 *            trace configuration
+	 */
+	public TraceProperties(TraceConfiguration configuration) {
+		this.traceConfiguration = configuration;
+		bTraceInformation = new BTraceInformation();
+		information = new TraceInformation();
+		parameters = new ArrayList<String>();
+	}
+
+	/**
+	 * Tells that this trace is binary and should be decoded
+	 */
+	public boolean binaryTrace;
+
+	/**
+	 * Tells that this is the last trace of the file or the trace block
+	 */
+	public boolean lastTrace;
+
+	/**
+	 * Message start offset in the byte buffer
+	 */
+	public int messageStart;
+
+	/**
+	 * Message length
+	 */
+	public int messageLength;
+
+	/**
+	 * Data start offset in the byte buffer
+	 */
+	public int dataStart;
+
+	/**
+	 * Data length
+	 */
+	public int dataLength;
+
+	/**
+	 * Trace number in the file
+	 */
+	public int traceNumber;
+
+	/**
+	 * Pointer to bytebuffer where trace is
+	 */
+	public ByteBuffer byteBuffer;
+
+	/**
+	 * Timestamp of the trace in nanoseconds
+	 */
+	public long timestamp;
+
+	/**
+	 * Time from previous trace in milliseconds. 0 if not available.
+	 */
+	public long timeFromPreviousTrace;
+
+	/**
+	 * Decoded trace string
+	 */
+	public String traceString;
+
+	/**
+	 * Comment for the trace
+	 */
+	public String traceComment;
+
+	/**
+	 * Decoded timestamp string in format HH:mm:ss.SSS[SSS] depending if the
+	 * chosen timestamp accuracy is milliseconds or microseconds
+	 */
+	public String timestampString;
+
+	/**
+	 * Trace configuration. Do not change the values if you don't know what you
+	 * are doing!
+	 */
+	public TraceConfiguration traceConfiguration;
+
+	/**
+	 * Trace information used to get metadata when needed from model
+	 */
+	public TraceInformation information;
+
+	/**
+	 * BTrace information containing for example Thread ID
+	 */
+	public BTraceInformation bTraceInformation;
+
+	/**
+	 * Decoded trace parameters as String
+	 */
+	public ArrayList<String> parameters;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/TraceProvider.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,115 @@
+/*
+ * 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:
+ *
+ * TraceProvider provides traces to the TraceViewer engine
+ *
+ */
+package com.nokia.traceviewer.engine;
+
+import java.nio.channels.ByteChannel;
+
+/**
+ * TraceProvider interface
+ */
+public interface TraceProvider {
+
+	/**
+	 * Requests TraceProvider to send an activate message to the device using
+	 * given component ID and array of group IDs.
+	 * 
+	 * @param activate
+	 *            if true, given groups should be activated. If false, given
+	 *            groups should be deactivated.
+	 * @param overWrite
+	 *            If true, all other groups not listed in groupsIds array are
+	 *            deactivated. Has only effect if activate boolean is also true.
+	 * @param componentId
+	 *            component ID
+	 * @param groupIds
+	 *            array of group IDs
+	 */
+	public void activate(boolean activate, boolean overWrite, int componentId,
+			int[] groupIds);
+
+	/**
+	 * Checks if file format seems to match to this TraceProvider
+	 * 
+	 * @param filePath
+	 *            file path
+	 * @return true if file format seems to match to this TraceProvider
+	 */
+	public boolean checkIfFileFormatMatches(String filePath);
+
+	/**
+	 * Creates and returns new data reader
+	 * 
+	 * @param callback
+	 *            callback to return traces to
+	 * @param conf
+	 *            trace configuration to use in the reader
+	 * @return new data reader
+	 */
+	public DataReader createDataReader(MediaCallback callback,
+			TraceConfiguration conf);
+
+	/**
+	 * Creates and returns data writer
+	 * 
+	 * @param writeChannel
+	 *            write channel to write to
+	 * @return the newly created data writer
+	 */
+	public DataWriter createDataWriter(ByteChannel writeChannel);
+
+	/**
+	 * Gets connection handler for this TraceProvider
+	 * 
+	 * @return connection handler
+	 */
+	public Connection getConnectionHandler();
+
+	/**
+	 * Gets name of the TraceProvider
+	 * 
+	 * @return the name of the TraceProvider
+	 */
+	public String getName();
+
+	/**
+	 * Gets preferred connection type for this TraceProvider. Types are taken
+	 * from com.nokia.traceviewer.engine.preferences.PreferenceConstants.java
+	 * 
+	 * @return preferred connection type
+	 */
+	public String getPreferredConnectionType();
+
+	/**
+	 * Sends message to the device. Adds header to the message with given
+	 * message ID
+	 * 
+	 * @param message
+	 *            the message
+	 * @param addHeader
+	 *            if true, protocol header should be added to the message before
+	 *            sending
+	 * @param messageId
+	 *            message ID
+	 * @param changeMediaType
+	 *            if true, media type should be changed to the selected one from
+	 *            the message. If addHeader is true, this is automatically done.
+	 */
+	public void sendMessage(byte[] message, boolean addHeader, byte messageId,
+			boolean changeMediaType);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/TraceViewer.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,747 @@
+/*
+ * 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:
+ *
+ * A singleton access point to functionality of Trace Viewer
+ *
+ */
+package com.nokia.traceviewer.engine;
+
+import java.util.List;
+
+import com.nokia.carbide.cpp.internal.featureTracker.FeatureUseTrackerConsts;
+import com.nokia.carbide.cpp.internal.featureTracker.FeatureUseTrackerPlugin;
+import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator;
+import com.nokia.carbide.remoteconnections.interfaces.IConnection;
+import com.nokia.carbide.remoteconnections.internal.api.IConnection2;
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.action.OpenDecodeFileInStartupHandler;
+import com.nokia.traceviewer.action.ReloadDecodeFilesAction;
+import com.nokia.traceviewer.engine.dataprocessor.DataProcessor;
+import com.nokia.traceviewer.engine.preferences.PreferenceConstants;
+import com.nokia.traceviewer.engine.preferences.XMLGeneralConfigurationExporter;
+import com.nokia.traceviewer.engine.preferences.XMLGeneralConfigurationImporter;
+import com.nokia.traceviewer.internal.api.TraceViewerAPI2Impl;
+
+/**
+ * A singleton access point to functionality of Trace Viewer
+ * 
+ */
+final class TraceViewer implements TraceViewerInterface, MediaCallback {
+
+	/**
+	 * Default file name
+	 */
+	private final String DEFAULT_FILE_NAME = Messages
+			.getString("TraceViewer.DefaultFileName"); //$NON-NLS-1$
+
+	/**
+	 * Default file path
+	 */
+	private final String DEFAULT_FILE_PATH = TraceViewerPlugin.getDefault()
+			.getStateLocation().append(DEFAULT_FILE_NAME).toOSString();
+
+	/**
+	 * Data Processor Access
+	 */
+	private DataProcessorAccess dataProcessorAccess;
+
+	/**
+	 * Data Reader Access
+	 */
+	private DataReaderAccess dataReaderAccess;
+
+	/**
+	 * Interface to the view
+	 */
+	private TraceViewerTraceViewInterface view;
+
+	/**
+	 * Interface to the dialogs. Initialize with dummy class.
+	 */
+	private TraceViewerDialogInterface dialogs = new DummyDialogs();
+
+	/**
+	 * Interface to trace file handler. Initialize with internal file handler.
+	 */
+	private TraceFileHandler fileHandler = new InternalFileHandler(
+			DEFAULT_FILE_PATH);
+
+	/**
+	 * Interface to the propertyview
+	 */
+	private TraceViewerPropertyViewInterface propertyView;
+
+	/**
+	 * Event listener that listens events from EventRouter
+	 */
+	private TraceViewerEventListener eventListener;
+
+	/**
+	 * Interface to the connection
+	 */
+	private Connection connection;
+
+	/**
+	 * TraceViewer stateHolder
+	 */
+	private StateHolder stateHolder;
+
+	/**
+	 * Trace Provider in use
+	 */
+	private TraceProvider provider;
+
+	/**
+	 * Decode Provider
+	 */
+	private DecodeProvider decodeProvider;
+
+	/**
+	 * Indicates that filter progressbar can be closed when currentDataReader
+	 * says EOF next time
+	 */
+	private boolean closeFilterProgressBar;
+
+	/**
+	 * Trace fetcher
+	 */
+	private TraceFetcher traceFetcher;
+
+	/**
+	 * Currently open connection
+	 */
+	private IConnection currentlyOpenConnection;
+
+	/**
+	 * Current connection status listener
+	 */
+	private ConnectionStatusListener currentConnectionStatusListener;
+
+	/**
+	 * Gets the trace viewer interface
+	 * 
+	 * @return this object
+	 */
+	TraceViewerInterface getTraceViewer() {
+		return this;
+	}
+
+	/**
+	 * Sets trace provider
+	 * 
+	 * @param newProvider
+	 *            new trace provider
+	 * @param clearDataBefore
+	 *            if true, clear data file before changing the new provider
+	 */
+	public void setTraceProvider(TraceProvider newProvider,
+			boolean clearDataBefore) {
+		// First provider, set as default
+		if (this.provider == null) {
+			this.provider = newProvider;
+
+			// Create main file
+			createMainFile();
+			initializeAfterProvider();
+
+			// Check if new provider is selected and not in use already. If yes,
+			// set as default.
+		} else if (newProvider.getName().equals(
+				TraceViewerPlugin.getDefault().getPreferenceStore().getString(
+						PreferenceConstants.DATA_FORMAT))
+				&& this.provider != newProvider) {
+
+			this.provider = newProvider;
+
+			// Clear old data file
+			if (clearDataBefore) {
+				clearAllData();
+			}
+
+			initializeAfterProvider();
+		}
+	}
+
+	/**
+	 * Initialize TraceViewer when Trace Provider has changed
+	 */
+	private void initializeAfterProvider() {
+		// Empty views
+		TraceViewerGlobals.getTraceViewer().emptyViews();
+
+		// Provider is alive, data reader can now be created
+		dataReaderAccess.createMainDataReader();
+
+		// If filtering is on and TraceProvider changes, create a new Filter
+		// Data Reader to be able to decode the new data
+		if (dataProcessorAccess.getFilterProcessor().isFiltering()) {
+			dataReaderAccess.createFilterDataReader();
+		}
+	}
+
+	/**
+	 * Gets trace provider
+	 * 
+	 * @return trace provider
+	 */
+	public TraceProvider getTraceProvider() {
+		return provider;
+	}
+
+	/**
+	 * Sets decode provider
+	 * 
+	 * @param decodeProvider
+	 */
+	public void setDecodeProvider(DecodeProvider decodeProvider) {
+		this.decodeProvider = decodeProvider;
+
+		// Set decode provider to show or not show class and function names
+		// before the trace text
+		boolean showClassFunctionName = TraceViewerPlugin.getDefault()
+				.getPreferenceStore().getBoolean(
+						PreferenceConstants.SHOW_CLASS_FUNCTION_NAME_CHECKBOX);
+		boolean showComponentGroupName = TraceViewerPlugin.getDefault()
+				.getPreferenceStore().getBoolean(
+						PreferenceConstants.SHOW_COMPONENT_GROUP_NAME_CHECKBOX);
+		decodeProvider.setAddPrefixesToTrace(showClassFunctionName,
+				showComponentGroupName);
+	}
+
+	/**
+	 * Gets decode provider
+	 * 
+	 * @return decode provider
+	 */
+	public DecodeProvider getDecodeProvider() {
+		return decodeProvider;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.TraceViewerInterface#getConnection()
+	 */
+	public Connection getConnection() {
+		return connection;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.TraceViewerInterface#getDataProcessorAccess
+	 * ()
+	 */
+	public DataProcessorAccess getDataProcessorAccess() {
+		return dataProcessorAccess;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.TraceViewerInterface#getDataReaderAccess()
+	 */
+	public DataReaderAccess getDataReaderAccess() {
+		return dataReaderAccess;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.TraceViewerInterface#getStateHolder()
+	 */
+	public StateHolder getStateHolder() {
+		return stateHolder;
+	}
+
+	/**
+	 * Starts TraceViewer.
+	 */
+	void start() {
+		// Create DataProcessors
+		dataProcessorAccess = new DataProcessorAccess();
+		dataProcessorAccess.createDataProcessors();
+
+		stateHolder = new StateHolder();
+
+		// Create Data Reader Access class
+		dataReaderAccess = new DataReaderAccess(this, DEFAULT_FILE_PATH);
+
+		// Start listening events from the event router
+		eventListener = new TraceViewerEventListener();
+		eventListener.register();
+
+		// Create "current connection" listener
+		ConnectionChangedListener connectionListener = new ConnectionChangedListener();
+		RemoteConnectionsActivator.getConnectionsManager()
+				.addConnectionListener(connectionListener);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @seecom.nokia.traceviewer.engine.TraceViewerInterface#setTraceView(
+	 * TraceViewerTraceViewInterface)
+	 */
+	public void setTraceView(TraceViewerTraceViewInterface newView) {
+		if (view == null || view.isDisposed()) {
+
+			// If old view is disposed but not null, remove it from the list
+			if (view != null) {
+				dataProcessorAccess.getDataProcessorList().remove(view);
+			}
+
+			view = newView;
+
+			// Add view to DataProcessor list
+			dataProcessorAccess.addTraceViewToList((DataProcessor) newView);
+
+			if (view != null) {
+
+				// View has notified about himself, we can import old
+				// configurations which require view
+				dataProcessorAccess.importConfiguration();
+
+				// Import general settings
+				XMLGeneralConfigurationImporter importer = new XMLGeneralConfigurationImporter(
+						TraceViewerPlugin.getDefault().getPreferenceStore()
+								.getString(
+										PreferenceConstants.CONFIGURATION_FILE),
+						true);
+				importer.importData();
+
+				// Clear data when view comes visible. This is to ensure that
+				// view is in sync with the data file.
+				clearAllData();
+
+				// Open possible previous decode files
+				new OpenDecodeFileInStartupHandler().start();
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @seecom.nokia.traceviewer.engine.TraceViewerInterface#setPropertyView(
+	 * TraceViewerPropertyViewInterface)
+	 */
+	public void setPropertyView(TraceViewerPropertyViewInterface newView) {
+		if (propertyView == null || propertyView.isDisposed()) {
+
+			// If old one is disposed but not null, remove it from the list
+			if (propertyView != null) {
+				dataProcessorAccess.getDataProcessorList().remove(propertyView);
+			}
+
+			this.propertyView = newView;
+
+			// Add view to DataProcessor list
+			dataProcessorAccess.addTraceViewToList((DataProcessor) newView);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @seecom.nokia.traceviewer.engine.TraceViewerInterface#setDialogs(
+	 * TraceViewerDialogInterface)
+	 */
+	public void setDialogs(TraceViewerDialogInterface dialogs) {
+		this.dialogs = dialogs;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.MediaCallback#processTrace(com.nokia.traceviewer
+	 * .engine.TraceProperties)
+	 */
+	public void processTrace(TraceProperties properties) {
+		// Loop through DataProcessors
+		List<DataProcessor> dataProcessors = dataProcessorAccess
+				.getDataProcessorList();
+		for (int i = 0; i < dataProcessors.size(); i++) {
+			dataProcessors.get(i).processData(properties);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.MediaCallback#endOfFile()
+	 */
+	public void endOfFile(DataReader reader) {
+		// If everything is not shown, show it
+		if (((view != null && view.hasUnshownData()) || (propertyView != null && propertyView
+				.hasUnshownData()))) {
+			if (reader == dataReaderAccess.getCurrentDataReader()) {
+				if (view != null) {
+					view.update();
+				}
+				if (propertyView != null) {
+					propertyView.updatePropertyTables();
+				}
+			} else {
+				// Nothing
+			}
+		}
+
+		// Plain text filter file must be flushed
+		if (reader instanceof PlainTextReader
+				&& (reader == dataReaderAccess.getMainDataReader())) {
+			dataProcessorAccess.getFilterProcessor().flush();
+		}
+
+		// If processing something with the progressbar, close it
+		if ((reader == dataReaderAccess.getMainDataReader())
+				&& (dataProcessorAccess.processingWithProgressBar())) {
+			if (!dataProcessorAccess.getFilterProcessor().isFiltering()) {
+				dataProcessorAccess.closeProgressBar();
+				// Filtering and main data reader is in the end. Next time
+				// current data reader is in the end, progressbar can be closed
+			} else {
+				closeFilterProgressBar = true;
+			}
+		}
+
+		// Close filter progressBar when current data reader is in the end after
+		// first the main data reader is in the end
+		if (closeFilterProgressBar
+				&& reader == dataReaderAccess.getCurrentDataReader()) {
+			dataProcessorAccess.closeProgressBar();
+			closeFilterProgressBar = false;
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.MediaCallback#dataHandleChanged()
+	 */
+	public void dataHandleChanged() {
+		// No need to do anything because main and current reader are handled
+		// already in DataReaderAccess
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.TraceViewerInterface#connect()
+	 */
+	public boolean connect() {
+		boolean success = false;
+
+		ConnectionCreator creator = new ConnectionCreator(DEFAULT_FILE_PATH);
+		connection = creator.getConnection();
+
+		if (connection != null) {
+
+			// Open file
+			fileHandler.openFile();
+
+			// Try to connect
+			success = connection.connect();
+		}
+
+		// Check if connection succeeded
+		if (success) {
+
+			currentlyOpenConnection = ConnectionHelper.currentEnsuredConnection;
+
+			// If Ensured connection was not found, try with current ID
+			if (currentlyOpenConnection == null) {
+				currentlyOpenConnection = ConnectionHelper
+						.getConnectionWithCurrentID();
+			}
+
+			// Set connection to use mode
+			if (currentlyOpenConnection != null) {
+				currentlyOpenConnection.useConnection(true);
+
+				// Add status listener to the connection
+				if (currentlyOpenConnection instanceof IConnection2) {
+					currentConnectionStatusListener = new ConnectionStatusListener();
+					((IConnection2) currentlyOpenConnection)
+							.addStatusChangedListener(currentConnectionStatusListener);
+				}
+
+				// Notifying possible clients interested in connect event
+				TraceViewerAPI2Impl.notifyConnection(currentlyOpenConnection);
+			}
+
+			// Start using feature
+			FeatureUseTrackerPlugin.getFeatureUseProxy().startUsingFeature(
+					FeatureUseTrackerConsts.CARBIDE_OST_TRACE);
+
+			// Connection failed, set internal file handler back
+		} else {
+			fileHandler = new InternalFileHandler(DEFAULT_FILE_PATH);
+		}
+
+		return success;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.TraceViewerInterface#disconnect()
+	 */
+	public boolean disconnect() {
+		boolean success = false;
+
+		// Disconnect and set internal file handler
+		success = disconnectAndSetFileHandler();
+
+		// Notifying possible clients interested in disconnect event
+		if (success) {
+			TraceViewerAPI2Impl.notifyDisconnection();
+		}
+
+		return success;
+	}
+
+	/**
+	 * Create the main trace file
+	 */
+	private void createMainFile() {
+		// Open the file and clear it
+		fileHandler.openFile();
+		fileHandler.clearFile();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.TraceViewerInterface#shutdown()
+	 */
+	public void shutdown() {
+		// Disconnect
+		disconnect();
+
+		// Flush logger
+		dataProcessorAccess.getLogger().flush();
+
+		// Dispose search dialog
+		dataProcessorAccess.getSearchProcessor().disposeSearchDialog();
+
+		// Stop Dictionary file changed listener
+		if (view != null) {
+			((ReloadDecodeFilesAction) (view.getActionFactory()
+					.getReloadDecodeFilesAction())).stopFileMonitor();
+		}
+
+		// Clear data
+		clearAllData();
+
+		// Unregister event listener
+		eventListener.unregister();
+
+		// Export general configurations
+		if (TraceViewerPlugin.getDefault().getPreferenceStore().getString(
+				PreferenceConstants.CONFIGURATION_FILE).equals(
+				PreferenceConstants.DEFAULT_CONFIGURATION_FILE)
+				&& view != null) {
+
+			XMLGeneralConfigurationExporter exporter = new XMLGeneralConfigurationExporter(
+					TraceViewerPlugin.getDefault().getPreferenceStore()
+							.getString(PreferenceConstants.CONFIGURATION_FILE),
+					true);
+			exporter.export();
+		} // noelse, don't export to elsewhere than default configuration file
+
+		setTraceView(null);
+	}
+
+	/**
+	 * Disconnects and sets internal file handler
+	 * 
+	 * @return true if disconnected
+	 */
+	private boolean disconnectAndSetFileHandler() {
+		boolean success = false;
+
+		// Disconnect and close the file
+		if (connection != null) {
+			connection.disconnect();
+			fileHandler.closeFile();
+			connection = null;
+
+			// Set internal file handler back
+			fileHandler = new InternalFileHandler(DEFAULT_FILE_PATH);
+			success = true;
+
+			// Set connection to free mode
+			if (currentlyOpenConnection != null) {
+				currentlyOpenConnection.useConnection(false);
+
+				// Remove status listener from the connection
+				if (currentlyOpenConnection instanceof IConnection2) {
+					((IConnection2) currentlyOpenConnection)
+							.removeStatusChangedListener(currentConnectionStatusListener);
+				}
+			}
+		}
+
+		// Stop using feature
+		FeatureUseTrackerPlugin.getFeatureUseProxy().stopUsingFeature(
+				FeatureUseTrackerConsts.CARBIDE_OST_TRACE);
+
+		return success;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.TraceViewerInterface#clearAllData()
+	 */
+	public void clearAllData() {
+		createMainFile();
+		if (dataReaderAccess.getMainDataReader() != null) {
+			dataReaderAccess.getMainDataReader().clearFile();
+		}
+
+		// If log file opened, unload it
+		if (dataProcessorAccess.getLogger().isLogFileOpened()) {
+			dataReaderAccess.createMainDataReader();
+			dataProcessorAccess.getLogger().setLogFileOpened(false);
+		}
+
+		dataReaderAccess.setFileStartOffset(0);
+
+		// Clear possible filter
+		clearFilterFile();
+
+		// Clear trace comments
+		dataProcessorAccess.getTraceCommentHandler().getComments().clear();
+
+		// Empty views
+		emptyViews();
+	}
+
+	/**
+	 * Clears filter file
+	 */
+	private void clearFilterFile() {
+		if (dataProcessorAccess.getFilterProcessor().isFiltering()) {
+			if (dataReaderAccess.getCurrentDataReader() != null
+					&& dataReaderAccess.getMainDataReader() != dataReaderAccess
+							.getCurrentDataReader()) {
+
+				// Clear current filter file and create filter writer and reader
+				// again
+				dataReaderAccess.getCurrentDataReader().clearFile();
+				dataProcessorAccess.getFilterProcessor()
+						.buildFilterFileWriter();
+				dataReaderAccess.createFilterDataReader();
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.TraceViewerInterface#getView()
+	 */
+	public TraceViewerTraceViewInterface getView() {
+		return view;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.TraceViewerInterface#getView()
+	 */
+	public TraceViewerPropertyViewInterface getPropertyView() {
+		return propertyView;
+	}
+
+	/**
+	 * Empties both views
+	 */
+	public void emptyViews() {
+		if (view != null) {
+			view.clearAll();
+		}
+
+		if (propertyView != null) {
+			propertyView.clearAll();
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.TraceViewerInterface#getDialogs()
+	 */
+	public TraceViewerDialogInterface getDialogs() {
+		return dialogs;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.TraceViewerInterface#getFileHandler()
+	 */
+	public TraceFileHandler getFileHandler() {
+		return fileHandler;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.TraceViewerInterface#setFileHandler(com.
+	 * nokia.traceviewer.engine.TraceFileHandler)
+	 */
+	public void setFileHandler(TraceFileHandler fileHandler) {
+		this.fileHandler = fileHandler;
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.TraceViewerInterface#getTraces(int,
+	 * int)
+	 */
+	public List<TraceProperties> getTraces(int start, int end) {
+		if (traceFetcher == null) {
+			traceFetcher = new TraceFetcher();
+		}
+		List<TraceProperties> traces = traceFetcher.startGatheringData(start,
+				end);
+		return traces;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.TraceViewerInterface#readDataFileFromBeginning
+	 * ()
+	 */
+	public void readDataFileFromBeginning() {
+		// Clear possible filter
+		clearFilterFile();
+
+		emptyViews();
+
+		dataReaderAccess.getMainDataReader().setFilePosition(0);
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/TraceViewerConst.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,51 @@
+/*
+ * 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:
+ *
+ * TraceViewer Constants
+ *
+ */
+package com.nokia.traceviewer.engine;
+
+/**
+ * TraceViewer Constants
+ * 
+ */
+public interface TraceViewerConst {
+
+	/**
+	 * Number of bytes shown in view
+	 */
+	int MAX_MESSAGE_SIZE = 65536;
+
+	/**
+	 * Receive buffer must be able to fit two complete messages
+	 */
+	int RECEIVE_BUFFER_SIZE = MAX_MESSAGE_SIZE * 2;
+
+	/**
+	 * Byte mask
+	 */
+	int BYTE_MASK = 0xFF;
+
+	/**
+	 * Short mask
+	 */
+	int SHORT_MASK = 0xFFFF;
+
+	/**
+	 * Int mask
+	 */
+	int INT_MASK = 0xFFFFFFFF;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/TraceViewerDialog.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,32 @@
+/*
+ * 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:
+ *
+ * Interface for TraceViewer dialogs
+ *
+ */
+package com.nokia.traceviewer.engine;
+
+/**
+ * Interface for TraceViewer dialogs
+ * 
+ */
+public interface TraceViewerDialog {
+
+	/**
+	 * Opens the dialog
+	 */
+	public void openDialog();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/TraceViewerDialogInterface.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,158 @@
+/*
+ * 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:
+ *
+ * Interface implemented by the some view of Trace Viewer to show up and create dialogs
+ *
+ */
+package com.nokia.traceviewer.engine;
+
+/**
+ * Interface implemented by the some view of Trace Viewer to show up and create
+ * dialogs
+ * 
+ */
+public interface TraceViewerDialogInterface {
+
+	/**
+	 * Enum containing the names for TraceViewer dialogs
+	 */
+	public enum Dialog {
+
+		/**
+		 * Filter dialog
+		 */
+		FILTER,
+
+		/**
+		 * Advanced filter dialog
+		 */
+		ADVANCEDFILTER,
+
+		/**
+		 * Search dialog
+		 */
+		SEARCH,
+
+		/**
+		 * Color dialog
+		 */
+		COLOR,
+
+		/**
+		 * Count lines dialog
+		 */
+		COUNTLINES,
+
+		/**
+		 * Variable tracing dialog
+		 */
+		VARIABLETRACING,
+
+		/**
+		 * Variable Tracing history dialog
+		 */
+		VARIBLETRACINGHISTORY,
+
+		/**
+		 * Trace activation dialog
+		 */
+		TRACEACTIVATION,
+
+		/**
+		 * Log dialog
+		 */
+		LOG,
+
+		/**
+		 * Trigger dialog
+		 */
+		TRIGGER,
+
+		/**
+		 * ProgressBar dialog
+		 */
+		PROGRESSBAR;
+	}
+
+	/**
+	 * Enum containing the preference pages for TraceViewer
+	 */
+	public enum TVPreferencePage {
+
+		/**
+		 * General preference pages
+		 */
+		GENERAL,
+
+		/**
+		 * Advanced preference page
+		 */
+		ADVANCED,
+
+		/**
+		 * Configurations preference page
+		 */
+		CONFIGURATIONS,
+
+		/**
+		 * Connection preference page
+		 */
+		CONNECTION;
+	}
+
+	/**
+	 * Shows an error message
+	 * 
+	 * @param error
+	 *            error string
+	 */
+
+	public void showErrorMessage(String error);
+
+	/**
+	 * Shows an information message to user
+	 * 
+	 * @param message
+	 *            the message to show
+	 */
+	public void showInformationMessage(String message);
+
+	/**
+	 * Shows confirmation dialog with ok and cancel choices
+	 * 
+	 * @param message
+	 *            message to show
+	 * @return true if user clicked ok, false if cancel
+	 */
+	public boolean showConfirmationDialog(String message);
+
+	/**
+	 * Opens project preference page
+	 * 
+	 * @param page
+	 *            the page name
+	 * @return true if user pressed OK from the dialog, false otherwise
+	 */
+	public boolean openPreferencePage(TVPreferencePage page);
+
+	/**
+	 * Creates a TraceViewer dialog
+	 * 
+	 * @param name
+	 *            name for the dialog
+	 * @return the newly created dialog
+	 */
+	public TraceViewerDialog createDialog(Dialog name);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/TraceViewerEventListener.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,183 @@
+/*
+ * 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:
+ *
+ * TraceViewer event listener
+ *
+ */
+package com.nokia.traceviewer.engine;
+
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.trace.eventrouter.PropertySource;
+import com.nokia.trace.eventrouter.TraceEvent;
+import com.nokia.trace.eventrouter.TraceEventListener;
+import com.nokia.trace.eventrouter.TraceEventRouter;
+import com.nokia.traceviewer.TraceViewerPlugin;
+
+/**
+ * TraceViewer event listener
+ * 
+ */
+final class TraceViewerEventListener implements TraceEventListener {
+
+	/**
+	 * Component ID string
+	 */
+	private static final String CID_STR = "cid"; //$NON-NLS-1$
+
+	/**
+	 * Group ID string
+	 */
+	private static final String GID_STR = "gid"; //$NON-NLS-1$
+
+	/**
+	 * Trace ID string
+	 */
+	private static final String TID_STR = "tid"; //$NON-NLS-1$
+
+	/**
+	 * Search trace action string
+	 */
+	private static final String SEARCHTRACEACTION = "searchtrace"; //$NON-NLS-1$
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.trace.eventrouter.TraceEventListener#processEvent(com.nokia
+	 * .trace.eventrouter.TraceEvent)
+	 */
+	public void processEvent(TraceEvent event) {
+		if (event.getSource() instanceof PropertySource) {
+			final PropertySource source = (PropertySource) event.getSource();
+
+			// This Event is meant for this plugin if the target is the
+			// ID of this Plugin
+			if (source.getTargetId().equals(TraceViewerPlugin.PLUGIN_ID)) {
+				PlatformUI.getWorkbench().getDisplay().asyncExec(
+						new Runnable() {
+
+							/*
+							 * (non-Javadoc)
+							 * 
+							 * @see java.lang.Runnable#run()
+							 */
+							public void run() {
+								handleEvent(source);
+							}
+						});
+			}
+		}
+	}
+
+	/**
+	 * Handles the event
+	 * 
+	 * @param source
+	 *            propertysource of the event to handle
+	 */
+	private void handleEvent(PropertySource source) {
+		String action = source.getActionName();
+		if (action.equals(SEARCHTRACEACTION)) {
+			handleSearchTraceAction(source);
+		} else {
+			// Unknown event action, do nothing
+		}
+	}
+
+	/**
+	 * Handles search trace action
+	 * 
+	 * @param source
+	 *            propertysource of the event to handle
+	 */
+	private void handleSearchTraceAction(PropertySource source) {
+
+		// View must exist to use the search functionality
+		if (TraceViewerGlobals.getTraceViewer().getView() != null) {
+			String cidStr = source.getProperties().get(CID_STR);
+			String gidStr = source.getProperties().get(GID_STR);
+			String tidStr = source.getProperties().get(TID_STR);
+
+			try {
+
+				int cid = Integer.parseInt(cidStr);
+
+				// Get the group ID in a separate method
+				int gid = getGroupID(cid, gidStr);
+
+				int tid = Integer.parseInt(tidStr);
+
+				// Create the search if ID's are valid
+				if (gid != -1 && tid != -1) {
+					TraceViewerGlobals.getTraceViewer()
+							.getDataProcessorAccess().getSearchProcessor()
+							.searchTraceWithID(cid, gid, tid);
+				}
+
+			} catch (NumberFormatException e) {
+				// If numbers parsing failed, show a error message
+				String errMsg1 = Messages
+						.getString("TraceViewerEventListener.InvalidSearchTraceMsg1"); //$NON-NLS-1$
+				String errMsg2 = Messages
+						.getString("TraceViewerEventListener.InvalidSearchTraceMsg2"); //$NON-NLS-1$
+				TraceViewerGlobals.getTraceViewer().getDialogs()
+						.showErrorMessage(
+								errMsg1 + source.getSourceId() + errMsg2);
+			}
+		}
+
+	}
+
+	/**
+	 * Gets group ID from the group string
+	 * 
+	 * @param componentId
+	 *            component ID
+	 * @param gidStr
+	 *            group ID string
+	 * @return group ID or -1 if parsing failed
+	 */
+	private int getGroupID(int componentId, String gidStr) {
+		int groupId = -1;
+		// First try to parse integer
+		try {
+			groupId = Integer.parseInt(gidStr);
+
+			// If parsing failed, string contains the group name. Go ask the ID
+			// from the DecodeProvider
+		} catch (NumberFormatException e) {
+			if (TraceViewerGlobals.getDecodeProvider() != null) {
+				groupId = TraceViewerGlobals.getDecodeProvider().getGroupId(
+						componentId, gidStr);
+			}
+		}
+		return groupId;
+	}
+
+	/**
+	 * Registers itself to the event router
+	 */
+	public void register() {
+		TraceEventRouter.getInstance().addEventListener(this);
+	}
+
+	/**
+	 * Unregisters itself from the event router
+	 */
+	public void unregister() {
+		TraceEventRouter.getInstance().removeEventListener(this);
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/TraceViewerGlobals.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,326 @@
+/*
+ * 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:
+ *
+ * Access point to the exported interfaces of Trace Viewer engine
+ *
+ */
+package com.nokia.traceviewer.engine;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.ui.console.ConsolePlugin;
+import org.eclipse.ui.console.IConsole;
+import org.eclipse.ui.console.IConsoleManager;
+import org.eclipse.ui.console.MessageConsole;
+import org.eclipse.ui.console.MessageConsoleStream;
+
+import com.nokia.trace.eventrouter.PropertySource;
+import com.nokia.trace.eventrouter.TraceEvent;
+import com.nokia.trace.eventrouter.TraceEventRouter;
+import com.nokia.traceviewer.TraceViewerPlugin;
+
+/**
+ * Access point to the exported interfaces of Trace Viewer engine
+ * 
+ */
+public final class TraceViewerGlobals {
+
+	/**
+	 * Action name for UI Event
+	 */
+	private static final String UI_EVENT_ACTION_NAME = "uievent"; //$NON-NLS-1$
+
+	/**
+	 * ID for statisticslogger plugin
+	 */
+	private static final String STATISTICSLOGGER_ID = "com.nokia.trace.statisticslogger"; //$NON-NLS-1$
+
+	/**
+	 * Number of lines in one block.
+	 */
+	public static final int blockSize = 200;
+
+	/**
+	 * If this value is true, debug prints are printed to console
+	 */
+	private static final boolean debugPrintsEnabled = false;
+
+	/**
+	 * Debug print level. None to get nothing
+	 */
+	private static final DebugLevel debugPrintLevel = DebugLevel.NONE;
+
+	/**
+	 * Trace viewer instance
+	 */
+	private static TraceViewer instance;
+
+	/**
+	 * TrimProvider
+	 */
+	private static TrimProvider trimProvider = new DummyTrim();
+
+	/**
+	 * List of TraceProviders
+	 */
+	private static List<TraceProvider> traceProviders = new ArrayList<TraceProvider>();
+
+	/**
+	 * Debug levels
+	 * 
+	 */
+	public enum DebugLevel {
+
+		/**
+		 * No prints
+		 */
+		NONE,
+
+		/**
+		 * Simple prints
+		 */
+		SIMPLE,
+
+		/**
+		 * Flow traces
+		 */
+		FLOW,
+
+		/**
+		 * Test traces
+		 */
+		TEST,
+
+		/**
+		 * All traces
+		 */
+		ALL
+	}
+
+	/**
+	 * Constructor is hidden
+	 */
+	private TraceViewerGlobals() {
+	}
+
+	/**
+	 * Starts Trace Viewer engine.
+	 */
+	public static void start() {
+		if (instance == null) {
+			instance = new TraceViewer();
+			instance.start();
+		}
+	}
+
+	/**
+	 * Gets the trace viewer interface
+	 * 
+	 * @return trace viewer
+	 */
+	public static TraceViewerInterface getTraceViewer() {
+		return instance.getTraceViewer();
+	}
+
+	/**
+	 * Called by the provider plug-in to set the provider
+	 * 
+	 * @param provider
+	 *            the trace provider
+	 * @param clearDataBefore
+	 *            if true, clear data file before changing the new provider
+	 */
+	public static void setTraceProvider(TraceProvider provider,
+			boolean clearDataBefore) {
+		// Add to list if doesn't exist yet
+		if (!traceProviders.contains(provider)) {
+
+			// Sort providers to alphabetic order. This is assuming there are
+			// only two providers.
+			if (!traceProviders.isEmpty()) {
+				TraceProvider prevProvider = traceProviders.get(0);
+				if (prevProvider.getName().compareTo(provider.getName()) < 0) {
+					traceProviders.add(provider);
+				} else {
+					traceProviders.add(0, provider);
+				}
+			} else {
+				traceProviders.add(provider);
+			}
+		}
+
+		// Tell the TraceViewer to set TraceProvider into use
+		instance.setTraceProvider(provider, clearDataBefore);
+	}
+
+	/**
+	 * Gets the trace provider
+	 * 
+	 * @return the trace provider
+	 */
+	public static TraceProvider getTraceProvider() {
+		return instance.getTraceProvider();
+	}
+
+	/**
+	 * Sets Trim provider
+	 * 
+	 * @param provider
+	 *            new trim provider
+	 */
+	public static void setTrimProvider(TrimProvider provider) {
+		trimProvider = provider;
+	}
+
+	/**
+	 * Gets the trim provider
+	 * 
+	 * @return the trimprovider
+	 */
+	public static TrimProvider getTrimProvider() {
+		return trimProvider;
+	}
+
+	/**
+	 * Gets list of available TraceProviders
+	 * 
+	 * @return the list of available TraceProviders
+	 */
+	public static List<TraceProvider> getListOfTraceProviders() {
+		return traceProviders;
+	}
+
+	/**
+	 * Called by the decoder plug-in to set the decoder
+	 * 
+	 * @param decoder
+	 *            the trace decoder
+	 */
+	public static void setDecodeProvider(DecodeProvider decoder) {
+		instance.setDecodeProvider(decoder);
+	}
+
+	/**
+	 * Gets the decode provider
+	 * 
+	 * @return the decode provider
+	 */
+	public static DecodeProvider getDecodeProvider() {
+		return instance.getDecodeProvider();
+	}
+
+	/**
+	 * Posts Error Event
+	 * 
+	 * @param description
+	 *            description of the event
+	 * @param category
+	 *            category of the event
+	 * @param source
+	 *            source of the event
+	 */
+	public static void postErrorEvent(String description, String category,
+			Object source) {
+		TraceEvent event = new TraceEvent(TraceEvent.ERROR, description);
+		event.setCategory(category);
+
+		// If source doesn't exist, insert current time
+		if (source == null) {
+			source = TraceViewerUtils.constructTimeString();
+		}
+		event.setSource(source);
+		TraceEventRouter.getInstance().postEvent(event);
+	}
+
+	/**
+	 * Posts Info Event
+	 * 
+	 * @param description
+	 *            description of the event
+	 * @param category
+	 *            category of the event
+	 * @param source
+	 *            source of the event
+	 */
+	public static void postInfoEvent(String description, String category,
+			Object source) {
+		TraceEvent event = new TraceEvent(TraceEvent.INFO, description);
+		event.setCategory(category);
+
+		// If source doesn't exist, insert current time
+		if (source == null) {
+			source = TraceViewerUtils.constructTimeString();
+		}
+		event.setSource(source);
+		TraceEventRouter.getInstance().postEvent(event);
+	}
+
+	/**
+	 * Posts UI Event
+	 * 
+	 * @param name
+	 *            name of the event
+	 * @param value
+	 *            value of the event
+	 */
+	public static void postUiEvent(String name, String value) {
+		TraceEvent event = new TraceEvent(TraceEvent.INFO, "UI Event"); //$NON-NLS-1$
+		PropertySource source = new PropertySource(UI_EVENT_ACTION_NAME,
+				STATISTICSLOGGER_ID, TraceViewerPlugin.PLUGIN_ID);
+		source.getProperties().put(name, value);
+		event.setSource(source);
+		TraceEventRouter.getInstance().postEvent(event);
+	}
+
+	/**
+	 * Print debug prints to console or do nothing if debug flag is not enabled
+	 * 
+	 * @param text
+	 *            text to print to console
+	 * @param level
+	 *            debug print level
+	 */
+	public static void debug(String text, DebugLevel level) {
+		if (debugPrintsEnabled) {
+			if (debugPrintLevel.compareTo(level) >= 0) {
+				MessageConsole myConsole = findConsole("TraceViewerDebug"); //$NON-NLS-1$
+				MessageConsoleStream out = myConsole.newMessageStream();
+				out.println(text);
+			}
+		}
+	}
+
+	/**
+	 * Find my console
+	 * 
+	 * @param name
+	 *            name for the console
+	 * @return my console
+	 */
+	private static MessageConsole findConsole(String name) {
+		ConsolePlugin plugin = ConsolePlugin.getDefault();
+		IConsoleManager conMan = plugin.getConsoleManager();
+		IConsole[] existing = conMan.getConsoles();
+		for (int i = 0; i < existing.length; i++)
+			if (name.equals(existing[i].getName()))
+				return (MessageConsole) existing[i];
+		// no console found, so create a new one
+		MessageConsole myConsole = new MessageConsole(name, null);
+		conMan.addConsoles(new IConsole[] { myConsole });
+		return myConsole;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/TraceViewerInterface.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,163 @@
+/*
+ * 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:
+ *
+ * Trace Viewer interface
+ *
+ */
+package com.nokia.traceviewer.engine;
+
+import java.util.List;
+
+/**
+ * Trace Viewer interface
+ */
+public interface TraceViewerInterface {
+
+	/**
+	 * Registers the trace view to Trace Viewer
+	 * 
+	 * @param view
+	 *            the view
+	 */
+	public void setTraceView(TraceViewerTraceViewInterface view);
+
+	/**
+	 * Registers the property view to Trace Viewer
+	 * 
+	 * @param view
+	 *            the view
+	 */
+	public void setPropertyView(TraceViewerPropertyViewInterface view);
+
+	/**
+	 * Registers dialog implementer
+	 * 
+	 * @param dialogs
+	 *            dialog implementer
+	 */
+	public void setDialogs(TraceViewerDialogInterface dialogs);
+
+	/**
+	 * Gets the dataprocessor access
+	 * 
+	 * @return dataprocessor access
+	 */
+	public DataProcessorAccess getDataProcessorAccess();
+
+	/**
+	 * Gets the datareader access
+	 * 
+	 * @return datareader access
+	 */
+	public DataReaderAccess getDataReaderAccess();
+
+	/**
+	 * Gets the connection
+	 * 
+	 * @return the connection
+	 */
+	public Connection getConnection();
+
+	/**
+	 * Sets the file handler
+	 * 
+	 * @param fileHandler
+	 *            the new file handler
+	 */
+	public void setFileHandler(TraceFileHandler fileHandler);
+
+	/**
+	 * Gets the file handler
+	 * 
+	 * @return the connection
+	 */
+	public TraceFileHandler getFileHandler();
+
+	/**
+	 * Gets the trace view
+	 * 
+	 * @return the view
+	 */
+	public TraceViewerTraceViewInterface getView();
+
+	/**
+	 * Gets the property view
+	 * 
+	 * @return the property view
+	 */
+	public TraceViewerPropertyViewInterface getPropertyView();
+
+	/**
+	 * Gets the dialogs
+	 * 
+	 * @return the dialogs
+	 */
+	public TraceViewerDialogInterface getDialogs();
+
+	/**
+	 * Gets StateHolder
+	 * 
+	 * @return the state holder
+	 */
+	public StateHolder getStateHolder();
+
+	/**
+	 * Connects to trace source using connection properties
+	 * 
+	 * @return TVAPI error code
+	 */
+	public boolean connect();
+
+	/**
+	 * Disconnects from trace source
+	 * 
+	 * @return true if disconnection succeeded, false otherwise
+	 */
+	public boolean disconnect();
+
+	/**
+	 * Controlled shutdown
+	 */
+	public void shutdown();
+
+	/**
+	 * Clears all data
+	 */
+	public void clearAllData();
+
+	/**
+	 * Reads the trace data file from the beginning. First clears the views and
+	 * then sets the data file position to the beginning of the file.
+	 */
+	public void readDataFileFromBeginning();
+
+	/**
+	 * Empties both views
+	 */
+	public void emptyViews();
+
+	/**
+	 * Get traces from the file between start and end indices. Start and end
+	 * traces are also included. Maximum number of traces to get with this
+	 * method is 5 times blocksize.
+	 * 
+	 * @param start
+	 *            the first trace to get
+	 * @param end
+	 *            the last trace to get
+	 * @return list of traces
+	 */
+	public List<TraceProperties> getTraces(int start, int end);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/TraceViewerPropertyViewInterface.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,58 @@
+/*
+ * 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:
+ *
+ * Interface implemented by the property view of Trace Viewer
+ *
+ */
+package com.nokia.traceviewer.engine;
+
+/**
+ * Interface implemented by the property view of TraceViewer
+ */
+public interface TraceViewerPropertyViewInterface extends
+		TraceViewerViewInterface {
+
+	/**
+	 * Updates property tables
+	 */
+	public void updatePropertyTables();
+
+	/**
+	 * Updated trace comments
+	 */
+	public void updateTraceComments();
+
+	/**
+	 * Creates new propertytable items
+	 */
+	public void createNewPropertyTableItems();
+
+	/**
+	 * Sets linecount table changed
+	 */
+	public void setLineCountTableChanged();
+
+	/**
+	 * Sets variable tracing table changed
+	 */
+	public void setVariableTracingTableChanged();
+
+	/**
+	 * Gets selected variableTable indices
+	 * 
+	 * @return indices of selected variable items
+	 */
+	public int[] getSelectedVariableIndices();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/TraceViewerTraceViewInterface.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,136 @@
+/*
+ * 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:
+ *
+ * Interface implemented by the trace view of Trace Viewer
+ *
+ */
+package com.nokia.traceviewer.engine;
+
+import org.eclipse.jface.text.TextViewer;
+import org.eclipse.swt.custom.StyleRange;
+
+import com.nokia.traceviewer.action.ActionFactory;
+import com.nokia.traceviewer.dialog.ProgressBarDialog;
+
+/**
+ * Interface implemented by the trace view of TraceViewer
+ */
+public interface TraceViewerTraceViewInterface extends TraceViewerViewInterface {
+
+	/**
+	 * View font
+	 */
+	String FONT = "Courier New"; //$NON-NLS-1$
+
+	/**
+	 * View font size
+	 */
+	public final int FONT_SIZE = 8;
+
+	/**
+	 * Number of lines to leave before (above) the found line
+	 */
+	static final int LINES_TO_LEAVE_BEFORE_FOUND_LINE = 6;
+
+	/**
+	 * Scrolls view to given line. If line is not visible, more traces are read
+	 * from the trace file and then scrolling is done. If lineNumber is smaller
+	 * than 0, first blocks of traces are shown. If lineNumber is bigger than
+	 * trace count, last blocks of traces are shown. ONLY call from UI thread!
+	 * 
+	 * @param lineNumber
+	 *            line number where to scroll
+	 */
+	public void scrollViewToLine(int lineNumber);
+
+	/**
+	 * Gets viewer from the view
+	 * 
+	 * @return the viewer
+	 */
+	public TextViewer getViewer();
+
+	/**
+	 * Gets showingTracesFrom variable
+	 * 
+	 * @return the showingTracesFrom variable
+	 */
+	public int getShowingTracesFrom();
+
+	/**
+	 * Highlights lines from start to end. If end is 0, only start line is
+	 * highlighted. Syncs to UI thread using "syncExec" so the update happens
+	 * immediately.
+	 * 
+	 * @param startLine
+	 *            start line number to highlight
+	 * @param endLine
+	 *            end line number to highlight
+	 * @param syncToSource
+	 *            if true, sync to source code in case of OST trace
+	 */
+
+	public void highlightLines(int startLine, int endLine, boolean syncToSource);
+
+	/**
+	 * Closes progressbar while progressing something (filtering etc)
+	 * 
+	 * @param dialog
+	 *            progressbar dialog
+	 */
+	public void closeProgressBar(ProgressBarDialog dialog);
+
+	/**
+	 * Colors current view with new color ranges
+	 * 
+	 * @param ranges
+	 *            the ranges to use
+	 */
+	public void applyColorRules(StyleRange[] ranges);
+
+	/**
+	 * Sets the name of the view based on current situation
+	 */
+	public void updateViewName();
+
+	/**
+	 * Gets action factory
+	 * 
+	 * @return action factory
+	 */
+	public ActionFactory getActionFactory();
+
+	/**
+	 * Stops or restarts the TraceViewer view update
+	 * 
+	 * @param stop
+	 *            if true, stops the view update. If false, restarts the update.
+	 */
+	public void stopViewUpdate(boolean stop);
+
+	/**
+	 * Refreshes current view in TraceViewer view. Is used if the way to show
+	 * data (for example timestamp accuracy) in the view is changed.
+	 */
+	public void refreshCurrentView();
+
+	/**
+	 * Sets font size
+	 * 
+	 * @param size
+	 *            the new size
+	 */
+	public void setFontSize(int size);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/TraceViewerUtils.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,203 @@
+/*
+ * 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:
+ *
+ * TraceViewer Utils contains utilities that can be used anywhere
+ *
+ */
+package com.nokia.traceviewer.engine;
+
+import java.nio.ByteBuffer;
+import java.util.Calendar;
+import java.util.List;
+
+/**
+ * TraceViewer Utils contains utilities that can be used anywhere
+ * 
+ */
+public class TraceViewerUtils {
+
+	/**
+	 * Time separator
+	 */
+	private static final String TIME_SEPARATOR = ":"; //$NON-NLS-1$
+
+	/**
+	 * Millisecond separator
+	 */
+	private static final String MILLISEC_SEPARATOR = "."; //$NON-NLS-1$
+
+	/**
+	 * Number ten
+	 */
+	private static final int TEN = 10;
+
+	/**
+	 * Number zero
+	 */
+	private static final String ZERO = "0"; //$NON-NLS-1$
+
+	/**
+	 * Characters for hex string
+	 */
+	private final static char hexChars[] = { '0', '1', '2', '3', '4', '5', '6',
+			'7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
+
+	/**
+	 * Gets trace as hex string
+	 * 
+	 * @param buf
+	 *            ByteBuffer to the data
+	 * @param startPos
+	 *            starting position in the byte buffer where to start reading
+	 * @param length
+	 *            how many bytes to read
+	 * @param spacesBetweenBytes
+	 *            if true, add spaces between bytes
+	 * @return the trace as hex string
+	 */
+	public static String getTraceAsHexString(ByteBuffer buf, int startPos,
+			int length, boolean spacesBetweenBytes) {
+		StringBuffer out;
+
+		// Read the message to a byte array
+		if (length >= 0) {
+			byte[] byteArr = new byte[length];
+			buf.position(startPos);
+			buf.get(byteArr, 0, length);
+
+			// Create new buffer with the size of messageLength multiplied with
+			// 3 (2 chars for the hex and one for the separator)
+
+			if (spacesBetweenBytes) {
+				out = new StringBuffer(byteArr.length * 3);
+			} else {
+				out = new StringBuffer(byteArr.length * 2);
+			}
+
+			// Go through every byte
+			for (byte b : byteArr) {
+				int v = b & 0xFF;
+				out.append(hexChars[v >>> 4]);
+				out.append(hexChars[v & 0xF]);
+				if (spacesBetweenBytes) {
+					out.append(' ');
+				}
+			}
+		} else {
+			out = new StringBuffer(Messages
+					.getString("TraceViewerUtils.DataCorruptMsg")); //$NON-NLS-1$
+		}
+
+		return out.toString();
+	}
+
+	/**
+	 * Checks if we need to read data file from the beginning
+	 * 
+	 * @return true if we need to read data file from the beginning
+	 */
+	public static boolean isReadingFromStartNeeded() {
+		boolean needed = false;
+
+		DataProcessorAccess access = TraceViewerGlobals.getTraceViewer()
+				.getDataProcessorAccess();
+
+		// Filtering is one condition
+		if (access.getFilterProcessor().isFiltering()) {
+			needed = true;
+
+			// Counting lines with text rules is one condition
+		} else if (access.getLineCountProcessor().getTextRules().size() > 0) {
+			needed = true;
+
+			// Tracing variables with text rules is one condition
+		} else if (access.getVariableTracingProcessor().getTextRules().size() > 0) {
+			needed = true;
+		}
+
+		return needed;
+	}
+
+	/**
+	 * Constructs time string from current time
+	 * 
+	 * @return current time as a String
+	 */
+	public static String constructTimeString() {
+		Calendar cal = Calendar.getInstance();
+		int hour = cal.get(Calendar.HOUR_OF_DAY);
+		int minute = cal.get(Calendar.MINUTE);
+		int seconds = cal.get(Calendar.SECOND);
+		int milliSeconds = cal.get(Calendar.MILLISECOND);
+
+		String time = ""; //$NON-NLS-1$
+
+		// Add hours
+		if (hour < TEN) {
+			time += ZERO;
+		}
+		time += hour + TIME_SEPARATOR;
+
+		// Add minutes
+		if (minute < TEN) {
+			time += ZERO;
+		}
+		time += minute + TIME_SEPARATOR;
+
+		// Add seconds
+		if (seconds < TEN) {
+			time += ZERO;
+		}
+		time += seconds + MILLISEC_SEPARATOR;
+
+		// Add milliseconds
+		if (milliSeconds < TEN * TEN) {
+			time += ZERO;
+		}
+		if (milliSeconds < TEN) {
+			time += ZERO;
+		}
+		time += milliSeconds;
+
+		return time;
+	}
+
+	/**
+	 * Gets timestamp string for a trace
+	 * 
+	 * @param traceNumber
+	 *            trace number
+	 * @return timestamp string for a trace number or empty string if not found
+	 */
+	public static String getTimestampStringForTrace(int traceNumber) {
+		String timestamp = ""; //$NON-NLS-1$
+
+		// Get the trace
+		List<TraceProperties> traceArr = TraceViewerGlobals.getTraceViewer()
+				.getTraces(traceNumber, traceNumber);
+		if (!traceArr.isEmpty()) {
+			TraceProperties trace = traceArr.get(0);
+
+			// Process timestamp
+			TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+					.getTimestampParser().processData(trace);
+
+			if (trace.timestampString != null) {
+				timestamp = trace.timestampString;
+			}
+		}
+		return timestamp;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/TraceViewerViewInterface.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,56 @@
+/*
+ * 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:
+ *
+ * Interface implemented by the view of Trace Viewer
+ *
+ */
+package com.nokia.traceviewer.engine;
+
+/**
+ * Interface implemented by the views of TraceViewer. The view registers itself
+ * to TraceViewer via TraceViewerInterface.setView call
+ * 
+ */
+public interface TraceViewerViewInterface {
+
+	/**
+	 * ID of the propertyView
+	 */
+	public static final String PROPERTYVIEW_ID = "com.nokia.traceviewer.view.TracePropertyView"; //$NON-NLS-1$
+
+	/**
+	 * Tells if the view is disposed. Must be called from UI thread!
+	 * 
+	 * @return true if view is disposed
+	 */
+	public boolean isDisposed();
+
+	/**
+	 * Clears all data from the display
+	 */
+	public void clearAll();
+
+	/**
+	 * Tells is view has data that isn't shown yet
+	 * 
+	 * @return true if there is unshown data
+	 */
+	public boolean hasUnshownData();
+
+	/**
+	 * Updates the view
+	 */
+	public void update();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/TrimProvider.java	Wed Jun 23 14:49:59 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:
+ *
+ * TrimProvider shows messages in Trim area
+ *
+ */
+package com.nokia.traceviewer.engine;
+
+/**
+ * TrimProvider shows messages in Trim area
+ */
+public interface TrimProvider {
+
+	/**
+	 * Updates text to TrimProvider
+	 * 
+	 * @param text
+	 *            the new text
+	 */
+	public void updateText(String text);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/activation/Messages.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,63 @@
+/*
+ * 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:
+ *
+ * String localization for engine activation package.
+ *
+ */
+package com.nokia.traceviewer.engine.activation;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * String localization for engine activation package.
+ * 
+ */
+final class Messages {
+
+	/**
+	 * Bundle name
+	 */
+	private static final String BUNDLE_NAME = "com.nokia.traceviewer.engine.activation.messages"; //$NON-NLS-1$
+
+	/**
+	 * Resource bundle
+	 */
+	private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
+			.getBundle(BUNDLE_NAME);
+
+	/**
+	 * Prevents construction.
+	 */
+	private Messages() {
+	}
+
+	/**
+	 * Maps a key to localized string.
+	 * 
+	 * @param key
+	 *            the key for the string
+	 * @return the localized string
+	 */
+	public static String getString(String key) {
+		String value;
+		try {
+			value = RESOURCE_BUNDLE.getString(key);
+		} catch (MissingResourceException e) {
+			value = '!' + key + '!';
+		}
+		return value;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/activation/OstTraceActivator.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,265 @@
+/*
+ * 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:
+ *
+ * OST Trace Activator class
+ *
+ */
+package com.nokia.traceviewer.engine.activation;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * OST Trace Activator
+ * 
+ */
+public final class OstTraceActivator {
+
+	/**
+	 * Hex prefix
+	 */
+	private static final String HEX_PREFIX = "0x"; //$NON-NLS-1$
+
+	/**
+	 * Lead zero
+	 */
+	private static final String LEAD_ZERO = "0"; //$NON-NLS-1$
+
+	/**
+	 * Group separator
+	 */
+	private static final String GROUP_SEPARATOR = ", "; //$NON-NLS-1$
+
+	/**
+	 * OST TraceProvider class name
+	 */
+	private static final String COM_NOKIA_TRACEVIEWER_OST_ENGINE = "com.nokia.traceviewer.ost.OstEngine"; //$NON-NLS-1$
+
+	/**
+	 * Trace activation category
+	 */
+	private static final String TRACE_ACTIVATION_CATEGORY = Messages
+			.getString("OstTraceActivator.TraceActivationCategory"); //$NON-NLS-1$
+
+	/**
+	 * Activation group string
+	 */
+	private static String activationGroupStr;
+
+	/**
+	 * Deactivation group string
+	 */
+	private static String deactivationGroupStr;
+
+	/**
+	 * Activates components in this list
+	 * 
+	 * @param changedComponents
+	 *            the changed components
+	 */
+	public static void activate(
+			List<TraceActivationComponentItem> changedComponents) {
+
+		// Loop through components
+		for (int i = 0; i < changedComponents.size(); i++) {
+			activationGroupStr = ""; //$NON-NLS-1$
+			deactivationGroupStr = ""; //$NON-NLS-1$
+
+			int cid = changedComponents.get(i).getId();
+
+			// Split component's groups to activation and deactivation arrays
+			List<TraceActivationGroupItem> activationItems = new ArrayList<TraceActivationGroupItem>();
+			List<TraceActivationGroupItem> deActivationItems = new ArrayList<TraceActivationGroupItem>();
+			splitArray(changedComponents.get(i), activationItems,
+					deActivationItems);
+
+			// Sort the arrays so that groups are in ascending order
+			int[] activationGroups = sortToAscending(activationItems, true);
+			int[] deActivationGroups = sortToAscending(deActivationItems, false);
+
+			// Send activation message even activation groups count can be zero
+			TraceViewerGlobals.getTraceProvider().activate(true, true, cid,
+					activationGroups);
+
+			// Post to event view if there were activated groups
+			if (activationGroups.length > 0) {
+				String infoEventMsg = constructInfoEventMsg(cid, true);
+				TraceViewerGlobals.postInfoEvent(infoEventMsg,
+						TRACE_ACTIVATION_CATEGORY, null);
+			}
+
+			// Send deactivation message
+			if (deActivationGroups.length > 0) {
+
+				// Send deactivation messages only if OST protocol in use
+				if (TraceViewerGlobals.getTraceProvider().getClass().getName()
+						.equals(COM_NOKIA_TRACEVIEWER_OST_ENGINE)) {
+					TraceViewerGlobals.getTraceProvider().activate(false,
+							false, cid, deActivationGroups);
+				}
+
+				// Post to event view
+				String infoEventMsg = constructInfoEventMsg(cid, false);
+				TraceViewerGlobals.postInfoEvent(infoEventMsg,
+						TRACE_ACTIVATION_CATEGORY, null);
+			}
+		}
+	}
+
+	/**
+	 * Constructs info event message
+	 * 
+	 * @param cid
+	 *            component ID
+	 * @param activate
+	 *            if true, construct activate message, otherwise deactivate
+	 *            message
+	 * @return info event message
+	 */
+	private static String constructInfoEventMsg(int cid, boolean activate) {
+		String infoEventMsg = null;
+		String componentName = null;
+
+		if (TraceViewerGlobals.getDecodeProvider() != null) {
+			componentName = TraceViewerGlobals.getDecodeProvider()
+					.getComponentName(cid);
+		}
+
+		// No component name was found, use CID
+		String groupStr = ""; //$NON-NLS-1$
+		if (componentName == null) {
+			if (activate) {
+				infoEventMsg = Messages
+						.getString("OstTraceActivator.ActivateInfoEventCid"); //$NON-NLS-1$
+				groupStr = activationGroupStr;
+			} else {
+				infoEventMsg = Messages
+						.getString("OstTraceActivator.DeactivateInfoEventCid"); //$NON-NLS-1$
+				groupStr = deactivationGroupStr;
+			}
+			infoEventMsg += Integer.toHexString(cid)
+					+ Messages.getString("OstTraceActivator.GroupsInfoEvent") //$NON-NLS-1$
+					+ groupStr;
+
+			// Use component name
+		} else {
+			if (activate) {
+				infoEventMsg = Messages
+						.getString("OstTraceActivator.ActivateInfoEventName"); //$NON-NLS-1$
+				groupStr = activationGroupStr;
+			} else {
+				infoEventMsg = Messages
+						.getString("OstTraceActivator.DeactivateInfoEventName"); //$NON-NLS-1$
+				groupStr = deactivationGroupStr;
+			}
+			infoEventMsg += componentName
+					+ Messages.getString("OstTraceActivator.GroupsInfoEvent") //$NON-NLS-1$
+					+ groupStr;
+		}
+
+		return infoEventMsg;
+	}
+
+	/**
+	 * Splits groups from a component to activation and deactiation arrays
+	 * 
+	 * @param component
+	 *            the component object
+	 * @param activationItems
+	 *            activation groups
+	 * @param deActivationItems
+	 *            deactivation groups
+	 */
+	private static void splitArray(TraceActivationComponentItem component,
+			List<TraceActivationGroupItem> activationItems,
+			List<TraceActivationGroupItem> deActivationItems) {
+
+		// Loop through the groups
+		List<TraceActivationGroupItem> groups = component.getGroups();
+		for (int i = 0; i < groups.size(); i++) {
+			TraceActivationGroupItem group = groups.get(i);
+			if (group.isActivated()) {
+				activationItems.add(group);
+			} else {
+				deActivationItems.add(group);
+			}
+		}
+	}
+
+	/**
+	 * Sorts groups to ascending order and returns them as a int array
+	 * 
+	 * @param groups
+	 *            the array of groups
+	 * @param activate
+	 *            if true, sorting activation array. Otherwise sorting
+	 *            deactivate array
+	 * @return sorted int array in ascending order
+	 */
+	private static int[] sortToAscending(List<TraceActivationGroupItem> groups,
+			boolean activate) {
+
+		// Create a comparator
+		Collections.sort(groups, new Comparator<TraceActivationGroupItem>() {
+
+			public int compare(TraceActivationGroupItem o1,
+					TraceActivationGroupItem o2) {
+				int id1 = (o1).getId();
+				int id2 = (o2).getId();
+
+				return id1 > id2 ? 1 : id1 < id2 ? -1 : 0;
+			}
+		});
+
+		// Create a int array and insert objects to it
+		int[] arr = new int[groups.size()];
+		for (int i = 0; i < groups.size(); i++) {
+			int id = groups.get(i).getId();
+			arr[i] = id;
+
+			String groupString = Integer.toHexString(id);
+			if (groupString.length() == 1) {
+				groupString = LEAD_ZERO + groupString;
+			}
+
+			// Add to activation string
+			if (activate) {
+				activationGroupStr += HEX_PREFIX + groupString
+						+ GROUP_SEPARATOR;
+			} else {
+				deactivationGroupStr += HEX_PREFIX + groupString
+						+ GROUP_SEPARATOR;
+			}
+		}
+
+		// Remove last comma
+		if (!groups.isEmpty()) {
+			if (activate) {
+				activationGroupStr = activationGroupStr.substring(0,
+						activationGroupStr.length() - GROUP_SEPARATOR.length());
+			} else {
+				deactivationGroupStr = deactivationGroupStr.substring(0,
+						deactivationGroupStr.length()
+								- GROUP_SEPARATOR.length());
+			}
+		}
+
+		return arr;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/activation/TraceActivationComponentItem.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,137 @@
+/*
+ * 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:
+ *
+ * Trace Activation Component Item
+ *
+ */
+package com.nokia.traceviewer.engine.activation;
+
+import java.util.ArrayList;
+
+/**
+ * Trace Activation Component Item
+ * 
+ */
+public class TraceActivationComponentItem {
+
+	/**
+	 * Name of the item
+	 */
+	private String name;
+
+	/**
+	 * Defined in a file
+	 */
+	private String definedInFile;
+
+	/**
+	 * ID of the component
+	 */
+	private int id;
+
+	/**
+	 * Groups inside this component
+	 */
+	private ArrayList<TraceActivationGroupItem> groups;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param id
+	 *            id of the component
+	 * @param name
+	 *            name of the component
+	 */
+	public TraceActivationComponentItem(int id, String name) {
+		groups = new ArrayList<TraceActivationGroupItem>();
+		this.id = id;
+		this.name = name;
+	}
+
+	/**
+	 * Get groups of this component
+	 * 
+	 * @return the groups
+	 */
+	public ArrayList<TraceActivationGroupItem> getGroups() {
+		return groups;
+	}
+
+	/**
+	 * Adds a new group for this component
+	 * 
+	 * @param group
+	 */
+	public void addGroup(TraceActivationGroupItem group) {
+		groups.add(group);
+	}
+
+	/**
+	 * Gets the name of the component
+	 * 
+	 * @return the name
+	 */
+	public String getName() {
+		return name;
+	}
+
+	/**
+	 * Set name for the component
+	 * 
+	 * @param name
+	 *            the name to set
+	 */
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	/**
+	 * Gets the file path where this component is defined in
+	 * 
+	 * @return file path
+	 */
+	public String getFilePath() {
+		return definedInFile;
+	}
+
+	/**
+	 * Sets the file path where this component is defined in
+	 * 
+	 * @param filePath
+	 *            file path
+	 */
+	public void setFilePath(String filePath) {
+		this.definedInFile = filePath;
+	}
+
+	/**
+	 * Description here
+	 * 
+	 * @return the id
+	 */
+	public int getId() {
+		return id;
+	}
+
+	/**
+	 * Description here
+	 * 
+	 * @param id
+	 *            the id to set
+	 */
+	public void setId(int id) {
+		this.id = id;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/activation/TraceActivationGroupItem.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,158 @@
+/*
+ * 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:
+ *
+ * Trace Activation Group Item
+ *
+ */
+package com.nokia.traceviewer.engine.activation;
+
+import java.util.ArrayList;
+
+/**
+ * Trace Activation Group Item
+ * 
+ */
+public class TraceActivationGroupItem {
+
+	/**
+	 * Parent component
+	 */
+	private TraceActivationComponentItem parent;
+
+	/**
+	 * Name of the group
+	 */
+	private String name;
+
+	/**
+	 * ID of the group
+	 */
+	private int id;
+
+	/**
+	 * Activation info of the group
+	 */
+	private boolean activated;
+
+	/**
+	 * Traces inside this group
+	 */
+	private ArrayList<TraceActivationTraceItem> traces;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parent
+	 *            parent of this item
+	 * @param id
+	 *            id of the item
+	 * @param name
+	 *            name of the item
+	 */
+	public TraceActivationGroupItem(TraceActivationComponentItem parent,
+			int id, String name) {
+		traces = new ArrayList<TraceActivationTraceItem>();
+		this.parent = parent;
+		this.id = id;
+		this.name = name;
+
+		parent.addGroup(this);
+	}
+
+	/**
+	 * Get traces of this group
+	 * 
+	 * @return the traces
+	 */
+	public ArrayList<TraceActivationTraceItem> getTraces() {
+		return traces;
+	}
+
+	/**
+	 * Adds a new group for this component
+	 * 
+	 * @param trace
+	 *            trace
+	 */
+	public void addTrace(TraceActivationTraceItem trace) {
+		traces.add(trace);
+	}
+
+	/**
+	 * Returns activation status of the group
+	 * 
+	 * @return the activated
+	 */
+	public boolean isActivated() {
+		return activated;
+	}
+
+	/**
+	 * Sets activation status
+	 * 
+	 * @param activated
+	 *            the activated to set
+	 */
+	public void setActivated(boolean activated) {
+		this.activated = activated;
+	}
+
+	/**
+	 * Gets the name
+	 * 
+	 * @return the name
+	 */
+	public String getName() {
+		return name;
+	}
+
+	/**
+	 * Sets the name
+	 * 
+	 * @param name
+	 *            the name to set
+	 */
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	/**
+	 * Gets parent
+	 * 
+	 * @return the parent
+	 */
+	public TraceActivationComponentItem getParent() {
+		return parent;
+	}
+
+	/**
+	 * Gets ID
+	 * 
+	 * @return the id
+	 */
+	public int getId() {
+		return id;
+	}
+
+	/**
+	 * Sets ID
+	 * 
+	 * @param id
+	 *            the id to set
+	 */
+	public void setId(int id) {
+		this.id = id;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/activation/TraceActivationTraceItem.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,132 @@
+/*
+ * 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:
+ *
+ * Trace activation trace item
+ *
+ */
+package com.nokia.traceviewer.engine.activation;
+
+/**
+ * Trace activation trace item
+ * 
+ */
+public class TraceActivationTraceItem {
+
+	/**
+	 * Parent group
+	 */
+	private TraceActivationGroupItem parent;
+
+	/**
+	 * Name of the group
+	 */
+	private String name;
+
+	/**
+	 * ID of the group
+	 */
+	private int id;
+
+	/**
+	 * Parameter count
+	 */
+	private int parameterCount;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parent
+	 *            parent of this item
+	 * @param id
+	 *            id of the item
+	 * @param name
+	 *            name of the item
+	 */
+	public TraceActivationTraceItem(TraceActivationGroupItem parent, int id,
+			String name) {
+		this.parent = parent;
+		this.id = id;
+		this.name = name;
+
+		parent.addTrace(this);
+	}
+
+	/**
+	 * Gets the name
+	 * 
+	 * @return the name
+	 */
+	public String getName() {
+		return name;
+	}
+
+	/**
+	 * Sets the name
+	 * 
+	 * @param name
+	 *            the name to set
+	 */
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	/**
+	 * Gets parent
+	 * 
+	 * @return the parent
+	 */
+	public TraceActivationGroupItem getParent() {
+		return parent;
+	}
+
+	/**
+	 * Gets ID
+	 * 
+	 * @return the id
+	 */
+	public int getId() {
+		return id;
+	}
+
+	/**
+	 * Sets ID
+	 * 
+	 * @param id
+	 *            the id to set
+	 */
+	public void setId(int id) {
+		this.id = id;
+	}
+
+	/**
+	 * Gets parameter count of the traces
+	 * 
+	 * @return parameter count of the traces
+	 */
+	public int getParameterCount() {
+		return parameterCount;
+	}
+
+	/**
+	 * Sets parameter count of the traces
+	 * 
+	 * @param parameterCount
+	 *            parameter count
+	 */
+	public void setParameterCount(int parameterCount) {
+		this.parameterCount = parameterCount;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/activation/TraceActivationXMLConstants.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,91 @@
+/*
+ * 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:
+ *
+ * Constants for TraceActivation XML export/import
+ *
+ */
+package com.nokia.traceviewer.engine.activation;
+
+/**
+ * Constants for TraceActivation XML export/import
+ */
+public class TraceActivationXMLConstants {
+
+	/**
+	 * XML Header
+	 */
+	public static final String XML_HEADER = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; //$NON-NLS-1$
+
+	/**
+	 * File start
+	 */
+	public static final String FILE_START = "<ConfigurationFile Version=\"1\">\n"; //$NON-NLS-1$
+
+	/**
+	 * File end
+	 */
+	public static final String FILE_END = "</ConfigurationFile>\n"; //$NON-NLS-1$
+
+	/**
+	 * Activations start
+	 */
+	public static final String ACTIVATIONS_START = "<Activations>\n"; //$NON-NLS-1$
+
+	/**
+	 * Activations end
+	 */
+	public static final String ACTIVATIONS_END = "</Activations>\n"; //$NON-NLS-1$
+
+	/**
+	 * Component tag
+	 */
+	public static final String COMPONENT_TAG = "Component"; //$NON-NLS-1$
+
+	/**
+	 * Group tag
+	 */
+	public static final String GROUP_TAG = "Group"; //$NON-NLS-1$
+
+	/**
+	 * Activations tag
+	 */
+	public static final String ACTIVATIONS_TAG = "Activations"; //$NON-NLS-1$
+
+	/**
+	 * Activation tag
+	 */
+	public static final String ACTIVATION_TAG = "Activation"; //$NON-NLS-1$
+
+	/**
+	 * Name tag
+	 */
+	public static final String NAME_TAG = "Name"; //$NON-NLS-1$
+
+	/**
+	 * ID tag
+	 */
+	public static final String ID_TAG = "Id"; //$NON-NLS-1$
+
+	/**
+	 * Yes tag
+	 */
+	public static final String YES_TAG = "Yes"; //$NON-NLS-1$
+
+	/**
+	 * No tag
+	 */
+	public static final String NO_TAG = "No"; //$NON-NLS-1$
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/activation/TraceActivationXMLExporter.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,411 @@
+/*
+ * 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:
+ *
+ * Trace activation information Exporter class
+ *
+ */
+package com.nokia.traceviewer.engine.activation;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.StringWriter;
+import java.util.List;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Trace activation information Exporter class
+ * 
+ */
+public class TraceActivationXMLExporter {
+
+	/**
+	 * Components that are exported
+	 */
+	private final List<TraceActivationComponentItem> components;
+
+	/**
+	 * File path to use when exporting
+	 */
+	private final String filePath;
+
+	/**
+	 * Configuration name to export
+	 */
+	private final String configurationName;
+
+	/**
+	 * Output stream writer
+	 */
+	private OutputStreamWriter out;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param components
+	 *            components
+	 * @param configurationFileName
+	 *            file name where to export data
+	 * @param configurationName
+	 *            name of the new configuration
+	 */
+	public TraceActivationXMLExporter(
+			List<TraceActivationComponentItem> components,
+			String configurationFileName, String configurationName) {
+		this.components = components;
+		this.configurationName = configurationName;
+		this.filePath = configurationFileName;
+
+		createFile();
+	}
+
+	/**
+	 * Exports data
+	 * 
+	 * @return true if exporting succeeds
+	 */
+	public boolean export() {
+		boolean succeeded = false;
+		Document doc = getDocument();
+		Node parent;
+
+		if (doc != null) {
+
+			// Get root node of activation rules
+			NodeList list = doc
+					.getElementsByTagName(TraceActivationXMLConstants.ACTIVATIONS_TAG);
+
+			// Doesn't exist, create
+			if (list.getLength() == 0) {
+				parent = doc
+						.createElement(TraceActivationXMLConstants.ACTIVATIONS_TAG);
+				try {
+					doc.appendChild(parent);
+				} catch (Exception e) {
+					parent = null;
+				}
+			} else {
+				parent = list.item(0);
+			}
+
+			// Search if given activation name already exists and delete it
+			if (parent != null) {
+				NodeList activations = parent.getChildNodes();
+				for (int i = 0; i < activations.getLength(); i++) {
+					if (activations.item(i) instanceof Element) {
+						NamedNodeMap itemAttributes = activations.item(i)
+								.getAttributes();
+
+						// Get name
+						Attr nameAttr = (Attr) itemAttributes
+								.getNamedItem(TraceActivationXMLConstants.NAME_TAG);
+						String name = nameAttr.getValue();
+						if (name.equals(configurationName)) {
+							parent.removeChild(activations.item(i));
+							break;
+						}
+					}
+				}
+
+				// Create new activation and process components to it
+				Node newActivation = doc
+						.createElement(TraceActivationXMLConstants.ACTIVATION_TAG);
+				parent.appendChild(newActivation);
+
+				// Set name
+				NamedNodeMap itemAttributes = newActivation.getAttributes();
+				Attr name = doc
+						.createAttribute(TraceActivationXMLConstants.NAME_TAG);
+				name.setValue(configurationName);
+				itemAttributes.setNamedItem(name);
+				for (int j = 0; j < components.size(); j++) {
+					processComponent(components.get(j), doc, newActivation);
+				}
+
+				// Get result from document
+				StreamResult result = getResultFromDocument(doc);
+
+				// Print out
+				String xmlString = result.getWriter().toString();
+				writeFile(xmlString);
+				succeeded = true;
+			} else {
+				// If comes here, root node "activation" was not found and
+				// couldn't be created
+				String cannotSave = Messages
+						.getString("TraceActivationXMLExporter.CannotSaveToTheFile"); //$NON-NLS-1$
+				TraceViewerGlobals.getTraceViewer().getDialogs()
+						.showErrorMessage(cannotSave);
+			}
+		} else {
+			// If comes here, file was not found
+			String fileNotFound = Messages
+					.getString("TraceActivationXMLExporter.CannotSaveToTheFile"); //$NON-NLS-1$
+			TraceViewerGlobals.getTraceViewer().getDialogs().showErrorMessage(
+					fileNotFound);
+		}
+
+		return succeeded;
+	}
+
+	/**
+	 * Removes given configuration
+	 */
+	public void remove() {
+		Document doc = getDocument();
+		Node parent;
+
+		if (doc != null) {
+
+			// Get root node of activation rules
+			NodeList list = doc
+					.getElementsByTagName(TraceActivationXMLConstants.ACTIVATIONS_TAG);
+			parent = list.item(0);
+
+			// Search if given activation name already exists and delete it
+			if (parent != null) {
+				NodeList activations = parent.getChildNodes();
+				for (int i = 0; i < activations.getLength(); i++) {
+					if (activations.item(i) instanceof Element) {
+						NamedNodeMap itemAttributes = activations.item(i)
+								.getAttributes();
+
+						// Get name
+						Attr nameAttr = (Attr) itemAttributes
+								.getNamedItem(TraceActivationXMLConstants.NAME_TAG);
+						String name = nameAttr.getValue();
+						if (name.equals(configurationName)) {
+							parent.removeChild(activations.item(i));
+							break;
+						}
+					}
+				}
+			}
+
+			// Get result from document
+			StreamResult result = getResultFromDocument(doc);
+
+			// Print out
+			String xmlString = result.getWriter().toString();
+			writeFile(xmlString);
+		}
+	}
+
+	/**
+	 * Process component
+	 * 
+	 * @param item
+	 *            component to process
+	 * @param doc
+	 *            document
+	 * @param root
+	 *            node to insert this child to
+	 */
+	private void processComponent(TraceActivationComponentItem item,
+			Document doc, Node root) {
+		// Process through the component
+		Node newItem = null;
+		newItem = doc.createElement(TraceActivationXMLConstants.COMPONENT_TAG);
+
+		// Get attributes
+		NamedNodeMap itemAttributes = newItem.getAttributes();
+
+		// Set ID
+		Attr id = doc.createAttribute(TraceActivationXMLConstants.ID_TAG);
+		id.setValue(String.valueOf(item.getId()));
+		itemAttributes.setNamedItem(id);
+
+		// Set as child to parent
+		root.appendChild(newItem);
+
+		// Loop through groups in this component
+		List<TraceActivationGroupItem> groups = item.getGroups();
+		for (int i = 0; i < groups.size(); i++) {
+
+			// Create new group node
+			Node newGroup = doc
+					.createElement(TraceActivationXMLConstants.GROUP_TAG);
+
+			// Get attributes
+			NamedNodeMap attributes = newGroup.getAttributes();
+
+			// Set ID
+			Attr groupId = doc
+					.createAttribute(TraceActivationXMLConstants.ID_TAG);
+			groupId.setValue(String.valueOf(groups.get(i).getId()));
+			attributes.setNamedItem(groupId);
+
+			// Set activation value
+			if (groups.get(i).isActivated()) {
+				newGroup.setTextContent(TraceActivationXMLConstants.YES_TAG);
+			} else {
+				newGroup.setTextContent(TraceActivationXMLConstants.NO_TAG);
+			}
+
+			// Set as child to parent
+			newItem.appendChild(newGroup);
+		}
+	}
+
+	/**
+	 * Creates the file
+	 */
+	public void createFile() {
+		File file = new File(filePath);
+
+		// File doesn't exist, create it
+		if (!file.exists() || file.length() == 0) {
+			createFileSkeleton();
+		} else {
+			// File exists
+		}
+	}
+
+	/**
+	 * Creates XML file skeleton
+	 */
+	private void createFileSkeleton() {
+		try {
+			// Open an Output Stream Writer to set encoding
+			OutputStream fout = new FileOutputStream(filePath);
+			OutputStream bout = new BufferedOutputStream(fout);
+			out = new OutputStreamWriter(bout, "UTF-8"); //$NON-NLS-1$
+
+			out.write(TraceActivationXMLConstants.XML_HEADER);
+			out.write(TraceActivationXMLConstants.FILE_START);
+			out.write(TraceActivationXMLConstants.ACTIVATIONS_START);
+			out.write(TraceActivationXMLConstants.ACTIVATIONS_END);
+			out.write(TraceActivationXMLConstants.FILE_END);
+			out.flush();
+			out.close();
+		} catch (IOException e) {
+		}
+
+	}
+
+	/**
+	 * Writes ready XML string to file
+	 * 
+	 * @param xmlString
+	 */
+	protected void writeFile(String xmlString) {
+
+		try {
+			// Open an Output Stream Writer to set encoding
+			OutputStream fout = new FileOutputStream(filePath);
+			OutputStream bout = new BufferedOutputStream(fout);
+			out = new OutputStreamWriter(bout, "UTF-8"); //$NON-NLS-1$
+
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		try {
+			out.write(xmlString);
+			out.flush();
+			out.close();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+	}
+
+	/**
+	 * Gets result from document
+	 * 
+	 * @param doc
+	 *            document
+	 * @return result
+	 */
+	protected StreamResult getResultFromDocument(Document doc) {
+		TransformerFactory tf = TransformerFactory.newInstance();
+		int indentSize = 2;
+		tf.setAttribute("indent-number", Integer.valueOf((indentSize))); //$NON-NLS-1$
+		Transformer transformer = null;
+		try {
+			transformer = tf.newTransformer();
+		} catch (TransformerConfigurationException e1) {
+			e1.printStackTrace();
+		}
+		if (transformer != null) {
+			transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$
+		}
+
+		// initialize StreamResult with File object to save to file
+		StreamResult result = new StreamResult(new StringWriter());
+		DOMSource source = new DOMSource(doc);
+		try {
+			if (transformer != null) {
+				transformer.transform(source, result);
+			}
+		} catch (TransformerException e) {
+			e.printStackTrace();
+		}
+		return result;
+	}
+
+	/**
+	 * Gets DOM document for the file path
+	 * 
+	 * @return document
+	 */
+	protected Document getDocument() {
+		DocumentBuilderFactory docFactory = DocumentBuilderFactory
+				.newInstance();
+		DocumentBuilder docBuilder = null;
+		try {
+			docBuilder = docFactory.newDocumentBuilder();
+		} catch (ParserConfigurationException e) {
+			e.printStackTrace();
+		}
+
+		// Get the document
+		Document doc = null;
+		try {
+			if (docBuilder != null) {
+				File file = new File(filePath);
+				if (file.exists()) {
+					doc = docBuilder.parse(filePath);
+				}
+			}
+		} catch (SAXException e1) {
+			e1.printStackTrace();
+		} catch (IOException e1) {
+			e1.printStackTrace();
+		}
+		return doc;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/activation/TraceActivationXMLImporter.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,472 @@
+/*
+ * 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:
+ *
+ * Trace activation information Importer class
+ *
+ */
+package com.nokia.traceviewer.engine.activation;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Trace activation information Importer class
+ * 
+ */
+public class TraceActivationXMLImporter {
+
+	/**
+	 * Category for trigger events
+	 */
+	private static final String TRIGGER_CATEGORY = Messages
+			.getString("TraceActivationXMLImporter.TriggerCategory"); //$NON-NLS-1$
+
+	/**
+	 * File path where to import
+	 */
+	private final String filePath;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param configurationFileName
+	 *            file name where to export data
+	 */
+	public TraceActivationXMLImporter(String configurationFileName) {
+		this.filePath = configurationFileName;
+	}
+
+	/**
+	 * Imports configuration names found from this XML file
+	 * 
+	 * @return the configuration names
+	 */
+	public String[] importConfigurationNames() {
+		ArrayList<String> confNameList = new ArrayList<String>();
+		String[] confNameArr = null;
+		File file = new File(filePath);
+		if (file.exists() && file.length() > 0) {
+			Document doc = getDocument();
+
+			// Get activations node from the XML file
+			NodeList list = doc
+					.getElementsByTagName(TraceActivationXMLConstants.ACTIVATIONS_TAG);
+			Node parent = list.item(0);
+
+			// Go through activations
+			if (parent != null) {
+				NodeList activations = parent.getChildNodes();
+				if (activations != null) {
+					for (int i = 0; i < activations.getLength(); i++) {
+						if (activations.item(i) instanceof Element) {
+							NamedNodeMap itemAttributes = activations.item(i)
+									.getAttributes();
+
+							// Get name
+							Attr nameAttr = (Attr) itemAttributes
+									.getNamedItem(TraceActivationXMLConstants.NAME_TAG);
+							String name = nameAttr.getValue();
+							confNameList.add(name);
+						}
+					}
+				} else {
+					// If comes here, activation information was not found
+				}
+			} else {
+				// If comes here, this XML file isn't the correct format
+				String xmlCorrupted = Messages
+						.getString("TraceActivationXMLImporter.XMLCorrupted"); //$NON-NLS-1$
+				TraceViewerGlobals.getTraceViewer().getDialogs()
+						.showErrorMessage(xmlCorrupted);
+			}
+		}
+
+		// Get items from list to array
+		confNameArr = new String[confNameList.size()];
+		for (int j = 0; j < confNameList.size(); j++) {
+			confNameArr[j] = confNameList.get(j);
+		}
+
+		return confNameArr;
+	}
+
+	/**
+	 * Inserts components from configuration to the given array
+	 * 
+	 * @param components
+	 *            components
+	 * @param configurationName
+	 *            configuration name
+	 */
+	public void createComponentListFromConfigurationName(
+			List<TraceActivationComponentItem> components,
+			String configurationName) {
+		File file = new File(filePath);
+		if (file.exists()) {
+			Document doc = getDocument();
+
+			// Get activations node from the XML file
+			NodeList list = doc
+					.getElementsByTagName(TraceActivationXMLConstants.ACTIVATIONS_TAG);
+			Node parent = list.item(0);
+
+			// Go trough activations
+			if (parent != null) {
+				NodeList activations = parent.getChildNodes();
+				if (activations != null) {
+					boolean found = false;
+					for (int i = 0; i < activations.getLength(); i++) {
+						if (activations.item(i) instanceof Element) {
+							NamedNodeMap itemAttributes = activations.item(i)
+									.getAttributes();
+
+							// Get name
+							Attr nameAttr = (Attr) itemAttributes
+									.getNamedItem(TraceActivationXMLConstants.NAME_TAG);
+							String name = nameAttr.getValue();
+							if (name.equals(configurationName)) {
+								NodeList componentList = activations.item(i)
+										.getChildNodes();
+								for (int j = 0; j < componentList.getLength(); j++) {
+									if (componentList.item(j) instanceof Element) {
+										processXMLTriggerRule(componentList
+												.item(j), components);
+									}
+								}
+								found = true;
+								break;
+							}
+						}
+					}
+					if (!found) {
+						// Specific activation information was not found
+						String confReference = Messages
+								.getString("TraceActivationXMLImporter.ConfNotFound"); //$NON-NLS-1$
+						TraceViewerGlobals.postErrorEvent(confReference,
+								TRIGGER_CATEGORY, configurationName);
+					}
+				} else {
+					// Activation informations were not found
+					String confNotFound = Messages
+							.getString("TraceActivationXMLImporter.ConfNotFound"); //$NON-NLS-1$
+					TraceViewerGlobals.postErrorEvent(confNotFound,
+							TRIGGER_CATEGORY, configurationName);
+				}
+			} else {
+				// XML file is corrupted
+				String xmlCorrupted = Messages
+						.getString("TraceActivationXMLImporter.XMLCorrupted"); //$NON-NLS-1$
+				TraceViewerGlobals.postErrorEvent(xmlCorrupted,
+						TRIGGER_CATEGORY, filePath);
+			}
+		} else {
+			// File was not found
+			String fileNotFound = Messages
+					.getString("TraceActivationXMLImporter.FileNotFound"); //$NON-NLS-1$
+			TraceViewerGlobals.postErrorEvent(fileNotFound, TRIGGER_CATEGORY,
+					filePath);
+		}
+	}
+
+	private void processXMLTriggerRule(Node item,
+			List<TraceActivationComponentItem> components) {
+		NamedNodeMap itemAttributes = item.getAttributes();
+
+		// Get id
+		Attr idAttr = (Attr) itemAttributes
+				.getNamedItem(TraceActivationXMLConstants.ID_TAG);
+		int id = Integer.parseInt(idAttr.getValue());
+
+		// Create new Activation item
+		TraceActivationComponentItem newActivationItem = new TraceActivationComponentItem(
+				id, ""); //$NON-NLS-1$
+		components.add(newActivationItem);
+
+		// Get groups from Activation item
+		List<TraceActivationGroupItem> groups = newActivationItem.getGroups();
+
+		// Get groups from XML item
+		NodeList XMLgroups = item.getChildNodes();
+
+		// Process groups from the Node item
+		for (int i = 0; i < XMLgroups.getLength(); i++) {
+			if (XMLgroups.item(i) instanceof Element) {
+				processGroups(XMLgroups.item(i), groups, newActivationItem);
+			}
+		}
+	}
+
+	private void processGroups(Node groupItem,
+			List<TraceActivationGroupItem> groups,
+			TraceActivationComponentItem parent) {
+		NamedNodeMap itemAttributes = groupItem.getAttributes();
+
+		// Get id
+		Attr idAttr = (Attr) itemAttributes
+				.getNamedItem(TraceActivationXMLConstants.ID_TAG);
+		int id = Integer.parseInt(idAttr.getValue());
+
+		// Create new group
+		TraceActivationGroupItem newGroup = new TraceActivationGroupItem(
+				parent, id, ""); //$NON-NLS-1$
+		groups.add(newGroup);
+
+		// Check activated status
+		String activated = groupItem.getTextContent();
+		if (activated.equals(TraceActivationXMLConstants.YES_TAG)) {
+			newGroup.setActivated(true);
+		}
+	}
+
+	/**
+	 * Imports activation data
+	 * 
+	 * @param components
+	 *            components
+	 * @param configurationName
+	 *            name of the configuration
+	 * @param changedComponents
+	 *            list of changed components to use when activating
+	 * @return true if everything went fine
+	 */
+	public boolean importData(List<TraceActivationComponentItem> components,
+			String configurationName,
+			List<TraceActivationComponentItem> changedComponents) {
+		boolean success = true;
+		File file = new File(filePath);
+		if (file.exists()) {
+			Document doc = getDocument();
+
+			// Get activations node from the XML file
+			NodeList list = doc
+					.getElementsByTagName(TraceActivationXMLConstants.ACTIVATIONS_TAG);
+			Node parent = list.item(0);
+
+			// Go trough activations
+			if (parent != null) {
+				NodeList activations = parent.getChildNodes();
+				if (activations != null) {
+					boolean found = false;
+					for (int i = 0; i < activations.getLength(); i++) {
+						if (activations.item(i) instanceof Element) {
+							NamedNodeMap itemAttributes = activations.item(i)
+									.getAttributes();
+
+							// Get name
+							Attr nameAttr = (Attr) itemAttributes
+									.getNamedItem(TraceActivationXMLConstants.NAME_TAG);
+							String name = nameAttr.getValue();
+							if (name.equals(configurationName)) {
+								NodeList componentList = activations.item(i)
+										.getChildNodes();
+								for (int j = 0; j < componentList.getLength(); j++) {
+									if (componentList.item(j) instanceof Element) {
+										processXMLComponent(componentList
+												.item(j), components,
+												changedComponents);
+									}
+								}
+								found = true;
+								break;
+							}
+						}
+					}
+					if (!found) {
+						// Specific activation information was not found
+						String confReference = Messages
+								.getString("TraceActivationXMLImporter.ConfNotFound"); //$NON-NLS-1$
+						TraceViewerGlobals.getTraceViewer().getDialogs()
+								.showErrorMessage(confReference);
+						success = false;
+					}
+				} else {
+					// Activation information was not found
+					String confNotFound = Messages
+							.getString("TraceActivationXMLImporter.ConfNotFound"); //$NON-NLS-1$
+					TraceViewerGlobals.getTraceViewer().getDialogs()
+							.showErrorMessage(confNotFound);
+					success = false;
+				}
+			} else {
+				// XML file is corrupted
+				String xmlCorrupted = Messages
+						.getString("TraceActivationXMLImporter.XMLCorrupted"); //$NON-NLS-1$
+				TraceViewerGlobals.getTraceViewer().getDialogs()
+						.showErrorMessage(xmlCorrupted);
+				success = false;
+			}
+		} else {
+			// File was not found
+			String fileNotFound = Messages
+					.getString("TraceActivationXMLImporter.FileNotFound"); //$NON-NLS-1$
+			TraceViewerGlobals.getTraceViewer().getDialogs().showErrorMessage(
+					fileNotFound);
+			success = false;
+		}
+		return success;
+	}
+
+	/**
+	 * Process XML component
+	 * 
+	 * @param component
+	 *            XML component to process
+	 * @param components
+	 *            all components loaded to model
+	 * @param changedComponents
+	 *            changed components list
+	 */
+	private void processXMLComponent(Node component,
+			List<TraceActivationComponentItem> components,
+			List<TraceActivationComponentItem> changedComponents) {
+		NamedNodeMap itemAttributes = component.getAttributes();
+
+		// Get id
+		Attr idAttr = (Attr) itemAttributes
+				.getNamedItem(TraceActivationXMLConstants.ID_TAG);
+		int id = Integer.parseInt(idAttr.getValue());
+
+		// Find component with correct id
+		for (int i = 0; i < components.size(); i++) {
+			if (components.get(i).getId() == id) {
+				processGroups(components.get(i), component, changedComponents);
+				break;
+			}
+		}
+	}
+
+	/**
+	 * Process groups from this component
+	 * 
+	 * @param item
+	 *            real component item
+	 * @param component
+	 *            XML component node
+	 * @param changedComponents
+	 *            changed components list
+	 */
+	private void processGroups(TraceActivationComponentItem item,
+			Node component, List<TraceActivationComponentItem> changedComponents) {
+		// Get groups from real component
+		List<TraceActivationGroupItem> groups = item.getGroups();
+
+		// Get groups from xml component
+		NodeList XMLgroups = component.getChildNodes();
+
+		// Go trough all groups from xml component
+		for (int i = 0; i < XMLgroups.getLength(); i++) {
+			if (XMLgroups.item(i) instanceof Element) {
+				NamedNodeMap itemAttributes = XMLgroups.item(i).getAttributes();
+
+				// Get id
+				Attr idAttr = (Attr) itemAttributes
+						.getNamedItem(TraceActivationXMLConstants.ID_TAG);
+				int id = Integer.parseInt(idAttr.getValue());
+
+				// Find this id from real groups
+				for (int j = 0; j < groups.size(); j++) {
+					TraceActivationGroupItem group = groups.get(j);
+					if (group.getId() == id) {
+						// Read the activation status
+						String activated = XMLgroups.item(i).getTextContent();
+
+						// Activate a group if it wasn't already activated
+						if (activated
+								.equals(TraceActivationXMLConstants.YES_TAG)) {
+							if (!group.isActivated()) {
+								group.setActivated(true);
+
+								// Add this components to the changed components
+								// list
+								if (!changedComponents.contains(group
+										.getParent())) {
+									changedComponents.add(group.getParent());
+								}
+							}
+						} else {
+
+							// Deactivate a group if it was activated
+							if (group.isActivated()) {
+								group.setActivated(false);
+
+								// Add this to the changed components
+								// list
+								if (!changedComponents.contains(group
+										.getParent())) {
+									changedComponents.add(group.getParent());
+								}
+							}
+						}
+					}
+				}
+			}
+		}
+	}
+
+	/**
+	 * Gets DOM document for the file path
+	 * 
+	 * @return document
+	 */
+	protected Document getDocument() {
+		DocumentBuilderFactory docFactory = DocumentBuilderFactory
+				.newInstance();
+		DocumentBuilder docBuilder = null;
+		try {
+			docBuilder = docFactory.newDocumentBuilder();
+		} catch (ParserConfigurationException e) {
+			e.printStackTrace();
+		}
+
+		// Get the document
+		Document doc = null;
+		try {
+			if (docBuilder != null) {
+				File file = new File(filePath);
+				if (file.exists()) {
+					doc = docBuilder.parse(filePath);
+				}
+			}
+		} catch (SAXException e1) {
+			e1.printStackTrace();
+
+			// Show file incorrect message
+			String fileIncorrect = Messages
+					.getString("TraceActivationXMLImporter.FileIncorrect"); //$NON-NLS-1$
+			TraceViewerGlobals.getTraceViewer().getDialogs().showErrorMessage(
+					fileIncorrect);
+
+		} catch (IOException e1) {
+			e1.printStackTrace();
+		}
+		return doc;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/activation/TraceActivator.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,41 @@
+/*
+ * 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:
+ *
+ * Trace Activator
+ *
+ */
+package com.nokia.traceviewer.engine.activation;
+
+import java.util.List;
+
+/**
+ * Trace Activator
+ */
+public class TraceActivator {
+
+	/**
+	 * Sends activation messages from given components
+	 * 
+	 * @param components
+	 *            the components
+	 */
+	public void activate(List<TraceActivationComponentItem> components) {
+
+		// Send OST activations
+		if (!components.isEmpty()) {
+			OstTraceActivator.activate(components);
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/activation/messages.properties	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,12 @@
+OstTraceActivator.ActivateInfoEventCid=Activate CID: 0x
+OstTraceActivator.ActivateInfoEventName=Activate: 
+OstTraceActivator.DeactivateInfoEventCid=Deactivate CID: 0x
+OstTraceActivator.DeactivateInfoEventName=Deactivate: 
+OstTraceActivator.GroupsInfoEvent=\. Groups: 
+OstTraceActivator.TraceActivationCategory=Trace Activation
+TraceActivationXMLImporter.ConfNotFound=Activation configuration was not found\!
+TraceActivationXMLImporter.FileNotFound=Given file was not found\!
+TraceActivationXMLImporter.XMLCorrupted=File is not a valid activation configuration file\!\n\nAre you sure you are trying to load a activation configuration XML file (saved activation information) and not a Dictionary XML file? If you want to load a Dictionary XML file, use option "Add Dictionary" in Activation Dialog.
+TraceActivationXMLImporter.FileIncorrect=Configuration file incorrect, please check or remove it manually\!
+TraceActivationXMLImporter.TriggerCategory=Trigger
+TraceActivationXMLExporter.CannotSaveToTheFile=Cannot save to given file path\!
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/ColorProcessor.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,392 @@
+/*
+ * 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:
+ *
+ * Colorer DataProcessor
+ *
+ */
+package com.nokia.traceviewer.engine.dataprocessor;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.swt.custom.StyleRange;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.graphics.Color;
+
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.dialog.BasePropertyDialog;
+import com.nokia.traceviewer.dialog.ColorDialog;
+import com.nokia.traceviewer.dialog.treeitem.ColorTreeBaseItem;
+import com.nokia.traceviewer.dialog.treeitem.ColorTreeComponentItem;
+import com.nokia.traceviewer.dialog.treeitem.ColorTreeItem;
+import com.nokia.traceviewer.dialog.treeitem.ColorTreeTextItem;
+import com.nokia.traceviewer.dialog.treeitem.TreeItemContentProvider;
+import com.nokia.traceviewer.dialog.treeitem.TreeItemListener;
+import com.nokia.traceviewer.engine.TraceInformation;
+import com.nokia.traceviewer.engine.TraceProperties;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.TraceViewerDialogInterface.Dialog;
+import com.nokia.traceviewer.engine.preferences.PreferenceConstants;
+import com.nokia.traceviewer.engine.preferences.XMLColorConfigurationImporter;
+
+/**
+ * Colorer DataProcessor
+ * 
+ */
+public final class ColorProcessor {
+
+	/**
+	 * Color dialog used in setting color rules
+	 */
+	private ColorDialog colorDialog;
+
+	/**
+	 * Content provider for the filter dialog
+	 */
+	private TreeItemContentProvider contentProvider;
+
+	/**
+	 * First visible object in the filter dialog tree
+	 */
+	private ColorTreeItem root;
+
+	/**
+	 * Text rules that are applied
+	 */
+	private final List<ColorTreeTextItem> textRules;
+
+	/**
+	 * Component rules that are applied
+	 */
+	private final List<ColorTreeComponentItem> componentRules;
+
+	/**
+	 * Style ranges
+	 */
+	private final List<StyleRange> ranges;
+
+	/**
+	 * Constructor
+	 */
+	public ColorProcessor() {
+		// Create initial tree
+		createInitialColorTree();
+
+		// Create rule arrays
+		textRules = new ArrayList<ColorTreeTextItem>();
+		componentRules = new ArrayList<ColorTreeComponentItem>();
+		ranges = new ArrayList<StyleRange>();
+	}
+
+	/**
+	 * Creates initial color tree
+	 */
+	public void createInitialColorTree() {
+		contentProvider = new TreeItemContentProvider();
+
+		// Create root node
+		ColorTreeItem treeRoot = new ColorTreeBaseItem(contentProvider, null,
+				"root", //$NON-NLS-1$
+				ColorTreeItem.Rule.GROUP, null, null);
+		root = new ColorTreeBaseItem(contentProvider, treeRoot,
+				TraceViewerPlugin.getDefault().getPreferenceStore().getString(
+						PreferenceConstants.CONFIGURATION_FILE),
+				ColorTreeItem.Rule.GROUP, null, null);
+		treeRoot.addChild(root);
+	}
+
+	/**
+	 * Imports color rules from configuration file
+	 */
+	public void importColorRules() {
+		XMLColorConfigurationImporter importer = new XMLColorConfigurationImporter(
+				root, TraceViewerPlugin.getDefault().getPreferenceStore()
+						.getString(PreferenceConstants.CONFIGURATION_FILE),
+				true);
+		importer.importData();
+	}
+
+	/**
+	 * Create color rules
+	 */
+	public void createColorRules() {
+		if (isColoring()) {
+
+			// Get trace information ready if there for possible component rules
+			ArrayList<TraceInformation> information = null;
+			if (!componentRules.isEmpty()) {
+
+				// Get properties from the traces in the view.
+				int showingTracesFrom = TraceViewerGlobals.getTraceViewer()
+						.getView().getShowingTracesFrom();
+				int widgetLineCount = TraceViewerGlobals.getTraceViewer()
+						.getView().getViewer().getTextWidget().getLineCount();
+				int start = showingTracesFrom;
+
+				// -2 comes from empty line in the end of widget and because
+				// traces start from offset 0, not 1
+				int end = showingTracesFrom + widgetLineCount - 2;
+				List<TraceProperties> traces = TraceViewerGlobals
+						.getTraceViewer().getTraces(start, end);
+
+				// Get the informations array
+				if (traces != null) {
+					information = new ArrayList<TraceInformation>(traces.size());
+					for (int i = 0; i < traces.size(); i++) {
+						information.add(traces.get(i).information);
+					}
+				}
+			}
+
+			IDocument document = TraceViewerGlobals.getTraceViewer().getView()
+					.getViewer().getDocument();
+			StyledText widget = TraceViewerGlobals.getTraceViewer().getView()
+					.getViewer().getTextWidget();
+			int lineCount = widget.getLineCount() - 1;
+
+			// Loop through all lines
+			for (int i = 0; i < lineCount; i++) {
+				try {
+					int lineStart = document.getLineOffset(i);
+					int lineLength = document.getLineLength(i);
+					String line = document.get(lineStart, lineLength);
+
+					boolean ruleAdded = false;
+
+					// Loop through all component / group rules if there are any
+					if (information != null) {
+						ruleAdded = processComponentRules(lineStart,
+								lineLength, information.get(i));
+					}
+
+					// Loop through all text rules
+					if (!ruleAdded) {
+						ruleAdded = processTextRules(lineStart, lineLength,
+								line);
+					}
+
+				} catch (Throwable t) {
+				}
+			}
+		} else {
+			clearRanges();
+		}
+
+		// Apply made rules
+		TraceViewerGlobals.getTraceViewer().getView().applyColorRules(
+				ranges.toArray(new StyleRange[ranges.size()]));
+
+		// Clear all rules
+		clearRanges();
+	}
+
+	/**
+	 * Processes component rules
+	 * 
+	 * @param lineStart
+	 *            line start offset
+	 * @param lineLength
+	 *            line length
+	 * @param information
+	 *            trace information
+	 * @return true if rule was added to this line
+	 */
+	private boolean processComponentRules(int lineStart, int lineLength,
+			TraceInformation information) {
+		boolean ruleAdded = false;
+
+		// Information must be defined
+		if (information != null && information.isDefined()) {
+
+			// Loop through the component rules
+			int len = componentRules.size();
+			ColorTreeComponentItem rule;
+			for (int i = 0; i < len; i++) {
+				rule = componentRules.get(i);
+				// Get component ID
+				int compId = rule.getComponentId();
+
+				// Component ID matches
+				if (compId == BasePropertyDialog.WILDCARD_INTEGER
+						|| compId == information.getComponentId()) {
+
+					// Get group ID
+					int groupId = rule.getGroupId();
+
+					// Group ID matches
+					if (groupId == BasePropertyDialog.WILDCARD_INTEGER
+							|| groupId == information.getGroupId()) {
+
+						addRange(lineStart, lineLength, rule
+								.getForegroundColor(), rule
+								.getBackgroundColor());
+						ruleAdded = true;
+						break;
+					}
+				}
+			}
+		}
+
+		return ruleAdded;
+	}
+
+	/**
+	 * Processes text rules
+	 * 
+	 * @param lineStart
+	 *            line start offset
+	 * @param lineLength
+	 *            line length
+	 * @param line
+	 *            line string
+	 * @return true if rule was added to this line
+	 */
+	private boolean processTextRules(int lineStart, int lineLength, String line) {
+		boolean ruleAdded = false;
+
+		// Get the rules and loop through them
+		int len = textRules.size();
+		ColorTreeTextItem rule;
+		for (int i = 0; i < len; i++) {
+			rule = textRules.get(i);
+			String colorRule = rule.getTextToCompare();
+
+			// Case insensitive
+			if (!rule.isMatchCase()) {
+				line = line.toLowerCase();
+			}
+
+			if (line.contains(colorRule)) {
+				addRange(lineStart, lineLength, rule.getForegroundColor(), rule
+						.getBackgroundColor());
+				ruleAdded = true;
+				break;
+			}
+		}
+		return ruleAdded;
+	}
+
+	/**
+	 * Gets color dialog
+	 * 
+	 * @return color dialog
+	 */
+	public ColorDialog getColorDialog() {
+		if (colorDialog == null) {
+			colorDialog = (ColorDialog) TraceViewerGlobals.getTraceViewer()
+					.getDialogs().createDialog(Dialog.COLOR);
+		}
+		return colorDialog;
+	}
+
+	/**
+	 * Gets style ranges
+	 * 
+	 * @return style ranges
+	 */
+	public List<StyleRange> getRanges() {
+		return ranges;
+	}
+
+	/**
+	 * Clears style ranges
+	 */
+	public void clearRanges() {
+		ranges.clear();
+	}
+
+	/**
+	 * Add new style range
+	 * 
+	 * @param lineStart
+	 *            offset of line start
+	 * @param lineLength
+	 *            line length
+	 * @param foregroundColor
+	 *            foreground color
+	 * @param backgroundColor
+	 *            background color
+	 */
+	public void addRange(int lineStart, int lineLength, Color foregroundColor,
+			Color backgroundColor) {
+		ranges.add(new StyleRange(lineStart, lineLength, foregroundColor,
+				backgroundColor));
+	}
+
+	/**
+	 * Get visible root of the color tree
+	 * 
+	 * @return the root
+	 */
+	public ColorTreeItem getRoot() {
+		return root;
+	}
+
+	/**
+	 * Returns tree item listener
+	 * 
+	 * @return the contentProvider
+	 */
+	public TreeItemListener getTreeItemListener() {
+		return contentProvider;
+	}
+
+	/**
+	 * Gets plain text color rules
+	 * 
+	 * @return plain text color rules
+	 */
+	public List<ColorTreeTextItem> getTextRules() {
+		return textRules;
+	}
+
+	/**
+	 * Gets component color rules
+	 * 
+	 * @return component color rules
+	 */
+	public List<ColorTreeComponentItem> getComponentRules() {
+		return componentRules;
+	}
+
+	/**
+	 * Indicates that some coloring rules are applied
+	 * 
+	 * @return true if some coloring rules are applied
+	 */
+	public boolean isColoring() {
+		boolean hasRules = false;
+		if (!textRules.isEmpty() || !componentRules.isEmpty()) {
+			hasRules = true;
+		}
+		return hasRules;
+	}
+
+	/**
+	 * Enable color rule
+	 * 
+	 * @param item
+	 *            the rule item
+	 */
+	public void enableRule(ColorTreeItem item) {
+		if (item instanceof ColorTreeTextItem) {
+			textRules.add((ColorTreeTextItem) item);
+		} else if (item instanceof ColorTreeComponentItem) {
+			componentRules.add((ColorTreeComponentItem) item);
+		}
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/DataProcessor.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,36 @@
+/*
+ * 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:
+ *
+ * Data Processor interface
+ *
+ */
+package com.nokia.traceviewer.engine.dataprocessor;
+
+import com.nokia.traceviewer.engine.TraceProperties;
+
+/**
+ * Data Processor interface
+ */
+public interface DataProcessor {
+
+	/**
+	 * Processes trace that comes through dataprocessor
+	 * 
+	 * @param properties
+	 *            trace properties
+	 */
+	public void processData(TraceProperties properties);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/Decoder.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,168 @@
+/*
+ * 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:
+ *
+ * Decoder class
+ *
+ */
+package com.nokia.traceviewer.engine.dataprocessor;
+
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.action.OpenDecodeFileAction;
+import com.nokia.traceviewer.engine.DecodeProvider;
+import com.nokia.traceviewer.engine.TraceProperties;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.preferences.PreferenceConstants;
+
+/**
+ * Decoder class
+ * 
+ */
+public class Decoder implements DataProcessor {
+
+	/**
+	 * Interval how often to update progressbar
+	 */
+	private static final int PROGRESSBAR_UPDATE_INTERVAL = 100;
+
+	/**
+	 * Decoder got from decodeProvider
+	 */
+	private DecodeProvider decoder;
+
+	/**
+	 * Offset where decoding of traces after decode file opening is so long that
+	 * we can start showing traces
+	 */
+	private int startShowingTracesAgainFromCount;
+
+	/**
+	 * Determines if Btrace variables (Thread ID, CPU ID) should be shown
+	 */
+	private boolean showBtraceVariables;
+
+	/**
+	 * Constructor
+	 */
+	public Decoder() {
+
+		// Get show BTrace variables option
+		showBtraceVariables = TraceViewerPlugin.getDefault()
+				.getPreferenceStore().getBoolean(
+						PreferenceConstants.SHOW_BTRACE_VARIABLES_CHECKBOX);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.DataProcessor#processData(com.nokia.traceviewer
+	 * .engine.TraceProperties)
+	 */
+	public void processData(TraceProperties properties) {
+		TraceViewerGlobals.debug("processData in Decoder", //$NON-NLS-1$
+				TraceViewerGlobals.DebugLevel.TEST);
+		if (decoder == null && TraceViewerGlobals.getDecodeProvider() != null) {
+			decoder = TraceViewerGlobals.getDecodeProvider();
+		}
+
+		// Needs to be binary trace to be decoded
+		if (properties.binaryTrace && decoder != null
+				&& decoder.isModelLoadedAndValid()) {
+			decoder.decodeTrace(properties.byteBuffer, properties);
+		}
+
+		// Insert BTrace variables if there is any
+		if (showBtraceVariables
+				&& properties.bTraceInformation.hasInformation()
+				&& properties.traceString != null) {
+
+			StringBuilder tmp = new StringBuilder(properties.traceString
+					.length() * 2);
+
+			// CPU ID
+			if (properties.bTraceInformation.getCpuId() != -1) {
+				tmp.append(Messages.getString("Decoder.CpuIdText")); //$NON-NLS-1$
+				tmp.append(properties.bTraceInformation.getCpuId());
+				tmp.append(Messages.getString("Decoder.CpuTextDelimeter"));//$NON-NLS-1$
+			}
+
+			tmp.append(properties.traceString);
+
+			// Thread ID
+			if (properties.bTraceInformation.getThreadId() != 0) {
+				tmp.append(Messages.getString("Decoder.ThreadIdText")); //$NON-NLS-1$
+				tmp.append(Integer.toHexString(properties.bTraceInformation
+						.getThreadId()));
+			}
+			properties.traceString = tmp.toString();
+		}
+
+		// Update progressBar
+		if (TraceViewerGlobals.getTraceViewer().getView() != null) {
+			updateProgressBar(properties);
+		}
+	}
+
+	/**
+	 * Updates progressBar if needed
+	 * 
+	 * @param properties
+	 *            trace properties
+	 */
+	private void updateProgressBar(TraceProperties properties) {
+		// Update possible progressBar
+		OpenDecodeFileAction decodeAction = ((OpenDecodeFileAction) TraceViewerGlobals
+				.getTraceViewer().getView().getActionFactory()
+				.getOpenDecodeFileAction());
+		int traceCount = TraceViewerGlobals.getTraceViewer()
+				.getDataReaderAccess().getCurrentDataReader().getTraceCount();
+
+		if (decodeAction.isDecodingTraces()) {
+			if (traceCount % PROGRESSBAR_UPDATE_INTERVAL == 0) {
+				decodeAction.getProgressBarDialog().updateProgressBar(
+						TraceViewerGlobals.getTraceViewer()
+								.getDataReaderAccess().getCurrentDataReader()
+								.getTraceCount());
+			}
+
+			// Start showing traces again
+			if (traceCount >= startShowingTracesAgainFromCount) {
+				properties.traceConfiguration.setShowInView(true);
+				startShowingTracesAgainFromCount = Integer.MAX_VALUE;
+			}
+		}
+	}
+
+	/**
+	 * Set startShowingTracesAgainFromCount
+	 * 
+	 * @param offset
+	 *            offset
+	 */
+	public void setStartShowingTracesAgainOffset(int offset) {
+		startShowingTracesAgainFromCount = offset;
+	}
+
+	/**
+	 * Sets show BTrace variables boolean
+	 * 
+	 * @param showVariables
+	 *            if true, show BTrace variables
+	 */
+	public void setShowBTraceVariables(boolean showVariables) {
+		this.showBtraceVariables = showVariables;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/DummyView.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,75 @@
+/*
+ * 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:
+ *
+ * Dummy View to be a placeholder for real TraceViewer views
+ *
+ */
+package com.nokia.traceviewer.engine.dataprocessor;
+
+import com.nokia.traceviewer.engine.TraceProperties;
+import com.nokia.traceviewer.engine.TraceViewerViewInterface;
+
+/**
+ * Dummy View to be a placeholder for real TraceViewer views
+ * 
+ */
+public final class DummyView implements TraceViewerViewInterface, DataProcessor {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.TraceViewerViewInterface#clearAll()
+	 */
+	public void clearAll() {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.TraceViewerViewInterface#hasUnshownData()
+	 */
+	public boolean hasUnshownData() {
+		return false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.TraceViewerViewInterface#isDisposed()
+	 */
+	public boolean isDisposed() {
+		return true;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.TraceViewerViewInterface#update()
+	 */
+	public void update() {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.dataprocessor.DataProcessor#processData(
+	 * com.nokia.traceviewer.engine.TraceProperties)
+	 */
+	public void processData(TraceProperties properties) {
+	}
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/ExternalFilterDataReader.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,117 @@
+/*
+ * 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:
+ *
+ * External Filter Data Reader
+ *
+ */
+package com.nokia.traceviewer.engine.dataprocessor;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+import com.nokia.traceviewer.engine.TraceConfiguration;
+import com.nokia.traceviewer.engine.TraceProperties;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * External Filter Data Reader gets data from Processes input stream
+ * 
+ */
+public class ExternalFilterDataReader extends Thread {
+
+	/**
+	 * Sleeping time
+	 */
+	private static final int SLEEPING_TIME = 1000;
+
+	/**
+	 * Input stream from the Process
+	 */
+	private final InputStream is;
+
+	/**
+	 * Buffered stream reader
+	 */
+	private final BufferedReader reader;
+
+	/**
+	 * Running boolean
+	 */
+	private boolean running;
+
+	/**
+	 * Trace properties used when inserting a string from external process to
+	 * text rule filtering
+	 */
+	private final TraceProperties properties;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param is
+	 *            input stream
+	 */
+	public ExternalFilterDataReader(InputStream is) {
+		this.is = is;
+		InputStreamReader isr = new InputStreamReader(is);
+		reader = new BufferedReader(isr);
+		properties = new TraceProperties(new TraceConfiguration());
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Thread#run()
+	 */
+	@Override
+	public void run() {
+		running = true;
+		try {
+			while (running) {
+				while ((properties.traceString = reader.readLine()) != null) {
+					TraceViewerGlobals.getTraceViewer()
+							.getDataProcessorAccess().getFilterProcessor()
+							.filterStringFromExternalProcess(properties);
+
+					// If no data available in the stream, flush after every
+					// trace
+					if (is.available() == 0) {
+						TraceViewerGlobals.getTraceViewer()
+								.getDataProcessorAccess().getFilterProcessor()
+								.flush();
+					}
+				}
+				// No data, sleep for a while before trying again
+				Thread.sleep(SLEEPING_TIME);
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+
+	/**
+	 * Shuts down the reader
+	 */
+	public void shutDown() {
+		running = false;
+		try {
+			reader.close();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/ExternalFilterDataWriter.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,111 @@
+/*
+ * 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:
+ *
+ * External Filter Data Writer
+ *
+ */
+package com.nokia.traceviewer.engine.dataprocessor;
+
+import java.io.BufferedWriter;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+
+import com.nokia.traceviewer.engine.TraceProperties;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * External Filter Data Writer sends data to Processes output stream
+ */
+public class ExternalFilterDataWriter {
+
+	/**
+	 * Output stream writer
+	 */
+	private final BufferedWriter writer;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param os
+	 *            output stream
+	 */
+	public ExternalFilterDataWriter(OutputStream os) {
+		OutputStreamWriter osw = new OutputStreamWriter(os);
+		writer = new BufferedWriter(osw);
+	}
+
+	/**
+	 * Writes trace to Process input stream
+	 * 
+	 * @param properties
+	 *            trace properties
+	 */
+	public void writeTrace(TraceProperties properties) {
+		try {
+			StringBuffer buf = new StringBuffer();
+			if (properties.timestampString != null) {
+				buf.append(properties.timestampString);
+				buf.append(TraceViewerGlobals.getTraceViewer()
+						.getDataProcessorAccess().getTimestampParser()
+						.getTimeFromPreviousString(
+								properties.timeFromPreviousTrace));
+				buf.append('\t');
+			}
+			if (properties.traceString != null) {
+				buf.append(properties.traceString);
+			}
+			buf.append('\n');
+			writer.write(buf.toString());
+
+			// Flush when last trace is written
+			if (properties.lastTrace) {
+				writer.flush();
+			}
+		} catch (IOException e) {
+			// If writing goes wrong, shut down possible progressbar
+			e.printStackTrace();
+			closeProgressBar();
+		}
+	}
+
+	/**
+	 * Closes progressbar
+	 */
+	private void closeProgressBar() {
+		if (TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+				.getFilterProcessor().isProcessingFilter()) {
+
+			// Close progressbar
+			TraceViewerGlobals.getTraceViewer().getView().closeProgressBar(
+					TraceViewerGlobals.getTraceViewer()
+							.getDataProcessorAccess().getFilterProcessor()
+							.getFilterDialog().getProgressBar());
+		}
+	}
+
+	/**
+	 * Shuts down the writer
+	 */
+	public void shutDown() {
+		try {
+			writer.close();
+		} catch (IOException e) {
+			// If writing goes wrong, shut down possible progressbar
+			// e.printStackTrace();
+			closeProgressBar();
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/ExternalFilterProcessor.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,235 @@
+/*
+ * 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:
+ *
+ * External Filter Processor
+ *
+ */
+package com.nokia.traceviewer.engine.dataprocessor;
+
+import java.io.IOException;
+import java.util.ArrayList;
+
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.engine.TraceProperties;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.preferences.PreferenceConstants;
+
+/**
+ * External Filter Processor handles starting and stopping external filter
+ * application
+ * 
+ */
+public final class ExternalFilterProcessor {
+
+	/**
+	 * Quotation mark char
+	 */
+	private static final char QUOTATION_MARK = '"';
+
+	/**
+	 * The process running the current filter application
+	 */
+	private Process process;
+
+	/**
+	 * Data sender
+	 */
+	private ExternalFilterDataWriter writer;
+
+	/**
+	 * Data reader
+	 */
+	private ExternalFilterDataReader reader;
+
+	/**
+	 * Start external application
+	 * 
+	 * @return true if process was started
+	 */
+	public boolean startExternalApplication() {
+		boolean success = true;
+		String command = TraceViewerPlugin.getDefault().getPreferenceStore()
+				.getString(PreferenceConstants.EXTERNAL_FILTER_COMMAND);
+
+		// Split the command
+		String[] args = splitCommand(command);
+
+		if (process != null) {
+			process.destroy();
+			process = null;
+		}
+		if (reader != null) {
+			reader.shutDown();
+			reader = null;
+		}
+
+		if (args.length > 0) {
+
+			// Create the process
+			try {
+				ProcessBuilder bb = new ProcessBuilder(args);
+				process = bb.start();
+
+				// Create data fetcher and start it
+				reader = new ExternalFilterDataReader(process.getInputStream());
+				reader.start();
+
+				// Create filtered file
+				createFilteredFile();
+
+			} catch (IOException e) {
+				e.printStackTrace();
+				success = false;
+			}
+		} else {
+			success = false;
+		}
+		return success;
+	}
+
+	/**
+	 * Creates filtered file
+	 */
+	private void createFilteredFile() {
+		// Create filtered file and open the progressbar
+		TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+				.getFilterProcessor().getFilterDialog().applyFilters(
+						TraceViewerGlobals.getTraceViewer()
+								.getDataReaderAccess().getMainDataReader()
+								.getTraceCount());
+
+	}
+
+	/**
+	 * Splits the command into String array
+	 * 
+	 * @param command
+	 *            command
+	 * @return String array containing the splitted command
+	 */
+	private String[] splitCommand(String command) {
+		boolean containsQuotationMark = false;
+		ArrayList<String> commands = new ArrayList<String>();
+
+		// Split the command with space
+		String[] args = command.split("\\s"); //$NON-NLS-1$
+
+		// Go through tokens
+		for (int i = 0; i < args.length; i++) {
+			String arg = args[i];
+
+			// No quotation marks going on
+			if (!containsQuotationMark) {
+				if (containsQuotationMark(arg)) {
+					containsQuotationMark = true;
+				}
+				commands.add(arg);
+
+				// Previous token has contained quotation mark
+			} else {
+				if (containsQuotationMark(arg)) {
+					containsQuotationMark = false;
+				}
+				int idx = commands.size() - 1;
+				String prev = commands.get(idx);
+				String newStr = prev + ' ' + arg;
+				commands.set(idx, newStr);
+			}
+		}
+
+		// Move the commands from the arraylist to array
+		String[] retArr = new String[commands.size()];
+		for (int i = 0; i < retArr.length; i++) {
+
+			// Remove quotation marks, ProcessBuilder doesn't want them
+			retArr[i] = commands.get(i).replace("\"", ""); //$NON-NLS-1$ //$NON-NLS-2$
+		}
+
+		return retArr;
+	}
+
+	/**
+	 * Checks if given argument contains odd number of quotation marks
+	 * 
+	 * @param arg
+	 *            the argument
+	 * @return true if arg contains odd number of quotation marks
+	 */
+	private boolean containsQuotationMark(String arg) {
+		boolean contains = false;
+		int noOfQuotationMarks = 0;
+
+		// Calculate quotation marks
+		for (int i = 0; i < arg.length(); i++) {
+			if (arg.charAt(i) == QUOTATION_MARK) {
+				noOfQuotationMarks++;
+			}
+		}
+
+		// Check that number of quotation marks is odd number
+		if (noOfQuotationMarks % 2 != 0) {
+			contains = true;
+		}
+
+		return contains;
+	}
+
+	/**
+	 * Stops external application
+	 */
+	public void stopExternalApplication() {
+		if (process != null) {
+			process.destroy();
+			process = null;
+		}
+		if (reader != null) {
+			reader.shutDown();
+			reader = null;
+		}
+		if (writer != null) {
+			writer.shutDown();
+			writer = null;
+		}
+
+		// Remove filters and open progressbar
+		TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+				.getFilterProcessor().getFilterDialog().removeFilters(
+						TraceViewerGlobals.getTraceViewer()
+								.getDataReaderAccess().getMainDataReader()
+								.getTraceCount());
+	}
+
+	/**
+	 * Gets process
+	 * 
+	 * @return the process
+	 */
+	public Process getProcess() {
+		return process;
+	}
+
+	/**
+	 * Writes trace to process outputstream
+	 * 
+	 * @param properties
+	 *            trace properties
+	 */
+	public void writeTraceToProcess(TraceProperties properties) {
+		if (writer == null) {
+			writer = new ExternalFilterDataWriter(process.getOutputStream());
+		}
+		writer.writeTrace(properties);
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/FilterProcessor.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,684 @@
+/*
+ * 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:
+ *
+ * FilterProcessor DataProcessor
+ *
+ */
+package com.nokia.traceviewer.engine.dataprocessor;
+
+import java.io.FileNotFoundException;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.RandomAccessFile;
+import java.nio.ByteBuffer;
+import java.nio.channels.ByteChannel;
+import java.util.Iterator;
+
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.dialog.FilterDialog;
+import com.nokia.traceviewer.dialog.FilterAdvancedDialog.ExitStatus;
+import com.nokia.traceviewer.dialog.treeitem.FilterTreeBaseItem;
+import com.nokia.traceviewer.dialog.treeitem.FilterTreeComponentItem;
+import com.nokia.traceviewer.dialog.treeitem.FilterTreeItem;
+import com.nokia.traceviewer.dialog.treeitem.FilterTreeTextItem;
+import com.nokia.traceviewer.dialog.treeitem.TreeItem;
+import com.nokia.traceviewer.dialog.treeitem.TreeItemContentProvider;
+import com.nokia.traceviewer.dialog.treeitem.TreeItemListener;
+import com.nokia.traceviewer.engine.DataWriter;
+import com.nokia.traceviewer.engine.PlainTextReader;
+import com.nokia.traceviewer.engine.TraceProperties;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.TraceViewerDialogInterface.Dialog;
+import com.nokia.traceviewer.engine.dataprocessor.FilterRuleSet.LogicalOperator;
+import com.nokia.traceviewer.engine.preferences.PreferenceConstants;
+import com.nokia.traceviewer.engine.preferences.XMLFilterConfigurationImporter;
+
+/**
+ * Filter DataProcessor
+ * 
+ */
+public final class FilterProcessor implements DataProcessor {
+
+	/**
+	 * Interval how often to update progressbar
+	 */
+	private static final int PROGRESSBAR_UPDATE_INTERVAL = 100;
+
+	/**
+	 * Name of Filtered file
+	 */
+	private static final String DEFAULT_FILTER_FILE_NAME = Messages
+			.getString("FilterProcessor.DefaultFilterFileName"); //$NON-NLS-1$
+
+	/**
+	 * Path of Filtered file
+	 */
+	public static final String DEFAULT_FILTER_FILE_PATH = TraceViewerPlugin
+			.getDefault().getStateLocation().append(DEFAULT_FILTER_FILE_NAME)
+			.toOSString();
+
+	/**
+	 * Filter dialog used in setting filters
+	 */
+	private FilterDialog filterDialog;
+
+	/**
+	 * Content provider for the filter dialog
+	 */
+	private TreeItemContentProvider contentProvider;
+
+	/**
+	 * First visible object in the filter dialog tree
+	 */
+	private TreeItem root;
+
+	/**
+	 * Filter rule sets
+	 */
+	private final FilterRuleSet filterRuleSet;
+
+	/**
+	 * DataWriter used to write binary filtered file
+	 */
+	private DataWriter dataWriter;
+
+	/**
+	 * Writer to be used for plain text writing
+	 */
+	private PrintWriter plainOutput;
+
+	/**
+	 * External Filter Processor
+	 */
+	private ExternalFilterProcessor externalFilterProcessor;
+
+	/**
+	 * Indicates that external filter program is in use
+	 */
+	private boolean usingExternalFilter;
+
+	/**
+	 * Indicates that stream must be flushed
+	 */
+	private boolean needsFlushing;
+
+	/**
+	 * Indicates to show traces containing the rule. Otherwise they're hidden
+	 */
+	private boolean showTracesContainingRule = true;
+
+	/**
+	 * Indicates that logical OR is in use. Otherwise AND is in use.
+	 */
+	private boolean logicalOrInUse = true;
+
+	/**
+	 * Advanced filter string
+	 */
+	private String advancedFilterString = ""; //$NON-NLS-1$
+
+	/**
+	 * Constructor
+	 */
+	public FilterProcessor() {
+		createInitialFilterTree();
+		filterRuleSet = new FilterRuleSet();
+		filterRuleSet.setOperator(LogicalOperator.OR);
+	}
+
+	/**
+	 * Creates initial filter tree
+	 */
+	public void createInitialFilterTree() {
+		contentProvider = new TreeItemContentProvider();
+		// Create root node
+		TreeItem treeRoot = new FilterTreeBaseItem(contentProvider, null,
+				"root", //$NON-NLS-1$
+				FilterTreeItem.Rule.GROUP);
+		root = new FilterTreeBaseItem(contentProvider, treeRoot,
+				TraceViewerPlugin.getDefault().getPreferenceStore().getString(
+						PreferenceConstants.CONFIGURATION_FILE),
+				FilterTreeItem.Rule.GROUP);
+		treeRoot.addChild(root);
+	}
+
+	/**
+	 * Imports filter rules from configuration file
+	 */
+	public void importFilterRules() {
+		// Import Filter rules
+		XMLFilterConfigurationImporter importer = new XMLFilterConfigurationImporter(
+				root, TraceViewerPlugin.getDefault().getPreferenceStore()
+						.getString(PreferenceConstants.CONFIGURATION_FILE),
+				true);
+		importer.importData();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.DataProcessor#processData(com.nokia.traceviewer
+	 * .engine.TraceProperties)
+	 */
+	public void processData(TraceProperties properties) {
+		TraceViewerGlobals.debug("processData in Filter", //$NON-NLS-1$
+				TraceViewerGlobals.DebugLevel.TEST);
+		if (isFiltering()) {
+			// Read from filter file or triggered out, don't try to filter again
+			if (properties.traceConfiguration.isReadFromFilterFile()
+					|| properties.traceConfiguration.isTriggeredOut()) {
+				// Don't' do anything
+			} else {
+				// Filter everything out from view that isn't from filterFile
+				properties.traceConfiguration.setFilteredOut(true);
+
+				// External filter processor
+				if (isUsingExternalFilter()) {
+					externalFilterProcessor.writeTraceToProcess(properties);
+				} else {
+
+					// Process filter rules
+					boolean filterHits = processFilterRules(properties,
+							filterRuleSet);
+
+					// Write trace
+					writeTrace(properties, filterHits);
+				}
+			}
+		} else {
+			properties.traceConfiguration.setFilteredOut(false);
+		}
+
+		// Update progressBar if needed
+		updateProgressBar();
+	}
+
+	/**
+	 * Writes trace if conditions ok
+	 * 
+	 * @param properties
+	 *            trace to write
+	 * @param filterHits
+	 *            filter hits property
+	 */
+	private void writeTrace(TraceProperties properties, boolean filterHits) {
+		// Write the trace
+		if (filterHits && showTracesContainingRule) {
+			writeTraceToFile(properties);
+		} else if (!filterHits && !showTracesContainingRule) {
+			writeTraceToFile(properties);
+		}
+	}
+
+	/**
+	 * Process Filter Rules
+	 * 
+	 * @param properties
+	 *            trace properties
+	 * @param ruleObject
+	 *            filter rule set
+	 * @return true if the rule object should be written to filter file
+	 */
+	private boolean processFilterRules(TraceProperties properties,
+			FilterRuleObject ruleObject) {
+		boolean filterHits = true;
+
+		// Process the rule
+		if (ruleObject != null) {
+			filterHits = ruleObject.processRule(properties);
+
+			// Rule set is null, abort
+		} else {
+			filterHits = false;
+		}
+
+		return filterHits;
+	}
+
+	/**
+	 * Writes trace to file
+	 * 
+	 * @param properties
+	 *            trace properties
+	 */
+	private void writeTraceToFile(TraceProperties properties) {
+
+		// Write the trace to filterFile
+		if (dataWriter != null) {
+
+			// Write all parts of multipart trace
+			if (properties.bTraceInformation.getMultiPartTraceParts() != null) {
+				Iterator<byte[]> i = properties.bTraceInformation
+						.getMultiPartTraceParts().getTraceParts().iterator();
+
+				while (i.hasNext()) {
+					byte[] byteArr = i.next();
+					dataWriter.writeMessage(ByteBuffer.wrap(byteArr), 0,
+							byteArr.length);
+				}
+			} else {
+				dataWriter.writeMessage(properties.byteBuffer,
+						properties.messageStart, properties.messageLength);
+			}
+		} else if (plainOutput != null) {
+			writeStringToPlainTextFilterFile(properties.traceString);
+		}
+	}
+
+	/**
+	 * Writes a string to plain text filter file. Adds line break after the
+	 * string
+	 * 
+	 * @param string
+	 *            string to write
+	 */
+	private void writeStringToPlainTextFilterFile(String string) {
+		StringBuffer buf = new StringBuffer(string.length() + 1);
+		buf.append(string);
+		buf.append('\n');
+		plainOutput.write(buf.toString());
+		needsFlushing = true;
+	}
+
+	/**
+	 * Updates progressBar if needed
+	 */
+	private void updateProgressBar() {
+
+		// Check that we are processing filter and update interval is reached
+		if (isProcessingFilter()
+				&& TraceViewerGlobals.getTraceViewer().getDataReaderAccess()
+						.getMainDataReader().getTraceCount()
+						% PROGRESSBAR_UPDATE_INTERVAL == 0) {
+			filterDialog.getProgressBar().updateProgressBar(
+					TraceViewerGlobals.getTraceViewer().getDataReaderAccess()
+							.getMainDataReader().getTraceCount());
+
+		}
+	}
+
+	/**
+	 * Tells if filters are on
+	 * 
+	 * @return filtering status
+	 */
+	public boolean isFiltering() {
+		boolean filtering = false;
+		if (hasRules()) {
+			filtering = true;
+		} else if (isUsingExternalFilter()) {
+			filtering = true;
+		}
+		return filtering;
+	}
+
+	/**
+	 * Creates filtered file
+	 */
+	public void createFilteredFile() {
+		// Build the file writer to filter file
+		buildFilterFileWriter();
+
+		// Shut down possible old filter reader
+		TraceViewerGlobals.getTraceViewer().getDataReaderAccess()
+				.deleteFilterReader();
+
+		// Start reading the data file from the beginning
+		TraceViewerGlobals.getTraceViewer().readDataFileFromBeginning();
+
+		// Create filter datareader
+		TraceViewerGlobals.getTraceViewer().getDataReaderAccess()
+				.createFilterDataReader();
+
+	}
+
+	/**
+	 * Builds the filter file writer
+	 * 
+	 * @return status of building filter file
+	 */
+	public boolean buildFilterFileWriter() {
+		boolean success = false;
+		try {
+			// Binary writer
+			if (!isUsingExternalFilter()
+					&& !(TraceViewerGlobals.getTraceViewer()
+							.getDataReaderAccess().getMainDataReader() instanceof PlainTextReader)) {
+
+				// If plain output exists, close it
+				if (plainOutput != null) {
+					plainOutput.close();
+					plainOutput = null;
+				}
+
+				// Close possible old binary writer
+				if (dataWriter != null) {
+					dataWriter.closeChannel();
+					dataWriter = null;
+				}
+
+				RandomAccessFile filterFile = null;
+				filterFile = new RandomAccessFile(DEFAULT_FILTER_FILE_PATH,
+						"rw"); //$NON-NLS-1$
+				filterFile.setLength(0);
+
+				ByteChannel writeChannel = filterFile.getChannel();
+
+				dataWriter = TraceViewerGlobals.getTraceProvider()
+						.createDataWriter(writeChannel);
+
+				success = true;
+				// Plain text writer
+			} else {
+				// Close possible binary writer
+				if (dataWriter != null) {
+					dataWriter.closeChannel();
+					dataWriter = null;
+				}
+
+				// Close possible previous plainOutput writer
+				if (plainOutput != null) {
+					plainOutput.close();
+				}
+
+				plainOutput = new PrintWriter(new FileWriter(
+						DEFAULT_FILTER_FILE_PATH));
+				success = true;
+			}
+
+		} catch (FileNotFoundException e) {
+			e.printStackTrace();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		return success;
+	}
+
+	/**
+	 * Gets filter dialog
+	 * 
+	 * @return filter dialog
+	 */
+	public FilterDialog getFilterDialog() {
+		if (filterDialog == null) {
+			filterDialog = (FilterDialog) TraceViewerGlobals.getTraceViewer()
+					.getDialogs().createDialog(Dialog.FILTER);
+		}
+		return filterDialog;
+	}
+
+	/**
+	 * Tells if initial filtering is in process
+	 * 
+	 * @return true if initial filtering is in progress
+	 */
+	public boolean isProcessingFilter() {
+		boolean isProcessing = false;
+		if (filterDialog != null && filterDialog.getProgressBar() != null
+				&& filterDialog.getProgressBar().getShell() != null
+				&& !filterDialog.getProgressBar().getShell().isDisposed()) {
+			isProcessing = true;
+		}
+		return isProcessing;
+	}
+
+	/**
+	 * Gets filter rule set
+	 * 
+	 * @return filter rule set
+	 */
+	public FilterRuleSet getFilterRules() {
+		return filterRuleSet;
+	}
+
+	/**
+	 * Indicates that some filtering rules are applied
+	 * 
+	 * @return true if some filtering rules are applied
+	 */
+	public boolean hasRules() {
+		boolean hasRules = false;
+		if (filterRuleSet != null && !filterRuleSet.getFilterRules().isEmpty()) {
+			hasRules = true;
+		}
+		return hasRules;
+	}
+
+	/**
+	 * Gets the visible root of the tree
+	 * 
+	 * @return the root root of the tree
+	 */
+	public TreeItem getRoot() {
+		return root;
+	}
+
+	/**
+	 * Gets Filter item listener
+	 * 
+	 * @return the contentProvider
+	 */
+	public TreeItemListener getTreeItemListener() {
+		return contentProvider;
+	}
+
+	/**
+	 * Gets data writer
+	 * 
+	 * @return the dataWriter
+	 */
+	public DataWriter getDataWriter() {
+		return dataWriter;
+	}
+
+	/**
+	 * Sets using of external filter boolean
+	 * 
+	 * @param using
+	 *            if true, starts using external filter program
+	 */
+	public void setUsingExternalFilter(boolean using) {
+		// Previously true, shut down possible Processes
+		if (usingExternalFilter && !using) {
+			externalFilterProcessor.stopExternalApplication();
+		} else if (using) {
+			// Create the processor when first needed
+			if (externalFilterProcessor == null) {
+				externalFilterProcessor = new ExternalFilterProcessor();
+			}
+		}
+		this.usingExternalFilter = using;
+	}
+
+	/**
+	 * Flushes plain text writing streams
+	 */
+	public void flush() {
+		// Flush the filter file writer
+		if (plainOutput != null && needsFlushing) {
+			plainOutput.flush();
+			needsFlushing = false;
+		}
+	}
+
+	/**
+	 * Gets External Filter Processor
+	 * 
+	 * @return the externalFilterProcessor
+	 */
+	public ExternalFilterProcessor getExternalFilterProcessor() {
+		return externalFilterProcessor;
+	}
+
+	/**
+	 * Indicates that we are using external filter file
+	 * 
+	 * @return the usingExternalFilter
+	 */
+	public boolean isUsingExternalFilter() {
+		boolean usingFilter = false;
+		if (usingExternalFilter && externalFilterProcessor != null
+				&& externalFilterProcessor.getProcess() != null) {
+			usingFilter = true;
+		}
+		return usingFilter;
+	}
+
+	/**
+	 * Checks if logical or is in use. Otherwise it's AND
+	 * 
+	 * @return the logicalOrInUse
+	 */
+	public boolean isLogicalOrInUse() {
+		return logicalOrInUse;
+	}
+
+	/**
+	 * Sets logical or to use
+	 * 
+	 * @param logicalOrInUse
+	 *            the logicalOrInUse to set
+	 */
+	public void setLogicalOrInUse(boolean logicalOrInUse) {
+		this.logicalOrInUse = logicalOrInUse;
+	}
+
+	/**
+	 * Checks if show traces is on. Otherwise hide traces is on.
+	 * 
+	 * @return the showTracesContainingRule
+	 */
+	public boolean isShowTracesContainingRule() {
+		return showTracesContainingRule;
+	}
+
+	/**
+	 * Sets the show / hide traces option
+	 * 
+	 * @param showTracesContainingRule
+	 *            the showTracesContainingRule to set
+	 */
+	public void setShowTracesContainingRule(boolean showTracesContainingRule) {
+		this.showTracesContainingRule = showTracesContainingRule;
+	}
+
+	/**
+	 * Filters string from external process and if it passes, writes it to
+	 * filter file
+	 * 
+	 * @param properties
+	 *            trace properties from the external process
+	 */
+	public void filterStringFromExternalProcess(TraceProperties properties) {
+		// If there are filter rules
+		if (hasRules()) {
+
+			// Line must hit a filter to be written to the file
+			processFilterRules(properties, filterRuleSet);
+
+		} else {
+			// Write the trace
+			writeStringToPlainTextFilterFile(properties.traceString);
+		}
+	}
+
+	/**
+	 * Enable filter rule
+	 * 
+	 * @param item
+	 *            the rule item
+	 * @param op
+	 *            logical operator
+	 */
+	public void enableRule(FilterTreeItem item, LogicalOperator op) {
+		// Get or create the set where new items are inserted
+		FilterRuleSet set;
+		if (filterRuleSet.getFilterRules().isEmpty()) {
+			set = new FilterRuleSet();
+			set.setOperator(op);
+			filterRuleSet.addObject(set);
+		} else {
+			set = (FilterRuleSet) filterRuleSet.getFilterRules().get(0);
+		}
+
+		if (item instanceof FilterTreeTextItem) {
+			set.addObject(item);
+		} else if (item instanceof FilterTreeComponentItem) {
+			set.addObject(0, item);
+		}
+
+		// First rule to enable
+		if (set.getFilterRules().size() == 1) {
+			enableRulesOnStartup();
+		}
+	}
+
+	/**
+	 * Enable advanced filter string
+	 * 
+	 * @param filterString
+	 *            the filter string
+	 */
+	public void enableAdvancedFilter(String filterString) {
+		advancedFilterString = filterString;
+
+		// Create needed shell items to advanced dialog
+		getFilterDialog().getAdvancedDialog().create();
+
+		// Check that rules are ok and then enable them
+		if (getFilterDialog().getAdvancedDialog().checkWrittenRules(
+				filterString)) {
+			getFilterDialog().getAdvancedDialog().exitStatus = ExitStatus.APPLYBUTTON;
+
+			// Generate the filter rule set
+			FilterRuleObject set = getFilterDialog().getAdvancedDialog()
+					.createRuleSet(filterString, false);
+			filterRuleSet.addObject(set);
+
+			enableRulesOnStartup();
+		}
+	}
+
+	/**
+	 * Enables rules on startup
+	 */
+	private void enableRulesOnStartup() {
+		createFilteredFile();
+
+		// Update view name
+		TraceViewerGlobals.getTraceViewer().getView().updateViewName();
+	}
+
+	/**
+	 * Gets advanced filter string
+	 * 
+	 * @return the advancedFilterString
+	 */
+	public String getAdvancedFilterString() {
+		return advancedFilterString.trim();
+	}
+
+	/**
+	 * Sets advanced filter string
+	 * 
+	 * @param advancedFilterString
+	 *            the advancedFilterString to set
+	 */
+	public void setAdvancedFilterString(String advancedFilterString) {
+		this.advancedFilterString = advancedFilterString;
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/FilterRuleObject.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,52 @@
+/*
+ * 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:
+ *
+ * Interface for filter rule objects
+ *
+ */
+package com.nokia.traceviewer.engine.dataprocessor;
+
+import com.nokia.traceviewer.engine.TraceProperties;
+
+/**
+ * Interface for filter rule objects
+ * 
+ */
+public interface FilterRuleObject {
+
+	/**
+	 * Tells that this filter rule object is inside a logical NOT
+	 * 
+	 * @return true if object is inside a logical NOT
+	 */
+	public boolean isLogicalNotRule();
+
+	/**
+	 * Sets this filter rule object to NOT condition
+	 * 
+	 * @param notRule
+	 *            the new status of NOT condition
+	 */
+	public void setLogicalNotRule(boolean notRule);
+
+	/**
+	 * Processes this filter rule
+	 * 
+	 * @param properties
+	 *            trace properties
+	 * @return true if filter rule hits, false otherwise
+	 */
+	public boolean processRule(TraceProperties properties);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/FilterRuleSet.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,191 @@
+/*
+ * 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:
+ *
+ * Filter Rule Set
+ *
+ */
+package com.nokia.traceviewer.engine.dataprocessor;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.nokia.traceviewer.engine.TraceProperties;
+
+/**
+ * Filter Rule Set
+ */
+public class FilterRuleSet implements FilterRuleObject {
+
+	/**
+	 * Filter rule objects contained in this rule set
+	 */
+	private final List<FilterRuleObject> filterRuleObjects;
+
+	/**
+	 * Indicates if this rule set is inside logical NOT
+	 */
+	private boolean notRuleSet;
+
+	/**
+	 * Logical operation for this rule set
+	 */
+	private LogicalOperator operator;
+
+	/**
+	 * Logical operations enumeration
+	 */
+	public enum LogicalOperator {
+
+		/**
+		 * Logical operator OR
+		 */
+		OR,
+
+		/**
+		 * Logical operator AND
+		 */
+		AND;
+	}
+
+	/**
+	 * Constructor
+	 */
+	public FilterRuleSet() {
+		filterRuleObjects = new ArrayList<FilterRuleObject>();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.dataprocessor.FilterRuleObject#isLogicalNotRule
+	 * ()
+	 */
+	public boolean isLogicalNotRule() {
+		return notRuleSet;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.dataprocessor.FilterRuleObject#setLogicalNotRule
+	 * (boolean)
+	 */
+	public void setLogicalNotRule(boolean notRule) {
+		// Change the operator when NOT status changes
+		if (this.notRuleSet != notRule) {
+			if (operator == LogicalOperator.OR) {
+				operator = LogicalOperator.AND;
+			} else {
+				operator = LogicalOperator.OR;
+			}
+		}
+		this.notRuleSet = notRule;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.dataprocessor.FilterRuleObject
+	 * #processRule(com.nokia.traceviewer.engine.TraceProperties)
+	 */
+	public boolean processRule(TraceProperties properties) {
+		int len = getFilterRules().size();
+		boolean filterHits = true;
+		// Loop through rules
+		for (int i = 0; filterHits && i < len; i++) {
+			// Get the rule
+			FilterRuleObject rule = getFilterRules().get(i);
+
+			// Process filter rule
+			if (rule != null) {
+				filterHits = rule.processRule(properties);
+			}
+
+			// Logical operator OR in use
+			if (getOperator() == LogicalOperator.OR) {
+				// One rule has hit, ready and break
+				if (filterHits) {
+					break;
+					// Not in end, continue
+				} else if (i < len - 1) {
+					filterHits = true;
+					// End, rule was not found
+				} else if (i == len - 1) {
+					filterHits = false;
+				}
+
+				// Logical operator AND in use
+			} else if (getOperator() == LogicalOperator.AND) {
+				// Some rule didn't hit, break
+				if (!filterHits) {
+					break;
+				}
+			}
+		}
+		return filterHits;
+	}
+
+	/**
+	 * Gets the logical operator
+	 * 
+	 * @return the operator
+	 */
+	public LogicalOperator getOperator() {
+		return operator;
+	}
+
+	/**
+	 * Sets the logical operator
+	 * 
+	 * @param operator
+	 *            the operator to set
+	 */
+	public void setOperator(LogicalOperator operator) {
+		this.operator = operator;
+	}
+
+	/**
+	 * Adds new Filter rule object to the list
+	 * 
+	 * @param object
+	 *            object to be added
+	 */
+	public void addObject(FilterRuleObject object) {
+		filterRuleObjects.add(object);
+	}
+
+	/**
+	 * Adds new Filter rule object to the list
+	 * 
+	 * @param position
+	 *            position to add the object
+	 * @param object
+	 *            object to be added
+	 */
+	public void addObject(int position, FilterRuleObject object) {
+		filterRuleObjects.add(position, object);
+	}
+
+	/**
+	 * Gets filter rule objects from this filter rule set
+	 * 
+	 * @return the filterRuleObjects
+	 */
+	public List<FilterRuleObject> getFilterRules() {
+		return filterRuleObjects;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/LineCountItem.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,109 @@
+/*
+ * 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:
+ *
+ * Line Count Item
+ *
+ */
+package com.nokia.traceviewer.engine.dataprocessor;
+
+/**
+ * Line count item showed in the lineCountingTable
+ * 
+ */
+public class LineCountItem {
+
+	/**
+	 * Name of the item
+	 */
+	private String name;
+
+	/**
+	 * Count of the item
+	 */
+	private int count;
+
+	/**
+	 * Indicates if item has changed since last update
+	 */
+	private boolean changed;
+
+	/**
+	 * @param name
+	 *            Name of the item
+	 * @param count
+	 *            count of the item
+	 */
+	public LineCountItem(String name, int count) {
+		this.name = name;
+		this.count = count;
+	}
+
+	/**
+	 * Tells the status of changed attribute
+	 * 
+	 * @return the changed
+	 */
+	public boolean isChanged() {
+		return changed;
+	}
+
+	/**
+	 * Sets the changed attribute
+	 * 
+	 * @param changed
+	 *            the changed to set
+	 */
+	public void setChanged(boolean changed) {
+		this.changed = changed;
+	}
+
+	/**
+	 * Gets count
+	 * 
+	 * @return the count
+	 */
+	public int getCount() {
+		return count;
+	}
+
+	/**
+	 * Sets count
+	 * 
+	 * @param count
+	 *            the count to set
+	 */
+	public void setCount(int count) {
+		this.count = count;
+	}
+
+	/**
+	 * Gets name
+	 * 
+	 * @return the name
+	 */
+	public String getName() {
+		return name;
+	}
+
+	/**
+	 * Sets name
+	 * 
+	 * @param name
+	 *            the name to set
+	 */
+	public void setName(String name) {
+		this.name = name;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/LineCountProcessor.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,379 @@
+/*
+ * 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:
+ *
+ * LineCountProcessor DataProcessor
+ *
+ */
+package com.nokia.traceviewer.engine.dataprocessor;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.action.TraceViewerActionUtils;
+import com.nokia.traceviewer.dialog.BasePropertyDialog;
+import com.nokia.traceviewer.dialog.LineCountDialog;
+import com.nokia.traceviewer.dialog.treeitem.LineCountTreeBaseItem;
+import com.nokia.traceviewer.dialog.treeitem.LineCountTreeComponentItem;
+import com.nokia.traceviewer.dialog.treeitem.LineCountTreeItem;
+import com.nokia.traceviewer.dialog.treeitem.LineCountTreeTextItem;
+import com.nokia.traceviewer.dialog.treeitem.TreeItem;
+import com.nokia.traceviewer.dialog.treeitem.TreeItemContentProvider;
+import com.nokia.traceviewer.dialog.treeitem.TreeItemListener;
+import com.nokia.traceviewer.engine.TraceInformation;
+import com.nokia.traceviewer.engine.TraceProperties;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.TraceViewerPropertyViewInterface;
+import com.nokia.traceviewer.engine.TraceViewerDialogInterface.Dialog;
+import com.nokia.traceviewer.engine.preferences.PreferenceConstants;
+import com.nokia.traceviewer.engine.preferences.XMLLineCountConfigurationImporter;
+
+/**
+ * LineCount DataProcessor
+ * 
+ */
+public final class LineCountProcessor implements DataProcessor {
+
+	/**
+	 * Interval how often to update progressbar
+	 */
+	private static final int PROGRESSBAR_UPDATE_INTERVAL = 100;
+
+	/**
+	 * Line count dialog used in setting rules
+	 */
+	private LineCountDialog lineCountDialog;
+
+	/**
+	 * Content provider for the dialog
+	 */
+	private TreeItemContentProvider contentProvider;
+
+	/**
+	 * First visible object in the dialog tree
+	 */
+	private TreeItem root;
+
+	/**
+	 * Line count items array
+	 */
+	private final List<LineCountItem> lineCountItems;
+
+	/**
+	 * Text rules that are applied
+	 */
+	private final List<LineCountTreeTextItem> textRules;
+
+	/**
+	 * Component rules that are applied
+	 */
+	private final List<LineCountTreeComponentItem> componentRules;
+
+	/**
+	 * Constructor
+	 */
+	public LineCountProcessor() {
+		// Create initial tree
+		createInitialTree();
+
+		// Create rule arrays
+		lineCountItems = new ArrayList<LineCountItem>();
+		textRules = new ArrayList<LineCountTreeTextItem>();
+		componentRules = new ArrayList<LineCountTreeComponentItem>();
+
+	}
+
+	/**
+	 * Creates initial tree
+	 */
+	public void createInitialTree() {
+		contentProvider = new TreeItemContentProvider();
+		// Create root node
+		TreeItem treeRoot = new LineCountTreeBaseItem(contentProvider, null,
+				"root", //$NON-NLS-1$
+				LineCountTreeItem.Rule.GROUP);
+		root = new LineCountTreeBaseItem(contentProvider, treeRoot,
+				TraceViewerPlugin.getDefault().getPreferenceStore().getString(
+						PreferenceConstants.CONFIGURATION_FILE),
+				LineCountTreeItem.Rule.GROUP);
+		treeRoot.addChild(root);
+	}
+
+	/**
+	 * Imports line count rules from configuration file
+	 */
+	public void importLineCountRules() {
+		// Import Line Count rules
+		XMLLineCountConfigurationImporter importer = new XMLLineCountConfigurationImporter(
+				root, TraceViewerPlugin.getDefault().getPreferenceStore()
+						.getString(PreferenceConstants.CONFIGURATION_FILE),
+				true);
+		importer.importData();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.DataProcessor#processData(com.nokia.traceviewer
+	 * .engine.TraceProperties)
+	 */
+	public void processData(TraceProperties properties) {
+		if (!properties.traceConfiguration.isScrolledTrace()
+				&& !properties.traceConfiguration.isFilteredOut()
+				&& !properties.traceConfiguration.isTriggeredOut()) {
+			if (!lineCountItems.isEmpty()) {
+				boolean ruleHit = false;
+
+				// Process component rules
+				ruleHit = processComponentRules(properties);
+
+				// Process text rules
+				if (!ruleHit) {
+					processTextRules(properties);
+				}
+
+				// Update progressBar if needed
+				updateProgressBar();
+			}
+		}
+	}
+
+	/**
+	 * Process component rules
+	 * 
+	 * @param properties
+	 *            trace properties
+	 * @return true if rule hits
+	 */
+	private boolean processComponentRules(TraceProperties properties) {
+		boolean ruleHit = false;
+		TraceInformation information = properties.information;
+
+		// Information must be defined
+		if (information != null && information.isDefined()) {
+
+			// Loop through component rules
+			int len = componentRules.size();
+			LineCountTreeComponentItem rule;
+			for (int i = 0; i < len; i++) {
+				rule = componentRules.get(i);
+				// Get component ID
+				int compId = rule.getComponentId();
+
+				// Component ID matches
+				if (compId == BasePropertyDialog.WILDCARD_INTEGER
+						|| compId == information.getComponentId()) {
+
+					// Get group ID
+					int groupId = rule.getGroupId();
+
+					// Group ID matches
+					if (groupId == BasePropertyDialog.WILDCARD_INTEGER
+							|| groupId == information.getGroupId()) {
+
+						updateLineCountItem(i);
+						ruleHit = true;
+						break;
+					}
+				}
+			}
+		}
+		return ruleHit;
+	}
+
+	/**
+	 * Process text rules
+	 * 
+	 * @param properties
+	 *            trace properties
+	 * @return true if rule hits
+	 */
+	private boolean processTextRules(TraceProperties properties) {
+		boolean ruleHit = false;
+
+		// Loop through text rules
+		int len = textRules.size();
+		LineCountTreeTextItem rule;
+		for (int i = 0; i < len; i++) {
+			rule = textRules.get(i);
+			String traceLine = ""; //$NON-NLS-1$
+
+			// Traces missing
+			if (properties.bTraceInformation.isTraceMissing()) {
+				traceLine = TraceViewerActionUtils.TRACES_DROPPED_MSG;
+			}
+			if (properties.traceString != null) {
+				traceLine += properties.traceString;
+			}
+
+			String ruleStr = rule.getTextToCompare();
+			if (ruleStr == null) {
+				break;
+			}
+			if (!rule.isMatchCase()) {
+				traceLine = traceLine.toLowerCase();
+			}
+
+			// Line hits
+			if (traceLine.contains(ruleStr)) {
+				// Get offset of this text rule in lineCountItems list by adding
+				// i to the number of component rules existing
+				updateLineCountItem(componentRules.size() + i);
+				ruleHit = true;
+			}
+		}
+		return ruleHit;
+	}
+
+	/**
+	 * Updates Line Count Item
+	 * 
+	 * @param offset
+	 *            offset of item to update
+	 */
+	private void updateLineCountItem(int offset) {
+		LineCountItem item = lineCountItems.get(offset);
+		int count = item.getCount();
+		item.setCount(count + 1);
+		item.setChanged(true);
+
+		TraceViewerPropertyViewInterface view = TraceViewerGlobals
+				.getTraceViewer().getPropertyView();
+		if (view != null) {
+			view.setLineCountTableChanged();
+		}
+	}
+
+	/**
+	 * Update progressBar if needed
+	 */
+	private void updateProgressBar() {
+		// Update possible progressBar
+		if (isProcessingCounting()
+				&& TraceViewerGlobals.getTraceViewer().getDataReaderAccess()
+						.getCurrentDataReader().getTraceCount()
+						% PROGRESSBAR_UPDATE_INTERVAL == 0) {
+			lineCountDialog.getProgressBar().updateProgressBar(
+					TraceViewerGlobals.getTraceViewer().getDataReaderAccess()
+							.getCurrentDataReader().getTraceCount());
+
+		}
+	}
+
+	/**
+	 * Tells if initial counting is in process
+	 * 
+	 * @return true if initial counting is in progress
+	 */
+	public boolean isProcessingCounting() {
+		return (lineCountDialog != null
+				&& lineCountDialog.getProgressBar() != null
+				&& lineCountDialog.getProgressBar().getShell() != null && !lineCountDialog
+				.getProgressBar().getShell().isDisposed());
+	}
+
+	/**
+	 * Gets lineCount dialog
+	 * 
+	 * @return filter dialog
+	 */
+	public LineCountDialog getLineCountDialog() {
+		if (lineCountDialog == null) {
+			lineCountDialog = (LineCountDialog) TraceViewerGlobals
+					.getTraceViewer().getDialogs().createDialog(
+							Dialog.COUNTLINES);
+		}
+		return lineCountDialog;
+	}
+
+	/**
+	 * Gets root of the filter tree
+	 * 
+	 * @return root
+	 */
+	public TreeItem getRoot() {
+		return root;
+	}
+
+	/**
+	 * Gets item listener
+	 * 
+	 * @return the contentProvider
+	 */
+	public TreeItemListener getTreeItemListener() {
+		return contentProvider;
+	}
+
+	/**
+	 * Gets lineCountItems
+	 * 
+	 * @return the lineCountItems
+	 */
+	public List<LineCountItem> getLineCountItems() {
+		return lineCountItems;
+	}
+
+	/**
+	 * Gets text rules
+	 * 
+	 * @return text rules
+	 */
+	public List<LineCountTreeTextItem> getTextRules() {
+		return textRules;
+	}
+
+	/**
+	 * Gets component rules
+	 * 
+	 * @return component rules
+	 */
+	public List<LineCountTreeComponentItem> getComponentRules() {
+		return componentRules;
+	}
+
+	/**
+	 * Empty lineCountItems
+	 */
+	public void emptyLineCountItems() {
+		for (int i = 0; i < lineCountItems.size(); i++) {
+			lineCountItems.get(i).setCount(0);
+			lineCountItems.get(i).setChanged(true);
+		}
+	}
+
+	/**
+	 * Enable linecount rule
+	 * 
+	 * @param item
+	 *            the rule item
+	 */
+	public void enableRule(LineCountTreeItem item) {
+		LineCountItem newItem = new LineCountItem(item.getName(), 0);
+		if (item instanceof LineCountTreeTextItem) {
+			textRules.add((LineCountTreeTextItem) item);
+			lineCountItems.add(newItem);
+
+			// Add component item to the beginning of the list
+		} else if (item instanceof LineCountTreeComponentItem) {
+			componentRules.add((LineCountTreeComponentItem) item);
+			lineCountItems.add(0, newItem);
+		}
+		if (TraceViewerGlobals.getTraceViewer().getPropertyView() != null) {
+			TraceViewerGlobals.getTraceViewer().getPropertyView()
+					.createNewPropertyTableItems();
+		}
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/Logger.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,650 @@
+/*
+ * 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:
+ *
+ * Logger DataProcessor
+ *
+ */
+package com.nokia.traceviewer.engine.dataprocessor;
+
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.nio.ByteBuffer;
+import java.nio.channels.FileChannel;
+import java.util.Iterator;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+
+import com.nokia.traceviewer.action.TraceViewerActionUtils;
+import com.nokia.traceviewer.engine.TraceProperties;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.TraceViewerUtils;
+
+/**
+ * Logger DataProcessor
+ * 
+ */
+public final class Logger implements DataProcessor {
+
+	/**
+	 * Equals char
+	 */
+	private static final char EQUALS_CHAR = '=';
+
+	/**
+	 * Parameter char
+	 */
+	private static final char PARAMETER_CHAR = 'p';
+
+	/**
+	 * Machine readable time tag
+	 */
+	private static final String TAG_TIME = "time="; //$NON-NLS-1$
+
+	/**
+	 * Machine readable CPU ID tag
+	 */
+	private static final String TAG_CPU_ID = "cpuID="; //$NON-NLS-1$
+
+	/**
+	 * Machine readable Thread ID tag
+	 */
+	private static final String TAG_THREAD_ID = "threadID="; //$NON-NLS-1$
+
+	/**
+	 * Component ID tag
+	 */
+	private static final String TAG_COMPONENT_ID = "compID="; //$NON-NLS-1$
+
+	/**
+	 * Group ID tag
+	 */
+	private static final String TAG_GROUP_ID = "groupID="; //$NON-NLS-1$
+
+	/**
+	 * Trace ID tag
+	 */
+	private static final String TAG_TRACE_ID = "traceID="; //$NON-NLS-1$
+
+	/**
+	 * Trace text tag
+	 */
+	private static final String TAG_TRACE_TEXT = "trace="; //$NON-NLS-1$
+
+	/**
+	 * Data tag
+	 */
+	private static final String DATA_TAG = "data="; //$NON-NLS-1$
+
+	/**
+	 * Comment tag
+	 */
+	private static final String COMMENT_TAG = "comment="; //$NON-NLS-1$
+
+	/**
+	 * Empty string
+	 */
+	private static final String EMPTY = ""; //$NON-NLS-1$
+
+	/**
+	 * Start bracket tag
+	 */
+	private static final char TAG_START_BRACKET = '[';
+
+	/**
+	 * End bracket tag
+	 */
+	private static final char TAG_END_BRACKET = ']';
+
+	/**
+	 * Hyphen char
+	 */
+	private static final char HYPHEN_CHAR = '-';
+
+	/**
+	 * Underscore char
+	 */
+	private static final char UNDERSCORE_CHAR = '_';
+
+	/**
+	 * Semicolon char
+	 */
+	private static final char SEMICOLON_CHAR = ';';
+
+	/**
+	 * End line character \r
+	 */
+	private static final char ENDLINE_R = '\r';
+
+	/**
+	 * End line character \n
+	 */
+	private static final char ENDLINE_N = '\n';
+
+	/**
+	 * Tabulator character
+	 */
+	private static final char TABULATOR = '\t';
+
+	/**
+	 * Writer to be used for writing
+	 */
+	private PrintWriter plainOutput;
+
+	/**
+	 * Filechannel where binary log is written
+	 */
+	private FileChannel binaryOutput;
+
+	/**
+	 * Logging in plain text
+	 */
+	private boolean plainLogging;
+
+	/**
+	 * Logging in binary
+	 */
+	private boolean binaryLogging;
+
+	/**
+	 * Path to plain text log file
+	 */
+	private String plainLogPath;
+
+	/**
+	 * Path to binary log file
+	 */
+	private String binaryLogPath;
+
+	/**
+	 * Omitting timestamp or not
+	 */
+	private boolean omitTimestamps;
+
+	/**
+	 * Machine readable log file
+	 */
+	private boolean machineReadable;
+
+	/**
+	 * Tells if a log file is opened
+	 */
+	private boolean logFileOpened;
+
+	/**
+	 * Opened log file path
+	 */
+	private String openedLogFilePath;
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.DataProcessor#processData(com.nokia.traceviewer
+	 * .engine.TraceProperties)
+	 */
+	public void processData(TraceProperties properties) {
+		if (!properties.traceConfiguration.isFilteredOut()
+				&& !properties.traceConfiguration.isScrolledTrace()
+				&& !properties.traceConfiguration.isTriggeredOut()) {
+
+			// Logging as plain text
+			if (plainLogging) {
+
+				String trace = createPlainTextTrace(properties);
+
+				// Write the trace
+				if (trace != null) {
+					plainOutput.write(trace);
+				}
+			}
+
+			// Binary logging
+			if (binaryLogging) {
+				try {
+					if (properties.byteBuffer != null && binaryOutput != null) {
+
+						// Write all parts of multipart trace
+						if (properties.bTraceInformation
+								.getMultiPartTraceParts() != null) {
+							Iterator<byte[]> i = properties.bTraceInformation
+									.getMultiPartTraceParts().getTraceParts()
+									.iterator();
+
+							while (i.hasNext()) {
+								byte[] byteArr = i.next();
+								binaryOutput.write(ByteBuffer.wrap(byteArr));
+							}
+						} else {
+
+							// Write the message to file
+							int position = properties.byteBuffer.position();
+							int limit = properties.byteBuffer.limit();
+							properties.byteBuffer.limit(properties.messageStart
+									+ properties.messageLength);
+							properties.byteBuffer
+									.position(properties.messageStart);
+
+							binaryOutput.write(properties.byteBuffer);
+							properties.byteBuffer.limit(limit);
+							properties.byteBuffer.position(position);
+						}
+					}
+				} catch (IOException e) {
+					e.printStackTrace();
+				}
+			}
+		}
+	}
+
+	/**
+	 * Create plain text trace
+	 * 
+	 * @param properties
+	 *            trace properties
+	 * @return plain text trace string or null if this trace should not be
+	 *         logged
+	 */
+	private String createPlainTextTrace(TraceProperties properties) {
+		String ret = null;
+		StringBuffer trace = null;
+
+		// Normal ASCII trace log
+		if (!machineReadable && !properties.binaryTrace) {
+
+			// If omitting timestamps, don't write them
+			if (omitTimestamps || properties.timestampString == null) {
+				int traceLen = properties.traceString.length() + 1;
+				trace = new StringBuffer(traceLen);
+				if (properties.bTraceInformation.isTraceMissing()) {
+					trace.append(TraceViewerActionUtils.TRACES_DROPPED_MSG);
+				}
+				trace.append(properties.traceString);
+				trace.append(ENDLINE_N);
+
+				// Write timestamp
+			} else {
+				StringBuffer timeFromPreviousSB = TraceViewerGlobals
+						.getTraceViewer().getDataProcessorAccess()
+						.getTimestampParser().getTimeFromPreviousString(
+								properties.timeFromPreviousTrace);
+				int traceLen = properties.timestampString.length() + 1
+						+ timeFromPreviousSB.length()
+						+ properties.traceString.length() + 1;
+				trace = new StringBuffer(traceLen);
+				if (properties.bTraceInformation.isTraceMissing()) {
+					trace.append(TraceViewerActionUtils.TRACES_DROPPED_MSG);
+				}
+				trace.append(properties.timestampString);
+				trace.append(timeFromPreviousSB);
+				trace.append(TABULATOR);
+				trace.append(properties.traceString);
+				trace.append(ENDLINE_N);
+			}
+
+			// Machine readable log file
+		} else if (machineReadable) {
+
+			// Create buffer three times as big as original trace text
+			if (properties.traceString != null) {
+				trace = new StringBuffer(properties.traceString.length() * 3);
+			} else {
+				trace = new StringBuffer();
+			}
+
+			// Get trace variables
+			int cid = properties.information.getComponentId();
+			int gid = properties.information.getGroupId();
+			int tid = properties.information.getTraceId();
+
+			// Timestamp
+			trace.append(TAG_TIME);
+			if (properties.timestampString != null) {
+				trace.append(properties.timestampString);
+			} else {
+				trace.append(properties.timestamp);
+			}
+			trace.append(SEMICOLON_CHAR);
+
+			// CPU ID
+			trace.append(TAG_CPU_ID);
+			if (properties.bTraceInformation.getCpuId() != -1) {
+				trace.append(properties.bTraceInformation.getCpuId());
+			} else {
+				trace.append(HYPHEN_CHAR);
+			}
+			trace.append(SEMICOLON_CHAR);
+
+			// Thread ID
+			trace.append(TAG_THREAD_ID);
+			if (properties.bTraceInformation.getThreadId() != 0) {
+				trace.append(properties.bTraceInformation.getThreadId());
+			} else {
+				trace.append(HYPHEN_CHAR);
+			}
+			trace.append(SEMICOLON_CHAR);
+
+			// Get Component, Group and Trace names
+			String[] names = TraceViewerGlobals.getDecodeProvider()
+					.getComponentGroupTraceName(cid, gid, tid);
+
+			// Component ID
+			String componentName = names[0];
+			if (componentName == null) {
+				componentName = EMPTY;
+			}
+			trace.append(TAG_COMPONENT_ID);
+			trace
+					.append(componentName.replace(SEMICOLON_CHAR,
+							UNDERSCORE_CHAR));
+			trace.append(TAG_START_BRACKET);
+			trace.append(cid);
+			trace.append(TAG_END_BRACKET);
+			trace.append(SEMICOLON_CHAR);
+
+			// Group ID
+			String groupName = names[1];
+			if (groupName == null) {
+				groupName = EMPTY;
+			}
+			trace.append(TAG_GROUP_ID);
+			trace.append(groupName.replace(SEMICOLON_CHAR, UNDERSCORE_CHAR));
+			trace.append(TAG_START_BRACKET);
+			trace.append(gid);
+			trace.append(TAG_END_BRACKET);
+			trace.append(SEMICOLON_CHAR);
+
+			// Trace ID
+			String traceName = names[2];
+			if (traceName == null) {
+				traceName = EMPTY;
+			}
+			trace.append(TAG_TRACE_ID);
+			trace.append(traceName.replace(SEMICOLON_CHAR, UNDERSCORE_CHAR));
+			trace.append(TAG_START_BRACKET);
+			trace.append(tid);
+			trace.append(TAG_END_BRACKET);
+			trace.append(SEMICOLON_CHAR);
+
+			// Parameters
+			for (int i = 0; i < properties.parameters.size(); i++) {
+				trace.append(PARAMETER_CHAR);
+				trace.append(i + 1);
+				trace.append(EQUALS_CHAR);
+				trace.append(properties.parameters.get(i).replace(
+						SEMICOLON_CHAR, UNDERSCORE_CHAR));
+				trace.append(SEMICOLON_CHAR);
+			}
+
+			// Trace comment
+			if (properties.traceComment != null) {
+				trace.append(COMMENT_TAG);
+				trace.append(properties.traceComment);
+				trace.append(SEMICOLON_CHAR);
+			}
+
+			// Trace string
+			if (properties.traceString != null) {
+				trace.append(TAG_TRACE_TEXT);
+				trace.append(properties.traceString.replace(SEMICOLON_CHAR,
+						UNDERSCORE_CHAR));
+				trace.append(SEMICOLON_CHAR);
+				// Trace as hex
+			} else {
+				// Get data as hex
+				String hexTrace = TraceViewerUtils.getTraceAsHexString(
+						properties.byteBuffer, properties.dataStart,
+						properties.dataLength, false);
+				trace.append(DATA_TAG);
+				trace.append(hexTrace);
+				trace.append(SEMICOLON_CHAR);
+
+			}
+
+			trace.append(ENDLINE_R);
+			trace.append(ENDLINE_N);
+		}
+
+		if (trace != null) {
+			ret = trace.toString();
+		}
+
+		return ret;
+	}
+
+	/**
+	 * Constructor
+	 */
+	public Logger() {
+		plainLogging = false;
+		binaryLogging = false;
+		omitTimestamps = false;
+		plainLogPath = EMPTY;
+		binaryLogPath = EMPTY;
+	}
+
+	/**
+	 * Flushes data
+	 */
+	public void flush() {
+		if (plainOutput != null) {
+			plainOutput.flush();
+		}
+	}
+
+	/**
+	 * Gets plain text logging status
+	 * 
+	 * @return status of plain text logging
+	 */
+	public boolean isPlainLogging() {
+		return plainLogging;
+	}
+
+	/**
+	 * Gets plain text log file path
+	 * 
+	 * @return plainLogPath
+	 */
+	public String getPlainLogPath() {
+		return plainLogPath;
+	}
+
+	/**
+	 * Gets binary log file path
+	 * 
+	 * @return binaryLogPath
+	 */
+	public String getBinaryLogPath() {
+		return binaryLogPath;
+	}
+
+	/**
+	 * Gets logging status
+	 * 
+	 * @return status of binary logging
+	 */
+	public boolean isBinLogging() {
+		return binaryLogging;
+	}
+
+	/**
+	 * Starts plain text logging
+	 * 
+	 * @param filename
+	 *            file name where to save
+	 * @param omitTimestamp
+	 *            true if timestamps should be omitted
+	 * @param machineReadable
+	 *            true if log file should be machine readable
+	 * @return status of starting of logging
+	 */
+	public boolean startPlainTextLogging(String filename,
+			boolean omitTimestamp, boolean machineReadable) {
+		plainLogPath = filename;
+		this.omitTimestamps = omitTimestamp;
+		this.machineReadable = machineReadable;
+
+		// Build file channel
+		boolean success = buildPlainFileWriter();
+		plainLogging = true;
+		return success;
+	}
+
+	/**
+	 * Stops plain text logging
+	 * 
+	 * @return status of stopPlainTextLogging
+	 */
+	public boolean stopPlainTextLogging() {
+		plainOutput.close();
+		plainLogging = false;
+
+		// Export possible comments
+		TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+				.getTraceCommentHandler().exportTraceComments(plainLogPath);
+
+		return true;
+	}
+
+	/**
+	 * Start binary logging
+	 * 
+	 * @param filename
+	 *            file name
+	 * @return status of binary logging
+	 */
+	public boolean startBinaryLogging(String filename) {
+		boolean success = false;
+		try {
+			binaryLogPath = filename;
+
+			// Build file channel
+			FileOutputStream outputFile = new FileOutputStream(binaryLogPath);
+
+			binaryOutput = outputFile.getChannel();
+			binaryLogging = true;
+			success = true;
+		} catch (FileNotFoundException e) {
+			e.printStackTrace();
+		}
+		return success;
+	}
+
+	/**
+	 * Stops binary logging
+	 * 
+	 * @return status of stopBinLogging
+	 */
+	public boolean stopBinLogging() {
+		binaryLogging = false;
+		try {
+			binaryOutput.close();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+
+		// Export possible comments
+		TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+				.getTraceCommentHandler().exportTraceComments(binaryLogPath);
+
+		return true;
+	}
+
+	/**
+	 * Opens log file
+	 * 
+	 * @param path
+	 *            path to log file
+	 * @param binary
+	 *            binary file
+	 */
+	public void openLogFile(String path, boolean binary) {
+		TraceViewerGlobals.getTraceViewer().getDataReaderAccess().openLogFile(
+				path, binary);
+		openedLogFilePath = path;
+	}
+
+	/**
+	 * Builds the plain file writer
+	 * 
+	 * @return status of building plain text file
+	 */
+	public boolean buildPlainFileWriter() {
+		boolean success = false;
+
+		try {
+			plainOutput = new PrintWriter(new FileWriter(plainLogPath));
+			success = true;
+		} catch (FileNotFoundException e) {
+			e.printStackTrace();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+
+		return success;
+	}
+
+	/**
+	 * Tells if log file is opened
+	 * 
+	 * @return true if log file is opened
+	 */
+	public boolean isLogFileOpened() {
+		return logFileOpened;
+	}
+
+	/**
+	 * Sets the log file opened variable
+	 * 
+	 * @param logFileOpened
+	 *            status of log file opened
+	 */
+	public void setLogFileOpened(boolean logFileOpened) {
+		this.logFileOpened = logFileOpened;
+
+		if (!logFileOpened) {
+			openedLogFilePath = null;
+		}
+	}
+
+	/**
+	 * Gets currently opened log file path
+	 * 
+	 * @return currently opened log file path or null if no log file is open
+	 */
+	public String getOpenedLogFilePath() {
+		return openedLogFilePath;
+	}
+
+	/**
+	 * Gets currently opened log file name
+	 * 
+	 * @return currently opened log file name or null if no log file is open
+	 */
+	public String getOpenedLogFileName() {
+		String fileName = null;
+
+		if (openedLogFilePath != null) {
+			IPath filePath = new Path(openedLogFilePath);
+			fileName = filePath.lastSegment();
+		}
+
+		return fileName;
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/Messages.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,63 @@
+/*
+ * 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:
+ *
+ * String localization for engine dataprocessor package.
+ *
+ */
+package com.nokia.traceviewer.engine.dataprocessor;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * String localization for engine dataprocessor package.
+ * 
+ */
+final class Messages {
+
+	/**
+	 * Bundle name
+	 */
+	private static final String BUNDLE_NAME = "com.nokia.traceviewer.engine.dataprocessor.messages"; //$NON-NLS-1$
+
+	/**
+	 * Resource bundle
+	 */
+	private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
+			.getBundle(BUNDLE_NAME);
+
+	/**
+	 * Prevents construction.
+	 */
+	private Messages() {
+	}
+
+	/**
+	 * Maps a key to localized string.
+	 * 
+	 * @param key
+	 *            the key for the string
+	 * @return the localized string
+	 */
+	public static String getString(String key) {
+		String value;
+		try {
+			value = RESOURCE_BUNDLE.getString(key);
+		} catch (MissingResourceException e) {
+			value = '!' + key + '!';
+		}
+		return value;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/SearchProcessor.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,789 @@
+/*
+ * 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:
+ *
+ * SearchProcessor DataProcessor
+ *
+ */
+package com.nokia.traceviewer.engine.dataprocessor;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.Document;
+import org.eclipse.jface.text.FindReplaceDocumentAdapter;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.action.TraceViewerActionUtils;
+import com.nokia.traceviewer.dialog.SearchDialog;
+import com.nokia.traceviewer.engine.DataProcessorAccess;
+import com.nokia.traceviewer.engine.DataReader;
+import com.nokia.traceviewer.engine.DataScrollReader;
+import com.nokia.traceviewer.engine.MediaCallback;
+import com.nokia.traceviewer.engine.StateHolder;
+import com.nokia.traceviewer.engine.TraceInformation;
+import com.nokia.traceviewer.engine.TraceProperties;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.TraceViewerDialogInterface.Dialog;
+
+/**
+ * SearchProcessor DataProcessor
+ */
+public final class SearchProcessor implements DataProcessor, MediaCallback {
+
+	/**
+	 * Enum indicating the error codes of TraceViewer API operations
+	 */
+	public enum TimestampSearchPhase {
+
+		/**
+		 * Timestamp search is not ongoing
+		 */
+		NONE,
+
+		/**
+		 * Finding end timestamp
+		 */
+		FINDING_END,
+
+		/**
+		 * End found
+		 */
+		END_FOUND;
+
+	}
+
+	/**
+	 * Search dialog used in searching
+	 */
+	private SearchDialog searchDialog;
+
+	/**
+	 * Temporary document used in searching
+	 */
+	private final IDocument document;
+
+	/**
+	 * Buffer to hold data before inserting all to document
+	 */
+	private final StringBuffer data;
+
+	/**
+	 * Finder adapter
+	 */
+	private final FindReplaceDocumentAdapter finder;
+
+	/**
+	 * Search properties
+	 */
+	private SearchProperties searchProperties;
+
+	/**
+	 * Timestamp range end trace number
+	 */
+	private int timestampEndTrace;
+
+	/**
+	 * Tells if we have hit EOF already
+	 */
+	private boolean hitEOFAlready;
+
+	/**
+	 * Tells that we should stop searching
+	 */
+	private boolean stopSearching;
+
+	/**
+	 * Tells that search is ongoing
+	 */
+	private boolean searchOngoing;
+
+	/**
+	 * Array containing trace informations (cid, gid and tid)
+	 */
+	private final List<TraceInformation> traceInformations;
+
+	/**
+	 * Array containing timestamp strings
+	 */
+	private final List<String> timestampStrings;
+
+	/**
+	 * Search data reader
+	 */
+	private DataScrollReader searchDataReader;
+
+	/**
+	 * Timestamp search phase
+	 */
+	private TimestampSearchPhase timestampSearchPhase = TimestampSearchPhase.NONE;
+
+	/**
+	 * Constructor
+	 */
+	public SearchProcessor() {
+		// Create needed elements and arrays
+		data = new StringBuffer();
+		document = new Document();
+		finder = new FindReplaceDocumentAdapter(document);
+		searchProperties = new SearchProperties();
+		traceInformations = new ArrayList<TraceInformation>();
+		timestampStrings = new ArrayList<String>();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.DataProcessor#processData(com.nokia.traceviewer
+	 * .engine.TraceProperties)
+	 */
+	public void processData(TraceProperties properties) {
+		DataProcessorAccess dpa = TraceViewerGlobals.getTraceViewer()
+				.getDataProcessorAccess();
+
+		// If binary trace, decode it
+		if (properties.binaryTrace) {
+			dpa.getDecoder().processData(properties);
+		}
+
+		// Parse timestamp
+		dpa.getTimestampParser().processData(properties);
+
+		// Traces missing
+		if (properties.bTraceInformation.isTraceMissing()) {
+			data.append(TraceViewerActionUtils.TRACES_DROPPED_MSG);
+		}
+
+		// Timestamp string
+		if (properties.timestampString != null) {
+			data.append(properties.timestampString);
+			data.append(dpa.getTimestampParser().getTimeFromPreviousString(
+					properties.timeFromPreviousTrace));
+			data.append('\t');
+
+			// Add to the timestampstrings array
+			timestampStrings.add(properties.timestampString);
+
+		}
+
+		// Trace string
+		data.append(properties.traceString);
+
+		// Trace comment
+		if (properties.traceComment != null) {
+			data.append(TraceViewerActionUtils.COMMENT_PREFIX);
+			data.append(properties.traceComment);
+		}
+		data.append('\n');
+
+		traceInformations.add(properties.information);
+
+		// Last trace, start search
+		if (properties.lastTrace) {
+			document.set(data.toString());
+			data.setLength(0);
+
+			// Data is received, start search
+			startSearch();
+			traceInformations.clear();
+			timestampStrings.clear();
+		}
+	}
+
+	/**
+	 * Starts search
+	 */
+	private void startSearch() {
+		if (!stopSearching) {
+			try {
+				int tracesTillNow = searchProperties
+						.getCurrentSearchStartLine()
+						+ TraceViewerGlobals.blockSize * 2;
+
+				// Get the search start offset
+				int searchStartOffset = getSearchStartOffset();
+
+				// Find the trace and get the offset of it
+				int offset = findTrace(searchStartOffset);
+
+				// Update progressBar
+				searchDialog.updateSearchProgressBar(searchProperties
+						.getCurrentSearchStartLine() + 1);
+
+				if (searchProperties.isSearchingForward()) {
+					processSearchingForward(tracesTillNow, offset);
+				} else {
+					processSearchingBackward(offset);
+				}
+
+			} catch (BadLocationException e) {
+				e.printStackTrace();
+				searchOngoing = false;
+			}
+		} else {
+			TraceViewerGlobals.getTraceViewer().getStateHolder().setState(
+					StateHolder.State.NORMAL);
+			stopSearching = false;
+			searchOngoing = false;
+		}
+
+	}
+
+	/**
+	 * Gets the correct search start offset
+	 * 
+	 * @return search start offset
+	 */
+	private int getSearchStartOffset() {
+		int searchStartOffset;
+
+		// Set proper offset to start searching from
+		if (searchProperties.isSearchingForward()) {
+			searchStartOffset = 0;
+
+			// Searching backward
+		} else {
+			searchStartOffset = document.getLength() - 1;
+		}
+
+		return searchStartOffset;
+	}
+
+	/**
+	 * Finds the trace using search properties
+	 * 
+	 * @param searchStartOffset
+	 *            start offset where to start the search
+	 * @return offset of the trace found or -1 if not found
+	 * @throws BadLocationException
+	 */
+	private int findTrace(int searchStartOffset) throws BadLocationException {
+		int offset = SearchUtils.NOT_FOUND;
+
+		// Search using component, group and trace ID's
+		if (SearchUtils.containsIdQuery(searchProperties.getSearchString())) {
+			offset = findTraceIDSearch(searchStartOffset);
+
+			// Timestamp search
+		} else if (SearchUtils.containsTimestampQuery(searchProperties
+				.getSearchString())) {
+			offset = findTraceTimestampSearch(searchStartOffset);
+
+			// Create a normal text search
+		} else {
+			timestampSearchPhase = TimestampSearchPhase.NONE;
+			IRegion region = finder.find(searchStartOffset, searchProperties
+					.getSearchString(), searchProperties.isSearchingForward(),
+					searchProperties.isCaseSensitive(), searchProperties
+							.isWholeWord(), searchProperties.isRegExp());
+
+			if (region != null) {
+				offset = region.getOffset();
+			}
+		}
+
+		return offset;
+	}
+
+	/**
+	 * Finds the trace using ID search
+	 * 
+	 * @param searchStartOffset
+	 *            search start offset
+	 * @return found offset
+	 * @throws BadLocationException
+	 */
+	private int findTraceIDSearch(int searchStartOffset)
+			throws BadLocationException {
+		int offset;
+		timestampSearchPhase = TimestampSearchPhase.NONE;
+
+		// Parse ID's from the search string
+		TraceInformation inf = SearchUtils.parseIDsFromString(searchProperties
+				.getSearchString());
+		int startTrace = document.getLineOfOffset(searchStartOffset);
+
+		// Get the trace number that matches the ID's
+		int foundTrace = SearchUtils.findTraceOffsetFromInformations(
+				startTrace, inf, traceInformations, searchProperties
+						.isSearchingForward());
+
+		if (foundTrace == SearchUtils.NOT_FOUND) {
+			offset = SearchUtils.NOT_FOUND;
+		} else {
+			offset = document.getLineOffset(foundTrace);
+		}
+		return offset;
+	}
+
+	/**
+	 * Finds the trace using timestamp search
+	 * 
+	 * @param searchStartOffset
+	 *            search start offset
+	 * @return found offset
+	 * @throws BadLocationException
+	 */
+	private int findTraceTimestampSearch(int searchStartOffset)
+			throws BadLocationException {
+		int offset;
+		boolean getFirstTimestamp = true;
+		boolean timestampSearchOnGoing = false;
+		if (timestampSearchPhase == TimestampSearchPhase.NONE
+				|| timestampSearchPhase == TimestampSearchPhase.FINDING_END) {
+			timestampSearchOnGoing = true;
+		}
+		if (SearchUtils.containsTimestampRangeQuery(searchProperties
+				.getSearchString())
+				&& timestampSearchOnGoing) {
+			getFirstTimestamp = false;
+			timestampSearchPhase = TimestampSearchPhase.FINDING_END;
+		}
+
+		// Parse timestamp from the search string
+		String timestamp = SearchUtils.parseTimestampFromString(
+				searchProperties.getSearchString(), getFirstTimestamp);
+
+		int startTrace = document.getLineOfOffset(searchStartOffset);
+
+		// Get the trace which matches the timestamp
+		int foundTrace = SearchUtils.findTraceOffsetFromTimestamps(startTrace,
+				timestamp, timestampStrings, searchProperties
+						.isSearchingForward());
+
+		if (foundTrace == SearchUtils.NOT_FOUND) {
+			offset = SearchUtils.NOT_FOUND;
+		} else {
+			offset = document.getLineOffset(foundTrace);
+		}
+		return offset;
+	}
+
+	/**
+	 * Processes situation when searching forward
+	 * 
+	 * @param tracesTillNow
+	 *            Tells how many traces is read from file
+	 * @param offset
+	 *            offset to found item
+	 * @throws BadLocationException
+	 */
+	private void processSearchingForward(int tracesTillNow, int offset)
+			throws BadLocationException {
+
+		// String found
+		if (offset != SearchUtils.NOT_FOUND) {
+			processStringFound(offset);
+
+			// Full round processed
+		} else if (tracesTillNow > searchProperties
+				.getOriginalSearchStartLine()
+				&& hitEOFAlready) {
+			fullRoundProcessed();
+			// We didn't find anything from these 2 blocks, go to next one
+		} else {
+			// Not End Of File
+			if (tracesTillNow < TraceViewerGlobals.getTraceViewer()
+					.getDataReaderAccess().getCurrentDataReader()
+					.getTraceCount()) {
+				searchProperties.setCurrentSearchStartLine(tracesTillNow + 1);
+				processSearch(searchProperties, true);
+				// End Of File
+			} else {
+				hitEOFAlready = true;
+				searchDialog.updateSearchProgressBar(TraceViewerGlobals
+						.getTraceViewer().getDataReaderAccess()
+						.getCurrentDataReader().getTraceCount());
+				searchDialog.searchHitEOF();
+				searchOngoing = false;
+			}
+		}
+	}
+
+	/**
+	 * Full round processed
+	 */
+	private void fullRoundProcessed() {
+		hitEOFAlready = false;
+		searchDialog.updateSearchProgressBar(searchProperties
+				.getOriginalSearchStartLine());
+		searchDialog.searchHitFullRound();
+		searchOngoing = false;
+	}
+
+	/**
+	 * Processes situation where result was found
+	 * 
+	 * @param offset
+	 *            offset of the result
+	 * @throws BadLocationException
+	 */
+	private void processStringFound(int offset) throws BadLocationException {
+		hitEOFAlready = false;
+		int line = document.getLineOfOffset(offset);
+
+		int foundTraceLine = searchProperties.getCurrentSearchStartLine()
+				+ line;
+
+		// Update progressBar
+		searchDialog.updateSearchProgressBar(foundTraceLine);
+
+		// Set the search line
+		if (timestampSearchPhase == TimestampSearchPhase.NONE) {
+			searchOngoing = false;
+			TraceViewerGlobals.getTraceViewer().getView().highlightLines(
+					foundTraceLine, 0, false);
+
+			// Timestamp range search
+		} else {
+			if (timestampSearchPhase == TimestampSearchPhase.FINDING_END) {
+				timestampSearchPhase = TimestampSearchPhase.END_FOUND;
+				timestampEndTrace = foundTraceLine;
+
+				// Start new search
+				searchProperties.setCurrentSearchStartLine(foundTraceLine);
+				processSearch(searchProperties, true);
+
+				// End and start both found
+			} else if (timestampSearchPhase == TimestampSearchPhase.END_FOUND) {
+				searchOngoing = false;
+				TraceViewerGlobals.getTraceViewer().getView().highlightLines(
+						foundTraceLine, timestampEndTrace, true);
+				timestampSearchPhase = TimestampSearchPhase.NONE;
+				timestampEndTrace = 0;
+			} else {
+				searchOngoing = false;
+			}
+		}
+
+	}
+
+	/**
+	 * Processes situation when searching backwards
+	 * 
+	 * @param offset
+	 *            offset to found item
+	 * @throws BadLocationException
+	 */
+	private void processSearchingBackward(int offset)
+			throws BadLocationException {
+
+		// String found
+		if (offset != SearchUtils.NOT_FOUND) {
+			processStringFound(offset);
+			// Full round processed
+		} else if (searchProperties.getCurrentSearchStartLine() <= searchProperties
+				.getOriginalSearchStartLine()
+				&& hitEOFAlready) {
+			fullRoundProcessed();
+		} else {
+			// Not End Of File
+			if (searchProperties.getCurrentSearchStartLine() > 0) {
+				searchProperties.setCurrentSearchStartLine(searchProperties
+						.getCurrentSearchStartLine()
+						- (TraceViewerGlobals.blockSize / 2));
+				processSearch(searchProperties, true);
+				// End Of File
+			} else {
+				hitEOFAlready = true;
+				searchDialog.updateSearchProgressBar(0);
+
+				// Timestamp search
+				if (timestampSearchPhase == TimestampSearchPhase.END_FOUND
+						|| timestampSearchPhase == TimestampSearchPhase.FINDING_END) {
+					if (timestampEndTrace == 0) {
+						timestampEndTrace--;
+					}
+					TraceViewerGlobals.getTraceViewer().getView()
+							.highlightLines(0, timestampEndTrace + 1, false);
+					timestampSearchPhase = TimestampSearchPhase.NONE;
+					timestampEndTrace = 0;
+
+					// Normal search
+				} else {
+					searchDialog.searchHitEOF();
+				}
+				searchOngoing = false;
+			}
+		}
+	}
+
+	/**
+	 * Sets hitEOFAlready variable
+	 * 
+	 * @param hitEOF
+	 *            boolean to set varible to
+	 */
+	public void setHitEOFAlready(boolean hitEOF) {
+		this.hitEOFAlready = hitEOF;
+	}
+
+	/**
+	 * Gets search dialog
+	 * 
+	 * @return search dialog
+	 */
+	public SearchDialog getSearchDialog() {
+		if (searchDialog == null) {
+			searchDialog = (SearchDialog) TraceViewerGlobals.getTraceViewer()
+					.getDialogs().createDialog(Dialog.SEARCH);
+		}
+		return searchDialog;
+	}
+
+	/**
+	 * Sets stop boolean as true or false. If true, searching will stop when
+	 * next block has been fetched from the file
+	 * 
+	 * @param stop
+	 *            indicates if the search should be stopped
+	 */
+	public void stopSearch(boolean stop) {
+		stopSearching = stop;
+	}
+
+	/**
+	 * Process search with given searchProperties
+	 * 
+	 * @param searchProperties
+	 *            searchproperties
+	 * @param internal
+	 *            if true, the search request is coming from TraceViewer
+	 *            internally
+	 */
+	public void processSearch(SearchProperties searchProperties,
+			boolean internal) {
+
+		// If search is already ongoing, stop it
+		if (!internal && searchOngoing) {
+			stopSearch(true);
+			while (searchOngoing) {
+				try {
+					Thread.sleep(50);
+				} catch (InterruptedException e) {
+					e.printStackTrace();
+				}
+			}
+		}
+		searchOngoing = true;
+
+		int traceCount = TraceViewerGlobals.getTraceViewer()
+				.getDataReaderAccess().getCurrentDataReader().getTraceCount();
+
+		int numberOfBlocks = 2;
+		int traceToStartReading = searchProperties.getCurrentSearchStartLine();
+
+		// Searching forward
+		if (searchProperties.isSearchingForward()) {
+
+			// Check now many blocks are needed
+			if (traceToStartReading + TraceViewerGlobals.blockSize > traceCount) {
+				numberOfBlocks = 1;
+			}
+
+			// Searching backward
+		} else {
+			// Check now many blocks are needed
+			if (traceToStartReading < TraceViewerGlobals.blockSize) {
+				numberOfBlocks = 1;
+			} else {
+				// If searching backwards, read traces from one block before
+				traceToStartReading = traceToStartReading
+						- TraceViewerGlobals.blockSize;
+			}
+		}
+
+		// Get the file position having given offset
+		int index = TraceViewerGlobals.getTraceViewer().getDataReaderAccess()
+				.getCurrentDataReader().getFileMap().getIndexFromOffset(
+						traceToStartReading);
+
+		this.searchProperties = searchProperties;
+
+		long pos = TraceViewerGlobals.getTraceViewer().getDataReaderAccess()
+				.getCurrentDataReader().getFileMap().getItem(index).longValue();
+		int startTrace = index * TraceViewerGlobals.blockSize;
+
+		this.searchProperties.setCurrentSearchStartLine(startTrace);
+
+		// Create searchDataReader if it doesn't exist and start it
+		searchDataReader = TraceViewerGlobals.getTraceViewer()
+				.getDataReaderAccess().startOwnDataReader(searchDataReader,
+						this, numberOfBlocks, pos, startTrace, false);
+	}
+
+	/**
+	 * Performs timestamp range search. Must be called from UI thread!
+	 * 
+	 * @param findStr
+	 *            find str
+	 */
+	public void doTimestampRangeSearch(String findStr) {
+		int traceCount = TraceViewerGlobals.getTraceViewer()
+				.getDataReaderAccess().getCurrentDataReader().getTraceCount();
+		searchProperties.setCurrentSearchStartLine(traceCount);
+		searchProperties.setOriginalSearchStartLine(traceCount);
+		searchProperties.setSearchString(findStr);
+		searchProperties.setSearchingForward(false);
+		getSearchDialog().setSearchText(findStr);
+		processSearch(searchProperties, false);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.MediaCallback#endOfFile(com.nokia.traceviewer
+	 * .engine.DataReader)
+	 */
+	public void endOfFile(DataReader reader) {
+		// Do nothing
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.MediaCallback#dataHandleChanged()
+	 */
+	public void dataHandleChanged() {
+		shutdownSearchReader();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.MediaCallback#processTrace(com.nokia.traceviewer
+	 * .engine.TraceProperties)
+	 */
+	public void processTrace(TraceProperties properties) {
+		processData(properties);
+	}
+
+	/**
+	 * Disposes search dialog. Also kill the search data reader.
+	 * 
+	 * @return true if search dialog was closed. False if it wasn't open.
+	 */
+	public boolean disposeSearchDialog() {
+		boolean closed = false;
+		if (searchDialog != null) {
+			closed = searchDialog.forceClose();
+			searchDialog = null;
+			shutdownSearchReader();
+		}
+		return closed;
+	}
+
+	/**
+	 * Shuts down search data reader
+	 */
+	public void shutdownSearchReader() {
+		if (searchDataReader != null) {
+			searchDataReader.shutdown();
+			searchDataReader = null;
+		}
+	}
+
+	/**
+	 * Searches the next trace with ID. Must be called from UI thread!
+	 * 
+	 * @param cid
+	 *            Component ID
+	 * @param gid
+	 *            Group ID
+	 * @param tid
+	 *            Trace ID
+	 */
+	public void searchTraceWithID(int cid, int gid, int tid) {
+
+		// Create search string
+		final String findStr = SearchUtils.createStringFromIDs(cid, gid, tid);
+		searchTraceWithString(findStr);
+	}
+
+	/**
+	 * Searches trace with timestamp. Must be called from UI thread and
+	 * TraceViewer view must exists!
+	 * 
+	 * @param startTimestamp
+	 *            start timestamp string
+	 * @param endTimestamp
+	 *            end timestamp string
+	 */
+	public void searchTraceWithTimestamp(final String startTimestamp,
+			final String endTimestamp) {
+
+		// Create search string
+		final String findStr = SearchUtils.createStringFromTimestamp(
+				startTimestamp, endTimestamp);
+		searchTraceWithString(findStr);
+	}
+
+	/**
+	 * Searches the next trace with text. Must be called from UI thread!
+	 * 
+	 * @param text
+	 *            text to search for
+	 */
+	public void searchTraceWithString(final String text) {
+		final SearchDialog dialog = getSearchDialog();
+		if (!dialog.isOpen()) {
+			dialog.create();
+		}
+
+		// Create a thread that will start the search because this thread will
+		// stop to message event loop when opening the search dialog
+		Thread a = new Thread() {
+
+			/*
+			 * (non-Javadoc)
+			 * 
+			 * @see java.lang.Thread#run()
+			 */
+			@Override
+			public void run() {
+				// Stop previous search
+				if (searchOngoing) {
+					stopSearch(true);
+				}
+
+				// Must be synced with the UI thread to be able to update the
+				// search dialog
+				PlatformUI.getWorkbench().getDisplay().asyncExec(
+						new Runnable() {
+
+							/*
+							 * (non-Javadoc)
+							 * 
+							 * @see java.lang.Runnable#run()
+							 */
+							public void run() {
+								dialog.startSearch(text);
+							}
+						});
+
+			}
+		};
+		a.start();
+
+		if (!dialog.isVisible()) {
+			dialog.openDialog();
+		}
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/SearchProperties.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,194 @@
+/*
+ * 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:
+ *
+ * Search Properties
+ *
+ */
+package com.nokia.traceviewer.engine.dataprocessor;
+
+/**
+ * Search Properties class
+ * 
+ */
+public class SearchProperties {
+
+	/**
+	 * Line where current search starts
+	 */
+	private int currentSearchStartLine;
+
+	/**
+	 * Line where search originally started
+	 */
+	private int originalSearchStartLine;
+
+	/**
+	 * Search string to be searched for
+	 */
+	private String searchString;
+
+	/**
+	 * Case sensitive attribute
+	 */
+	private boolean caseSensitive;
+
+	/**
+	 * Whole word attribute
+	 */
+	private boolean wholeWord;
+
+	/**
+	 * Regular expression attribute
+	 */
+	private boolean regExp;
+
+	/**
+	 * Tells if we are searching forward
+	 */
+	private boolean searchingForward = true;
+
+	/**
+	 * Tells if search is case sensitive
+	 * 
+	 * @return the caseSensitive
+	 */
+	public boolean isCaseSensitive() {
+		return caseSensitive;
+	}
+
+	/**
+	 * Sets case sensitive
+	 * 
+	 * @param caseSensitive
+	 *            the caseSensitive to set
+	 */
+	public void setCaseSensitive(boolean caseSensitive) {
+		this.caseSensitive = caseSensitive;
+	}
+
+	/**
+	 * Gets current search start line
+	 * 
+	 * @return the currentSearchStartLine
+	 */
+	public int getCurrentSearchStartLine() {
+		return currentSearchStartLine;
+	}
+
+	/**
+	 * Sets current search start line
+	 * 
+	 * @param currentSearchStartLine
+	 *            the currentSearchStartLine to set
+	 */
+	public void setCurrentSearchStartLine(int currentSearchStartLine) {
+		this.currentSearchStartLine = currentSearchStartLine;
+	}
+
+	/**
+	 * Gets original search start line
+	 * 
+	 * @return the originalSearchStartLine
+	 */
+	public int getOriginalSearchStartLine() {
+		return originalSearchStartLine;
+	}
+
+	/**
+	 * Sets originial search start line
+	 * 
+	 * @param originalSearchStartLine
+	 *            the originalSearchStartLine to set
+	 */
+	public void setOriginalSearchStartLine(int originalSearchStartLine) {
+		this.originalSearchStartLine = originalSearchStartLine;
+	}
+
+	/**
+	 * Tells if search is regular expression search
+	 * 
+	 * @return the regExp
+	 */
+	public boolean isRegExp() {
+		return regExp;
+	}
+
+	/**
+	 * Sets regular expression attribute
+	 * 
+	 * @param regExp
+	 *            the regExp to set
+	 */
+	public void setRegExp(boolean regExp) {
+		this.regExp = regExp;
+	}
+
+	/**
+	 * Tells if search is forward search
+	 * 
+	 * @return the searchingForward
+	 */
+	public boolean isSearchingForward() {
+		return searchingForward;
+	}
+
+	/**
+	 * Sets search to go forward
+	 * 
+	 * @param searchingForward
+	 *            the searchingForward to set
+	 */
+	public void setSearchingForward(boolean searchingForward) {
+		this.searchingForward = searchingForward;
+	}
+
+	/**
+	 * Gets search string
+	 * 
+	 * @return the searchString
+	 */
+	public String getSearchString() {
+		return searchString;
+	}
+
+	/**
+	 * Sets search string
+	 * 
+	 * @param searchString
+	 *            the searchString to set
+	 */
+	public void setSearchString(String searchString) {
+		this.searchString = searchString;
+	}
+
+	/**
+	 * Tells if search need whole word to match
+	 * 
+	 * @return the wholeWord
+	 */
+	public boolean isWholeWord() {
+		return wholeWord;
+	}
+
+	/**
+	 * Sets search to need whole word to match
+	 * 
+	 * @param wholeWord
+	 *            the wholeWord to set
+	 */
+	public void setWholeWord(boolean wholeWord) {
+		this.wholeWord = wholeWord;
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/SearchUtils.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,384 @@
+/*
+ * 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:
+ *
+ * Search utils
+ *
+ */
+package com.nokia.traceviewer.engine.dataprocessor;
+
+import java.util.List;
+
+import com.nokia.traceviewer.engine.TraceInformation;
+
+/**
+ * Search utils
+ */
+public final class SearchUtils {
+
+	/**
+	 * Empty String
+	 */
+	public static final String EMPTY = ""; //$NON-NLS-1$
+
+	/**
+	 * Dash string
+	 */
+	private static final String DASH = "-"; //$NON-NLS-1$
+
+	/**
+	 * Indicates not found
+	 */
+	public static final int NOT_FOUND = -1;
+
+	/**
+	 * Semicolon
+	 */
+	private static final char SEMICOLON = ';';
+
+	/**
+	 * Component ID String
+	 */
+	private static final String CID_STR = "cid:"; //$NON-NLS-1$
+
+	/**
+	 * Group ID String
+	 */
+	private static final String GID_STR = "gid:"; //$NON-NLS-1$
+
+	/**
+	 * Trace ID String
+	 */
+	private static final String TID_STR = "tid:"; //$NON-NLS-1$
+
+	/**
+	 * Timestamp String
+	 */
+	private static final String TIMESTAMP_STR = "{timestamp_srch}:"; //$NON-NLS-1$
+
+	/**
+	 * Parses trace information class from the seach string
+	 * 
+	 * @param searchStr
+	 *            the search string
+	 * @return trace information containing cid, gid and tid
+	 */
+	public static TraceInformation parseIDsFromString(String searchStr) {
+		TraceInformation inf = new TraceInformation();
+
+		// Parse component ID
+		int cidIndex = searchStr.indexOf(CID_STR);
+		String cidStr = searchStr.substring(cidIndex + CID_STR.length(),
+				searchStr.indexOf(SEMICOLON, cidIndex));
+		int cid = Integer.parseInt(cidStr);
+
+		// Parse group ID
+		int gidIndex = searchStr.indexOf(GID_STR);
+		String gidStr = searchStr.substring(gidIndex + GID_STR.length(),
+				searchStr.indexOf(SEMICOLON, gidIndex));
+		int gid = Integer.parseInt(gidStr);
+		searchStr = searchStr.substring(searchStr.indexOf(SEMICOLON) + 1);
+
+		// Parse trace ID
+		int tidIndex = searchStr.indexOf(TID_STR);
+		String tidStr = searchStr.substring(tidIndex + TID_STR.length(),
+				searchStr.indexOf(SEMICOLON, tidIndex));
+		int tid = Integer.parseInt(tidStr);
+
+		// Set ID's and return
+		inf.setComponentId(cid);
+		inf.setGroupId(gid);
+		inf.setTraceId(tid);
+
+		return inf;
+	}
+
+	/**
+	 * Parses searchable timestamp from the seach string
+	 * 
+	 * @param searchStr
+	 *            the search string
+	 * @param getFirstTimestamp
+	 *            if true, get first timestamp. If false, get second timestamp
+	 * @return searchable timestamp
+	 */
+	public static String parseTimestampFromString(String searchStr,
+			boolean getFirstTimestamp) {
+
+		int timestampStartIndex = searchStr.indexOf(TIMESTAMP_STR);
+		int startIndex = timestampStartIndex + TIMESTAMP_STR.length();
+		int endIndex = searchStr.length();
+
+		int dashIndex = searchStr.indexOf(DASH);
+		if (dashIndex != -1) {
+
+			// Get first timestamp
+			if (getFirstTimestamp) {
+				endIndex = dashIndex;
+			} else {
+				startIndex = dashIndex + 1;
+			}
+		}
+
+		// Parse timestamp
+		String timestampStr = searchStr.substring(startIndex, endIndex);
+
+		return timestampStr;
+	}
+
+	/**
+	 * Finds trace line from informations array
+	 * 
+	 * @param startTrace
+	 *            start trace where to start search
+	 * @param inf
+	 *            trace information to search for
+	 * @param informations
+	 *            trace informations arraylist
+	 * @param searchForward
+	 *            if true, search forward. Otherwise search backward
+	 * @return line of found trace or -1 if not found
+	 */
+	public static int findTraceOffsetFromInformations(int startTrace,
+			TraceInformation inf, List<TraceInformation> informations,
+			boolean searchForward) {
+		int line = NOT_FOUND;
+
+		// Search forward
+		if (searchForward && informations != null) {
+			// Start from start line and go through ID's
+			for (int i = startTrace; i < informations.size(); i++) {
+				TraceInformation listInf = informations.get(i);
+				if (idsMatch(inf, listInf)) {
+					line = i;
+					break;
+				}
+			}
+
+			// Search backwards
+		} else if (informations != null) {
+			// Start from start line and go through ID's backwards
+			for (int i = startTrace; i >= 0; i--) {
+				TraceInformation listInf = informations.get(i);
+				if (idsMatch(inf, listInf)) {
+					line = i;
+					break;
+				}
+			}
+		}
+
+		return line;
+	}
+
+	/**
+	 * Finds trace line from timestamps array
+	 * 
+	 * @param startTrace
+	 *            start trace where to start search
+	 * @param timestamp
+	 *            timestamp to search for
+	 * @param timestamps
+	 *            timestamps arraylist
+	 * @param searchForward
+	 *            if true, search forward. Otherwise search backward
+	 * @return line of found trace or -1 if not found
+	 */
+	public static int findTraceOffsetFromTimestamps(int startTrace,
+			String timestamp, List<String> timestamps, boolean searchForward) {
+		int line = NOT_FOUND;
+
+		// Search forward
+		if (searchForward && timestamps != null) {
+
+			// Start from start line and go through timestamps
+			for (int i = startTrace; i < timestamps.size(); i++) {
+				if (i < timestamps.size()) {
+					String ts = timestamps.get(i);
+					if (ts.compareTo(timestamp) >= 0) {
+						line = i;
+						break;
+					}
+				}
+			}
+
+			// Search backwards
+		} else if (timestamps != null) {
+			// Start from start line and go through timestamps backwards
+			for (int i = startTrace; i >= 0; i--) {
+				if (i < timestamps.size()) {
+					String ts = timestamps.get(i);
+					if (ts.compareTo(timestamp) <= 0) {
+						line = i;
+						break;
+					}
+				}
+			}
+		}
+
+		return line;
+	}
+
+	/**
+	 * Checks if all ID's match
+	 * 
+	 * @param inf
+	 *            first ID list
+	 * @param listInf
+	 *            second ID list
+	 * @return true if all ID's match
+	 */
+	private static boolean idsMatch(TraceInformation inf,
+			TraceInformation listInf) {
+		return listInf.getComponentId() == inf.getComponentId()
+				&& listInf.getGroupId() == inf.getGroupId()
+				&& listInf.getTraceId() == inf.getTraceId();
+	}
+
+	/**
+	 * Checks does the search string contain ID query
+	 * 
+	 * @param searchString
+	 *            the search string
+	 * @return true if search string contains ID query
+	 */
+	public static boolean containsIdQuery(String searchString) {
+		boolean containsIdQuery = false;
+
+		// Check that string contains cid, gid and tid strings
+		if (searchString.contains(CID_STR) && searchString.contains(GID_STR)
+				&& searchString.contains(TID_STR)) {
+
+			// Parse ID's as strings
+			int cidIdx = searchString.indexOf(CID_STR);
+			String cid = searchString.substring(cidIdx + CID_STR.length(),
+					searchString.indexOf(SEMICOLON, cidIdx));
+			int gidIdx = searchString.indexOf(GID_STR);
+			String gid = searchString.substring(gidIdx + GID_STR.length(),
+					searchString.indexOf(SEMICOLON, gidIdx));
+			int tidIdx = searchString.indexOf(TID_STR);
+			String tid = searchString.substring(tidIdx + TID_STR.length(),
+					searchString.indexOf(SEMICOLON, tidIdx));
+
+			// Check that ID's are real integers
+			if (!cid.equals(EMPTY) && !gid.equals(EMPTY) && !tid.equals(EMPTY)) {
+				try {
+					Integer.parseInt(cid);
+					Integer.parseInt(gid);
+					Integer.parseInt(tid);
+					containsIdQuery = true;
+				} catch (NumberFormatException e) {
+					containsIdQuery = false;
+				}
+			}
+		}
+
+		return containsIdQuery;
+	}
+
+	/**
+	 * Checks does the search string contain timestamp query
+	 * 
+	 * @param searchString
+	 *            the search string
+	 * @return true if search string contains timestamp query
+	 */
+	public static boolean containsTimestampQuery(String searchString) {
+		boolean containsTimestampQuery = false;
+
+		// Check that string contains timestamp strings
+		if (searchString.contains(TIMESTAMP_STR)) {
+			containsTimestampQuery = true;
+		}
+
+		return containsTimestampQuery;
+	}
+
+	/**
+	 * Checks does the search string contain timestamp range query. User should
+	 * first call "containsTimestampQuery" before this to actually ensure this
+	 * is timestamp range query.
+	 * 
+	 * @param searchString
+	 *            the search string
+	 * @return true if search string contains timestamp query
+	 */
+	public static boolean containsTimestampRangeQuery(String searchString) {
+		boolean containsTimestampRangeQuery = false;
+
+		// Check that string contains timestamp range string
+		int dashIndex = searchString.indexOf(DASH);
+		if (dashIndex != -1 && searchString.length() > dashIndex + 1) {
+			containsTimestampRangeQuery = true;
+		}
+
+		return containsTimestampRangeQuery;
+	}
+
+	/**
+	 * Creates a search string from ID's
+	 * 
+	 * @param cid
+	 *            Component ID
+	 * @param gid
+	 *            Group ID
+	 * @param tid
+	 *            Trace ID
+	 * @return a search string that can be used to search with ID's
+	 */
+	public static String createStringFromIDs(int cid, int gid, int tid) {
+		StringBuffer buf = new StringBuffer();
+		// Add component ID
+		buf.append(CID_STR);
+		buf.append(cid);
+		buf.append(SEMICOLON);
+
+		// Add group ID
+		buf.append(GID_STR);
+		buf.append(gid);
+		buf.append(SEMICOLON);
+
+		// Add trace ID
+		buf.append(TID_STR);
+		buf.append(tid);
+		buf.append(SEMICOLON);
+
+		return buf.toString();
+	}
+
+	/**
+	 * Creates a search string from timestamp
+	 * 
+	 * @param startTimestamp
+	 *            start timestamp
+	 * @param endTimestamp
+	 *            end timestamp
+	 * @return a search string that can be used to search with timestamp
+	 */
+	public static String createStringFromTimestamp(String startTimestamp,
+			String endTimestamp) {
+		StringBuffer buf = new StringBuffer();
+
+		// Add start timestamp
+		buf.append(TIMESTAMP_STR);
+		buf.append(startTimestamp);
+
+		// If end timestamp exists, add it
+		if (endTimestamp != null) {
+			buf.append(DASH);
+			buf.append(endTimestamp);
+		}
+
+		return buf.toString();
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/TimestampParser.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,516 @@
+/*
+ * 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:
+ *
+ * Timestamp Parser DataProcessor
+ *
+ */
+package com.nokia.traceviewer.engine.dataprocessor;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.engine.PlainTextReader;
+import com.nokia.traceviewer.engine.TraceProperties;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.preferences.PreferenceConstants;
+
+/**
+ * Timestamp Parser DataProcessor
+ */
+public class TimestampParser implements DataProcessor {
+
+	/**
+	 * Ten
+	 */
+	private static final int TEN = 10;
+
+	/**
+	 * Thousand
+	 */
+	private static final int THOUSAND = 1000;
+
+	/**
+	 * Hours in a day
+	 */
+	private static final int HOURS_IN_DAY = 24;
+
+	/**
+	 * Minutes in a hour
+	 */
+	private static final int MINUTES_IN_HOUR = 60;
+
+	/**
+	 * Seconds in a minute
+	 */
+	private static final int SECONDS_IN_MINUTE = 60;
+
+	/**
+	 * Milliseconds in second
+	 */
+	private static final int MILLISECS_IN_SECOND = THOUSAND;
+
+	/**
+	 * Milliseconds in minute
+	 */
+	private static final long MILLISECS_IN_MINUTE = MILLISECS_IN_SECOND
+			* SECONDS_IN_MINUTE;
+
+	/**
+	 * Milliseconds in hour
+	 */
+	private static final long MILLISECS_IN_HOUR = MILLISECS_IN_MINUTE
+			* MINUTES_IN_HOUR;
+
+	/**
+	 * Milliseconds in day
+	 */
+	private static final long MILLISECS_IN_DAY = MILLISECS_IN_HOUR
+			* HOURS_IN_DAY;
+
+	/**
+	 * Hour start index
+	 */
+	private static final int HOUR_START_INDEX = 0;
+
+	/**
+	 * Hour stop index
+	 */
+	private static final int HOUR_STOP_INDEX = 2;
+
+	/**
+	 * Minute start index
+	 */
+	private static final int MINUTE_START_INDEX = 3;
+
+	/**
+	 * Minute stop index
+	 */
+	private static final int MINUTE_STOP_INDEX = 5;
+
+	/**
+	 * Second start index
+	 */
+	private static final int SECOND_START_INDEX = 6;
+
+	/**
+	 * Second stop index
+	 */
+	private static final int SECOND_STOP_INDEX = 8;
+
+	/**
+	 * Millisecond start index
+	 */
+	private static final int MILLISECOND_START_INDEX = 9;
+
+	/**
+	 * Millisecond stop index
+	 */
+	private static final int MILLISECOND_STOP_INDEX = 12;
+
+	/**
+	 * Bracket start index when accuracy is milliseconds
+	 */
+	private static final int BRACKET_START_INDEX_ACCURACY_MILLISECS = 13;
+
+	/**
+	 * Bracket start index when accuracy is microseconds
+	 */
+	private static final int BRACKET_START_INDEX_ACCURACY_MICROSECS = 16;
+
+	/**
+	 * Length of timestamp string from format HH:mm:ss.SSSSSS
+	 */
+	private static final int LENGTH_OF_TIMESTAMP_STRING = 15;
+
+	/**
+	 * Empty stringbuffer
+	 */
+	private final StringBuffer emptyBuffer = new StringBuffer(0);
+
+	/**
+	 * Bracket start offset
+	 */
+	private int bracketStartIndex;
+
+	/**
+	 * Previous traces timestamp
+	 */
+	private long timeOfPreviousNormalTrace;
+
+	/**
+	 * Previous scrolled traces timestamp
+	 */
+	private long timeOfPreviousScrolledTrace;
+
+	/**
+	 * Previous traces timestamp when filtering
+	 */
+	private long timeOfPreviousFilterTrace;
+
+	/**
+	 * Previous plain text filter trace timestamp
+	 */
+	private long timeOfPreviousPlainTextFilterTrace;
+
+	/**
+	 * Previous timestamp for own calculations
+	 */
+	private long timeOfPreviousOwnEvent;
+
+	/**
+	 * If true, timestamp accuracy is millisecs, otherwise it's microsecs
+	 */
+	private boolean timestampAccuracyMilliSecs;
+
+	/**
+	 * If true, show time from previous trace as milliseconds
+	 */
+	private boolean showTimeFromPreviousTrace;
+
+	/**
+	 * Constructor
+	 */
+	public TimestampParser() {
+		// Get variables from preference store
+		IPreferenceStore store = TraceViewerPlugin.getDefault()
+				.getPreferenceStore();
+		boolean millisec = false;
+		if (store.getString(PreferenceConstants.TIMESTAMP_ACCURACY).equals(
+				PreferenceConstants.MILLISECOND_ACCURACY)) {
+			millisec = true;
+		}
+
+		timestampAccuracyMilliSecs = millisec;
+		showTimeFromPreviousTrace = store
+				.getBoolean(PreferenceConstants.TIME_FROM_PREVIOUS_TRACE_CHECKBOX);
+
+		// Start index of "time from previous trace" changes according to the
+		// timestamp accuracy
+		if (timestampAccuracyMilliSecs) {
+			bracketStartIndex = BRACKET_START_INDEX_ACCURACY_MILLISECS;
+		} else {
+			bracketStartIndex = BRACKET_START_INDEX_ACCURACY_MICROSECS;
+		}
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.DataProcessor#processData(com.nokia.traceviewer
+	 * .engine.TraceProperties)
+	 */
+	public void processData(TraceProperties properties) {
+
+		if (properties.timestamp != 0) {
+			properties.timestampString = processTimestamp(properties);
+		} else if (properties.traceConfiguration.isReadFromFilterFile()
+				&& TraceViewerGlobals.getTraceViewer().getDataReaderAccess()
+						.getCurrentDataReader() instanceof PlainTextReader) {
+			properties.traceString = processTimestampFromPlainText(
+					properties.traceString, true);
+		} else {
+			properties.timestampString = null;
+		}
+	}
+
+	/**
+	 * Nulls previous timestamps
+	 */
+	public void nullPreviousTimestamp() {
+		timeOfPreviousNormalTrace = 0;
+		timeOfPreviousScrolledTrace = 0;
+		timeOfPreviousFilterTrace = 0;
+		timeOfPreviousPlainTextFilterTrace = 0;
+	}
+
+	/**
+	 * Nulls previous own timestamp
+	 */
+	public void nullPreviousOwnTimestamp() {
+		timeOfPreviousOwnEvent = 0;
+	}
+
+	/**
+	 * Processes nanosecond timestamp to human readable form
+	 * 
+	 * @param properties
+	 *            trace properties
+	 * @return human readable timestamp
+	 */
+	private String processTimestamp(TraceProperties properties) {
+		long previousTimestamp;
+
+		// Get the previous timestamp
+		if (!properties.traceConfiguration.isReadFromFilterFile()) {
+			if (properties.traceConfiguration.isScrolledTrace()) {
+				previousTimestamp = timeOfPreviousScrolledTrace;
+			} else {
+				previousTimestamp = timeOfPreviousNormalTrace;
+			}
+		} else {
+			previousTimestamp = timeOfPreviousFilterTrace;
+		}
+
+		long timestamp = properties.timestamp;
+		StringBuffer newData = new StringBuffer(LENGTH_OF_TIMESTAMP_STRING);
+
+		long microseconds = timestamp / THOUSAND;
+		long milliseconds = microseconds / THOUSAND;
+
+		if (previousTimestamp == 0
+				|| TraceViewerGlobals.getTraceViewer().getDataReaderAccess()
+						.getCurrentDataReader().getTraceCount() == 1) {
+			previousTimestamp = milliseconds;
+		}
+
+		// Insert milliseconds from previous trace to trace properties
+		properties.timeFromPreviousTrace = milliseconds - previousTimestamp;
+		previousTimestamp = milliseconds;
+
+		long seconds = milliseconds / THOUSAND;
+		milliseconds = milliseconds % THOUSAND;
+
+		int minutes = (int) (seconds / SECONDS_IN_MINUTE);
+		seconds = seconds % SECONDS_IN_MINUTE;
+
+		int hours = (minutes / MINUTES_IN_HOUR);
+		minutes = minutes % MINUTES_IN_HOUR;
+		hours = hours % HOURS_IN_DAY;
+
+		// Format the String, add hours
+		if (hours < TEN) {
+			newData.append('0');
+		}
+		newData.append(hours);
+
+		// Minutes
+		newData.append(':');
+		if (minutes < TEN) {
+			newData.append('0');
+		}
+		newData.append(minutes);
+
+		// Seconds
+		newData.append(':');
+		if (seconds < TEN) {
+			newData.append('0');
+		}
+		newData.append(seconds);
+
+		// Milliseconds
+		newData.append('.');
+		if (milliseconds < (TEN * TEN)) {
+			newData.append('0');
+		}
+		if (milliseconds < TEN) {
+			newData.append('0');
+		}
+		newData.append(milliseconds);
+
+		// Microseconds
+		if (!timestampAccuracyMilliSecs) {
+			microseconds = microseconds % THOUSAND;
+
+			if (microseconds < (TEN * TEN)) {
+				newData.append('0');
+			}
+			if (microseconds < TEN) {
+				newData.append('0');
+			}
+			newData.append(microseconds);
+		}
+
+		// Set the previous timestamp
+		if (!properties.traceConfiguration.isReadFromFilterFile()) {
+			if (properties.traceConfiguration.isScrolledTrace()) {
+				timeOfPreviousScrolledTrace = previousTimestamp;
+			} else {
+				timeOfPreviousNormalTrace = previousTimestamp;
+			}
+		} else {
+			timeOfPreviousFilterTrace = previousTimestamp;
+		}
+
+		return newData.toString();
+	}
+
+	/**
+	 * Processes timestamp from plain text trace
+	 * 
+	 * @param traceLine
+	 *            traceline where we need to change the time
+	 * @param filterTrace
+	 *            indicates that this is a filter trace
+	 * @return traceline with a correct timestamp string
+	 */
+	public String processTimestampFromPlainText(String traceLine,
+			boolean filterTrace) {
+		long previousTime;
+
+		if (filterTrace) {
+			previousTime = timeOfPreviousPlainTextFilterTrace;
+		} else {
+			previousTime = timeOfPreviousOwnEvent;
+		}
+
+		StringBuffer newTrace = new StringBuffer();
+
+		try {
+
+			int bracketStart = traceLine.indexOf('[');
+			int bracketEnd = traceLine.indexOf(']');
+
+			// If start bracket not in place or end bracket not found, skip the
+			// whole process
+			if (bracketStart == bracketStartIndex && bracketEnd != -1) {
+
+				// Get the current time in milliseconds
+				long currentTime = Integer.parseInt(traceLine.substring(
+						HOUR_START_INDEX, HOUR_STOP_INDEX))
+						* MILLISECS_IN_HOUR;
+				currentTime += Integer.parseInt(traceLine.substring(
+						MINUTE_START_INDEX, MINUTE_STOP_INDEX))
+						* MILLISECS_IN_MINUTE;
+				currentTime += Integer.parseInt(traceLine.substring(
+						SECOND_START_INDEX, SECOND_STOP_INDEX))
+						* MILLISECS_IN_SECOND;
+				currentTime += Integer.parseInt(traceLine.substring(
+						MILLISECOND_START_INDEX, MILLISECOND_STOP_INDEX));
+
+				long timeFromLastTrace;
+
+				if (previousTime == 0
+						|| TraceViewerGlobals.getTraceViewer()
+								.getDataReaderAccess().getCurrentDataReader()
+								.getTraceCount() == 1) {
+					timeFromLastTrace = 0;
+				} else {
+					if (currentTime < previousTime) {
+						currentTime += MILLISECS_IN_DAY;
+					}
+					timeFromLastTrace = currentTime - previousTime;
+				}
+
+				previousTime = currentTime;
+
+				newTrace.append(traceLine.substring(0, bracketStartIndex + 1));
+				newTrace.append(timeFromLastTrace);
+				newTrace.append(traceLine.substring(bracketEnd));
+			} else {
+				newTrace.append(traceLine);
+			}
+
+			// If something goes wrong, don't put timestamp in to the trace
+		} catch (Exception e) {
+			// e.printStackTrace();
+			newTrace.append(traceLine);
+		}
+
+		// Set back the previous time to correct variable
+		if (filterTrace) {
+			timeOfPreviousPlainTextFilterTrace = previousTime;
+		} else {
+			timeOfPreviousOwnEvent = previousTime;
+		}
+
+		return newTrace.toString();
+
+	}
+
+	/**
+	 * Gets timestamp accuracy
+	 * 
+	 * @return true if timestamp accuracy is milliseconds. False if
+	 *         microseconds.
+	 */
+	public boolean isTimestampAccuracyMilliSecs() {
+		return timestampAccuracyMilliSecs;
+	}
+
+	/**
+	 * Sets timestamp accuracy
+	 * 
+	 * @param timestampAccuracyMilliSecs
+	 *            if true, set timestamp accuracy to milliseconds. If false, set
+	 *            it to microseconds.
+	 */
+	public void setTimestampAccuracyMilliSecs(boolean timestampAccuracyMilliSecs) {
+		this.timestampAccuracyMilliSecs = timestampAccuracyMilliSecs;
+
+		if (timestampAccuracyMilliSecs) {
+			bracketStartIndex = BRACKET_START_INDEX_ACCURACY_MILLISECS;
+		} else {
+			bracketStartIndex = BRACKET_START_INDEX_ACCURACY_MICROSECS;
+		}
+	}
+
+	/**
+	 * Sets showing time from previous trace on / off
+	 * 
+	 * @param showTimeFromPreviousTrace
+	 *            if true, show time from previous trace
+	 */
+	public void setShowTimeFromPrevious(boolean showTimeFromPreviousTrace) {
+		this.showTimeFromPreviousTrace = showTimeFromPreviousTrace;
+	}
+
+	/**
+	 * Gets timestamp strings length
+	 * 
+	 * @return length of the timestamp string
+	 */
+	public int getTimestampStringLength() {
+
+		// Length is bracket start offset + tabulator
+		int minLength = bracketStartIndex + 1;
+
+		// If showing time from previous trace, there is at least three more
+		// characters added
+		if (showTimeFromPreviousTrace) {
+			minLength += 3;
+		}
+
+		return minLength;
+	}
+
+	/**
+	 * Gets time from previous trace String
+	 * 
+	 * @param timeFromPrevious
+	 *            time from previous as long
+	 * 
+	 * @return stringBuffer containing string where time from previous trace is
+	 *         in milliseconds
+	 */
+	public StringBuffer getTimeFromPreviousString(long timeFromPrevious) {
+		StringBuffer buf;
+
+		// Insert to stringbuffer
+		if (showTimeFromPreviousTrace) {
+			buf = new StringBuffer();
+			buf.append(' ');
+			buf.append('[');
+			buf.append(timeFromPrevious);
+			buf.append(']');
+
+			// Else return empty buffer
+		} else {
+			buf = emptyBuffer;
+		}
+		return buf;
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/TraceCommentHandler.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,202 @@
+/*
+ * 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:
+ *
+ * Trace Comment Handler
+ *
+ */
+package com.nokia.traceviewer.engine.dataprocessor;
+
+import java.util.Map;
+import java.util.TreeMap;
+
+import com.nokia.traceviewer.action.TraceViewerActionUtils;
+import com.nokia.traceviewer.engine.TraceProperties;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.metafile.MetaFileXMLExporter;
+import com.nokia.traceviewer.engine.metafile.MetaFileXMLImporter;
+
+/**
+ * Trace Comment Handler
+ */
+public class TraceCommentHandler implements DataProcessor {
+
+	/**
+	 * Postfix for comments file
+	 */
+	private static final String COMMENTS_FILE_POSTFIX = ".meta"; //$NON-NLS-1$
+
+	/**
+	 * Map containing the trace comments
+	 */
+	private final Map<Integer, String> commentMap;
+
+	/**
+	 * Constructor
+	 */
+	public TraceCommentHandler() {
+		commentMap = new TreeMap<Integer, String>();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.dataprocessor.DataProcessor#processData(
+	 * com.nokia.traceviewer.engine.TraceProperties)
+	 */
+	public void processData(TraceProperties properties) {
+		if (!commentMap.isEmpty()) {
+			properties.traceComment = commentMap.get(Integer
+					.valueOf(properties.traceNumber));
+		}
+	}
+
+	/**
+	 * Inserts new comment to trace
+	 * 
+	 * @param traceNumber
+	 *            trace number
+	 * @param comment
+	 *            trace comment
+	 */
+	public void insertComment(int traceNumber, String comment) {
+		if (!commentMap.containsKey(Integer.valueOf(traceNumber))) {
+			commentMap.put(Integer.valueOf(traceNumber), comment);
+
+			updateCommentsToViewAndFile();
+		}
+	}
+
+	/**
+	 * Update comment to the trace
+	 * 
+	 * @param traceNumber
+	 *            trace number
+	 * @param comment
+	 *            trace comment
+	 */
+	public void updateComment(int traceNumber, String comment) {
+		if (commentMap.containsKey(Integer.valueOf(traceNumber))) {
+			commentMap.remove(Integer.valueOf(traceNumber));
+			commentMap.put(Integer.valueOf(traceNumber), comment);
+
+			updateCommentsToViewAndFile();
+		}
+	}
+
+	/**
+	 * Update comment to the trace
+	 * 
+	 * @param traceNumber
+	 *            trace number
+	 */
+	public void removeComment(int traceNumber) {
+		if (commentMap.containsKey(Integer.valueOf(traceNumber))) {
+			commentMap.remove(Integer.valueOf(traceNumber));
+
+			updateCommentsToViewAndFile();
+		}
+	}
+
+	/**
+	 * Get comments in line number order
+	 * 
+	 * @return map of the line numbers and comments
+	 */
+	public Map<Integer, String> getComments() {
+		return commentMap;
+	}
+
+	/**
+	 * Gets comment with a trace number
+	 * 
+	 * @param traceNumber
+	 *            trace number
+	 * @return comment for this trace number or null if not found
+	 */
+	public String getComment(int traceNumber) {
+		String comment = null;
+		if (commentMap.containsKey(Integer.valueOf(traceNumber))) {
+			comment = commentMap.get(Integer.valueOf(traceNumber));
+		}
+
+		return comment;
+	}
+
+	/**
+	 * Exports trace comments to a file
+	 * 
+	 * @param logFilePath
+	 *            path where the log file was saved
+	 */
+	public void exportTraceComments(String logFilePath) {
+		if (!commentMap.isEmpty()) {
+			String commentLogPath = logFilePath + COMMENTS_FILE_POSTFIX;
+
+			MetaFileXMLExporter exporter = new MetaFileXMLExporter(
+					commentLogPath);
+			exporter.export();
+		}
+	}
+
+	/**
+	 * Imports trace comments from a file
+	 * 
+	 * @param logFilePath
+	 *            path where the log file was saved
+	 */
+	public void importTraceComments(String logFilePath) {
+		String commentLogPath = logFilePath + COMMENTS_FILE_POSTFIX;
+
+		MetaFileXMLImporter importer = new MetaFileXMLImporter(commentLogPath);
+		importer.importData(commentMap);
+
+		// Update property view
+		updateCommentsToViewAndFile();
+	}
+
+	/**
+	 * Updates comments to property view and possible file
+	 */
+	void updateCommentsToViewAndFile() {
+		// Open property view if it doesn't exist and there's comments
+		if (!commentMap.isEmpty()) {
+			TraceViewerActionUtils.openPropertyView();
+		}
+		// Update comments
+		if (TraceViewerGlobals.getTraceViewer().getPropertyView() != null) {
+			TraceViewerGlobals.getTraceViewer().getPropertyView()
+					.updateTraceComments();
+		}
+
+		// If log file is opened, update the comments file
+		if (TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+				.getLogger().isLogFileOpened()) {
+			String logFile = TraceViewerGlobals.getTraceViewer()
+					.getDataProcessorAccess().getLogger()
+					.getOpenedLogFilePath();
+
+			if (logFile != null) {
+				// Export the changed comments
+				exportTraceComments(logFile);
+			}
+		}
+
+		// Refresh current view
+		if (TraceViewerGlobals.getTraceViewer().getView() != null) {
+			TraceViewerGlobals.getTraceViewer().getView().refreshCurrentView();
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/TriggerProcessor.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,437 @@
+/*
+ * 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:
+ *
+ * TriggerProcessor DataProcessor
+ *
+ */
+package com.nokia.traceviewer.engine.dataprocessor;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.action.TraceViewerActionUtils;
+import com.nokia.traceviewer.dialog.TriggerDialog;
+import com.nokia.traceviewer.dialog.treeitem.TreeItem;
+import com.nokia.traceviewer.dialog.treeitem.TreeItemContentProvider;
+import com.nokia.traceviewer.dialog.treeitem.TreeItemListener;
+import com.nokia.traceviewer.dialog.treeitem.TriggerTreeBaseItem;
+import com.nokia.traceviewer.dialog.treeitem.TriggerTreeItem;
+import com.nokia.traceviewer.dialog.treeitem.TriggerTreeTextItem;
+import com.nokia.traceviewer.engine.TraceProperties;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.TraceViewerDialogInterface.Dialog;
+import com.nokia.traceviewer.engine.activation.TraceActivationComponentItem;
+import com.nokia.traceviewer.engine.activation.TraceActivationXMLImporter;
+import com.nokia.traceviewer.engine.activation.TraceActivator;
+import com.nokia.traceviewer.engine.preferences.PreferenceConstants;
+import com.nokia.traceviewer.engine.preferences.XMLTriggerConfigurationImporter;
+
+/**
+ * Trigger DataProcessor
+ * 
+ */
+public final class TriggerProcessor implements DataProcessor {
+
+	/**
+	 * Dataprocessors stop delay
+	 */
+	private static final int DATAPROCESSOR_STOP_DELAY = 500;
+
+	/**
+	 * State of the trigger process enumeration
+	 */
+	public enum TriggerState {
+
+		/**
+		 * Searching for start trigger
+		 */
+		SEARCHING_FOR_STARTTRIGGER,
+
+		/**
+		 * Searching for stop trigger
+		 */
+		SEARCHING_FOR_STOPTRIGGER
+	}
+
+	/**
+	 * State of the trigger process
+	 */
+	private TriggerState triggerState;
+
+	/**
+	 * Trigger dialog used in setting rules
+	 */
+	private TriggerDialog triggerDialog;
+
+	/**
+	 * Content provider for the dialog
+	 */
+	private TreeItemContentProvider contentProvider;
+
+	/**
+	 * First visible object in the dialog tree
+	 */
+	private TreeItem root;
+
+	/**
+	 * Start triggers
+	 */
+	private final List<TriggerTreeTextItem> startTriggers;
+
+	/**
+	 * Stop triggers
+	 */
+	private final List<TriggerTreeTextItem> stopTriggers;
+
+	/**
+	 * Activation triggers
+	 */
+	private final List<TriggerTreeTextItem> activationTriggers;
+
+	/**
+	 * Constructor
+	 */
+	public TriggerProcessor() {
+		createInitialTree();
+		startTriggers = new ArrayList<TriggerTreeTextItem>();
+		stopTriggers = new ArrayList<TriggerTreeTextItem>();
+		activationTriggers = new ArrayList<TriggerTreeTextItem>();
+	}
+
+	/**
+	 * Creates initial tree
+	 */
+	public void createInitialTree() {
+		contentProvider = new TreeItemContentProvider();
+		// Create root node
+		TreeItem treeRoot = new TriggerTreeBaseItem(contentProvider, null,
+				"root", //$NON-NLS-1$
+				TriggerTreeItem.Rule.GROUP, null);
+		root = new TriggerTreeBaseItem(contentProvider, treeRoot,
+				TraceViewerPlugin.getDefault().getPreferenceStore().getString(
+						PreferenceConstants.CONFIGURATION_FILE),
+				TriggerTreeItem.Rule.GROUP, null);
+		treeRoot.addChild(root);
+	}
+
+	/**
+	 * Imports trigger rules from configuration file
+	 */
+	public void importTriggerRules() {
+		// Import rules
+		XMLTriggerConfigurationImporter importer = new XMLTriggerConfigurationImporter(
+				root, TraceViewerPlugin.getDefault().getPreferenceStore()
+						.getString(PreferenceConstants.CONFIGURATION_FILE),
+				true);
+		importer.importData();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.DataProcessor#processData(com.nokia.traceviewer
+	 * .engine.TraceProperties)
+	 */
+	public void processData(TraceProperties properties) {
+		if (isTriggering() && !properties.traceConfiguration.isScrolledTrace()) {
+
+			// Set the trigger State
+			if (!startTriggers.isEmpty()) {
+				triggerState = TriggerState.SEARCHING_FOR_STARTTRIGGER;
+				properties.traceConfiguration.setTriggeredOut(true);
+			} else if (!stopTriggers.isEmpty()) {
+				triggerState = TriggerState.SEARCHING_FOR_STOPTRIGGER;
+				properties.traceConfiguration.setTriggeredOut(false);
+			}
+
+			// Searching for activation line
+			if (!activationTriggers.isEmpty()) {
+				if (containsTrigger(activationTriggers, properties)) {
+					generateAndSendActivationMsg(activationTriggers, properties);
+				}
+			}
+
+			// State machine
+			if (triggerState == TriggerState.SEARCHING_FOR_STARTTRIGGER) {
+
+				// Start trigger is found
+				if (containsTrigger(startTriggers, properties)) {
+
+					// One of the start triggers has been found, remove all
+					// start triggers and change the view state
+					startTriggers.clear();
+					TraceViewerGlobals.getTraceViewer().getView()
+							.updateViewName();
+
+					// Start using trigger file
+					long posInFile = TraceViewerGlobals.getTraceViewer()
+							.getDataReaderAccess().getMainDataReader()
+							.getTracePositionInFile();
+					startUsingTriggerFile(posInFile);
+				}
+
+			} else if (triggerState == TriggerState.SEARCHING_FOR_STOPTRIGGER) {
+
+				// One of the stop triggers has been found, remove all
+				// stop triggers, and pause data reader. Pausing the data reader
+				// will also update the view name so it's not necessary here
+				if (containsTrigger(stopTriggers, properties)) {
+					stopTriggers.clear();
+					TraceViewerGlobals.getTraceViewer().getView()
+							.getActionFactory().getPauseAction().run();
+				}
+			}
+		}
+	}
+
+	/**
+	 * Sets TraceViewer to use the new trigger file as main file
+	 * 
+	 * @param position
+	 *            position of the message containing the start trigger
+	 */
+	private void startUsingTriggerFile(long position) {
+		TraceViewerGlobals.getTraceViewer().getFileHandler().closeFile();
+
+		// Shut down data readers
+		TraceViewerGlobals.getTraceViewer().getDataReaderAccess()
+				.getMainDataReader().shutdown();
+		TraceViewerGlobals.getTraceViewer().getDataReaderAccess()
+				.deleteScrollReader();
+
+		// Wait for a while for readers to really stop
+		try {
+			Thread.sleep(DATAPROCESSOR_STOP_DELAY);
+		} catch (InterruptedException e) {
+		}
+
+		// Set the start of the trace file
+		TraceViewerGlobals.getTraceViewer().getDataReaderAccess()
+				.setFileStartOffset(position);
+
+		// Create new main file
+		TraceViewerGlobals.getTraceViewer().getFileHandler().openFile();
+
+		// Start new main data reader
+		TraceViewerGlobals.getTraceViewer().getDataReaderAccess()
+				.createMainDataReader();
+
+		triggerState = TriggerState.SEARCHING_FOR_STOPTRIGGER;
+	}
+
+	/**
+	 * Tells if this trace hits any of the triggers in the list
+	 * 
+	 * @param triggers
+	 *            trigger list to find from
+	 * @param properties
+	 *            trace to find
+	 * @return true if trace is contained in the trigger array
+	 */
+	private boolean containsTrigger(List<TriggerTreeTextItem> triggers,
+			TraceProperties properties) {
+		boolean found = false;
+
+		// Loop through triggers
+		for (int i = 0; i < triggers.size(); i++) {
+			found = containsTrigger(triggers.get(i), properties);
+
+			if (found) {
+				break;
+			}
+		}
+
+		return found;
+	}
+
+	/**
+	 * Tells if this trace hits given trigger
+	 * 
+	 * @param trigger
+	 *            trigger rule
+	 * @param properties
+	 *            trace
+	 * @return true if trace hits the given trigger
+	 */
+	private boolean containsTrigger(TriggerTreeTextItem trigger,
+			TraceProperties properties) {
+		boolean found = false;
+		String triggerStr = trigger.getTextToCompare();
+
+		String traceLine = ""; //$NON-NLS-1$
+
+		// Traces missing
+		if (properties.bTraceInformation.isTraceMissing()) {
+			traceLine = TraceViewerActionUtils.TRACES_DROPPED_MSG;
+		}
+		if (properties.traceString != null) {
+			traceLine += properties.traceString;
+		}
+
+		if (!trigger.isMatchCase()) {
+			traceLine = traceLine.toLowerCase();
+		}
+		if (traceLine.contains(triggerStr)) {
+			found = true;
+		}
+		return found;
+	}
+
+	/**
+	 * Generate and send activation message
+	 * 
+	 * @param triggers
+	 *            activation triggers
+	 * @param trace
+	 *            trace properties
+	 */
+	private void generateAndSendActivationMsg(
+			List<TriggerTreeTextItem> triggers, TraceProperties trace) {
+
+		// Go through the whole list as one trace can hit multiple triggers
+		for (int i = 0; i < triggers.size(); i++) {
+			TriggerTreeTextItem trigger = triggers.get(i);
+
+			// Trigger hits
+			if (containsTrigger(trigger, trace)) {
+				// Generate activation list
+				TraceActivationXMLImporter importer = new TraceActivationXMLImporter(
+						trigger.getConfigurationFilePath());
+
+				// Create the list
+				List<TraceActivationComponentItem> activationList = new ArrayList<TraceActivationComponentItem>();
+
+				// Fill the list from the importer
+				importer.createComponentListFromConfigurationName(
+						activationList, trigger.getConfigurationName());
+
+				// Activate
+				new TraceActivator().activate(activationList);
+			}
+		}
+	}
+
+	/**
+	 * Tells are we start triggering
+	 * 
+	 * @return true if start triggering
+	 */
+	public boolean isStartTriggering() {
+		boolean isStartTriggering = !startTriggers.isEmpty();
+		return isStartTriggering;
+	}
+
+	/**
+	 * Tells are we stop triggering
+	 * 
+	 * @return true if stop triggering
+	 */
+	public boolean isStopTriggering() {
+		boolean isStopTriggering = !stopTriggers.isEmpty();
+		return isStopTriggering;
+	}
+
+	/**
+	 * Tells are we triggering
+	 * 
+	 * @return true if triggering
+	 */
+	public boolean isTriggering() {
+		boolean isTriggering = !startTriggers.isEmpty()
+				|| !stopTriggers.isEmpty() || !activationTriggers.isEmpty();
+		return isTriggering;
+	}
+
+	/**
+	 * Gets trigger dialog
+	 * 
+	 * @return Trigger dialog
+	 */
+	public TriggerDialog getTriggerDialog() {
+		if (triggerDialog == null) {
+			triggerDialog = (TriggerDialog) TraceViewerGlobals.getTraceViewer()
+					.getDialogs().createDialog(Dialog.TRIGGER);
+		}
+		return triggerDialog;
+	}
+
+	/**
+	 * Gets root node of the tree
+	 * 
+	 * @return root node of the tree
+	 */
+	public TreeItem getRoot() {
+		return root;
+	}
+
+	/**
+	 * Gets item listener
+	 * 
+	 * @return the contentProvider
+	 */
+	public TreeItemListener getTreeItemListener() {
+		return contentProvider;
+	}
+
+	/**
+	 * Removes triggers
+	 */
+	public void removeTriggers() {
+		startTriggers.clear();
+		stopTriggers.clear();
+	}
+
+	/**
+	 * Gets start triggers
+	 * 
+	 * @return the startTriggers
+	 */
+	public List<TriggerTreeTextItem> getStartTriggers() {
+		return startTriggers;
+	}
+
+	/**
+	 * Gets stop triggers
+	 * 
+	 * @return the stopTriggers
+	 */
+	public List<TriggerTreeTextItem> getStopTriggers() {
+		return stopTriggers;
+	}
+
+	/**
+	 * Gets activation triggers
+	 * 
+	 * @return the activationTriggers
+	 */
+	public List<TriggerTreeTextItem> getActivationTriggers() {
+		return activationTriggers;
+	}
+
+	/**
+	 * Enable variabletracing rule
+	 * 
+	 * @param item
+	 *            the rule item
+	 */
+	public void enableRule(TriggerTreeItem item) {
+		if (item instanceof TriggerTreeTextItem) {
+			TriggerTreeTextItem newItem = (TriggerTreeTextItem) item;
+			activationTriggers.add(newItem);
+		}
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/VariableTracingEvent.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,132 @@
+/*
+ * 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:
+ *
+ * VariableTracing Event contains information about events when the value of variable changes
+ *
+ */
+package com.nokia.traceviewer.engine.dataprocessor;
+
+import com.nokia.traceviewer.engine.TraceInformation;
+
+/**
+ * VariableTracing Event contains information about events when the value of
+ * variable changes
+ */
+public class VariableTracingEvent {
+
+	/**
+	 * Parent VariableTracing item
+	 */
+	private final VariableTracingItem parent;
+
+	/**
+	 * Timestamp string
+	 */
+	private final String timestamp;
+
+	/**
+	 * Value of the variable in this event
+	 */
+	private final String value;
+
+	/**
+	 * Line where event occurred
+	 */
+	private int line;
+
+	/**
+	 * Trace information included in the event
+	 */
+	private final TraceInformation traceInformation;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parent
+	 *            parent item
+	 * @param timestamp
+	 *            timestamp of the event
+	 * @param value
+	 *            value of the event
+	 * @param line
+	 *            line where event happened
+	 * @param traceInformation
+	 *            trace information of the event
+	 */
+	public VariableTracingEvent(VariableTracingItem parent, String timestamp,
+			String value, int line, TraceInformation traceInformation) {
+		this.parent = parent;
+		this.timestamp = timestamp;
+		this.value = value;
+		this.line = line;
+		this.traceInformation = traceInformation;
+	}
+
+	/**
+	 * Gets the line where event occurred
+	 * 
+	 * @return the line
+	 */
+	public int getLine() {
+		return line;
+	}
+
+	/**
+	 * Sets the line where event occurred
+	 * 
+	 * @param line
+	 *            the line to set
+	 */
+	public void setLine(int line) {
+		this.line = line;
+	}
+
+	/**
+	 * Gets trace information
+	 * 
+	 * @return the traceInformation
+	 */
+	public TraceInformation getTraceInformation() {
+		return traceInformation;
+	}
+
+	/**
+	 * Gets the value of the variable
+	 * 
+	 * @return the value
+	 */
+	public String getValue() {
+		return value;
+	}
+
+	/**
+	 * Gets parent variableTracing item
+	 * 
+	 * @return the parent
+	 */
+	public VariableTracingItem getParent() {
+		return parent;
+	}
+
+	/**
+	 * Gets the timestamp
+	 * 
+	 * @return the timestamp
+	 */
+	public String getTimestamp() {
+		return timestamp;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/VariableTracingItem.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,179 @@
+/*
+ * 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:
+ *
+ * Variable Tracing Item
+ *
+ */
+package com.nokia.traceviewer.engine.dataprocessor;
+
+import java.util.LinkedList;
+
+/**
+ * Varible tracing item showed in the variableTracingTable
+ */
+public class VariableTracingItem {
+
+	/**
+	 * Name of the item
+	 */
+	private final String name;
+
+	/**
+	 * Text to be compared
+	 */
+	private final String textToCompare;
+
+	/**
+	 * Indicates if item needs matching case
+	 */
+	private final boolean matchCase;
+
+	/**
+	 * Number of history items to save in this item
+	 */
+	private final int saveHistory;
+
+	/**
+	 * Linked list containing variable tracing events
+	 */
+	private final LinkedList<VariableTracingEvent> events;
+
+	/**
+	 * Indicates if item has changed since last update
+	 */
+	private boolean changed;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param name
+	 *            name of the item
+	 * @param text
+	 *            text of the item
+	 * @param matchCase
+	 *            matchcase indicator
+	 * @param saveHistory
+	 *            number of history steps to save
+	 */
+	public VariableTracingItem(String name, String text, boolean matchCase,
+			int saveHistory) {
+		// Create the linked list
+		events = new LinkedList<VariableTracingEvent>();
+		this.name = name;
+		this.matchCase = matchCase;
+
+		// Always save at least 1
+		if (saveHistory < 1) {
+			this.saveHistory = 1;
+		} else {
+			this.saveHistory = saveHistory;
+		}
+
+		// Save text to compare
+		if (matchCase || text == null) {
+			textToCompare = text;
+		} else {
+			textToCompare = text.toLowerCase();
+		}
+	}
+
+	/**
+	 * Tells the status of changed attribute
+	 * 
+	 * @return the changed
+	 */
+	public boolean isChanged() {
+		return changed;
+	}
+
+	/**
+	 * Sets changed attribute
+	 * 
+	 * @param changed
+	 *            the changed to set
+	 */
+	public void setChanged(boolean changed) {
+		this.changed = changed;
+	}
+
+	/**
+	 * Tells the status of match case attribute
+	 * 
+	 * @return the matchCase
+	 */
+	public boolean isMatchCase() {
+		return matchCase;
+	}
+
+	/**
+	 * Gets the name
+	 * 
+	 * @return the name
+	 */
+	public String getName() {
+		return name;
+	}
+
+	/**
+	 * Gets text to compare
+	 * 
+	 * @return the text to compare
+	 */
+	public String getTextToCompare() {
+		return textToCompare;
+	}
+
+	/**
+	 * Adds new variable tracing event to the list
+	 * 
+	 * @param event
+	 *            the event
+	 */
+	public void addEvent(VariableTracingEvent event) {
+		if (events.size() >= saveHistory) {
+			events.removeLast();
+		}
+		events.addFirst(event);
+	}
+
+	/**
+	 * Gets list of events from this item
+	 * 
+	 * @return list of events
+	 */
+	public LinkedList<VariableTracingEvent> getEventList() {
+		return events;
+	}
+
+	/**
+	 * Adds new variable tracing event to the list
+	 */
+	public void clear() {
+		events.clear();
+	}
+
+	/**
+	 * Gets value of the latest item
+	 * 
+	 * @return value of the latest item
+	 */
+	public String getValue() {
+		String value = ""; //$NON-NLS-1$
+		if (!events.isEmpty()) {
+			value = events.get(0).getValue();
+		}
+		return value;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/VariableTracingProcessor.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,288 @@
+/*
+ * 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:
+ *
+ * VariableTracingProcessor DataProcessor
+ *
+ */
+package com.nokia.traceviewer.engine.dataprocessor;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.action.TraceViewerActionUtils;
+import com.nokia.traceviewer.dialog.VariableTracingDialog;
+import com.nokia.traceviewer.dialog.treeitem.TreeItem;
+import com.nokia.traceviewer.dialog.treeitem.TreeItemContentProvider;
+import com.nokia.traceviewer.dialog.treeitem.TreeItemListener;
+import com.nokia.traceviewer.dialog.treeitem.VariableTracingTreeBaseItem;
+import com.nokia.traceviewer.dialog.treeitem.VariableTracingTreeItem;
+import com.nokia.traceviewer.dialog.treeitem.VariableTracingTreeTextItem;
+import com.nokia.traceviewer.engine.TraceProperties;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.TraceViewerPropertyViewInterface;
+import com.nokia.traceviewer.engine.TraceViewerDialogInterface.Dialog;
+import com.nokia.traceviewer.engine.preferences.PreferenceConstants;
+import com.nokia.traceviewer.engine.preferences.XMLVariableTracingConfigurationImporter;
+
+/**
+ * VariableTracing DataProcessor
+ * 
+ */
+public final class VariableTracingProcessor implements DataProcessor {
+
+	/**
+	 * Interval how often to update progressbar
+	 */
+	private static final int PROGRESSBAR_UPDATE_INTERVAL = 100;
+
+	/**
+	 * Variable Tracing dialog used in setting rules
+	 */
+	private VariableTracingDialog variableTracingDialog;
+
+	/**
+	 * Content provider for the dialog
+	 */
+	private TreeItemContentProvider contentProvider;
+
+	/**
+	 * First visible object in the dialog tree
+	 */
+	private TreeItem root;
+
+	/**
+	 * List of variable tracing items
+	 */
+	private final List<VariableTracingItem> variableTracingItems;
+
+	/**
+	 * Text rules that are applied
+	 */
+	private final List<VariableTracingTreeTextItem> textRules;
+
+	/**
+	 * Constructor
+	 */
+	public VariableTracingProcessor() {
+		createInitialTree();
+		variableTracingItems = new ArrayList<VariableTracingItem>();
+		textRules = new ArrayList<VariableTracingTreeTextItem>();
+
+	}
+
+	/**
+	 * Creates initial tree
+	 */
+	public void createInitialTree() {
+		contentProvider = new TreeItemContentProvider();
+		// Create root node
+		TreeItem treeRoot = new VariableTracingTreeBaseItem(contentProvider,
+				null, "root", VariableTracingTreeItem.Rule.GROUP); //$NON-NLS-1$
+		root = new VariableTracingTreeBaseItem(contentProvider, treeRoot,
+				TraceViewerPlugin.getDefault().getPreferenceStore().getString(
+						PreferenceConstants.CONFIGURATION_FILE),
+				VariableTracingTreeItem.Rule.GROUP);
+		treeRoot.addChild(root);
+	}
+
+	/**
+	 * Imports line count rules from configuration file
+	 */
+	public void importVariableTracingRules() {
+		// Import rules
+		XMLVariableTracingConfigurationImporter importer = new XMLVariableTracingConfigurationImporter(
+				root, TraceViewerPlugin.getDefault().getPreferenceStore()
+						.getString(PreferenceConstants.CONFIGURATION_FILE),
+				true);
+		importer.importData();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.DataProcessor#processData(com.nokia.traceviewer
+	 * .engine.TraceProperties)
+	 */
+	public void processData(TraceProperties properties) {
+		if (!properties.traceConfiguration.isScrolledTrace()
+				&& !properties.traceConfiguration.isFilteredOut()
+				&& !properties.traceConfiguration.isTriggeredOut()) {
+			int len = variableTracingItems.size();
+			if (len > 0) {
+
+				// Loop through variable tracing items
+				VariableTracingItem item;
+				for (int i = 0; i < len; i++) {
+					item = variableTracingItems.get(i);
+
+					String traceLine = ""; //$NON-NLS-1$
+
+					// Traces missing
+					if (properties.bTraceInformation.isTraceMissing()) {
+						traceLine = TraceViewerActionUtils.TRACES_DROPPED_MSG;
+					}
+					if (properties.traceString != null) {
+						traceLine += properties.traceString;
+					}
+
+					String rule = item.getTextToCompare();
+					if (rule == null) {
+						break;
+					}
+
+					String checkString = traceLine;
+					if (!item.isMatchCase()) {
+						checkString = checkString.toLowerCase();
+					}
+
+					// Line hits
+					if (checkString.contains(rule)) {
+						VariableTracingEvent event = new VariableTracingEvent(
+								item,
+								properties.timestampString,
+								traceLine.substring(checkString.indexOf(rule)
+										+ rule.length()),
+								TraceViewerGlobals.getTraceViewer()
+										.getDataReaderAccess()
+										.getCurrentDataReader().getTraceCount(),
+								properties.information);
+						item.addEvent(event);
+						item.setChanged(true);
+						TraceViewerPropertyViewInterface view = TraceViewerGlobals
+								.getTraceViewer().getPropertyView();
+						if (view != null) {
+							view.setVariableTracingTableChanged();
+						}
+					}
+				}
+
+				// Update progressbar if needed
+				updateProgressBar();
+			}
+		}
+	}
+
+	/**
+	 * Update progressbar if needed
+	 */
+	private void updateProgressBar() {
+		// Update possible progressBar
+		if (isProcessingTracing()
+				&& TraceViewerGlobals.getTraceViewer().getDataReaderAccess()
+						.getCurrentDataReader().getTraceCount()
+						% PROGRESSBAR_UPDATE_INTERVAL == 0) {
+
+			variableTracingDialog.getProgressBar().updateProgressBar(
+					TraceViewerGlobals.getTraceViewer().getDataReaderAccess()
+							.getCurrentDataReader().getTraceCount());
+		}
+	}
+
+	/**
+	 * Tells if initial tracing is in process
+	 * 
+	 * @return true if initial tracing is in progress
+	 */
+	public boolean isProcessingTracing() {
+		return (variableTracingDialog != null
+				&& variableTracingDialog.getProgressBar() != null
+				&& variableTracingDialog.getProgressBar().getShell() != null && !variableTracingDialog
+				.getProgressBar().getShell().isDisposed());
+	}
+
+	/**
+	 * Gets variable tracing dialog
+	 * 
+	 * @return variable tracing dialog
+	 */
+	public VariableTracingDialog getVariableTracingDialog() {
+		if (variableTracingDialog == null) {
+			variableTracingDialog = (VariableTracingDialog) TraceViewerGlobals
+					.getTraceViewer().getDialogs().createDialog(
+							Dialog.VARIABLETRACING);
+		}
+		return variableTracingDialog;
+	}
+
+	/**
+	 * Gets root of the tree
+	 * 
+	 * @return root
+	 */
+	public TreeItem getRoot() {
+		return root;
+	}
+
+	/**
+	 * Gets item listener
+	 * 
+	 * @return the contentProvider
+	 */
+	public TreeItemListener getTreeItemListener() {
+		return contentProvider;
+	}
+
+	/**
+	 * Gets VariableTracingItems
+	 * 
+	 * @return the VariableTracingItems
+	 */
+	public List<VariableTracingItem> getVariableTracingItems() {
+		return variableTracingItems;
+	}
+
+	/**
+	 * Empty variablesTracingItems
+	 */
+	public void emptyVariableTracingItems() {
+		for (int i = 0; i < variableTracingItems.size(); i++) {
+			variableTracingItems.get(i).clear();
+			variableTracingItems.get(i).setChanged(true);
+		}
+	}
+
+	/**
+	 * Gets text rules
+	 * 
+	 * @return text rules
+	 */
+	public List<VariableTracingTreeTextItem> getTextRules() {
+		return textRules;
+	}
+
+	/**
+	 * Enable variabletracing rule
+	 * 
+	 * @param item
+	 *            the rule item
+	 */
+	public void enableRule(VariableTracingTreeItem item) {
+		if (item instanceof VariableTracingTreeTextItem) {
+			VariableTracingTreeTextItem item2 = (VariableTracingTreeTextItem) item;
+			VariableTracingItem newItem = new VariableTracingItem(item2
+					.getName(), item2.getText(), item2.isMatchCase(), item2
+					.getHistoryCount());
+			textRules.add((VariableTracingTreeTextItem) item);
+			variableTracingItems.add(newItem);
+		}
+
+		if (TraceViewerGlobals.getTraceViewer().getPropertyView() != null) {
+			TraceViewerGlobals.getTraceViewer().getPropertyView()
+					.createNewPropertyTableItems();
+		}
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/dataprocessor/messages.properties	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,4 @@
+Decoder.CpuIdText=Cpu
+Decoder.CpuTextDelimeter=: 
+Decoder.ThreadIdText=;Thread ID:0x
+FilterProcessor.DefaultFilterFileName=TraceViewerFilterFile.bin
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/messages.properties	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,4 @@
+TraceViewer.DefaultFileName=TraceViewerBinFile.bin
+TraceViewerEventListener.InvalidSearchTraceMsg1=Search trace event coming from 
+TraceViewerEventListener.InvalidSearchTraceMsg2=\ contains faulty ID numbers\!
+TraceViewerUtils.DataCorruptMsg=Data corrupt
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/metafile/MetaFileXMLConstants.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,65 @@
+/*
+ * 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:
+ *
+ * Constants for Meta File XML export/import
+ *
+ */
+package com.nokia.traceviewer.engine.metafile;
+
+/**
+ * Constants for TraceActivation XML export/import
+ */
+public class MetaFileXMLConstants {
+
+	/**
+	 * XML Header
+	 */
+	public static final String XML_HEADER = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; //$NON-NLS-1$
+
+	/**
+	 * File start
+	 */
+	public static final String FILE_START = "<MetadataFile Version=\"1\">\n"; //$NON-NLS-1$
+
+	/**
+	 * File end
+	 */
+	public static final String FILE_END = "</MetadataFile>\n"; //$NON-NLS-1$
+
+	/**
+	 * Trace comments start
+	 */
+	public static final String TRACECOMMENTS_START = "<TraceComments>\n"; //$NON-NLS-1$
+
+	/**
+	 * Trace comments
+	 */
+	public static final String TRACECOMMENTS_END = "</TraceComments>\n"; //$NON-NLS-1$
+
+	/**
+	 * Activations tag
+	 */
+	public static final String TRACECOMMENTS_TAG = "TraceComments"; //$NON-NLS-1$
+
+	/**
+	 * Comment tag
+	 */
+	public static final String COMMENT_TAG = "Comment"; //$NON-NLS-1$
+
+	/**
+	 * Line tag
+	 */
+	public static final String LINE_TAG = "Line"; //$NON-NLS-1$
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/metafile/MetaFileXMLExporter.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,279 @@
+/*
+ * 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:
+ *
+ * Metadata file Exporter class
+ *
+ */
+package com.nokia.traceviewer.engine.metafile;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.StringWriter;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Metadata file Exporter class
+ * 
+ */
+public class MetaFileXMLExporter {
+
+	/**
+	 * File path to use when exporting
+	 */
+	private final String filePath;
+
+	/**
+	 * Output stream writer
+	 */
+	private OutputStreamWriter out;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param filePath
+	 *            file path where to export data
+	 */
+	public MetaFileXMLExporter(String filePath) {
+		this.filePath = filePath;
+
+		createFile();
+	}
+
+	/**
+	 * Exports data
+	 * 
+	 * @return true if exporting succeeds
+	 */
+	public boolean export() {
+		boolean succeeded = false;
+		Document doc = getDocument();
+		Node parent;
+
+		if (doc != null) {
+
+			// Get root node of trace comment rules
+			NodeList list = doc
+					.getElementsByTagName(MetaFileXMLConstants.TRACECOMMENTS_TAG);
+
+			// Doesn't exist, create
+			if (list.getLength() == 0) {
+				parent = doc
+						.createElement(MetaFileXMLConstants.TRACECOMMENTS_TAG);
+				try {
+					doc.appendChild(parent);
+				} catch (Exception e) {
+					parent = null;
+				}
+			} else {
+				parent = list.item(0);
+			}
+
+			// Delete old trace comments
+			if (parent != null) {
+				NodeList filterChilds = parent.getChildNodes();
+				int len = filterChilds.getLength();
+				for (int i = 0; i < len; i++) {
+					parent.removeChild(filterChilds.item(0));
+				}
+
+				// Get trace comments
+				Map<Integer, String> traceComments = TraceViewerGlobals
+						.getTraceViewer().getDataProcessorAccess()
+						.getTraceCommentHandler().getComments();
+
+				// Loop through the trace comments
+				Iterator<Entry<Integer, String>> it = traceComments.entrySet()
+						.iterator();
+				while (it.hasNext()) {
+					Entry<Integer, String> entry = it.next();
+
+					Node newItem = null;
+					newItem = doc
+							.createElement(MetaFileXMLConstants.COMMENT_TAG);
+					NamedNodeMap itemAttributes = newItem.getAttributes();
+					Attr line = doc
+							.createAttribute(MetaFileXMLConstants.LINE_TAG);
+					line.setValue(String.valueOf(entry.getKey()));
+					itemAttributes.setNamedItem(line);
+					newItem.setTextContent(entry.getValue());
+					parent.appendChild(newItem);
+				}
+
+				// Get result from document
+				StreamResult result = getResultFromDocument(doc);
+
+				// Print out
+				String xmlString = result.getWriter().toString();
+				writeFile(xmlString);
+				succeeded = true;
+			}
+		}
+
+		return succeeded;
+	}
+
+	/**
+	 * Creates the file
+	 */
+	public void createFile() {
+		File file = new File(filePath);
+
+		// File doesn't exist, create it
+		if (!file.exists() || file.length() == 0) {
+			createFileSkeleton();
+		} else {
+			// File exists
+		}
+	}
+
+	/**
+	 * Creates XML file skeleton
+	 */
+	private void createFileSkeleton() {
+		try {
+			// Open an Output Stream Writer to set encoding
+			OutputStream fout = new FileOutputStream(filePath);
+			OutputStream bout = new BufferedOutputStream(fout);
+			out = new OutputStreamWriter(bout, "UTF-8"); //$NON-NLS-1$
+
+			out.write(MetaFileXMLConstants.XML_HEADER);
+			out.write(MetaFileXMLConstants.FILE_START);
+			out.write(MetaFileXMLConstants.TRACECOMMENTS_START);
+			out.write(MetaFileXMLConstants.TRACECOMMENTS_END);
+			out.write(MetaFileXMLConstants.FILE_END);
+			out.flush();
+			out.close();
+		} catch (IOException e) {
+		}
+
+	}
+
+	/**
+	 * Writes ready XML string to file
+	 * 
+	 * @param xmlString
+	 */
+	protected void writeFile(String xmlString) {
+
+		try {
+			// Open an Output Stream Writer to set encoding
+			OutputStream fout = new FileOutputStream(filePath);
+			OutputStream bout = new BufferedOutputStream(fout);
+			out = new OutputStreamWriter(bout, "UTF-8"); //$NON-NLS-1$
+
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		try {
+			out.write(xmlString);
+			out.flush();
+			out.close();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+	}
+
+	/**
+	 * Gets result from document
+	 * 
+	 * @param doc
+	 *            document
+	 * @return result
+	 */
+	protected StreamResult getResultFromDocument(Document doc) {
+		TransformerFactory tf = TransformerFactory.newInstance();
+		int indentSize = 2;
+		tf.setAttribute("indent-number", Integer.valueOf(indentSize)); //$NON-NLS-1$
+		Transformer transformer = null;
+		try {
+			transformer = tf.newTransformer();
+		} catch (TransformerConfigurationException e1) {
+			e1.printStackTrace();
+		}
+		if (transformer != null) {
+			transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$
+		}
+
+		// initialize StreamResult with File object to save to file
+		StreamResult result = new StreamResult(new StringWriter());
+		DOMSource source = new DOMSource(doc);
+		try {
+			if (transformer != null) {
+				transformer.transform(source, result);
+			}
+		} catch (TransformerException e) {
+			e.printStackTrace();
+		}
+		return result;
+	}
+
+	/**
+	 * Gets DOM document for the file path
+	 * 
+	 * @return document
+	 */
+	protected Document getDocument() {
+		DocumentBuilderFactory docFactory = DocumentBuilderFactory
+				.newInstance();
+		DocumentBuilder docBuilder = null;
+		try {
+			docBuilder = docFactory.newDocumentBuilder();
+		} catch (ParserConfigurationException e) {
+			e.printStackTrace();
+		}
+
+		// Get the document
+		Document doc = null;
+		try {
+			if (docBuilder != null) {
+				File file = new File(filePath);
+				if (file.exists()) {
+					doc = docBuilder.parse(filePath);
+				}
+			}
+		} catch (SAXException e1) {
+			e1.printStackTrace();
+		} catch (IOException e1) {
+			e1.printStackTrace();
+		}
+		return doc;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/metafile/MetaFileXMLImporter.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,136 @@
+/*
+ * 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:
+ *
+ * Metadata file Importer class
+ *
+ */
+package com.nokia.traceviewer.engine.metafile;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Map;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+/**
+ * Metadata file Importer class
+ */
+public class MetaFileXMLImporter {
+
+	/**
+	 * File path where to import
+	 */
+	private final String filePath;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param filePath
+	 *            file name where to export data
+	 */
+	public MetaFileXMLImporter(String filePath) {
+		this.filePath = filePath;
+	}
+
+	/**
+	 * Imports trace comment data
+	 * 
+	 * @param traceComments
+	 *            trace comments map
+	 * @return true if everything went fine
+	 */
+	public boolean importData(Map<Integer, String> traceComments) {
+		boolean success = true;
+		File file = new File(filePath);
+		if (file.exists()) {
+			Document doc = getDocument();
+
+			// Get root node of trace comment rules
+			NodeList list = doc
+					.getElementsByTagName(MetaFileXMLConstants.TRACECOMMENTS_TAG);
+			Node parent = list.item(0);
+
+			// Go trough the comments
+			if (parent != null) {
+				NodeList comments = parent.getChildNodes();
+				if (comments != null) {
+
+					for (int i = 0; i < comments.getLength(); i++) {
+						Node node = comments.item(i);
+						if (node instanceof Element) {
+
+							// Get line number
+							NamedNodeMap itemAttributes = node.getAttributes();
+							Attr lineAttr = (Attr) itemAttributes
+									.getNamedItem(MetaFileXMLConstants.LINE_TAG);
+							String line = lineAttr.getValue();
+
+							// Get comment
+							String comment = node.getTextContent();
+
+							// Insert to the comments map
+							traceComments.put(Integer.valueOf(line), comment);
+						}
+					}
+				}
+			}
+		}
+
+		return success;
+	}
+
+	/**
+	 * Gets DOM document for the file path
+	 * 
+	 * @return document
+	 */
+	protected Document getDocument() {
+		DocumentBuilderFactory docFactory = DocumentBuilderFactory
+				.newInstance();
+		DocumentBuilder docBuilder = null;
+		try {
+			docBuilder = docFactory.newDocumentBuilder();
+		} catch (ParserConfigurationException e) {
+			e.printStackTrace();
+		}
+
+		// Get the document
+		Document doc = null;
+		try {
+			if (docBuilder != null) {
+				File file = new File(filePath);
+				if (file.exists()) {
+					doc = docBuilder.parse(filePath);
+				}
+			}
+		} catch (SAXException e1) {
+			e1.printStackTrace();
+
+		} catch (IOException e1) {
+			e1.printStackTrace();
+		}
+		return doc;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/LabelFieldEditor.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,116 @@
+/*
+ * 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:
+ *
+ * Label Field Editor
+ *
+ */
+package com.nokia.traceviewer.engine.preferences;
+
+import org.eclipse.jface.preference.FieldEditor;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+
+/**
+ * Label Field Editor
+ * 
+ */
+class LabelFieldEditor extends FieldEditor {
+
+	/**
+	 * Label
+	 */
+	private Label label;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param value
+	 *            value for the label
+	 * @param parent
+	 *            parent composite
+	 */
+	public LabelFieldEditor(String value, Composite parent) {
+		super("label", value, parent); //$NON-NLS-1$
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.preference.FieldEditor#adjustForNumColumns(int)
+	 */
+	@Override
+	protected void adjustForNumColumns(int numColumns) {
+		((GridData) label.getLayoutData()).horizontalSpan = numColumns;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.jface.preference.FieldEditor#doFillIntoGrid(org.eclipse.swt
+	 * .widgets.Composite, int)
+	 */
+	@Override
+	protected void doFillIntoGrid(Composite parent, int numColumns) {
+		label = getLabelControl(parent);
+
+		GridData gridData = new GridData();
+		gridData.horizontalSpan = numColumns;
+		gridData.horizontalAlignment = GridData.FILL;
+		gridData.grabExcessHorizontalSpace = false;
+		gridData.verticalAlignment = GridData.CENTER;
+		gridData.grabExcessVerticalSpace = false;
+
+		label.setLayoutData(gridData);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.preference.FieldEditor#getNumberOfControls()
+	 */
+	@Override
+	public int getNumberOfControls() {
+		return 1;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.preference.FieldEditor#doLoad()
+	 */
+	@Override
+	protected void doLoad() {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.preference.FieldEditor#doLoadDefault()
+	 */
+	@Override
+	protected void doLoadDefault() {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.preference.FieldEditor#doStore()
+	 */
+	@Override
+	protected void doStore() {
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/Messages.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,63 @@
+/*
+ * 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:
+ *
+ * String localization for engine preferences package.
+ *
+ */
+package com.nokia.traceviewer.engine.preferences;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * String localization for engine preferences package.
+ * 
+ */
+final class Messages {
+
+	/**
+	 * Bundle name
+	 */
+	private static final String BUNDLE_NAME = "com.nokia.traceviewer.engine.preferences.messages"; //$NON-NLS-1$
+
+	/**
+	 * Resource bundle
+	 */
+	private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
+			.getBundle(BUNDLE_NAME);
+
+	/**
+	 * Prevents construction.
+	 */
+	private Messages() {
+	}
+
+	/**
+	 * Maps a key to localized string.
+	 * 
+	 * @param key
+	 *            the key for the string
+	 * @return the localized string
+	 */
+	public static String getString(String key) {
+		String value;
+		try {
+			value = RESOURCE_BUNDLE.getString(key);
+		} catch (MissingResourceException e) {
+			value = '!' + key + '!';
+		}
+		return value;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/PreferenceConstants.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,181 @@
+/*
+ * 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:
+ *
+ * Constant definitions for plug-in preferences
+ *
+ */
+package com.nokia.traceviewer.engine.preferences;
+
+/**
+ * Constant definitions for plug-in preferences
+ */
+public final class PreferenceConstants {
+
+	/**
+	 * Connection type preference name
+	 */
+	public static final String CONNECTION_TYPE = "connectionTypePreference"; //$NON-NLS-1$
+
+	/**
+	 * Selected connection ID
+	 */
+	public static final String SELECTED_CONNECTION_ID = "selectedConnectionId"; //$NON-NLS-1$
+
+	/**
+	 * Selected connection name
+	 */
+	public static final String SELECTED_CONNECTION_NAME = "selectedConnectionName"; //$NON-NLS-1$
+
+	/**
+	 * Timestamp accuracy preference name
+	 */
+	public static final String TIMESTAMP_ACCURACY = "timestampAccuracyPreference"; //$NON-NLS-1$
+
+	/**
+	 * Data format preference name
+	 */
+	public static final String DATA_FORMAT = "dataFormatPreference"; //$NON-NLS-1$
+
+	/**
+	 * IP address preference name
+	 */
+	public static final String IP_ADDRESS = "ipAddressPreference"; //$NON-NLS-1$
+
+	/**
+	 * TCP/IP port preference name
+	 */
+	public static final String TCPIP_PORT = "tcpIpPortPreference"; //$NON-NLS-1$
+
+	/**
+	 * TCP/IP channel preference name
+	 */
+	public static final String TCPIP_CHANNEL = "tcpIpChannelPreference"; //$NON-NLS-1$
+
+	/**
+	 * TCP/IP default channel
+	 */
+	public static final int TCPIP_DEFAULT_CHANNEL = 2;
+
+	/**
+	 * TCP connection type
+	 */
+	public static final String CONNECTION_TYPE_TCPIP = "tcpip"; //$NON-NLS-1$
+
+	/**
+	 * USB connection type
+	 */
+	public static final String CONNECTION_TYPE_USB = "usb"; //$NON-NLS-1$
+
+	/**
+	 * USB Serial connection type
+	 */
+	public static final String CONNECTION_TYPE_USB_SERIAL = "usbserial"; //$NON-NLS-1$
+
+	/**
+	 * Connection is not supported
+	 */
+	public static final String CONNECTION_TYPE_NOT_SUPPORTED = "notsupported"; //$NON-NLS-1$
+
+	/**
+	 * COM port number in USB serial connection
+	 */
+	public static final String USB_SERIAL_COM_PORT = "serialcomport"; //$NON-NLS-1$
+
+	/**
+	 * Default USB serial COM port
+	 */
+	public static final String DEFAULT_USB_SERIAL_COM_PORT = "COM1"; //$NON-NLS-1$
+
+	/**
+	 * Millisecond timestamp accuracy
+	 */
+	public static final String MILLISECOND_ACCURACY = "millisecond"; //$NON-NLS-1$
+
+	/**
+	 * Microsecond timestamp accuracy
+	 */
+	public static final String MICROSECOND_ACCURACY = "microsecond"; //$NON-NLS-1$
+
+	/**
+	 * Show undecoded traces as info text
+	 */
+	public static final String UNDECODED_INFO_TEXT = "undecodedInfoText"; //$NON-NLS-1$
+
+	/**
+	 * Show undecoded traces as hex
+	 */
+	public static final String UNDECODED_HEX = "undecodedHex"; //$NON-NLS-1$
+
+	/**
+	 * Show undecoded traces as ID's and data
+	 */
+	public static final String UNDECODED_ID_AND_DATA = "undecodedIdAndData"; //$NON-NLS-1$
+
+	/**
+	 * Configuration file
+	 */
+	public static final String CONFIGURATION_FILE = "configurationFile"; //$NON-NLS-1$
+
+	/**
+	 * Default configuration file
+	 */
+	public static final String DEFAULT_CONFIGURATION_FILE = Messages
+			.getString("PreferenceConstants.DefaultConfigurationFile"); //$NON-NLS-1$
+
+	/**
+	 * Use external filter command checkbox
+	 */
+	public static final String EXTERNAL_FILTER_CHECKBOX = "externalFilterCheckbox"; //$NON-NLS-1$
+
+	/**
+	 * Show time from previous trace checkbox
+	 */
+	public static final String TIME_FROM_PREVIOUS_TRACE_CHECKBOX = "timeFromPreviousTraceCheckbox"; //$NON-NLS-1$
+
+	/**
+	 * Show component and group name checkbox
+	 */
+	public static final String SHOW_COMPONENT_GROUP_NAME_CHECKBOX = "showComponentGroupNameCheckbox"; //$NON-NLS-1$
+
+	/**
+	 * Show class and function name checkbox
+	 */
+	public static final String SHOW_CLASS_FUNCTION_NAME_CHECKBOX = "showClassFunctionNameCheckbox"; //$NON-NLS-1$
+
+	/**
+	 * Automatically reload changed Dictionaries checkbox
+	 */
+	public static final String AUTO_RELOAD_DICTIONARIES_CHECKBOX = "autoReloadChangedDictionariesCheckbox"; //$NON-NLS-1$
+
+	/**
+	 * Show BTrace variables checkbox
+	 */
+	public static final String SHOW_BTRACE_VARIABLES_CHECKBOX = "showBTraceVariablesCheckbox"; //$NON-NLS-1$
+
+	/**
+	 * Show binary traces type radio group
+	 */
+	public static final String SHOW_UNDECODED_TRACES_TYPE = "showBinaryTracesType"; //$NON-NLS-1$
+
+	/**
+	 * External filter command
+	 */
+	public static final String EXTERNAL_FILTER_COMMAND = "externalFilterCommand"; //$NON-NLS-1$
+
+	/**
+	 * Auto-connect to dynamic connections checkbox
+	 */
+	public static final String AUTO_CONNECT_DYNAMIC_CONNECTIONS_CHECKBOX = "autoConnectDynamicConnections"; //$NON-NLS-1$
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/PreferenceInitializer.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,83 @@
+/*
+ * 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:
+ *
+ * Class used to initialize default preference values.
+ *
+ */
+package com.nokia.traceviewer.engine.preferences;
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.jface.preference.IPreferenceStore;
+
+import com.nokia.traceviewer.TraceViewerPlugin;
+
+/**
+ * Class used to initialize default preference values.
+ */
+public class PreferenceInitializer extends AbstractPreferenceInitializer {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @seeorg.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#
+	 * initializeDefaultPreferences()
+	 */
+	@Override
+	public void initializeDefaultPreferences() {
+		IPreferenceStore store = TraceViewerPlugin.getDefault()
+				.getPreferenceStore();
+
+		// Configuration file
+		store.setDefault(PreferenceConstants.CONFIGURATION_FILE,
+				PreferenceConstants.DEFAULT_CONFIGURATION_FILE);
+
+		// Timestamp accuracy
+		store.setDefault(PreferenceConstants.TIMESTAMP_ACCURACY,
+				PreferenceConstants.MILLISECOND_ACCURACY);
+
+		// Time from previous checkbox
+		store.setDefault(PreferenceConstants.TIME_FROM_PREVIOUS_TRACE_CHECKBOX,
+				false);
+
+		// Show component and group name before trace text checkbox
+		store.setDefault(
+				PreferenceConstants.SHOW_COMPONENT_GROUP_NAME_CHECKBOX, true);
+
+		// Show class and function name before trace text checkbox
+		store.setDefault(PreferenceConstants.SHOW_CLASS_FUNCTION_NAME_CHECKBOX,
+				true);
+
+		// Auto reload changed Dictionaries checkbox
+		store.setDefault(PreferenceConstants.AUTO_RELOAD_DICTIONARIES_CHECKBOX,
+				true);
+
+		// Show BTrace variables checkbox
+		store.setDefault(PreferenceConstants.SHOW_BTRACE_VARIABLES_CHECKBOX,
+				true);
+
+		// Show undecoded traces as what type checkbox
+		store.setDefault(PreferenceConstants.SHOW_UNDECODED_TRACES_TYPE,
+				PreferenceConstants.UNDECODED_ID_AND_DATA);
+
+		// Insert OST as default data format
+		store.setDefault(PreferenceConstants.DATA_FORMAT,
+				"OST - Open System Trace"); //$NON-NLS-1$
+
+		// Auto connect to dynamic connections
+		store.setDefault(
+				PreferenceConstants.AUTO_CONNECT_DYNAMIC_CONNECTIONS_CHECKBOX,
+				false);
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/SpacerFieldEditor.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,38 @@
+/*
+ * 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:
+ *
+ * Spacer Field Editor
+ *
+ */
+package com.nokia.traceviewer.engine.preferences;
+
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * Spacer Field Editor
+ * 
+ */
+public class SpacerFieldEditor extends LabelFieldEditor {
+
+	/**
+	 * Constructor
+	 * 
+	 * @param parent
+	 *            parent composite
+	 */
+	public SpacerFieldEditor(Composite parent) {
+		super("", parent); //$NON-NLS-1$
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/TraceViewerAdvancedPreferencesPage.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,317 @@
+/*
+ * 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:
+ *
+ * Advanced preferences page
+ *
+ */
+package com.nokia.traceviewer.engine.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+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.Control;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Advanced preferences page
+ * 
+ */
+public class TraceViewerAdvancedPreferencesPage extends PreferencePage
+		implements IWorkbenchPreferencePage {
+
+	/**
+	 * Text to show about enabling external filter
+	 */
+	private static final String EXTERNALFILTER_INFORMATION = Messages
+			.getString("TraceViewerAdvancedPreferencesPage.ExternalFilterInformation"); //$NON-NLS-1$
+
+	/**
+	 * PreferenceStore holding all preferences
+	 */
+	private final IPreferenceStore store;
+
+	/**
+	 * External filter checkbox
+	 */
+	private Button externalFilterCheckBox;
+
+	/**
+	 * External filter text field
+	 */
+	private Text externalFilterText;
+
+	/**
+	 * External filter browse button
+	 */
+	private Button externalFilterBrowseButton;
+
+	/**
+	 * Constructor
+	 */
+	public TraceViewerAdvancedPreferencesPage() {
+		super();
+
+		// Set the preference store for the preference page.
+		store = TraceViewerPlugin.getDefault().getPreferenceStore();
+		setPreferenceStore(store);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse
+	 * .swt.widgets.Composite)
+	 */
+	@Override
+	protected Control createContents(Composite parent) {
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(parent,
+				TraceViewerHelpContextIDs.ADVANCED_PREFERENCES);
+
+		// Create Top composite in top of the parent composite
+		Composite top = new Composite(parent, SWT.LEFT);
+		GridData topCompositeGridData = new GridData(SWT.FILL, SWT.FILL, true,
+				false);
+		top.setLayoutData(topCompositeGridData);
+		GridLayout topCompositeGridLayout = new GridLayout();
+		topCompositeGridLayout.horizontalSpacing = 0;
+		topCompositeGridLayout.verticalSpacing = 0;
+		topCompositeGridLayout.marginWidth = 0;
+		topCompositeGridLayout.marginHeight = 0;
+		top.setLayout(topCompositeGridLayout);
+
+		// Advanced group
+		GridLayout advancedGroupGridLayout = new GridLayout();
+		advancedGroupGridLayout.numColumns = 3;
+		Group advancedGroup = new Group(top, SWT.NONE);
+		String advGroupName = Messages
+				.getString("TraceViewerAdvancedPreferencesPage.AdvancedGroupName"); //$NON-NLS-1$
+		advancedGroup.setText(advGroupName);
+		GridData advancedGroupGridData = new GridData(SWT.FILL, SWT.FILL, true,
+				false);
+		advancedGroup.setLayoutData(advancedGroupGridData);
+		advancedGroup.setLayout(advancedGroupGridLayout);
+
+		// External filter checkbox
+		String extFilterText = Messages
+				.getString("TraceViewerAdvancedPreferencesPage.ExternalFilterText"); //$NON-NLS-1$
+		GridData externalFilterGridData = new GridData(SWT.FILL, SWT.FILL,
+				true, false);
+		externalFilterGridData.horizontalSpan = 3;
+		externalFilterCheckBox = new Button(advancedGroup, SWT.CHECK);
+		externalFilterCheckBox.setText(extFilterText);
+		externalFilterCheckBox.setToolTipText(extFilterText);
+		externalFilterCheckBox.setLayoutData(externalFilterGridData);
+		externalFilterCheckBox.setSelection(store
+				.getBoolean(PreferenceConstants.EXTERNAL_FILTER_CHECKBOX));
+
+		// External filter label
+		String commandEditorText = Messages
+				.getString("TraceViewerAdvancedPreferencesPage.CommandEditorText"); //$NON-NLS-1$
+		Label filterLabel = new Label(advancedGroup, SWT.NONE);
+		filterLabel.setText(commandEditorText);
+
+		// External filter text
+		GridData externalFilterTextGridData = new GridData();
+		externalFilterTextGridData.grabExcessHorizontalSpace = true;
+		externalFilterTextGridData.horizontalAlignment = SWT.FILL;
+		externalFilterText = new Text(advancedGroup, SWT.BORDER);
+		externalFilterText.setText(store
+				.getString(PreferenceConstants.EXTERNAL_FILTER_COMMAND));
+		externalFilterText.setLayoutData(externalFilterTextGridData);
+
+		// External filter browse button
+		GridData externalFilterBrowseButtonGridData = new GridData();
+		externalFilterBrowseButtonGridData.widthHint = 75;
+		externalFilterBrowseButton = new Button(advancedGroup, SWT.NONE);
+		String browseText = Messages
+				.getString("TraceViewerAdvancedPreferencesPage.BrowseButtonText"); //$NON-NLS-1$
+		externalFilterBrowseButton.setText(browseText);
+		String browseToolTip = Messages
+				.getString("TraceViewerAdvancedPreferencesPage.BrowseButtonToolTip"); //$NON-NLS-1$
+		externalFilterBrowseButton.setToolTipText(browseToolTip);
+		externalFilterBrowseButton
+				.setLayoutData(externalFilterBrowseButtonGridData);
+
+		// Disable if checkbox is not checked
+		if (!externalFilterCheckBox.getSelection()) {
+			externalFilterText.setEnabled(false);
+			externalFilterBrowseButton.setEnabled(false);
+		}
+
+		// Spacer label
+		Label spacerLabel = new Label(advancedGroup, SWT.NONE);
+		GridData spacerLabelGridData = new GridData();
+		spacerLabelGridData.horizontalSpan = 3;
+		spacerLabel.setLayoutData(spacerLabelGridData);
+
+		// Information label
+		Label label = new Label(advancedGroup, SWT.WRAP);
+		label.setText(EXTERNALFILTER_INFORMATION);
+		GridData labelGridData = new GridData();
+		labelGridData.horizontalSpan = 3;
+		label.setLayoutData(labelGridData);
+
+		// Create action listeners
+		createActionListeners();
+
+		return top;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+	 */
+	public void init(IWorkbench workbench) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
+	 */
+	@Override
+	protected void performDefaults() {
+		if (getControl() != null && !getControl().isDisposed()) {
+			externalFilterCheckBox.setSelection(false);
+			externalFilterText.setText(""); //$NON-NLS-1$
+			super.performDefaults();
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.preference.PreferencePage#performOk()
+	 */
+	@Override
+	public boolean performOk() {
+		saveSettings();
+		return super.performOk();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.preference.PreferencePage#performApply()
+	 */
+	@Override
+	public void performApply() {
+		saveSettings();
+		super.performApply();
+	}
+
+	/**
+	 * Saves settings
+	 */
+	private void saveSettings() {
+		if (getControl() != null && !getControl().isDisposed()) {
+
+			// Give FilterProcessor the information about using external filter
+			// or
+			TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+					.getFilterProcessor().setUsingExternalFilter(
+							externalFilterCheckBox.getSelection());
+
+			store.setValue(PreferenceConstants.EXTERNAL_FILTER_COMMAND,
+					externalFilterText.getText());
+
+			store.setValue(PreferenceConstants.EXTERNAL_FILTER_CHECKBOX,
+					externalFilterCheckBox.getSelection());
+		}
+	}
+
+	/**
+	 * Creates action listeners
+	 */
+	private void createActionListeners() {
+		// Add listener to checkbox
+		externalFilterCheckBox.addSelectionListener(new SelectionAdapter() {
+
+			/*
+			 * (non-Javadoc)
+			 * 
+			 * @see
+			 * org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse
+			 * .swt.events.SelectionEvent)
+			 */
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				boolean selected = externalFilterCheckBox.getSelection();
+				if (selected) {
+					externalFilterText.setEnabled(true);
+					externalFilterBrowseButton.setEnabled(true);
+				} else {
+					externalFilterText.setEnabled(false);
+					externalFilterBrowseButton.setEnabled(false);
+				}
+			}
+
+		});
+
+		// Add listener to Browse button
+		externalFilterBrowseButton.addSelectionListener(new SelectionAdapter() {
+			/*
+			 * (non-Javadoc)
+			 * 
+			 * @see
+			 * org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse
+			 * .swt.events.SelectionEvent)
+			 */
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				Shell activeShell = PlatformUI.getWorkbench().getDisplay()
+						.getActiveShell();
+				Shell fileDialogShell = new Shell(activeShell);
+				FileDialog dlg = new FileDialog(fileDialogShell);
+
+				// Move the dialog to the center of the top level shell.
+				Rectangle shellBounds = activeShell.getBounds();
+				Point dialogSize = fileDialogShell.getSize();
+				int middleX = shellBounds.x
+						+ ((shellBounds.width - dialogSize.x) / 2);
+				int middleY = shellBounds.y
+						+ ((shellBounds.height - dialogSize.y) / 2);
+				fileDialogShell.setLocation(middleX, middleY);
+
+				String file = dlg.open();
+				externalFilterText.setText(file);
+			}
+		});
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/TraceViewerConnectionPreferencesPage.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,210 @@
+/*
+ * 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:
+ *
+ * Connection preferences page
+ *
+ */
+package com.nokia.traceviewer.engine.preferences;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.swt.SWT;
+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.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.carbide.remoteconnections.interfaces.IConnection;
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.engine.ConnectionHelper;
+import com.nokia.traceviewer.internal.api.TraceViewerAPI2Impl;
+
+/**
+ * Connection preferences page
+ * 
+ */
+public final class TraceViewerConnectionPreferencesPage extends PreferencePage
+		implements IWorkbenchPreferencePage {
+
+	/**
+	 * Id for Connection preferences page
+	 */
+	public static final String PAGE_ID = "com.nokia.traceviewer.preferences.ConnectionPreferences"; //$NON-NLS-1$
+
+	/**
+	 * PreferenceStore holding all preferences
+	 */
+	private final IPreferenceStore store;
+
+	/**
+	 * Auto-connect to dynamic connections checkbox
+	 */
+	private Button autoConnectDynamicConnectionsCheckBox;
+
+	/**
+	 * Connection that is used after latest call to <code>saveSettings()</code>
+	 * method.
+	 */
+	private IConnection conn;
+
+	/**
+	 * Constructor
+	 */
+	public TraceViewerConnectionPreferencesPage() {
+		super();
+
+		// Set the preference store for the preference page.
+		store = TraceViewerPlugin.getDefault().getPreferenceStore();
+		setPreferenceStore(store);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse
+	 * .swt.widgets.Composite)
+	 */
+	@Override
+	protected Control createContents(Composite parent) {
+
+		// Create Top composite in top of the parent composite
+		Composite top = new Composite(parent, SWT.LEFT);
+		GridData topCompositeGridData = new GridData(SWT.FILL, SWT.FILL, true,
+				false);
+		top.setLayoutData(topCompositeGridData);
+		GridLayout topCompositeGridLayout = new GridLayout();
+		topCompositeGridLayout.horizontalSpacing = 5;
+		topCompositeGridLayout.verticalSpacing = 5;
+		topCompositeGridLayout.marginWidth = 0;
+		topCompositeGridLayout.marginHeight = 0;
+		top.setLayout(topCompositeGridLayout);
+
+		// Create client side UI
+		Composite returnedComposite = ConnectionHelper
+				.createClientServiceUI(top);
+
+		// If client service UI couldn't be constructed, give an error message
+		// to the user
+		if (returnedComposite == null) {
+			Label errorLabel = new Label(top, SWT.NONE);
+			String msg = Messages
+					.getString("TraceViewerConnectionPreferencesPage.ServiceUiFailed"); //$NON-NLS-1$ 
+			errorLabel.setText(msg);
+		} else {
+
+			// Select connection from the UI with ID
+			String selectedConnId = store
+					.getString(PreferenceConstants.SELECTED_CONNECTION_ID);
+			ConnectionHelper.selectConnectionFromUIWithID(selectedConnId);
+		}
+
+		// Auto-connect to dynamic connections checkbox
+		autoConnectDynamicConnectionsCheckBox = new Button(top, SWT.CHECK);
+		String autoConnectText = Messages
+				.getString("TraceViewerConnectionPreferencesPage.AutoConnectDynamicText"); //$NON-NLS-1$
+		String autoConnectToolTip = Messages
+				.getString("TraceViewerConnectionPreferencesPage.AutoConnectDynamicToolTip"); //$NON-NLS-1$
+		autoConnectDynamicConnectionsCheckBox.setText(autoConnectText);
+		autoConnectDynamicConnectionsCheckBox
+				.setToolTipText(autoConnectToolTip);
+		autoConnectDynamicConnectionsCheckBox
+				.setSelection(store
+						.getBoolean(PreferenceConstants.AUTO_CONNECT_DYNAMIC_CONNECTIONS_CHECKBOX));
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(parent,
+				TraceViewerHelpContextIDs.CONNECTION_PREFERENCES);
+
+		return top;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+	 */
+	public void init(IWorkbench workbench) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.preference.PreferencePage#performOk()
+	 */
+	@Override
+	public boolean performOk() {
+		saveSettings();
+		// Preferences has been saved successfully, notifying listeners about
+		// the change. Default implementation of super.performApply() calls back
+		// performOK() method so notification to listeners should be only sent
+		// in here. In case of Apply and OK sequence, however, the notification
+		// is sent twice. Only sent the notification if the connection ID is not
+		// the virtual "Current connection"
+		if (conn != null
+				&& !conn.getIdentifier().equals(
+						ConnectionHelper.CURRENT_CONNECTION_ID)) {
+			TraceViewerAPI2Impl.notifyConnPrefsChanged(conn);
+		}
+		return super.performOk();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.preference.PreferencePage#performApply()
+	 */
+	@Override
+	public void performApply() {
+		saveSettings();
+		super.performApply();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
+	 */
+	@Override
+	protected void performDefaults() {
+		if (getControl() != null && !getControl().isDisposed()) {
+			autoConnectDynamicConnectionsCheckBox.setSelection(false);
+		}
+		super.performDefaults();
+	}
+
+	/**
+	 * Saves settings
+	 */
+	private void saveSettings() {
+		if (getControl() != null && !getControl().isDisposed()) {
+			conn = ConnectionHelper
+					.saveConnectionSettingsToPreferenceStore(false);
+
+			store
+					.setValue(
+							PreferenceConstants.AUTO_CONNECT_DYNAMIC_CONNECTIONS_CHECKBOX,
+							autoConnectDynamicConnectionsCheckBox
+									.getSelection());
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/TraceViewerPluginsPreferencesPage.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,78 @@
+/*
+ * 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:
+ *
+ * Preference page for TraceViewer Plugins
+ *
+ */
+package com.nokia.traceviewer.engine.preferences;
+
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+
+/**
+ * Preference page for TraceViewer Plugins
+ * 
+ */
+public class TraceViewerPluginsPreferencesPage extends PreferencePage implements
+		IWorkbenchPreferencePage {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse
+	 * .swt.widgets.Composite)
+	 */
+	@Override
+	protected Control createContents(Composite parent) {
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(parent,
+				TraceViewerHelpContextIDs.PLUGINS_PREFERENCES);
+
+		noDefaultAndApplyButton();
+
+		// Title label
+		Label titleLabel = new Label(parent, SWT.NONE);
+		titleLabel.setText(Messages
+				.getString("TraceViewerPluginsPreferencesPage.TitleLabel")); //$NON-NLS-1$
+
+		// Spacer
+		new Label(parent, SWT.NONE);
+
+		// More information
+		Label infoLabel = new Label(parent, SWT.NONE);
+		infoLabel.setText(Messages
+				.getString("TraceViewerPluginsPreferencesPage.InfoLabel")); //$NON-NLS-1$
+		return parent;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+	 */
+	public void init(IWorkbench workbench) {
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/TraceViewerPreferencesPage.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,555 @@
+/*
+ * 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:
+ *
+ * TraceViewer preferences page
+ *
+ */
+package com.nokia.traceviewer.engine.preferences;
+
+import java.util.List;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.swt.SWT;
+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.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.eclipse.ui.PlatformUI;
+
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.engine.TraceProvider;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * TraceViewer preferences page
+ * 
+ */
+public final class TraceViewerPreferencesPage extends PreferencePage implements
+		IWorkbenchPreferencePage {
+
+	/**
+	 * Preference page ID for opening page directly
+	 */
+	public static final String PAGE_ID = "com.nokia.traceviewer.preferences.TraceViewerPreferences"; //$NON-NLS-1$
+
+	/**
+	 * PreferenceStore holding all preferences
+	 */
+	private final IPreferenceStore store;
+
+	/**
+	 * Radio buttons to implify timestamp accuracy
+	 */
+	private Button[] timestampAccuracyButton = new Button[2];
+
+	/**
+	 * Radio buttons to implify how to show undecoded traces
+	 */
+	private Button[] showUndecodedTracesAsButton = new Button[3];
+
+	/**
+	 * Time from previous trace checkbox
+	 */
+	private Button timeFromPreviousTraceCheckBox;
+
+	/**
+	 * Show trace component and group name in trace checkbox
+	 */
+	private Button showComponentGroupNameCheckBox;
+
+	/**
+	 * Show trace class and function name in trace checkbox
+	 */
+	private Button showClassFunctionNameCheckBox;
+
+	/**
+	 * Automatically reload changed Dictionaries checkbox
+	 */
+	private Button autoReloadDictionariesCheckBox;
+
+	/**
+	 * Show BTrace variables checkbox
+	 */
+	private Button showBTraceVariablesCheckBox;
+
+	/**
+	 * Radio buttons to implify data format
+	 */
+	private Button[] dataFormatButton;
+
+	/**
+	 * Constructor
+	 */
+	public TraceViewerPreferencesPage() {
+		super();
+		// Set the preference store for the preference page.
+		store = TraceViewerPlugin.getDefault().getPreferenceStore();
+		setPreferenceStore(store);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+	 */
+	public void init(IWorkbench workbench) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse
+	 * .swt.widgets.Composite)
+	 */
+	@Override
+	protected Control createContents(Composite parent) {
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(parent,
+				TraceViewerHelpContextIDs.GENERAL_PREFERENCES);
+
+		// Create Top composite in top of the parent composite
+		Composite top = new Composite(parent, SWT.LEFT);
+		GridData topCompositeGridData = new GridData(SWT.FILL, SWT.FILL, true,
+				false);
+		top.setLayoutData(topCompositeGridData);
+		GridLayout topCompositeGridLayout = new GridLayout();
+		topCompositeGridLayout.horizontalSpacing = 5;
+		topCompositeGridLayout.verticalSpacing = 5;
+		topCompositeGridLayout.marginWidth = 0;
+		topCompositeGridLayout.marginHeight = 0;
+		top.setLayout(topCompositeGridLayout);
+
+		Label generalTextLabel = new Label(top, SWT.NONE);
+		String generalTextLabelText = Messages
+				.getString("TraceViewerPreferencesPage.GeneralSettingsText"); //$NON-NLS-1$
+		generalTextLabel.setText(generalTextLabelText);
+
+		// General group
+		Group generalGroup = new Group(top, SWT.NONE);
+		String generalGroupText = Messages
+				.getString("TraceViewerPreferencesPage.GeneralGroupText"); //$NON-NLS-1$
+		generalGroup.setText(generalGroupText);
+		GridData generalGroupGridData = new GridData(SWT.FILL, SWT.FILL, true,
+				false);
+		generalGroup.setLayoutData(generalGroupGridData);
+		generalGroup.setLayout(new GridLayout());
+
+		// Show milliseconds from previous trace checkbox
+		timeFromPreviousTraceCheckBox = new Button(generalGroup, SWT.CHECK);
+		timeFromPreviousTraceCheckBox.setText(Messages
+				.getString("TraceViewerPreferencesPage.ShowPreviousTimeText")); //$NON-NLS-1$
+		timeFromPreviousTraceCheckBox
+				.setToolTipText(Messages
+						.getString("TraceViewerPreferencesPage.TimeFromPreviousToolTip")); //$NON-NLS-1$
+		timeFromPreviousTraceCheckBox
+				.setSelection(store
+						.getBoolean(PreferenceConstants.TIME_FROM_PREVIOUS_TRACE_CHECKBOX));
+
+		// Show trace component and group before trace text checkbox
+		showComponentGroupNameCheckBox = new Button(generalGroup, SWT.CHECK);
+		showComponentGroupNameCheckBox
+				.setText(Messages
+						.getString("TraceViewerPreferencesPage.ShowComponentGroupName")); //$NON-NLS-1$
+		String showComponentGroupToolTip = Messages
+				.getString("TraceViewerPreferencesPage.ShowComponentAndGroupToolTip"); //$NON-NLS-1$
+		showComponentGroupNameCheckBox
+				.setToolTipText(showComponentGroupToolTip);
+		showComponentGroupNameCheckBox
+				.setSelection(store
+						.getBoolean(PreferenceConstants.SHOW_COMPONENT_GROUP_NAME_CHECKBOX));
+
+		// Show trace class and function before trace text checkbox
+		showClassFunctionNameCheckBox = new Button(generalGroup, SWT.CHECK);
+		showClassFunctionNameCheckBox.setText(Messages
+				.getString("TraceViewerPreferencesPage.ShowClassFunctionName")); //$NON-NLS-1$
+		String showClassFunctionToolTip = Messages
+				.getString("TraceViewerPreferencesPage.ShowClassAndFunctionToolTip"); //$NON-NLS-1$
+		showClassFunctionNameCheckBox.setToolTipText(showClassFunctionToolTip);
+		showClassFunctionNameCheckBox
+				.setSelection(store
+						.getBoolean(PreferenceConstants.SHOW_CLASS_FUNCTION_NAME_CHECKBOX));
+
+		// Automatically reload changed Dictionaries checkbox
+		autoReloadDictionariesCheckBox = new Button(generalGroup, SWT.CHECK);
+		String autoReloadText = Messages
+				.getString("TraceViewerPreferencesPage.AutoReloadDictionariesText"); //$NON-NLS-1$
+		String autoReloadToolTip = Messages
+				.getString("TraceViewerPreferencesPage.AutoReloadDictionariesToolTip"); //$NON-NLS-1$
+		autoReloadDictionariesCheckBox.setText(autoReloadText);
+		autoReloadDictionariesCheckBox.setToolTipText(autoReloadToolTip);
+		autoReloadDictionariesCheckBox
+				.setSelection(store
+						.getBoolean(PreferenceConstants.AUTO_RELOAD_DICTIONARIES_CHECKBOX));
+
+		// Show BTrace variables in OST traces checkbox
+		showBTraceVariablesCheckBox = new Button(generalGroup, SWT.CHECK);
+		String btraceVariablesText = Messages
+				.getString("TraceViewerPreferencesPage.ShowBTraceVariablesText"); //$NON-NLS-1$
+		String btraceVariablesToolTip = Messages
+				.getString("TraceViewerPreferencesPage.ShowBTraceVariablesToolTip"); //$NON-NLS-1$
+		showBTraceVariablesCheckBox.setText(btraceVariablesText);
+		showBTraceVariablesCheckBox.setToolTipText(btraceVariablesToolTip);
+		showBTraceVariablesCheckBox
+				.setSelection(store
+						.getBoolean(PreferenceConstants.SHOW_BTRACE_VARIABLES_CHECKBOX));
+
+		// Timestamp accuracy group
+		Group timestampAccuracyGroup = new Group(top, SWT.NONE);
+		String timestampAccuracyGroupText = Messages
+				.getString("TraceViewerPreferencesPage.TimestampAccuracyText"); //$NON-NLS-1$
+		timestampAccuracyGroup.setText(timestampAccuracyGroupText);
+		GridData timestampAccuracyGroupGridData = new GridData(SWT.FILL,
+				SWT.FILL, true, false);
+		timestampAccuracyGroup.setLayoutData(timestampAccuracyGroupGridData);
+		timestampAccuracyGroup.setLayout(new GridLayout());
+
+		// Timestamp accuracy milliseconds
+		timestampAccuracyButton[0] = new Button(timestampAccuracyGroup,
+				SWT.RADIO);
+		String milliSecondsText = Messages
+				.getString("TraceViewerPreferencesPage.MilliSecondsText"); //$NON-NLS-1$
+		timestampAccuracyButton[0].setText(milliSecondsText);
+
+		// Timestamp accuracy microseconds
+		timestampAccuracyButton[1] = new Button(timestampAccuracyGroup,
+				SWT.RADIO);
+		String microSecondsText = Messages
+				.getString("TraceViewerPreferencesPage.MicroSecondsText"); //$NON-NLS-1$
+		timestampAccuracyButton[1].setText(microSecondsText);
+
+		// Get the current accuracy from PreferenceStore
+		String accuracy = store
+				.getString(PreferenceConstants.TIMESTAMP_ACCURACY);
+		if (accuracy.equals(PreferenceConstants.MILLISECOND_ACCURACY)) {
+			timestampAccuracyButton[0].setSelection(true);
+			timestampAccuracyButton[1].setSelection(false);
+		} else {
+			timestampAccuracyButton[0].setSelection(false);
+			timestampAccuracyButton[1].setSelection(true);
+		}
+
+		// Show undecoded traces as group
+		Group showUndecodedTracesGroup = new Group(top, SWT.NONE);
+		String showUndecodedTracesAs = Messages
+				.getString("TraceViewerPreferencesPage.ShowUndecodedTracesAsText"); //$NON-NLS-1$
+		showUndecodedTracesGroup.setText(showUndecodedTracesAs);
+		GridData showUndecodedTracesAsGroupGridData = new GridData(SWT.FILL,
+				SWT.FILL, true, false);
+		showUndecodedTracesGroup
+				.setLayoutData(showUndecodedTracesAsGroupGridData);
+		showUndecodedTracesGroup.setLayout(new GridLayout());
+
+		// Show undecoded traces as "BINARY TRACE"
+		showUndecodedTracesAsButton[0] = new Button(showUndecodedTracesGroup,
+				SWT.RADIO);
+		String asInfoText = Messages
+				.getString("TraceViewerPreferencesPage.ShowUndecodedTracesAsInfoText"); //$NON-NLS-1$
+		showUndecodedTracesAsButton[0].setText(asInfoText);
+
+		// Show undecoded traces as "HEX"
+		showUndecodedTracesAsButton[1] = new Button(showUndecodedTracesGroup,
+				SWT.RADIO);
+		String asHexText = Messages
+				.getString("TraceViewerPreferencesPage.ShowUndecodedTracesAsHexText"); //$NON-NLS-1$
+		showUndecodedTracesAsButton[1].setText(asHexText);
+
+		// Show undecoded traces as "ID numbers"
+		showUndecodedTracesAsButton[2] = new Button(showUndecodedTracesGroup,
+				SWT.RADIO);
+		String asTraceIDsText = Messages
+				.getString("TraceViewerPreferencesPage.ShowUndecodedTracesAsIDsText"); //$NON-NLS-1$
+		showUndecodedTracesAsButton[2].setText(asTraceIDsText);
+
+		// Get the current "show undecoded traces" value from PreferenceStore
+		String showUndecoded = store
+				.getString(PreferenceConstants.SHOW_UNDECODED_TRACES_TYPE);
+		if (showUndecoded.equals(PreferenceConstants.UNDECODED_INFO_TEXT)) {
+			showUndecodedTracesAsButton[0].setSelection(true);
+			showUndecodedTracesAsButton[1].setSelection(false);
+			showUndecodedTracesAsButton[2].setSelection(false);
+		} else if (showUndecoded.equals(PreferenceConstants.UNDECODED_HEX)) {
+			showUndecodedTracesAsButton[0].setSelection(false);
+			showUndecodedTracesAsButton[1].setSelection(true);
+			showUndecodedTracesAsButton[2].setSelection(false);
+		} else {
+			showUndecodedTracesAsButton[0].setSelection(false);
+			showUndecodedTracesAsButton[1].setSelection(false);
+			showUndecodedTracesAsButton[2].setSelection(true);
+		}
+
+		// Data format editor. Show only if there are more than one
+		// TraceProviders registered
+		List<TraceProvider> dataFormats = TraceViewerGlobals
+				.getListOfTraceProviders();
+		if (dataFormats.size() > 1) {
+
+			// Data format group
+			String dataFormatText = Messages
+					.getString("TraceViewerPreferencesPage.DataFormatText"); //$NON-NLS-1$
+			Group dataFormatGroup = new Group(top, SWT.NONE);
+			dataFormatGroup.setText(dataFormatText);
+			GridData dataFormatGroupGridData = new GridData(SWT.FILL, SWT.FILL,
+					true, false);
+			dataFormatGroup.setLayoutData(dataFormatGroupGridData);
+			dataFormatGroup.setLayout(new GridLayout());
+
+			dataFormatButton = new Button[dataFormats.size()];
+			String dataFormat = store
+					.getString(PreferenceConstants.DATA_FORMAT);
+
+			// Go through data formats
+			for (int i = 0; i < dataFormats.size(); i++) {
+				dataFormatButton[i] = new Button(dataFormatGroup, SWT.RADIO);
+				String dataFormatName = dataFormats.get(i).getName();
+				dataFormatButton[i].setText(dataFormatName);
+				if (dataFormat.equals(dataFormatName)) {
+					dataFormatButton[i].setSelection(true);
+				} else {
+					dataFormatButton[i].setSelection(false);
+				}
+			}
+		}
+
+		return top;
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
+	 */
+	@Override
+	protected void performDefaults() {
+		if (getControl() != null && !getControl().isDisposed()) {
+
+			// Timestamp accuracy
+			timestampAccuracyButton[0].setSelection(true);
+			timestampAccuracyButton[1].setSelection(false);
+
+			timeFromPreviousTraceCheckBox.setSelection(true);
+
+			// Show undecoded traces as
+			showUndecodedTracesAsButton[0].setSelection(false);
+			showUndecodedTracesAsButton[1].setSelection(false);
+			showUndecodedTracesAsButton[2].setSelection(true);
+
+			showClassFunctionNameCheckBox.setSelection(true);
+			autoReloadDictionariesCheckBox.setSelection(true);
+			showBTraceVariablesCheckBox.setSelection(true);
+			super.performDefaults();
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.preference.PreferencePage#performOk()
+	 */
+	@Override
+	public boolean performOk() {
+		saveSettings();
+		return super.performOk();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.preference.PreferencePage#performApply()
+	 */
+	@Override
+	public void performApply() {
+		saveSettings();
+		super.performApply();
+	}
+
+	/**
+	 * Saves settings
+	 */
+	private void saveSettings() {
+		if (getControl() != null && !getControl().isDisposed()) {
+
+			// Save old values before saving
+			boolean updateNeeded = false;
+			String oldTimestampAccuracy = store
+					.getString(PreferenceConstants.TIMESTAMP_ACCURACY);
+			boolean oldTimeFromPrevious = store
+					.getBoolean(PreferenceConstants.TIME_FROM_PREVIOUS_TRACE_CHECKBOX);
+			String oldShowBinaryAsType = store
+					.getString(PreferenceConstants.SHOW_UNDECODED_TRACES_TYPE);
+			boolean showComponentGroupNamePrevious = store
+					.getBoolean(PreferenceConstants.SHOW_COMPONENT_GROUP_NAME_CHECKBOX);
+			boolean showClassNamePrevious = store
+					.getBoolean(PreferenceConstants.SHOW_CLASS_FUNCTION_NAME_CHECKBOX);
+			boolean showThreadId = store
+					.getBoolean(PreferenceConstants.SHOW_BTRACE_VARIABLES_CHECKBOX);
+
+			// Store new values. Timestamp accuracy.
+			if (timestampAccuracyButton[0].getSelection()) {
+				store.setValue(PreferenceConstants.TIMESTAMP_ACCURACY,
+						PreferenceConstants.MILLISECOND_ACCURACY);
+			} else {
+				store.setValue(PreferenceConstants.TIMESTAMP_ACCURACY,
+						PreferenceConstants.MICROSECOND_ACCURACY);
+			}
+
+			// Show time from previous trace
+			store.setValue(
+					PreferenceConstants.TIME_FROM_PREVIOUS_TRACE_CHECKBOX,
+					timeFromPreviousTraceCheckBox.getSelection());
+
+			// Store "show undecoded traces" value
+			if (showUndecodedTracesAsButton[0].getSelection()) {
+				store.setValue(PreferenceConstants.SHOW_UNDECODED_TRACES_TYPE,
+						PreferenceConstants.UNDECODED_INFO_TEXT);
+			} else if (showUndecodedTracesAsButton[1].getSelection()) {
+				store.setValue(PreferenceConstants.SHOW_UNDECODED_TRACES_TYPE,
+						PreferenceConstants.UNDECODED_HEX);
+			} else {
+				store.setValue(PreferenceConstants.SHOW_UNDECODED_TRACES_TYPE,
+						PreferenceConstants.UNDECODED_ID_AND_DATA);
+			}
+
+			// Show component and group name
+			store.setValue(
+					PreferenceConstants.SHOW_COMPONENT_GROUP_NAME_CHECKBOX,
+					showComponentGroupNameCheckBox.getSelection());
+
+			// Show class and function name
+			store.setValue(
+					PreferenceConstants.SHOW_CLASS_FUNCTION_NAME_CHECKBOX,
+					showClassFunctionNameCheckBox.getSelection());
+
+			// Auto reload changed Dictionaries
+			store.setValue(
+					PreferenceConstants.AUTO_RELOAD_DICTIONARIES_CHECKBOX,
+					autoReloadDictionariesCheckBox.getSelection());
+
+			// Show Thread ID
+			store.setValue(PreferenceConstants.SHOW_BTRACE_VARIABLES_CHECKBOX,
+					showBTraceVariablesCheckBox.getSelection());
+
+			// Data format
+			if (dataFormatButton != null) {
+				for (int i = 0; i < dataFormatButton.length; i++) {
+					if (dataFormatButton[i].getSelection()) {
+						store.setValue(PreferenceConstants.DATA_FORMAT,
+								dataFormatButton[i].getText());
+					}
+				}
+			}
+
+			// Check if new values are different from old values and set
+			// updateNeeded boolean to true if needed
+			if (!store.getString(PreferenceConstants.TIMESTAMP_ACCURACY)
+					.equals(oldTimestampAccuracy)) {
+				updateNeeded = true;
+			} else if (store
+					.getBoolean(PreferenceConstants.TIME_FROM_PREVIOUS_TRACE_CHECKBOX) != oldTimeFromPrevious) {
+				updateNeeded = true;
+			} else if (!store.getString(
+					PreferenceConstants.SHOW_UNDECODED_TRACES_TYPE).equals(
+					oldShowBinaryAsType)) {
+				updateNeeded = true;
+			} else if (store
+					.getBoolean(PreferenceConstants.SHOW_COMPONENT_GROUP_NAME_CHECKBOX) != showComponentGroupNamePrevious) {
+				updateNeeded = true;
+			} else if (store
+					.getBoolean(PreferenceConstants.SHOW_CLASS_FUNCTION_NAME_CHECKBOX) != showClassNamePrevious) {
+				updateNeeded = true;
+			} else if (store
+					.getBoolean(PreferenceConstants.SHOW_BTRACE_VARIABLES_CHECKBOX) != showThreadId) {
+				updateNeeded = true;
+			}
+
+			// Update properties
+			updateProperties(updateNeeded);
+		}
+	}
+
+	/**
+	 * Updates properties to TraceViewer engine
+	 * 
+	 * @param updateNeeded
+	 *            if true, update to engine is needed
+	 */
+	private void updateProperties(boolean updateNeeded) {
+		// Change the values and refresh the TraceViewer view if update is
+		// needed
+		if (updateNeeded) {
+			// Set timestamp accuracy to timestampParser
+			boolean millisec = false;
+			if (store.getString(PreferenceConstants.TIMESTAMP_ACCURACY).equals(
+					PreferenceConstants.MILLISECOND_ACCURACY)) {
+				millisec = true;
+			}
+			TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+					.getTimestampParser().setTimestampAccuracyMilliSecs(
+							millisec);
+
+			// Set showing time from previous trace to timestampParser
+			TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+					.getTimestampParser().setShowTimeFromPrevious(
+							timeFromPreviousTraceCheckBox.getSelection());
+
+			// Set show class and function name before trace text
+			if (TraceViewerGlobals.getDecodeProvider() != null) {
+				TraceViewerGlobals.getDecodeProvider().setAddPrefixesToTrace(
+						showClassFunctionNameCheckBox.getSelection(),
+						showComponentGroupNameCheckBox.getSelection());
+			}
+
+			// Set show BTrace variables to Decoder
+			TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+					.getDecoder().setShowBTraceVariables(
+							showBTraceVariablesCheckBox.getSelection());
+
+			// Update the TraceViewer view
+			TraceViewerGlobals.getTraceViewer().getView().refreshCurrentView();
+
+		}
+
+		// Set new TraceProvider. Find it from the list of TraceProviders using
+		// the selected name. TraceViewer handles the change. If provider is
+		// the same as previously, nothing is done.
+		List<TraceProvider> dataFormats = TraceViewerGlobals
+				.getListOfTraceProviders();
+		if (dataFormatButton != null) {
+			for (int i = 0; i < dataFormats.size(); i++) {
+
+				// Compare the name of the Provider to the name saved to the
+				// preference store
+				if (dataFormats.get(i).getName().equals(
+						store.getString(PreferenceConstants.DATA_FORMAT))) {
+
+					// Set new TraceProvider to the TraceViewer
+					TraceViewerGlobals.setTraceProvider(dataFormats.get(i),
+							false);
+					break;
+				}
+			}
+		}
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/XMLBaseConfigurationExporter.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,235 @@
+/*
+ * 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:
+ *
+ * Base class for all configuration exporters
+ *
+ */
+package com.nokia.traceviewer.engine.preferences;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.StringWriter;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.eclipse.core.runtime.IPath;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.dialog.treeitem.TreeItem;
+
+/**
+ * Base class for all configuration exporters
+ * 
+ */
+public abstract class XMLBaseConfigurationExporter implements
+		XMLConfigurationFileConstants {
+
+	/**
+	 * Root Treeitem
+	 */
+	protected TreeItem root;
+
+	/**
+	 * File path
+	 */
+	private String filePath;
+
+	/**
+	 * Output writer
+	 */
+	private OutputStreamWriter out;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param root
+	 *            root of the elements
+	 * @param configurationFileName
+	 *            file name where to export data
+	 * @param pathRelative
+	 *            tells is the path relative
+	 */
+	public XMLBaseConfigurationExporter(TreeItem root,
+			String configurationFileName, boolean pathRelative) {
+		this.root = root;
+
+		// If path is relative, get plugins metadata folder
+		if (pathRelative) {
+			IPath path = TraceViewerPlugin.getDefault().getStateLocation()
+					.append(configurationFileName);
+			filePath = path.toOSString();
+		} else {
+			filePath = configurationFileName;
+		}
+		createFile();
+	}
+
+	/**
+	 * Creates the file
+	 */
+	public void createFile() {
+		File file = new File(filePath);
+
+		// File doesn't exist, create it
+		if (!file.exists()) {
+			createFileSkeleton();
+		} else {
+			// File exists
+		}
+	}
+
+	/**
+	 * Creates XML file skeleton
+	 */
+	private void createFileSkeleton() {
+		try {
+			// Open an Output Stream Writer and set encoding
+			OutputStream fout = new FileOutputStream(filePath);
+			OutputStream bout = new BufferedOutputStream(fout);
+			out = new OutputStreamWriter(bout, "UTF-8"); //$NON-NLS-1$
+
+			// Write dummy Dictionary XML file
+			out.write(XML_HEADER);
+			out.write(FILE_START);
+			out.write(MAINCONFIGURATIONS_START);
+			out.write(GENERAL_CONFIGURATION_START);
+			out.write(GENERAL_CONFIGURATION_END);
+			out.write(COLOR_CONFIGURATION_START);
+			out.write(COLOR_CONFIGURATION_END);
+			out.write(FILTER_CONFIGURATION_START);
+			out.write(FILTER_CONFIGURATION_END);
+			out.write(LINECOUNT_CONFIGURATION_START);
+			out.write(LINECOUNT_CONFIGURATION_END);
+			out.write(VARIABLETRACING_CONFIGURATION_START);
+			out.write(VARIABLETRACING_CONFIGURATION_END);
+			out.write(TRIGGER_CONFIGURATION_START);
+			out.write(TRIGGER_CONFIGURATION_END);
+			out.write(MAINCONFIGURATIONS_END);
+			out.write(FILE_END);
+
+			// Flush and close the stream
+			out.flush();
+			out.close();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+
+	}
+
+	/**
+	 * Writes ready XML string to file
+	 * 
+	 * @param xmlString
+	 */
+	protected void writeFile(String xmlString) {
+
+		try {
+			// Open an Output Stream Writer to set encoding
+			OutputStream fout = new FileOutputStream(filePath);
+			OutputStream bout = new BufferedOutputStream(fout);
+			out = new OutputStreamWriter(bout, "UTF-8"); //$NON-NLS-1$
+
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		try {
+			out.write(xmlString);
+			out.flush();
+			out.close();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+	}
+
+	/**
+	 * Gets result from document
+	 * 
+	 * @param doc
+	 *            document
+	 * @return result
+	 */
+	protected StreamResult getResultFromDocument(Document doc) {
+		TransformerFactory tf = TransformerFactory.newInstance();
+		int indentSize = 2;
+		tf.setAttribute("indent-number", Integer.valueOf(indentSize)); //$NON-NLS-1$
+		Transformer transformer = null;
+		try {
+			transformer = tf.newTransformer();
+		} catch (TransformerConfigurationException e1) {
+			e1.printStackTrace();
+		}
+		if (transformer != null) {
+			transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$
+		}
+
+		// initialize StreamResult with File object to save to file
+		StreamResult result = new StreamResult(new StringWriter());
+		DOMSource source = new DOMSource(doc);
+		try {
+			if (transformer != null) {
+				transformer.transform(source, result);
+			}
+		} catch (TransformerException e) {
+			e.printStackTrace();
+		}
+		return result;
+	}
+
+	/**
+	 * Gets DOM document for the file path
+	 * 
+	 * @return document
+	 */
+	protected Document getDocument() {
+		DocumentBuilderFactory docFactory = DocumentBuilderFactory
+				.newInstance();
+		DocumentBuilder docBuilder = null;
+		try {
+			docBuilder = docFactory.newDocumentBuilder();
+		} catch (ParserConfigurationException e) {
+			e.printStackTrace();
+		}
+
+		// Get the document
+		Document doc = null;
+		try {
+			if (docBuilder != null) {
+				File file = new File(filePath);
+				doc = docBuilder.parse(file);
+			}
+		} catch (SAXException e1) {
+			e1.printStackTrace();
+		} catch (IOException e1) {
+			e1.printStackTrace();
+		}
+		return doc;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/XMLBaseConfigurationImporter.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,113 @@
+/*
+ * 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:
+ *
+ * Base class for importing configuration to XML file
+ *
+ */
+package com.nokia.traceviewer.engine.preferences;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.eclipse.core.runtime.IPath;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.dialog.treeitem.TreeItem;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Base class for importing configuration to XML file
+ * 
+ */
+public abstract class XMLBaseConfigurationImporter implements
+		XMLConfigurationFileConstants {
+
+	/**
+	 * Root tree item
+	 */
+	protected TreeItem root;
+
+	/**
+	 * File path
+	 */
+	protected String filePath;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param root
+	 *            root of the elements
+	 * @param configurationFileName
+	 *            file name where to import data from
+	 * @param pathRelative
+	 *            tells is the path relative
+	 */
+	public XMLBaseConfigurationImporter(TreeItem root,
+			String configurationFileName, boolean pathRelative) {
+		this.root = root;
+
+		// If path is relative, get plugins metadata folder
+		if (pathRelative) {
+			IPath path = TraceViewerPlugin.getDefault().getStateLocation()
+					.append(configurationFileName);
+			filePath = path.toOSString();
+		} else {
+			filePath = configurationFileName;
+		}
+	}
+
+	/**
+	 * Gets DOM document for the file path
+	 * 
+	 * @return document
+	 */
+	protected Document getDocument() {
+		DocumentBuilderFactory docFactory = DocumentBuilderFactory
+				.newInstance();
+		DocumentBuilder docBuilder = null;
+		try {
+			docBuilder = docFactory.newDocumentBuilder();
+		} catch (ParserConfigurationException e) {
+			e.printStackTrace();
+		}
+
+		// Get the document
+		Document doc = null;
+		try {
+			if (docBuilder != null) {
+				File file = new File(filePath);
+				doc = docBuilder.parse(file);
+			}
+		} catch (SAXException e1) {
+			e1.printStackTrace();
+
+			// Inform about import unsuccesful
+			String importFailed = Messages
+					.getString("XMLBaseConfigurationImporter.IncorrectFileErrorMsg"); //$NON-NLS-1$
+			TraceViewerGlobals.getTraceViewer().getDialogs().showErrorMessage(
+					importFailed);
+
+		} catch (IOException e1) {
+			e1.printStackTrace();
+		}
+		return doc;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/XMLColorConfigurationExporter.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,265 @@
+/*
+ * 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:
+ *
+ * Exports Color configuration to XML file
+ *
+ */
+package com.nokia.traceviewer.engine.preferences;
+
+import javax.xml.transform.stream.StreamResult;
+
+import org.eclipse.swt.graphics.Color;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import com.nokia.traceviewer.dialog.treeitem.ColorTreeComponentItem;
+import com.nokia.traceviewer.dialog.treeitem.ColorTreeItem;
+import com.nokia.traceviewer.dialog.treeitem.ColorTreeTextItem;
+import com.nokia.traceviewer.dialog.treeitem.TreeItem;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Exports Color configuration to XML file
+ */
+public final class XMLColorConfigurationExporter extends
+		XMLBaseConfigurationExporter {
+
+	/**
+	 * Constructor
+	 * 
+	 * @param root
+	 *            root of the Color elements
+	 * @param configurationFileName
+	 *            file name where to export data
+	 * @param pathRelative
+	 *            tells is the path relative
+	 */
+	public XMLColorConfigurationExporter(TreeItem root,
+			String configurationFileName, boolean pathRelative) {
+		super(root, configurationFileName, pathRelative);
+	}
+
+	/**
+	 * Exports data
+	 */
+	public void export() {
+		Document doc = getDocument();
+		Node parent;
+
+		// Get root node of color rules
+		NodeList list = doc.getElementsByTagName(COLOR_TAG);
+		if (list.getLength() == 0) {
+			parent = doc.createElement(COLOR_TAG);
+			// Get the main configurations tag
+			NodeList list2 = doc.getElementsByTagName(CONFIGURATIONS_TAG);
+			Node mainRoot = list2.item(0);
+			mainRoot.appendChild(parent);
+		} else {
+			parent = list.item(0);
+		}
+
+		// Delete old color information
+		NodeList colorChilds = parent.getChildNodes();
+		int len = colorChilds.getLength();
+		for (int i = 0; i < len; i++) {
+			parent.removeChild(colorChilds.item(0));
+		}
+
+		// Process through the tree
+		for (int i = 0; i < root.getChildren().length; i++) {
+			processChild((ColorTreeItem) root.getChildren()[i], doc, parent);
+		}
+
+		// Get result from document
+		StreamResult result = getResultFromDocument(doc);
+
+		// Print out
+		String xmlString = result.getWriter().toString();
+		writeFile(xmlString);
+	}
+
+	/**
+	 * Process child
+	 * 
+	 * @param item
+	 *            child to process
+	 * @param doc
+	 *            document
+	 * @param root
+	 *            node to insert this child to
+	 */
+	private void processChild(ColorTreeItem item, Document doc, Node root) {
+		// Process through the tree
+		Node newItem = null;
+		// Group rule
+		if (item.getRule() == ColorTreeItem.Rule.GROUP) {
+			newItem = doc.createElement(GROUP_TAG);
+			// Create a configuration
+		} else {
+			newItem = doc.createElement(CONFIGURATION_TAG);
+		}
+
+		// Get attributes
+		NamedNodeMap itemAttributes = newItem.getAttributes();
+
+		// Set name
+		Attr name = doc.createAttribute(NAME_TAG);
+		name.setValue(item.getName());
+		itemAttributes.setNamedItem(name);
+
+		// Check is the item group
+		if (item.getRule() != ColorTreeItem.Rule.GROUP) {
+
+			// Add rule type attribute
+			Attr rule = doc.createAttribute(RULE_TAG);
+			if (item.getRule() == ColorTreeItem.Rule.TEXT_RULE) {
+				rule.setValue(TEXTRULE_TAG);
+			} else if (item.getRule() == ColorTreeItem.Rule.COMPONENT_RULE) {
+				rule.setValue(COMPONENTRULE_TAG);
+			} else {
+				String unknownText = Messages
+						.getString("XMLColorConfigurationExporter.UnknownText"); //$NON-NLS-1$ 
+				rule.setValue(unknownText);
+			}
+			itemAttributes.setNamedItem(rule);
+
+			// Add enabled attribute
+			Attr enabled = doc.createAttribute(ENABLED_TAG);
+			boolean checked = isChecked(item);
+			if (checked) {
+				enabled.setValue(YES_TAG);
+			} else {
+				enabled.setValue(NO_TAG);
+			}
+			itemAttributes.setNamedItem(enabled);
+		}
+
+		// Set as child to parent
+		root.appendChild(newItem);
+
+		// Set common attributes for non-group items
+		if (item.getRule() != ColorTreeItem.Rule.GROUP) {
+
+			// ForeColor
+			Node foreColor = doc.createElement(FORECOLOR_TAG);
+			Color foregroundColor = item.getForegroundColor();
+			String foregroundColorString = createHexStringFromColor(foregroundColor);
+			foreColor.setTextContent(foregroundColorString);
+			newItem.appendChild(foreColor);
+
+			// BackColor
+			Node backColor = doc.createElement(BACKCOLOR_TAG);
+			Color backgroundColor = item.getBackgroundColor();
+			String backgroundColorString = createHexStringFromColor(backgroundColor);
+			backColor.setTextContent(backgroundColorString);
+			newItem.appendChild(backColor);
+		}
+
+		// Set rest of the attributes from text rule
+		if (item.getRule() == ColorTreeItem.Rule.TEXT_RULE) {
+			ColorTreeTextItem textItem = (ColorTreeTextItem) item;
+
+			// Text
+			Node text = doc.createElement(TEXT_TAG);
+			text.setTextContent(textItem.getText());
+			newItem.appendChild(text);
+
+			// Match case
+			Node matchCase = doc.createElement(MATCHCASE_TAG);
+			if (textItem.isMatchCase()) {
+				matchCase.setTextContent(YES_TAG);
+			} else {
+				matchCase.setTextContent(NO_TAG);
+			}
+			newItem.appendChild(matchCase);
+
+			// Component rule
+		} else if (item.getRule() == ColorTreeItem.Rule.COMPONENT_RULE) {
+			ColorTreeComponentItem componentItem = (ColorTreeComponentItem) item;
+
+			// Component ID
+			Node component = doc.createElement(COMPONENTID_TAG);
+			component.setTextContent(String.valueOf(componentItem
+					.getComponentId()));
+			newItem.appendChild(component);
+
+			// Group ID
+			Node group = doc.createElement(GROUPID_TAG);
+			group.setTextContent(String.valueOf(componentItem.getGroupId()));
+			newItem.appendChild(group);
+		}
+
+		// Loop through own children
+		for (int i = 0; i < item.getChildren().length; i++) {
+			processChild((ColorTreeItem) item.getChildren()[i], doc, newItem);
+		}
+	}
+
+	/**
+	 * Checks it the given item is checked in the color dialog
+	 * 
+	 * @param item
+	 *            item to be checked
+	 * @return true if the given item is checked
+	 */
+	private boolean isChecked(ColorTreeItem item) {
+		boolean checked = false;
+		if (TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+				.getColorer().getTextRules().contains(item)
+				|| TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+						.getColorer().getComponentRules().contains(item)) {
+			checked = true;
+		}
+		return checked;
+	}
+
+	/**
+	 * Creates hex string from color
+	 * 
+	 * @param color
+	 *            color to create hex string from
+	 * @return hex string
+	 */
+	private String createHexStringFromColor(Color color) {
+		String colorString = ""; //$NON-NLS-1$
+		if (color != null) {
+
+			// Add red color as hex
+			String colorPart = Integer.toHexString(color.getRed());
+			if (colorPart.equals("0")) { //$NON-NLS-1$
+				colorString += "0"; //$NON-NLS-1$
+			}
+			colorString += colorPart;
+
+			// Add green color as hex
+			colorPart = Integer.toHexString(color.getGreen());
+			if (colorPart.equals("0")) { //$NON-NLS-1$
+				colorString += "0"; //$NON-NLS-1$
+			}
+			colorString += colorPart;
+
+			// Add blue color as hex
+			colorPart = Integer.toHexString(color.getBlue());
+			if (colorPart.equals("0")) { //$NON-NLS-1$
+				colorString += "0"; //$NON-NLS-1$
+			}
+			colorString += colorPart;
+		}
+		return colorString;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/XMLColorConfigurationImporter.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,322 @@
+/*
+ * 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:
+ *
+ * Imports Color configuration from XML file
+ *
+ */
+package com.nokia.traceviewer.engine.preferences;
+
+import java.io.File;
+
+import org.eclipse.swt.custom.StyleRange;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.ui.PlatformUI;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import com.nokia.traceviewer.dialog.BasePropertyDialog;
+import com.nokia.traceviewer.dialog.treeitem.ColorTreeBaseItem;
+import com.nokia.traceviewer.dialog.treeitem.ColorTreeComponentItem;
+import com.nokia.traceviewer.dialog.treeitem.ColorTreeItem;
+import com.nokia.traceviewer.dialog.treeitem.ColorTreeTextItem;
+import com.nokia.traceviewer.dialog.treeitem.TreeItem;
+import com.nokia.traceviewer.dialog.treeitem.TreeItemListener;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.dataprocessor.ColorProcessor;
+
+/**
+ * Imports Color configuration from XML file
+ * 
+ */
+public final class XMLColorConfigurationImporter extends
+		XMLBaseConfigurationImporter {
+
+	/**
+	 * Constructor
+	 * 
+	 * @param root
+	 *            root of the Color elements
+	 * @param configurationFileName
+	 *            file name where to import data from
+	 * @param pathRelative
+	 *            tells is the path relative
+	 */
+	public XMLColorConfigurationImporter(TreeItem root,
+			String configurationFileName, boolean pathRelative) {
+		super(root, configurationFileName, pathRelative);
+	}
+
+	/**
+	 * Imports data
+	 */
+	public void importData() {
+		File file = new File(filePath);
+		if (file.exists()) {
+			Document doc = getDocument();
+
+			if (doc != null) {
+
+				// Delete old color rules
+				Object[] oldColorRules = root.getChildren();
+				for (int i = 0; i < oldColorRules.length; i++) {
+
+					// Dispose colors
+					if ((((ColorTreeItem) oldColorRules[i])
+							.getForegroundColor() != null)
+							&& ((ColorTreeItem) oldColorRules[i])
+									.getBackgroundColor() != null) {
+						((ColorTreeItem) oldColorRules[i]).getForegroundColor()
+								.dispose();
+						((ColorTreeItem) oldColorRules[i]).getBackgroundColor()
+								.dispose();
+					}
+					root.removeChild((ColorTreeItem) oldColorRules[i]);
+				}
+
+				// Clear all old rules
+				ColorProcessor proc = TraceViewerGlobals.getTraceViewer()
+						.getDataProcessorAccess().getColorer();
+				proc.getTextRules().clear();
+				proc.getComponentRules().clear();
+				proc.clearRanges();
+				TraceViewerGlobals.getTraceViewer().getView().applyColorRules(
+						proc.getRanges().toArray(new StyleRange[0]));
+
+				// Get color node from the XML file
+				NodeList list = doc.getElementsByTagName(COLOR_TAG);
+				Node parent = list.item(0);
+
+				// Import colors
+				if (parent != null) {
+					NodeList colors = parent.getChildNodes();
+					for (int i = 0; i < colors.getLength(); i++) {
+						if (colors.item(i) instanceof Element) {
+							processColorRule(colors.item(i), root);
+						}
+					}
+				}
+
+				// Create new rules
+				proc.createColorRules();
+			}
+		}
+	}
+
+	/**
+	 * Import this color rule to root
+	 * 
+	 * @param node
+	 *            Color node to import
+	 * @param root
+	 *            Root node of color dialog
+	 */
+	private void processColorRule(Node node, TreeItem root) {
+		String name = null;
+		NamedNodeMap itemAttributes = node.getAttributes();
+
+		// Get name
+		Attr nameAttr = (Attr) itemAttributes.getNamedItem(NAME_TAG);
+		name = nameAttr.getValue();
+
+		// Group item
+		TreeItem newItem = null;
+		if (node.getNodeName().equals(GROUP_TAG)) {
+			newItem = new ColorTreeBaseItem(TraceViewerGlobals.getTraceViewer()
+					.getDataProcessorAccess().getColorer()
+					.getTreeItemListener(), root, name,
+					ColorTreeItem.Rule.GROUP, null, null);
+
+			// Process normal rules
+		} else if (node.getNodeName().equals(CONFIGURATION_TAG)) {
+
+			// Get tree item listener from the processor
+			TreeItemListener listener = TraceViewerGlobals.getTraceViewer()
+					.getDataProcessorAccess().getColorer()
+					.getTreeItemListener();
+
+			// Get rule name
+			Attr ruleAttr = (Attr) itemAttributes.getNamedItem(RULE_TAG);
+			String rule = ruleAttr.getValue();
+
+			// Create Text Item
+			if (rule.equals(TEXTRULE_TAG)) {
+				newItem = processTextRule(node, root, name, listener);
+				// Create Component Item
+			} else if (rule.equals(COMPONENTRULE_TAG)) {
+				newItem = processComponentRule(node, root, name, listener);
+			} else {
+				// Unknown rule, shouldn't come here
+			}
+
+			// Check if the color rules should be kept over boot
+			Attr enabledAttr = (Attr) itemAttributes.getNamedItem(ENABLED_TAG);
+			if (enabledAttr != null) {
+				String enabled = enabledAttr.getValue();
+				if (enabled.equals(YES_TAG)) {
+					TraceViewerGlobals.getTraceViewer()
+							.getDataProcessorAccess().getColorer().enableRule(
+									(ColorTreeItem) newItem);
+				}
+			}
+
+		} else {
+			// Unknown node name, shouldn't come here
+		}
+
+		// Add the child to the parent node
+		if (newItem != null) {
+			root.addChild(newItem);
+		}
+
+		// If node was group, process it's children
+		if (node.getNodeName().equals(GROUP_TAG)) {
+			// Get children
+			NodeList children = node.getChildNodes();
+			for (int i = 0; i < children.getLength(); i++) {
+				if (children.item(i) instanceof Element) {
+					processColorRule(children.item(i), newItem);
+				}
+			}
+		}
+
+	}
+
+	/**
+	 * Processes text rule
+	 * 
+	 * @param node
+	 *            Node to process
+	 * @param root
+	 *            root node
+	 * @param name
+	 *            name of the rule
+	 * @param listener
+	 *            TreeItem listener
+	 * @return the newly created text item
+	 */
+	private TreeItem processTextRule(Node node, TreeItem root, String name,
+			TreeItemListener listener) {
+		TreeItem newItem;
+		String text = null;
+		boolean matchCase = false;
+		Color foregroundColor = null;
+		Color backgroundColor = null;
+		NodeList properties = node.getChildNodes();
+		for (int i = 0; i < properties.getLength(); i++) {
+			if (properties.item(i) instanceof Element) {
+				String nodeName = properties.item(i).getNodeName();
+				if (nodeName.equals(FORECOLOR_TAG)) {
+					foregroundColor = createColorFromHexString(properties.item(
+							i).getTextContent());
+				} else if (nodeName.equals(BACKCOLOR_TAG)) {
+					backgroundColor = createColorFromHexString(properties.item(
+							i).getTextContent());
+				} else if (nodeName.equals(TEXT_TAG)) {
+					text = properties.item(i).getTextContent();
+				} else if (nodeName.equals(MATCHCASE_TAG)) {
+					if (properties.item(i).getTextContent().equals(NO_TAG)) {
+						matchCase = false;
+					} else {
+						matchCase = true;
+					}
+				}
+			}
+		}
+
+		// Create new text item
+		newItem = new ColorTreeTextItem(listener, root, name,
+				ColorTreeItem.Rule.TEXT_RULE, foregroundColor, backgroundColor,
+				text, matchCase);
+		return newItem;
+	}
+
+	/**
+	 * Processes component rule
+	 * 
+	 * @param node
+	 *            Node to process
+	 * @param root
+	 *            root node
+	 * @param name
+	 *            name of the rule
+	 * @param listener
+	 *            TreeItem listener
+	 * @return the newly created component item
+	 */
+	private TreeItem processComponentRule(Node node, TreeItem root,
+			String name, TreeItemListener listener) {
+		TreeItem newItem;
+		Color foregroundColor = null;
+		Color backgroundColor = null;
+		int componentId = BasePropertyDialog.WILDCARD_INTEGER;
+		int groupId = BasePropertyDialog.WILDCARD_INTEGER;
+		NodeList properties = node.getChildNodes();
+		for (int i = 0; i < properties.getLength(); i++) {
+			if (properties.item(i) instanceof Element) {
+				String nodeName = properties.item(i).getNodeName();
+				if (nodeName.equals(FORECOLOR_TAG)) {
+					foregroundColor = createColorFromHexString(properties.item(
+							i).getTextContent());
+				} else if (nodeName.equals(BACKCOLOR_TAG)) {
+					backgroundColor = createColorFromHexString(properties.item(
+							i).getTextContent());
+				} else if (nodeName.equals(COMPONENTID_TAG)) {
+					// Get component ID. If parse fails, it means that component
+					// ID is a wildcard
+					try {
+						componentId = Integer.parseInt(properties.item(i)
+								.getTextContent());
+					} catch (NumberFormatException e) {
+					}
+				} else if (nodeName.equals(GROUPID_TAG)) {
+					// Get group ID. If parse fails, it means that group
+					// ID is a wildcard
+					try {
+						groupId = Integer.parseInt(properties.item(i)
+								.getTextContent());
+					} catch (NumberFormatException e) {
+					}
+				}
+			}
+		}
+
+		// Create new component item
+		newItem = new ColorTreeComponentItem(listener, root, name,
+				ColorTreeItem.Rule.COMPONENT_RULE, foregroundColor,
+				backgroundColor, componentId, groupId);
+		return newItem;
+	}
+
+	/**
+	 * Creates color from hex string
+	 * 
+	 * @param hexString
+	 *            hex string
+	 * @return color
+	 */
+	private Color createColorFromHexString(String hexString) {
+		final int hex = 16;
+		int red = Integer.parseInt(hexString.substring(0, 2), hex);
+		int green = Integer.parseInt(hexString.substring(2, 4), hex);
+		int blue = Integer.parseInt(hexString.substring(4, 6), hex);
+		Color color = new Color(PlatformUI.getWorkbench().getDisplay(), red,
+				green, blue);
+		return color;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/XMLConfigurationFileConstants.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,297 @@
+/*
+ * 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:
+ *
+ * Constants for XML Configuration file
+ *
+
+ */
+package com.nokia.traceviewer.engine.preferences;
+
+/**
+ * Constants for XML Configuration file
+ * 
+ */
+interface XMLConfigurationFileConstants {
+
+	/**
+	 * XML Header
+	 */
+	final String XML_HEADER = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; //$NON-NLS-1$
+
+	/**
+	 * File start
+	 */
+	final String FILE_START = "<ConfigurationFile Version=\"1\">\n"; //$NON-NLS-1$
+
+	/**
+	 * File end
+	 */
+	final String FILE_END = "</ConfigurationFile>\n"; //$NON-NLS-1$
+
+	/**
+	 * Main configurations start
+	 */
+	final String MAINCONFIGURATIONS_START = "  <Configurations>\n"; //$NON-NLS-1$
+
+	/**
+	 * Main configurations end
+	 */
+	final String MAINCONFIGURATIONS_END = "  </Configurations>\n"; //$NON-NLS-1$
+
+	/**
+	 * General configuration start
+	 */
+	final String GENERAL_CONFIGURATION_START = "    <General>\n"; //$NON-NLS-1$
+
+	/**
+	 * General configuration end
+	 */
+	final String GENERAL_CONFIGURATION_END = "    </General>\n"; //$NON-NLS-1$
+
+	/**
+	 * Color configuration start
+	 */
+	final String COLOR_CONFIGURATION_START = "    <ColorCoding>\n"; //$NON-NLS-1$
+
+	/**
+	 * Color configuration end
+	 */
+	final String COLOR_CONFIGURATION_END = "    </ColorCoding>\n"; //$NON-NLS-1$
+
+	/**
+	 * Filter configuration start
+	 */
+	final String FILTER_CONFIGURATION_START = "    <Filter>\n"; //$NON-NLS-1$
+
+	/**
+	 * Filter configuration end
+	 */
+	final String FILTER_CONFIGURATION_END = "    </Filter>\n"; //$NON-NLS-1$
+
+	/**
+	 * Linecount configuration start
+	 */
+	final String LINECOUNT_CONFIGURATION_START = "    <LineCount>\n"; //$NON-NLS-1$
+
+	/**
+	 * Linecount configuration end
+	 */
+	final String LINECOUNT_CONFIGURATION_END = "    </LineCount>\n"; //$NON-NLS-1$
+
+	/**
+	 * Variabletracing configuration start
+	 */
+	final String VARIABLETRACING_CONFIGURATION_START = "    <VariableTracing>\n"; //$NON-NLS-1$
+
+	/**
+	 * Variabletracing configuration end
+	 */
+	final String VARIABLETRACING_CONFIGURATION_END = "    </VariableTracing>\n"; //$NON-NLS-1$
+
+	/**
+	 * Trigger configuration start
+	 */
+	final String TRIGGER_CONFIGURATION_START = "    <Trigger>\n"; //$NON-NLS-1$
+
+	/**
+	 * Trigger configuration end
+	 */
+	final String TRIGGER_CONFIGURATION_END = "    </Trigger>\n"; //$NON-NLS-1$
+
+	/**
+	 * Filter tag
+	 */
+	final String FILTER_TAG = "Filter"; //$NON-NLS-1$
+
+	/**
+	 * General tag
+	 */
+	final String GENERAL_TAG = "General"; //$NON-NLS-1$
+
+	/**
+	 * Color tag
+	 */
+	final String COLOR_TAG = "ColorCoding"; //$NON-NLS-1$
+
+	/**
+	 * Linecount tag
+	 */
+	final String LINECOUNT_TAG = "LineCount"; //$NON-NLS-1$
+
+	/**
+	 * Variabletracing tag
+	 */
+	final String VARIABLETRACING_TAG = "VariableTracing"; //$NON-NLS-1$
+
+	/**
+	 * Trigger tag
+	 */
+	final String TRIGGER_TAG = "Trigger"; //$NON-NLS-1$
+
+	/**
+	 * Group tag
+	 */
+	final String GROUP_TAG = "Group"; //$NON-NLS-1$
+
+	/**
+	 * Configurations tag
+	 */
+	final String CONFIGURATIONS_TAG = "Configurations"; //$NON-NLS-1$
+
+	/**
+	 * Configuration tag
+	 */
+	final String CONFIGURATION_TAG = "Configuration"; //$NON-NLS-1$
+
+	/**
+	 * Rule tag
+	 */
+	final String RULE_TAG = "Rule"; //$NON-NLS-1$
+
+	/**
+	 * Name tag
+	 */
+	final String NAME_TAG = "Name"; //$NON-NLS-1$
+
+	/**
+	 * Type tag
+	 */
+	final String TYPE_TAG = "Type"; //$NON-NLS-1$
+
+	/**
+	 * Action tag
+	 */
+	final String ACTION_TAG = "Action"; //$NON-NLS-1$
+
+	/**
+	 * Text tag
+	 */
+	final String TEXT_TAG = "Text"; //$NON-NLS-1$
+
+	/**
+	 * Text rule tag
+	 */
+	final String TEXTRULE_TAG = "Text"; //$NON-NLS-1$
+
+	/**
+	 * Component rule tag
+	 */
+	final String COMPONENTRULE_TAG = "Component"; //$NON-NLS-1$
+
+	/**
+	 * Match case tag
+	 */
+	final String MATCHCASE_TAG = "MatchCase"; //$NON-NLS-1$
+
+	/**
+	 * Enabled tag
+	 */
+	final String ENABLED_TAG = "Enabled"; //$NON-NLS-1$
+
+	/**
+	 * Trigger type tag
+	 */
+	final String TRIGGERTYPE_TAG = "TriggerType"; //$NON-NLS-1$
+
+	/**
+	 * Configuration file tag
+	 */
+	final String CONFIGURATION_FILE_TAG = "ConfigurationFile"; //$NON-NLS-1$
+
+	/**
+	 * Configuration name tag
+	 */
+	final String CONFIGURATION_NAME_TAG = "ConfigurationName"; //$NON-NLS-1$
+
+	/**
+	 * Foreground color tag
+	 */
+	final String FORECOLOR_TAG = "ForeColor"; //$NON-NLS-1$
+
+	/**
+	 * Background color tag
+	 */
+	final String BACKCOLOR_TAG = "BackColor"; //$NON-NLS-1$
+
+	/**
+	 * Yes tag
+	 */
+	final String YES_TAG = "Yes"; //$NON-NLS-1$
+
+	/**
+	 * No tag
+	 */
+	final String NO_TAG = "No"; //$NON-NLS-1$
+
+	/**
+	 * AND tag
+	 */
+	final String AND_TAG = "AND"; //$NON-NLS-1$
+
+	/**
+	 * OR tag
+	 */
+	final String OR_TAG = "OR"; //$NON-NLS-1$
+
+	/**
+	 * Show tag
+	 */
+	final String SHOW_TAG = "Show"; //$NON-NLS-1$
+
+	/**
+	 * Hide tag
+	 */
+	final String HIDE_TAG = "Hide"; //$NON-NLS-1$
+
+	/**
+	 * Start trigger tag
+	 */
+	final String STARTTRIGGER_TAG = "StartTrigger"; //$NON-NLS-1$
+
+	/**
+	 * Stop trigger tag
+	 */
+	final String STOPTRIGGER_TAG = "StopTrigger"; //$NON-NLS-1$
+
+	/**
+	 * Activation trigger tag
+	 */
+	final String ACTIVATIONTRIGGER_TAG = "ActivationTrigger"; //$NON-NLS-1$
+
+	/**
+	 * Decode file tag
+	 */
+	final String DECODEFILE_TAG = "DecodeFile"; //$NON-NLS-1$
+
+	/**
+	 * Save history tag
+	 */
+	final String SAVEHISTORY_TAG = "SaveHistory"; //$NON-NLS-1$
+
+	/**
+	 * Component ID tag
+	 */
+	final String COMPONENTID_TAG = "ComponentId"; //$NON-NLS-1$
+
+	/**
+	 * Group ID tag
+	 */
+	final String GROUPID_TAG = "GroupId"; //$NON-NLS-1$
+
+	/**
+	 * Advanced filter tag
+	 */
+	final String ADVANCEDFILTER_TAG = "AdvancedFilter"; //$NON-NLS-1$
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/XMLFilterConfigurationExporter.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,265 @@
+/*
+ * 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:
+ *
+ * Exports Filter configuration to XML file
+ *
+ */
+package com.nokia.traceviewer.engine.preferences;
+
+import java.util.List;
+
+import javax.xml.transform.stream.StreamResult;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import com.nokia.traceviewer.dialog.treeitem.FilterTreeComponentItem;
+import com.nokia.traceviewer.dialog.treeitem.FilterTreeItem;
+import com.nokia.traceviewer.dialog.treeitem.FilterTreeTextItem;
+import com.nokia.traceviewer.dialog.treeitem.TreeItem;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.dataprocessor.FilterRuleObject;
+import com.nokia.traceviewer.engine.dataprocessor.FilterRuleSet;
+
+/**
+ * Exports Filter configuration to XML file
+ * 
+ */
+public final class XMLFilterConfigurationExporter extends
+		XMLBaseConfigurationExporter {
+
+	/**
+	 * Constructor
+	 * 
+	 * @param root
+	 *            root of the Filter elements
+	 * @param configurationFileName
+	 *            file name where to export data
+	 * @param pathRelative
+	 *            tells is the path relative
+	 */
+	public XMLFilterConfigurationExporter(TreeItem root,
+			String configurationFileName, boolean pathRelative) {
+		super(root, configurationFileName, pathRelative);
+	}
+
+	/**
+	 * Exports data
+	 */
+	public void export() {
+		Document doc = getDocument();
+		Node parent;
+
+		// Get root node of filter rules
+		NodeList list = doc.getElementsByTagName(FILTER_TAG);
+		if (list.getLength() == 0) {
+			parent = doc.createElement(FILTER_TAG);
+
+			// Get the main configurations tag
+			NodeList list2 = doc.getElementsByTagName(CONFIGURATIONS_TAG);
+			Node mainRoot = list2.item(0);
+			mainRoot.appendChild(parent);
+		} else {
+			parent = list.item(0);
+		}
+
+		// Delete old filter information
+		NodeList filterChilds = parent.getChildNodes();
+		int len = filterChilds.getLength();
+		for (int i = 0; i < len; i++) {
+			parent.removeChild(filterChilds.item(0));
+		}
+
+		// Add Type, Action and AdvancedFilter attributes
+		addCommonAttributes(doc, parent);
+
+		// Process through the tree
+		for (int i = 0; i < root.getChildren().length; i++) {
+			processChild((FilterTreeItem) root.getChildren()[i], doc, parent);
+		}
+
+		// Get result from document
+		StreamResult result = getResultFromDocument(doc);
+
+		// Print out
+		String xmlString = result.getWriter().toString();
+		writeFile(xmlString);
+	}
+
+	/**
+	 * Adds common attributes to the XML
+	 * 
+	 * @param doc
+	 *            document
+	 * @param parent
+	 *            parent node
+	 */
+	private void addCommonAttributes(Document doc, Node parent) {
+		// Get attributes
+		NamedNodeMap attr = parent.getAttributes();
+
+		// Type attribute
+		Attr type = doc.createAttribute(TYPE_TAG);
+		String operator = AND_TAG;
+		if (TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+				.getFilterProcessor().isLogicalOrInUse()) {
+			operator = OR_TAG;
+		}
+		type.setValue(operator);
+		attr.setNamedItem(type);
+
+		// Action attribute
+		Attr action = doc.createAttribute(ACTION_TAG);
+		String actionStr = HIDE_TAG;
+		if (TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+				.getFilterProcessor().isShowTracesContainingRule()) {
+			actionStr = SHOW_TAG;
+		}
+		action.setValue(actionStr);
+		attr.setNamedItem(action);
+
+		// Advanced filter attribute
+		Attr string = doc.createAttribute(ADVANCEDFILTER_TAG);
+		string.setValue(TraceViewerGlobals.getTraceViewer()
+				.getDataProcessorAccess().getFilterProcessor()
+				.getAdvancedFilterString());
+		attr.setNamedItem(string);
+	}
+
+	/**
+	 * Process child
+	 * 
+	 * @param item
+	 *            child to process
+	 * @param doc
+	 *            document
+	 * @param root
+	 *            node to insert this child to
+	 */
+	private void processChild(FilterTreeItem item, Document doc, Node root) {
+
+		// Process through the tree
+		Node newItem = null;
+		// Group rule
+		if (item.getRule() == FilterTreeItem.Rule.GROUP) {
+			newItem = doc.createElement(GROUP_TAG);
+			// Create a configuration
+		} else {
+			newItem = doc.createElement(CONFIGURATION_TAG);
+		}
+
+		// Get attributes
+		NamedNodeMap itemAttributes = newItem.getAttributes();
+
+		// Set name
+		Attr name = doc.createAttribute(NAME_TAG);
+		name.setValue(item.getName());
+		itemAttributes.setNamedItem(name);
+
+		// Set rule if not group item
+		if (item.getRule() != FilterTreeItem.Rule.GROUP) {
+			Attr rule = doc.createAttribute(RULE_TAG);
+			if (item.getRule() == FilterTreeItem.Rule.TEXT_RULE) {
+				rule.setValue(TEXTRULE_TAG);
+			} else if (item.getRule() == FilterTreeItem.Rule.COMPONENT_RULE) {
+				rule.setValue(COMPONENTRULE_TAG);
+			} else {
+				String unknownText = Messages
+						.getString("XMLFilterConfigurationExporter.UnknownText"); //$NON-NLS-1$
+				rule.setValue(unknownText);
+			}
+			itemAttributes.setNamedItem(rule);
+
+			// Add enabled attribute
+			Attr enabled = doc.createAttribute(ENABLED_TAG);
+			boolean checked = isChecked(item);
+			if (checked) {
+				enabled.setValue(YES_TAG);
+			} else {
+				enabled.setValue(NO_TAG);
+			}
+			itemAttributes.setNamedItem(enabled);
+		}
+
+		// Set as child to parent
+		root.appendChild(newItem);
+
+		// Set nodes when text rule
+		if (item.getRule() == FilterTreeItem.Rule.TEXT_RULE) {
+			FilterTreeTextItem textItem = (FilterTreeTextItem) item;
+
+			// Text
+			Node text = doc.createElement(TEXT_TAG);
+			text.setTextContent(textItem.getText());
+			newItem.appendChild(text);
+
+			// Match case
+			Node matchCase = doc.createElement(MATCHCASE_TAG);
+			if (textItem.isMatchCase()) {
+				matchCase.setTextContent(YES_TAG);
+			} else {
+				matchCase.setTextContent(NO_TAG);
+			}
+			newItem.appendChild(matchCase);
+
+			// Component rule
+		} else if (item.getRule() == FilterTreeItem.Rule.COMPONENT_RULE) {
+			FilterTreeComponentItem componentItem = (FilterTreeComponentItem) item;
+
+			// Component ID
+			Node component = doc.createElement(COMPONENTID_TAG);
+			component.setTextContent(String.valueOf(componentItem
+					.getComponentId()));
+			newItem.appendChild(component);
+
+			// Group ID
+			Node group = doc.createElement(GROUPID_TAG);
+			group.setTextContent(String.valueOf(componentItem.getGroupId()));
+			newItem.appendChild(group);
+		}
+
+		// Loop through own children
+		for (int i = 0; i < item.getChildren().length; i++) {
+			processChild((FilterTreeItem) item.getChildren()[i], doc, newItem);
+		}
+	}
+
+	/**
+	 * Checks it the given item is checked in the filter dialog
+	 * 
+	 * @param item
+	 *            item to be checked
+	 * @return true if the given item is checked
+	 */
+	private boolean isChecked(FilterTreeItem item) {
+		boolean checked = false;
+
+		List<FilterRuleObject> rules = TraceViewerGlobals.getTraceViewer()
+				.getDataProcessorAccess().getFilterProcessor().getFilterRules()
+				.getFilterRules();
+
+		// First object must be rule set
+		if (!rules.isEmpty() && rules.get(0) instanceof FilterRuleSet) {
+			if (((FilterRuleSet) rules.get(0)).getFilterRules().contains(item)) {
+				checked = true;
+			}
+		}
+
+		return checked;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/XMLFilterConfigurationImporter.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,322 @@
+/*
+ * 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:
+ *
+ * Imports Filter configuration from XML file
+ *
+ */
+package com.nokia.traceviewer.engine.preferences;
+
+import java.io.File;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import com.nokia.traceviewer.dialog.BasePropertyDialog;
+import com.nokia.traceviewer.dialog.treeitem.FilterTreeBaseItem;
+import com.nokia.traceviewer.dialog.treeitem.FilterTreeComponentItem;
+import com.nokia.traceviewer.dialog.treeitem.FilterTreeItem;
+import com.nokia.traceviewer.dialog.treeitem.FilterTreeTextItem;
+import com.nokia.traceviewer.dialog.treeitem.TreeItem;
+import com.nokia.traceviewer.dialog.treeitem.TreeItemListener;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.dataprocessor.FilterProcessor;
+import com.nokia.traceviewer.engine.dataprocessor.FilterRuleSet.LogicalOperator;
+
+/**
+ * Imports Filter configuration from XML file
+ */
+public final class XMLFilterConfigurationImporter extends
+		XMLBaseConfigurationImporter {
+
+	/**
+	 * Tells the logical operator in use
+	 */
+	private LogicalOperator operator = LogicalOperator.OR;
+
+	/**
+	 * Advanced filter string
+	 */
+	private String advancedFilterString = ""; //$NON-NLS-1$
+
+	/**
+	 * Constructor
+	 * 
+	 * @param root
+	 *            root of the Filter elements
+	 * @param configurationFileName
+	 *            file name where to import data from
+	 * @param pathRelative
+	 *            tells is the path relative
+	 */
+	public XMLFilterConfigurationImporter(TreeItem root,
+			String configurationFileName, boolean pathRelative) {
+		super(root, configurationFileName, pathRelative);
+	}
+
+	/**
+	 * Imports data
+	 */
+	public void importData() {
+		File file = new File(filePath);
+		if (file.exists()) {
+
+			Document doc = getDocument();
+
+			if (doc != null) {
+
+				// Delete old filter rules
+				Object[] oldFilters = root.getChildren();
+				for (int i = 0; i < oldFilters.length; i++) {
+					root.removeChild((FilterTreeItem) oldFilters[i]);
+				}
+
+				// Get filter node from the XML file
+				NodeList list = doc.getElementsByTagName(FILTER_TAG);
+				Node parent = list.item(0);
+
+				if (parent != null) {
+					// Process Filter settings
+					NamedNodeMap parentAttributes = parent.getAttributes();
+					processFilterSettings(parentAttributes);
+
+					// Import filters
+					NodeList filters = parent.getChildNodes();
+					for (int i = 0; i < filters.getLength(); i++) {
+						if (filters.item(i) instanceof Element) {
+							processFilter(filters.item(i), root);
+						}
+					}
+
+					// Enable possible advanced filter
+					if (!advancedFilterString.equals("")) { //$NON-NLS-1$
+						TraceViewerGlobals.getTraceViewer()
+								.getDataProcessorAccess().getFilterProcessor()
+								.enableAdvancedFilter(advancedFilterString);
+					}
+				}
+			}
+		}
+	}
+
+	/**
+	 * Process filter settings
+	 * 
+	 * @param itemAttributes
+	 *            attributes
+	 */
+	private void processFilterSettings(NamedNodeMap itemAttributes) {
+		FilterProcessor proc = TraceViewerGlobals.getTraceViewer()
+				.getDataProcessorAccess().getFilterProcessor();
+		// Show / Hide action
+		Attr action = ((Attr) itemAttributes.getNamedItem(ACTION_TAG));
+		if (action != null) {
+			proc
+					.setShowTracesContainingRule(action.getValue().equals(
+							SHOW_TAG));
+		}
+
+		// Type of the filters
+		Attr type = ((Attr) itemAttributes.getNamedItem(TYPE_TAG));
+		if (type != null) {
+			boolean orInUse = type.getValue().equals(OR_TAG);
+			if (!orInUse) {
+				operator = LogicalOperator.AND;
+			}
+			proc.setLogicalOrInUse(orInUse);
+		}
+
+		// Advanced filter string
+		Attr advancedFilter = ((Attr) itemAttributes
+				.getNamedItem(ADVANCEDFILTER_TAG));
+
+		// If exists, set it as member variable. Will be set to processor after
+		// all filter rules are applied
+		if (advancedFilter != null) {
+			if (!advancedFilter.getValue().equals("")) { //$NON-NLS-1$
+				advancedFilterString = advancedFilter.getValue();
+			}
+		}
+	}
+
+	/**
+	 * Import this filter rule to root
+	 * 
+	 * @param node
+	 *            Filter node to import
+	 * @param root
+	 *            Root node of filter dialog
+	 */
+	private void processFilter(Node node, TreeItem root) {
+		String name = null;
+		NamedNodeMap itemAttributes = node.getAttributes();
+
+		TreeItem newItem = null;
+
+		// Get tree item listener from the processor
+		TreeItemListener listener = TraceViewerGlobals.getTraceViewer()
+				.getDataProcessorAccess().getFilterProcessor()
+				.getTreeItemListener();
+
+		// Group item
+		if (node.getNodeName().equals(GROUP_TAG)) {
+			// Get name
+			Attr nameAttr = (Attr) itemAttributes.getNamedItem(NAME_TAG);
+			name = nameAttr.getValue();
+			newItem = new FilterTreeBaseItem(listener, root, name,
+					FilterTreeItem.Rule.GROUP);
+
+			// This is for normal rules
+		} else if (node.getNodeName().equals(CONFIGURATION_TAG)) {
+			// Get name
+			Attr nameAttr = (Attr) itemAttributes.getNamedItem(NAME_TAG);
+			name = nameAttr.getValue();
+
+			// Get rule
+			Attr ruleAttr = (Attr) itemAttributes.getNamedItem(RULE_TAG);
+			String rule = ruleAttr.getValue();
+
+			if (rule.equals(TEXTRULE_TAG)) {
+				newItem = processTextRule(node, root, name, listener);
+			} else if (rule.equals(COMPONENTRULE_TAG)) {
+				newItem = processComponentRule(node, root, name, listener);
+			}
+
+			// Check if the filter rules should be kept over boot
+			Attr enabledAttr = (Attr) itemAttributes.getNamedItem(ENABLED_TAG);
+			if (enabledAttr != null) {
+				String enabled = enabledAttr.getValue();
+				if (enabled.equals(YES_TAG)) {
+					TraceViewerGlobals.getTraceViewer()
+							.getDataProcessorAccess().getFilterProcessor()
+							.enableRule((FilterTreeItem) newItem, operator);
+				}
+			}
+
+		} else {
+			// Unknown rule, shouldn't come here
+		}
+
+		// Add the child to the parent node
+		if (newItem != null) {
+			root.addChild(newItem);
+		}
+
+		// If node was group, process it's children
+		if (node.getNodeName().equals(GROUP_TAG)) {
+			// Get children
+			NodeList children = node.getChildNodes();
+			for (int i = 0; i < children.getLength(); i++) {
+				if (children.item(i) instanceof Element) {
+					processFilter(children.item(i), newItem);
+				}
+			}
+		}
+
+	}
+
+	/**
+	 * Process text filter rule
+	 * 
+	 * @param node
+	 *            node to process
+	 * @param root
+	 *            root node
+	 * @param name
+	 *            name for the rule
+	 * @param listener
+	 *            TreeItem Listener
+	 * @return the newly created text item
+	 */
+	private TreeItem processTextRule(Node node, TreeItem root, String name,
+			TreeItemListener listener) {
+		TreeItem newItem;
+		String text = null;
+		boolean matchCase = false;
+		NodeList textProperties = node.getChildNodes();
+		for (int i = 0; i < textProperties.getLength(); i++) {
+			if (textProperties.item(i) instanceof Element) {
+				if (textProperties.item(i).getNodeName().equals(TEXT_TAG)) {
+					text = textProperties.item(i).getTextContent();
+				} else if (textProperties.item(i).getNodeName().equals(
+						MATCHCASE_TAG)) {
+					if (textProperties.item(i).getTextContent().equals(NO_TAG)) {
+						matchCase = false;
+					} else {
+						matchCase = true;
+					}
+				}
+			}
+		}
+
+		// Create new item
+		newItem = new FilterTreeTextItem(listener, root, name,
+				FilterTreeItem.Rule.TEXT_RULE, text, matchCase);
+
+		return newItem;
+	}
+
+	/**
+	 * Process component filter rule
+	 * 
+	 * @param node
+	 *            node to process
+	 * @param root
+	 *            root node
+	 * @param name
+	 *            name of the rule
+	 * @param listener
+	 *            TreeItem Listener
+	 * @return the newly created component item
+	 */
+	private TreeItem processComponentRule(Node node, TreeItem root,
+			String name, TreeItemListener listener) {
+		TreeItem newItem;
+		int componentId = BasePropertyDialog.WILDCARD_INTEGER;
+		int groupId = BasePropertyDialog.WILDCARD_INTEGER;
+		NodeList properties = node.getChildNodes();
+		for (int i = 0; i < properties.getLength(); i++) {
+			if (properties.item(i) instanceof Element) {
+				String nodeName = properties.item(i).getNodeName();
+				if (nodeName.equals(COMPONENTID_TAG)) {
+					// Get component ID. If parse fails, it means that component
+					// ID is a wildcard
+					try {
+						componentId = Integer.parseInt(properties.item(i)
+								.getTextContent());
+					} catch (NumberFormatException e) {
+					}
+				} else if (nodeName.equals(GROUPID_TAG)) {
+					// Get group ID. If parse fails, it means that group
+					// ID is a wildcard
+					try {
+						groupId = Integer.parseInt(properties.item(i)
+								.getTextContent());
+					} catch (NumberFormatException e) {
+					}
+				}
+			}
+		}
+
+		// Create new component item
+		newItem = new FilterTreeComponentItem(listener, root, name,
+				FilterTreeItem.Rule.COMPONENT_RULE, componentId, groupId);
+
+		return newItem;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/XMLGeneralConfigurationExporter.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,200 @@
+/*
+ * 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:
+ *
+ * Exports general configuration to XML file
+ *
+ */
+package com.nokia.traceviewer.engine.preferences;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+import javax.xml.transform.stream.StreamResult;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import com.nokia.traceviewer.action.OpenDecodeFileAction;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.activation.TraceActivationComponentItem;
+
+/**
+ * Exports general configuration to XML file
+ * 
+ */
+public class XMLGeneralConfigurationExporter extends
+		XMLBaseConfigurationExporter {
+
+	/**
+	 * Constructor
+	 * 
+	 * @param configurationFileName
+	 *            file name where to export data
+	 * @param pathRelative
+	 *            tells is the path relative
+	 */
+	public XMLGeneralConfigurationExporter(String configurationFileName,
+			boolean pathRelative) {
+		super(null, configurationFileName, pathRelative);
+	}
+
+	/**
+	 * Exports data
+	 */
+	public void export() {
+		Document doc = getDocument();
+		Node parent;
+
+		// Get root node of general configs
+		NodeList list = doc.getElementsByTagName(GENERAL_TAG);
+
+		// Tag not found
+		if (list.getLength() == 0) {
+			parent = doc.createElement(GENERAL_TAG);
+			// Get the main configurations tag
+			NodeList list2 = doc.getElementsByTagName(CONFIGURATIONS_TAG);
+			Node mainRoot = list2.item(0);
+			mainRoot.appendChild(parent);
+		} else {
+			parent = list.item(0);
+		}
+
+		// Delete old rule information
+		NodeList children = parent.getChildNodes();
+		int len = children.getLength();
+		for (int i = 0; i < len; i++) {
+			parent.removeChild(children.item(0));
+		}
+
+		// Process settings
+		processSettings(doc, parent);
+
+		// Get result from document
+		StreamResult result = getResultFromDocument(doc);
+
+		// Print out
+		String xmlString = result.getWriter().toString();
+		writeFile(xmlString);
+	}
+
+	/**
+	 * Process settings
+	 * 
+	 * @param doc
+	 *            document
+	 * @param root
+	 *            node to insert this child to
+	 */
+	private void processSettings(Document doc, Node root) {
+		// Decode files
+		processDecodeFiles(doc, root);
+	}
+
+	/**
+	 * Processes decode files
+	 * 
+	 * @param doc
+	 *            document
+	 * @param root
+	 *            node to insert this child to
+	 */
+	private void processDecodeFiles(Document doc, Node root) {
+		// Get decode files from the decode model
+		if (TraceViewerGlobals.getDecodeProvider() != null) {
+			List<TraceActivationComponentItem> components = TraceViewerGlobals
+					.getDecodeProvider().getActivationInformation(false);
+
+			// Loop through components
+			for (int i = 0; i < components.size(); i++) {
+
+				// Get previously opened decode file
+				String decodeFile = components.get(i).getFilePath();
+
+				// Check that file exists
+				File file = new File(decodeFile);
+				if (file.exists()) {
+
+					Node decodeFileNode = doc.createElement(DECODEFILE_TAG);
+
+					// Set as contents of the node
+					decodeFileNode.setTextContent(decodeFile);
+
+					// Set as child to parent
+					root.appendChild(decodeFileNode);
+				}
+			}
+
+			// Check if there are ZIP files
+			List<String> zipFiles = ((OpenDecodeFileAction) TraceViewerGlobals
+					.getTraceViewer().getView().getActionFactory()
+					.getOpenDecodeFileAction()).getStartupFiles();
+
+			for (int i = 0; i < zipFiles.size(); i++) {
+				String decodeFile = zipFiles.get(i);
+
+				// Check that file exists
+				File file = new File(decodeFile);
+				if (file.exists()) {
+
+					boolean addZipFile = false;
+
+					// Check that at least one of the components can be found
+					// from the ZIP file
+					try {
+						ZipFile zipFile = new ZipFile(file);
+						Enumeration<? extends ZipEntry> entries = zipFile
+								.entries();
+
+						// Go through ZIP file entries
+						while (entries.hasMoreElements()) {
+							String name = entries.nextElement().getName();
+
+							// Go through components
+							for (int j = 0; j < components.size(); j++) {
+								TraceActivationComponentItem component = components
+										.get(j);
+
+								// Component file path matches the ZIP file
+								// entry
+								if (component.getFilePath().equals(name)) {
+									addZipFile = true;
+									break;
+								}
+							}
+						}
+					} catch (IOException e) {
+					}
+
+					// Only add ZIP file if at least one component was found
+					// from it
+					if (addZipFile) {
+						Node decodeFileNode = doc.createElement(DECODEFILE_TAG);
+
+						// Set as contents of the node
+						decodeFileNode.setTextContent(decodeFile);
+
+						// Set as child to parent
+						root.appendChild(decodeFileNode);
+					}
+				}
+			}
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/XMLGeneralConfigurationImporter.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,105 @@
+/*
+ * 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:
+ *
+ * Imports general configuration from XML file
+ *
+ */
+package com.nokia.traceviewer.engine.preferences;
+
+import java.io.File;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import com.nokia.traceviewer.action.OpenDecodeFileAction;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Imports general configuration from XML file
+ */
+public class XMLGeneralConfigurationImporter extends
+		XMLBaseConfigurationImporter {
+
+	/**
+	 * Constructor
+	 * 
+	 * @param configurationFileName
+	 *            file name where to import data from
+	 * @param pathRelative
+	 *            tells is the path relative
+	 */
+	public XMLGeneralConfigurationImporter(String configurationFileName,
+			boolean pathRelative) {
+		super(null, configurationFileName, pathRelative);
+	}
+
+	/**
+	 * Imports data
+	 */
+	public void importData() {
+		File file = new File(filePath);
+		if (file.exists()) {
+			Document doc = getDocument();
+
+			if (doc != null) {
+
+				// Get lineCount node from the XML file
+				NodeList list = doc.getElementsByTagName(GENERAL_TAG);
+				Node parent = list.item(0);
+
+				// Import configurations
+				if (parent != null) {
+					NodeList children = parent.getChildNodes();
+					for (int i = 0; i < children.getLength(); i++) {
+						if (children.item(i) instanceof Element) {
+							processItems(children.item(i));
+						}
+					}
+				}
+			}
+		}
+	}
+
+	/**
+	 * Import configurations
+	 * 
+	 * @param node
+	 *            Configuration node
+	 */
+	private void processItems(Node node) {
+		// Decode file
+		if (node.getNodeName().equals(DECODEFILE_TAG)) {
+			processDecodeFile(node);
+		}
+	}
+
+	/**
+	 * Processes decode file node
+	 * 
+	 * @param node
+	 *            node to be processed
+	 */
+	private void processDecodeFile(Node node) {
+		String path = node.getTextContent();
+		if (path != null && !path.equals("")) { //$NON-NLS-1$
+			OpenDecodeFileAction action = (OpenDecodeFileAction) TraceViewerGlobals
+					.getTraceViewer().getView().getActionFactory()
+					.getOpenDecodeFileAction();
+			action.addOpenInStartupDictionary(path);
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/XMLLineCountConfigurationExporter.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,213 @@
+/*
+ * 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:
+ *
+ * Exports LineCountRule configuration to XML file
+ *
+ */
+package com.nokia.traceviewer.engine.preferences;
+
+import javax.xml.transform.stream.StreamResult;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import com.nokia.traceviewer.dialog.treeitem.LineCountTreeComponentItem;
+import com.nokia.traceviewer.dialog.treeitem.LineCountTreeItem;
+import com.nokia.traceviewer.dialog.treeitem.LineCountTreeTextItem;
+import com.nokia.traceviewer.dialog.treeitem.TreeItem;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Exports LineCountRule configuration to XML file
+ */
+public final class XMLLineCountConfigurationExporter extends
+		XMLBaseConfigurationExporter {
+
+	/**
+	 * Constructor
+	 * 
+	 * @param root
+	 *            root of the LineCount elements
+	 * @param configurationFileName
+	 *            file name where to export data
+	 * @param pathRelative
+	 *            tells is the path relative
+	 */
+	public XMLLineCountConfigurationExporter(TreeItem root,
+			String configurationFileName, boolean pathRelative) {
+		super(root, configurationFileName, pathRelative);
+	}
+
+	/**
+	 * Exports data
+	 */
+	public void export() {
+		Document doc = getDocument();
+		Node parent;
+
+		// Get root node of line count rules
+		NodeList list = doc.getElementsByTagName(LINECOUNT_TAG);
+
+		// Tag not found
+		if (list.getLength() == 0) {
+			parent = doc.createElement(LINECOUNT_TAG);
+			// Get the main configurations tag
+			NodeList list2 = doc.getElementsByTagName(CONFIGURATIONS_TAG);
+			Node mainRoot = list2.item(0);
+			mainRoot.appendChild(parent);
+		} else {
+			parent = list.item(0);
+		}
+
+		// Delete old rule information
+		NodeList children = parent.getChildNodes();
+		int len = children.getLength();
+		for (int i = 0; i < len; i++) {
+			parent.removeChild(children.item(0));
+		}
+
+		// Process through the tree
+		for (int i = 0; i < root.getChildren().length; i++) {
+			processChild((LineCountTreeItem) root.getChildren()[i], doc, parent);
+		}
+
+		// Get result from document
+		StreamResult result = getResultFromDocument(doc);
+
+		// Print out
+		String xmlString = result.getWriter().toString();
+		writeFile(xmlString);
+	}
+
+	/**
+	 * Process child
+	 * 
+	 * @param item
+	 *            child to process
+	 * @param doc
+	 *            document
+	 * @param root
+	 *            node to insert this child to
+	 */
+	private void processChild(LineCountTreeItem item, Document doc, Node root) {
+		// Process through the tree
+		Node newItem = null;
+		// Group rule
+		if (item.getRule() == LineCountTreeItem.Rule.GROUP) {
+			newItem = doc.createElement(GROUP_TAG);
+			// Create a configuration
+		} else {
+			newItem = doc.createElement(CONFIGURATION_TAG);
+		}
+
+		// Get attributes
+		NamedNodeMap itemAttributes = newItem.getAttributes();
+
+		// Set name
+		Attr name = doc.createAttribute(NAME_TAG);
+		name.setValue(item.getName());
+		itemAttributes.setNamedItem(name);
+
+		// Set rule if not group item
+		if (item.getRule() != LineCountTreeItem.Rule.GROUP) {
+			Attr rule = doc.createAttribute(RULE_TAG);
+			if (item.getRule() == LineCountTreeItem.Rule.TEXT_RULE) {
+				rule.setValue(TEXTRULE_TAG);
+			} else if (item.getRule() == LineCountTreeItem.Rule.COMPONENT_RULE) {
+				rule.setValue(COMPONENTRULE_TAG);
+			} else {
+				String unknownText = Messages
+						.getString("XMLLineCountRuleConfigurationExporter.UnknownText"); //$NON-NLS-1$
+				rule.setValue(unknownText);
+			}
+			itemAttributes.setNamedItem(rule);
+
+			// Add enabled attribute
+			Attr enabled = doc.createAttribute(ENABLED_TAG);
+			boolean checked = isChecked(item);
+			if (checked) {
+				enabled.setValue(YES_TAG);
+			} else {
+				enabled.setValue(NO_TAG);
+			}
+			itemAttributes.setNamedItem(enabled);
+		}
+
+		// Set as child to parent
+		root.appendChild(newItem);
+
+		// Set nodes when text rule
+		if (item.getRule() == LineCountTreeItem.Rule.TEXT_RULE) {
+			LineCountTreeTextItem textItem = (LineCountTreeTextItem) item;
+
+			// Text
+			Node text = doc.createElement(TEXT_TAG);
+			text.setTextContent(textItem.getText());
+			newItem.appendChild(text);
+
+			// Match case
+			Node matchCase = doc.createElement(MATCHCASE_TAG);
+			if (textItem.isMatchCase()) {
+				matchCase.setTextContent(YES_TAG);
+			} else {
+				matchCase.setTextContent(NO_TAG);
+			}
+			newItem.appendChild(matchCase);
+
+			// Component rule
+		} else if (item.getRule() == LineCountTreeItem.Rule.TEXT_RULE) {
+			LineCountTreeComponentItem componentItem = (LineCountTreeComponentItem) item;
+
+			// Component ID
+			Node component = doc.createElement(COMPONENTID_TAG);
+			component.setTextContent(String.valueOf(componentItem
+					.getComponentId()));
+			newItem.appendChild(component);
+
+			// Group ID
+			Node group = doc.createElement(GROUPID_TAG);
+			group.setTextContent(String.valueOf(componentItem.getGroupId()));
+			newItem.appendChild(group);
+		}
+
+		// Loop through own children
+		for (int i = 0; i < item.getChildren().length; i++) {
+			processChild((LineCountTreeItem) item.getChildren()[i], doc,
+					newItem);
+		}
+	}
+
+	/**
+	 * Checks it the given item is checked in the dialog
+	 * 
+	 * @param item
+	 *            item to be checked
+	 * @return true if the given item is checked
+	 */
+	private boolean isChecked(LineCountTreeItem item) {
+		boolean checked = false;
+		if (TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+				.getLineCountProcessor().getTextRules().contains(item)
+				|| TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+						.getLineCountProcessor().getComponentRules().contains(
+								item)) {
+			checked = true;
+		}
+		return checked;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/XMLLineCountConfigurationImporter.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,263 @@
+/*
+ * 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:
+ *
+ * Imports LineCountRule configuration from XML file
+ *
+ */
+package com.nokia.traceviewer.engine.preferences;
+
+import java.io.File;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import com.nokia.traceviewer.dialog.BasePropertyDialog;
+import com.nokia.traceviewer.dialog.treeitem.LineCountTreeBaseItem;
+import com.nokia.traceviewer.dialog.treeitem.LineCountTreeComponentItem;
+import com.nokia.traceviewer.dialog.treeitem.LineCountTreeItem;
+import com.nokia.traceviewer.dialog.treeitem.LineCountTreeTextItem;
+import com.nokia.traceviewer.dialog.treeitem.TreeItem;
+import com.nokia.traceviewer.dialog.treeitem.TreeItemListener;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Imports LineCountRule configuration from XML file
+ */
+public final class XMLLineCountConfigurationImporter extends
+		XMLBaseConfigurationImporter {
+
+	/**
+	 * Constructor
+	 * 
+	 * @param root
+	 *            root of the LineCount elements
+	 * @param configurationFileName
+	 *            file name where to export data
+	 * @param pathRelative
+	 *            tells is the path relative
+	 */
+	public XMLLineCountConfigurationImporter(TreeItem root,
+			String configurationFileName, boolean pathRelative) {
+		super(root, configurationFileName, pathRelative);
+	}
+
+	/**
+	 * Imports data
+	 */
+	public void importData() {
+		File file = new File(filePath);
+		if (file.exists()) {
+			Document doc = getDocument();
+
+			if (doc != null) {
+
+				// Remove all children from the tree item
+				Object[] oldRules = root.getChildren();
+				for (int i = 0; i < oldRules.length; i++) {
+					root.removeChild((LineCountTreeItem) oldRules[i]);
+				}
+
+				// Delete old rules from the processor
+				TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+						.getLineCountProcessor().getLineCountItems().clear();
+				TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+						.getLineCountProcessor().getTextRules().clear();
+				TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+						.getLineCountProcessor().getComponentRules().clear();
+
+				// Get lineCount node from the XML file
+				NodeList list = doc.getElementsByTagName(LINECOUNT_TAG);
+				Node parent = list.item(0);
+
+				// Import rules
+				if (parent != null) {
+					NodeList children = parent.getChildNodes();
+					for (int i = 0; i < children.getLength(); i++) {
+						if (children.item(i) instanceof Element) {
+							processChild(children.item(i), root);
+						}
+					}
+				}
+			}
+		}
+	}
+
+	/**
+	 * Import this Line Count rule to root
+	 * 
+	 * @param node
+	 *            Line Count node to import
+	 * @param root
+	 *            Root node of lineCount dialog
+	 */
+	private void processChild(Node node, TreeItem root) {
+		String name = null;
+		NamedNodeMap itemAttributes = node.getAttributes();
+
+		// Get name
+		Attr nameAttr = (Attr) itemAttributes.getNamedItem(NAME_TAG);
+		name = nameAttr.getValue();
+
+		// Group item
+		TreeItem newItem = null;
+		if (node.getNodeName().equals(GROUP_TAG)) {
+			newItem = new LineCountTreeBaseItem(TraceViewerGlobals
+					.getTraceViewer().getDataProcessorAccess()
+					.getLineCountProcessor().getTreeItemListener(), root, name,
+					LineCountTreeItem.Rule.GROUP);
+
+			// This is for normal rules
+		} else if (node.getNodeName().equals(CONFIGURATION_TAG)) {
+
+			// Get tree item listener from the processor
+			TreeItemListener listener = TraceViewerGlobals.getTraceViewer()
+					.getDataProcessorAccess().getLineCountProcessor()
+					.getTreeItemListener();
+
+			// Get rule
+			Attr ruleAttr = (Attr) itemAttributes.getNamedItem(RULE_TAG);
+			String rule = ruleAttr.getValue();
+
+			if (rule.equals(TEXTRULE_TAG)) {
+				newItem = processTextRule(node, root, name, listener);
+			} else if (rule.equals(COMPONENTRULE_TAG)) {
+				newItem = processComponentRule(node, root, name, listener);
+			}
+
+			// Check if the rules should be kept over boot
+			Attr enabledAttr = (Attr) itemAttributes.getNamedItem(ENABLED_TAG);
+			if (enabledAttr != null) {
+				String enabled = enabledAttr.getValue();
+				if (enabled.equals(YES_TAG)) {
+					TraceViewerGlobals.getTraceViewer()
+							.getDataProcessorAccess().getLineCountProcessor()
+							.enableRule((LineCountTreeItem) newItem);
+				}
+			}
+
+		} else {
+			// Unknown rule, shouldn't come here
+		}
+
+		// Add the child to the parent node
+		if (newItem != null) {
+			root.addChild(newItem);
+		}
+
+		// If node was group, process it's children
+		if (node.getNodeName().equals(GROUP_TAG)) {
+			// Get children
+			NodeList children = node.getChildNodes();
+			for (int i = 0; i < children.getLength(); i++) {
+				if (children.item(i) instanceof Element) {
+					processChild(children.item(i), newItem);
+				}
+			}
+		}
+
+	}
+
+	/**
+	 * Process text LineCount rule
+	 * 
+	 * @param node
+	 *            node to process
+	 * @param root
+	 *            root node
+	 * @param name
+	 *            name for the rule
+	 * @param listener
+	 *            TreeItem Listener
+	 * @return the newly created text item
+	 */
+	private TreeItem processTextRule(Node node, TreeItem root, String name,
+			TreeItemListener listener) {
+		TreeItem newItem;
+		String text = null;
+		boolean matchCase = false;
+		NodeList textProperties = node.getChildNodes();
+		for (int i = 0; i < textProperties.getLength(); i++) {
+			if (textProperties.item(i) instanceof Element) {
+				if (textProperties.item(i).getNodeName().equals(TEXT_TAG)) {
+					text = textProperties.item(i).getTextContent();
+				} else if (textProperties.item(i).getNodeName().equals(
+						MATCHCASE_TAG)) {
+					if (textProperties.item(i).getTextContent().equals(NO_TAG)) {
+						matchCase = false;
+					} else {
+						matchCase = true;
+					}
+				}
+			}
+		}
+
+		// Create new item
+		newItem = new LineCountTreeTextItem(listener, root, name,
+				LineCountTreeItem.Rule.TEXT_RULE, text, matchCase);
+		return newItem;
+	}
+
+	/**
+	 * Process component LineCount rule
+	 * 
+	 * @param node
+	 *            node to process
+	 * @param root
+	 *            root node
+	 * @param name
+	 *            name of the rule
+	 * @param listener
+	 *            TreeItem Listener
+	 * @return the newly created component item
+	 */
+	private TreeItem processComponentRule(Node node, TreeItem root,
+			String name, TreeItemListener listener) {
+		TreeItem newItem;
+		int componentId = BasePropertyDialog.WILDCARD_INTEGER;
+		int groupId = BasePropertyDialog.WILDCARD_INTEGER;
+		NodeList properties = node.getChildNodes();
+		for (int i = 0; i < properties.getLength(); i++) {
+			if (properties.item(i) instanceof Element) {
+				String nodeName = properties.item(i).getNodeName();
+				if (nodeName.equals(COMPONENTID_TAG)) {
+					// Get component ID. If parse fails, it means that component
+					// ID is a wildcard
+					try {
+						componentId = Integer.parseInt(properties.item(i)
+								.getTextContent());
+					} catch (NumberFormatException e) {
+					}
+				} else if (nodeName.equals(GROUPID_TAG)) {
+					// Get group ID. If parse fails, it means that group
+					// ID is a wildcard
+					try {
+						groupId = Integer.parseInt(properties.item(i)
+								.getTextContent());
+					} catch (NumberFormatException e) {
+					}
+				}
+			}
+		}
+
+		// Create new component item
+		newItem = new LineCountTreeComponentItem(listener, root, name,
+				LineCountTreeItem.Rule.COMPONENT_RULE, componentId, groupId);
+		return newItem;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/XMLTriggerConfigurationExporter.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,225 @@
+/*
+ * 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:
+ *
+ * Exports Trigger configuration to XML file
+ *
+ */
+package com.nokia.traceviewer.engine.preferences;
+
+import javax.xml.transform.stream.StreamResult;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import com.nokia.traceviewer.dialog.treeitem.TreeItem;
+import com.nokia.traceviewer.dialog.treeitem.TriggerTreeItem;
+import com.nokia.traceviewer.dialog.treeitem.TriggerTreeTextItem;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Exports Trigger configuration to XML file
+ * 
+ */
+public class XMLTriggerConfigurationExporter extends
+		XMLBaseConfigurationExporter {
+
+	/**
+	 * Constructor
+	 * 
+	 * @param root
+	 *            root of the Trigger elements
+	 * @param configurationFileName
+	 *            file name where to export data
+	 * @param pathRelative
+	 *            tells is the path relative
+	 */
+	public XMLTriggerConfigurationExporter(TreeItem root,
+			String configurationFileName, boolean pathRelative) {
+		super(root, configurationFileName, pathRelative);
+	}
+
+	/**
+	 * Exports data
+	 */
+	public void export() {
+		Document doc = getDocument();
+		Node parent;
+
+		// Get root node of line count rules
+		NodeList list = doc.getElementsByTagName(TRIGGER_TAG);
+
+		// Tag not found
+		if (list.getLength() == 0) {
+			parent = doc.createElement(TRIGGER_TAG);
+			// Get the main configurations tag
+			NodeList list2 = doc.getElementsByTagName(CONFIGURATIONS_TAG);
+			Node mainRoot = list2.item(0);
+			mainRoot.appendChild(parent);
+		} else {
+			parent = list.item(0);
+		}
+
+		// Delete old rule information
+		NodeList children = parent.getChildNodes();
+		int len = children.getLength();
+		for (int i = 0; i < len; i++) {
+			parent.removeChild(children.item(0));
+		}
+
+		// Process through the tree
+		for (int i = 0; i < root.getChildren().length; i++) {
+			processChild((TriggerTreeItem) root.getChildren()[i], doc, parent);
+		}
+
+		// Get result from document
+		StreamResult result = getResultFromDocument(doc);
+
+		// Print out
+		String xmlString = result.getWriter().toString();
+		writeFile(xmlString);
+	}
+
+	/**
+	 * Process child
+	 * 
+	 * @param item
+	 *            child to process
+	 * @param doc
+	 *            document
+	 * @param root
+	 *            node to insert this child to
+	 */
+	private void processChild(TriggerTreeItem item, Document doc, Node root) {
+
+		// Process through the tree
+		Node newItem = null;
+		if (item.getRule() == TriggerTreeItem.Rule.GROUP) {
+			newItem = doc.createElement(GROUP_TAG);
+		} else if (item.getRule() == TriggerTreeItem.Rule.TEXT_RULE) {
+			newItem = doc.createElement(CONFIGURATION_TAG);
+		}
+		if (newItem != null) {
+
+			// Get attributes
+			NamedNodeMap itemAttributes = newItem.getAttributes();
+
+			// Set name
+			Attr name = doc.createAttribute(NAME_TAG);
+			name.setValue(item.getName());
+			itemAttributes.setNamedItem(name);
+
+			// Set rule if not group item
+			if (item.getRule() != TriggerTreeItem.Rule.GROUP) {
+				Attr rule = doc.createAttribute(RULE_TAG);
+				if (item.getRule() == TriggerTreeItem.Rule.TEXT_RULE) {
+					rule.setValue(TEXTRULE_TAG);
+				} else {
+					String unknownText = Messages
+							.getString("XMLTriggerConfigurationExporter.UnknownText"); //$NON-NLS-1$
+					rule.setValue(unknownText);
+				}
+				itemAttributes.setNamedItem(rule);
+
+				// Add enabled attribute for activation triggers
+				if (item.getType() == TriggerTreeItem.Type.ACTIVATIONTRIGGER) {
+					Attr enabled = doc.createAttribute(ENABLED_TAG);
+					boolean checked = isChecked(item);
+					if (checked) {
+						enabled.setValue(YES_TAG);
+					} else {
+						enabled.setValue(NO_TAG);
+					}
+					itemAttributes.setNamedItem(enabled);
+				}
+			}
+
+			// Set as child to parent
+			root.appendChild(newItem);
+
+			// Set nodes when text rule
+			if (item.getRule() == TriggerTreeItem.Rule.TEXT_RULE) {
+				TriggerTreeTextItem textItem = (TriggerTreeTextItem) item;
+
+				// Text
+				Node text = doc.createElement(TEXT_TAG);
+				text.setTextContent(textItem.getText());
+				newItem.appendChild(text);
+
+				// Match case
+				Node matchCase = doc.createElement(MATCHCASE_TAG);
+				if (textItem.isMatchCase()) {
+					matchCase.setTextContent(YES_TAG);
+				} else {
+					matchCase.setTextContent(NO_TAG);
+				}
+				newItem.appendChild(matchCase);
+
+				// TriggerType
+				Node triggerType = doc.createElement(TRIGGERTYPE_TAG);
+				if (textItem.getType() == TriggerTreeItem.Type.STARTTRIGGER) {
+					triggerType.setTextContent(STARTTRIGGER_TAG);
+				} else if (textItem.getType() == TriggerTreeItem.Type.STARTTRIGGER) {
+					triggerType.setTextContent(STOPTRIGGER_TAG);
+				} else if (textItem.getType() == TriggerTreeItem.Type.ACTIVATIONTRIGGER) {
+					triggerType.setTextContent(ACTIVATIONTRIGGER_TAG);
+				}
+				newItem.appendChild(triggerType);
+
+				// Specific cases for Activation trigger
+				if (textItem.getType() == TriggerTreeItem.Type.ACTIVATIONTRIGGER) {
+					// Configuration file path
+					Node configurationFile = doc
+							.createElement(CONFIGURATION_FILE_TAG);
+					configurationFile.setTextContent(textItem
+							.getConfigurationFilePath());
+					newItem.appendChild(configurationFile);
+
+					// Configuration name
+					Node configurationName = doc
+							.createElement(CONFIGURATION_NAME_TAG);
+					configurationName.setTextContent(textItem
+							.getConfigurationName());
+					newItem.appendChild(configurationName);
+				}
+
+			}
+
+			// Loop through own children
+			for (int i = 0; i < item.getChildren().length; i++) {
+				processChild((TriggerTreeItem) item.getChildren()[i], doc,
+						newItem);
+			}
+		}
+	}
+
+	/**
+	 * Checks it the given item is checked in the dialog
+	 * 
+	 * @param item
+	 *            item to be checked
+	 * @return true if the given item is checked
+	 */
+	private boolean isChecked(TriggerTreeItem item) {
+		boolean checked = false;
+		if (TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+				.getTriggerProcessor().getActivationTriggers().contains(item)) {
+			checked = true;
+		}
+		return checked;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/XMLTriggerConfigurationImporter.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,246 @@
+/*
+ * 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:
+ *
+ * Imports Trigger configuration from XML file
+ *
+ */
+package com.nokia.traceviewer.engine.preferences;
+
+import java.io.File;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import com.nokia.traceviewer.dialog.treeitem.TreeItem;
+import com.nokia.traceviewer.dialog.treeitem.TreeItemListener;
+import com.nokia.traceviewer.dialog.treeitem.TriggerTreeBaseItem;
+import com.nokia.traceviewer.dialog.treeitem.TriggerTreeItem;
+import com.nokia.traceviewer.dialog.treeitem.TriggerTreeTextItem;
+import com.nokia.traceviewer.dialog.treeitem.TriggerTreeItem.Type;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Imports Trigger configuration from XML file
+ * 
+ */
+public class XMLTriggerConfigurationImporter extends
+		XMLBaseConfigurationImporter {
+
+	/**
+	 * Constructor
+	 * 
+	 * @param root
+	 *            root of the Trigger elements
+	 * @param configurationFileName
+	 *            file name where to export data
+	 * @param pathRelative
+	 *            tells is the path relative
+	 */
+	public XMLTriggerConfigurationImporter(TreeItem root,
+			String configurationFileName, boolean pathRelative) {
+		super(root, configurationFileName, pathRelative);
+	}
+
+	/**
+	 * Imports data
+	 */
+	public void importData() {
+		File file = new File(filePath);
+		if (file.exists()) {
+			Document doc = getDocument();
+
+			if (doc != null) {
+
+				// Delete old rules
+				Object[] oldRules = root.getChildren();
+				for (int i = 0; i < oldRules.length; i++) {
+					root.removeChild((TriggerTreeItem) oldRules[i]);
+				}
+
+				// Get trigger node from the XML file
+				NodeList list = doc.getElementsByTagName(TRIGGER_TAG);
+				Node parent = list.item(0);
+
+				// Import children
+				if (parent != null) {
+					NodeList children = parent.getChildNodes();
+					for (int i = 0; i < children.getLength(); i++) {
+						if (children.item(i) instanceof Element) {
+							processChild(children.item(i), root);
+						}
+					}
+				}
+			}
+		}
+	}
+
+	/**
+	 * Import this trigger rule to root
+	 * 
+	 * @param node
+	 *            Trigger node to import
+	 * @param root
+	 *            Root node of trigger dialog
+	 */
+	private void processChild(Node node, TreeItem root) {
+		String name = null;
+		String text = null;
+		boolean matchCase = false;
+		Type triggerType = null;
+
+		NamedNodeMap itemAttributes = node.getAttributes();
+
+		// Get name
+		Attr nameAttr = (Attr) itemAttributes.getNamedItem(NAME_TAG);
+		name = nameAttr.getValue();
+
+		// Group item
+		TreeItem newItem = null;
+		if (node.getNodeName().equals(GROUP_TAG)) {
+			newItem = new TriggerTreeBaseItem(TraceViewerGlobals
+					.getTraceViewer().getDataProcessorAccess()
+					.getTriggerProcessor().getTreeItemListener(), root, name,
+					TriggerTreeItem.Rule.GROUP,
+					TriggerTreeItem.Type.STARTTRIGGER);
+
+			// This is for Text rules
+		} else if (node.getNodeName().equals(CONFIGURATION_TAG)) {
+
+			// Get rule
+			Attr ruleAttr = (Attr) itemAttributes.getNamedItem(RULE_TAG);
+			String rule = ruleAttr.getValue();
+
+			if (rule.equals(TEXTRULE_TAG)) {
+				newItem = processTextRule(node, root, name, text, matchCase,
+						triggerType);
+
+			} else {
+				// Unknown rule, shouldn't come here
+			}
+
+			// Check if the rules should be kept over boot
+			Attr enabledAttr = (Attr) itemAttributes.getNamedItem(ENABLED_TAG);
+			if (enabledAttr != null && newItem != null) {
+				String enabled = enabledAttr.getValue();
+				if (enabled.equals(YES_TAG)) {
+					TraceViewerGlobals.getTraceViewer()
+							.getDataProcessorAccess().getTriggerProcessor()
+							.enableRule((TriggerTreeItem) newItem);
+				}
+			}
+
+		} else {
+			// Unknown rule, shouldn't come here
+		}
+
+		// Add the child to the parent node
+		if (newItem != null) {
+			root.addChild(newItem);
+		}
+
+		// If node was group, process it's children
+		if (node.getNodeName().equals(GROUP_TAG)) {
+			// Get children
+			NodeList children = node.getChildNodes();
+			for (int i = 0; i < children.getLength(); i++) {
+				if (children.item(i) instanceof Element) {
+					processChild(children.item(i), newItem);
+				}
+			}
+		}
+
+	}
+
+	/**
+	 * Processes text rule
+	 * 
+	 * @param node
+	 *            xml node
+	 * @param root
+	 *            root of trigger rules
+	 * @param name
+	 *            name of the rule
+	 * @param text
+	 *            text of the rule
+	 * @param matchCase
+	 *            match case value
+	 * @param triggerType
+	 *            trigger type
+	 * @return newly created trigger item
+	 */
+	private TreeItem processTextRule(Node node, TreeItem root, String name,
+			String text, boolean matchCase, Type triggerType) {
+		String configurationFilePath = null;
+		String configurationName = null;
+
+		TreeItem newItem;
+		// Get the text properties
+		NodeList textProperties = node.getChildNodes();
+		for (int i = 0; i < textProperties.getLength(); i++) {
+			if (textProperties.item(i) instanceof Element) {
+				// Text
+				if (textProperties.item(i).getNodeName().equals(TEXT_TAG)) {
+					text = textProperties.item(i).getTextContent();
+					// Match case
+				} else if (textProperties.item(i).getNodeName().equals(
+						MATCHCASE_TAG)) {
+					if (textProperties.item(i).getTextContent().equals(NO_TAG)) {
+						matchCase = false;
+					} else {
+						matchCase = true;
+					}
+					// Trigger type
+				} else if (textProperties.item(i).getNodeName().equals(
+						TRIGGERTYPE_TAG)) {
+					if (textProperties.item(i).getTextContent().equals(
+							STARTTRIGGER_TAG)) {
+						triggerType = TriggerTreeItem.Type.STARTTRIGGER;
+					} else if (textProperties.item(i).getTextContent().equals(
+							STOPTRIGGER_TAG)) {
+						triggerType = TriggerTreeItem.Type.STOPTRIGGER;
+					} else if (textProperties.item(i).getTextContent().equals(
+							ACTIVATIONTRIGGER_TAG)) {
+						triggerType = TriggerTreeItem.Type.ACTIVATIONTRIGGER;
+					} else {
+						// Unknown type, shouldn't come here
+					}
+					// Configuration file
+				} else if (textProperties.item(i).getNodeName().equals(
+						CONFIGURATION_FILE_TAG)) {
+					configurationFilePath = textProperties.item(i)
+							.getTextContent();
+
+					// Configuration name
+				} else if (textProperties.item(i).getNodeName().equals(
+						CONFIGURATION_NAME_TAG)) {
+					configurationName = textProperties.item(i).getTextContent();
+				}
+			}
+		}
+
+		// Create new item
+		TreeItemListener listener = TraceViewerGlobals.getTraceViewer()
+				.getDataProcessorAccess().getTriggerProcessor()
+				.getTreeItemListener();
+		newItem = new TriggerTreeTextItem(listener, root, name,
+				TriggerTreeItem.Rule.TEXT_RULE, text, matchCase, triggerType,
+				configurationFilePath, configurationName);
+		return newItem;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/XMLVariableTracingConfigurationExporter.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,201 @@
+/*
+ * 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:
+ *
+ * Exports Variable Tracing configuration to XML file
+ *
+ */
+package com.nokia.traceviewer.engine.preferences;
+
+import javax.xml.transform.stream.StreamResult;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import com.nokia.traceviewer.dialog.treeitem.TreeItem;
+import com.nokia.traceviewer.dialog.treeitem.VariableTracingTreeItem;
+import com.nokia.traceviewer.dialog.treeitem.VariableTracingTreeTextItem;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Exports Variable Tracing configuration to XML file
+ */
+public final class XMLVariableTracingConfigurationExporter extends
+		XMLBaseConfigurationExporter {
+
+	/**
+	 * Constructor
+	 * 
+	 * @param root
+	 *            root of the LineCount elements
+	 * @param configurationFileName
+	 *            file name where to export data
+	 * @param pathRelative
+	 *            tells is the path relative
+	 */
+	public XMLVariableTracingConfigurationExporter(TreeItem root,
+			String configurationFileName, boolean pathRelative) {
+		super(root, configurationFileName, pathRelative);
+	}
+
+	/**
+	 * Exports data
+	 */
+	public void export() {
+		Document doc = getDocument();
+		Node parent;
+
+		// Get root node of line count rules
+		NodeList list = doc.getElementsByTagName(VARIABLETRACING_TAG);
+
+		// Tag not found
+		if (list.getLength() == 0) {
+			parent = doc.createElement(VARIABLETRACING_TAG);
+			// Get the main configurations tag
+			NodeList list2 = doc.getElementsByTagName(CONFIGURATIONS_TAG);
+			Node mainRoot = list2.item(0);
+			mainRoot.appendChild(parent);
+		} else {
+			parent = list.item(0);
+		}
+
+		// Delete old rule information
+		NodeList children = parent.getChildNodes();
+		int len = children.getLength();
+		for (int i = 0; i < len; i++) {
+			parent.removeChild(children.item(0));
+		}
+
+		// Process through the tree
+		for (int i = 0; i < root.getChildren().length; i++) {
+			processChild((VariableTracingTreeItem) root.getChildren()[i], doc,
+					parent);
+		}
+
+		// Get result from document
+		StreamResult result = getResultFromDocument(doc);
+
+		// Print out
+		String xmlString = result.getWriter().toString();
+		writeFile(xmlString);
+	}
+
+	/**
+	 * Process child
+	 * 
+	 * @param item
+	 *            child to process
+	 * @param doc
+	 *            document
+	 * @param root
+	 *            node to insert this child to
+	 */
+	private void processChild(VariableTracingTreeItem item, Document doc,
+			Node root) {
+
+		// Process through the tree
+		Node newItem = null;
+		if (item.getRule() == VariableTracingTreeItem.Rule.GROUP) {
+			newItem = doc.createElement(GROUP_TAG);
+		} else if (item.getRule() == VariableTracingTreeItem.Rule.TEXT_RULE) {
+			newItem = doc.createElement(CONFIGURATION_TAG);
+		}
+		if (newItem != null) {
+
+			// Get attributes
+			NamedNodeMap itemAttributes = newItem.getAttributes();
+
+			// Set name
+			Attr name = doc.createAttribute(NAME_TAG);
+			name.setValue(item.getName());
+			itemAttributes.setNamedItem(name);
+
+			// Set rule if not group item
+			if (item.getRule() != VariableTracingTreeItem.Rule.GROUP) {
+				Attr rule = doc.createAttribute(RULE_TAG);
+				if (item.getRule() == VariableTracingTreeItem.Rule.TEXT_RULE) {
+					rule.setValue(TEXTRULE_TAG);
+				} else {
+					String unknownText = Messages
+							.getString("XMLVariableTracingConfigurationExporter.Unkn"); //$NON-NLS-1$ 
+					rule.setValue(unknownText);
+				}
+				itemAttributes.setNamedItem(rule);
+
+				// Add enabled attribute
+				Attr enabled = doc.createAttribute(ENABLED_TAG);
+				boolean checked = isChecked(item);
+				if (checked) {
+					enabled.setValue(YES_TAG);
+				} else {
+					enabled.setValue(NO_TAG);
+				}
+				itemAttributes.setNamedItem(enabled);
+			}
+
+			// Set as child to parent
+			root.appendChild(newItem);
+
+			// Set nodes when text rule
+			if (item.getRule() == VariableTracingTreeItem.Rule.TEXT_RULE) {
+				VariableTracingTreeTextItem textItem = (VariableTracingTreeTextItem) item;
+
+				// Text
+				Node text = doc.createElement(TEXT_TAG);
+				text.setTextContent(textItem.getText());
+				newItem.appendChild(text);
+
+				// Match case
+				Node matchCase = doc.createElement(MATCHCASE_TAG);
+				if (textItem.isMatchCase()) {
+					matchCase.setTextContent(YES_TAG);
+				} else {
+					matchCase.setTextContent(NO_TAG);
+				}
+				newItem.appendChild(matchCase);
+
+				// Save History
+				Node saveHistory = doc.createElement(SAVEHISTORY_TAG);
+				saveHistory.setTextContent(String.valueOf(textItem
+						.getHistoryCount()));
+				newItem.appendChild(saveHistory);
+			}
+
+			// Loop through own children
+			for (int i = 0; i < item.getChildren().length; i++) {
+				processChild((VariableTracingTreeItem) item.getChildren()[i],
+						doc, newItem);
+			}
+		}
+	}
+
+	/**
+	 * Checks it the given item is checked in the dialog
+	 * 
+	 * @param item
+	 *            item to be checked
+	 * @return true if the given item is checked
+	 */
+	private boolean isChecked(VariableTracingTreeItem item) {
+		boolean checked = false;
+		if (TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+				.getVariableTracingProcessor().getTextRules().contains(item)) {
+			checked = true;
+		}
+		return checked;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/XMLVariableTracingConfigurationImporter.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,223 @@
+/*
+ * 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:
+ *
+ * Imports Variable Tracing configuration from XML file
+ *
+ */
+package com.nokia.traceviewer.engine.preferences;
+
+import java.io.File;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import com.nokia.traceviewer.dialog.treeitem.TreeItem;
+import com.nokia.traceviewer.dialog.treeitem.TreeItemListener;
+import com.nokia.traceviewer.dialog.treeitem.VariableTracingTreeBaseItem;
+import com.nokia.traceviewer.dialog.treeitem.VariableTracingTreeItem;
+import com.nokia.traceviewer.dialog.treeitem.VariableTracingTreeTextItem;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Imports Variable Tracing configuration from XML file
+ */
+public final class XMLVariableTracingConfigurationImporter extends
+		XMLBaseConfigurationImporter {
+
+	/**
+	 * Constructor
+	 * 
+	 * @param root
+	 *            root of the LineCount elements
+	 * @param configurationFileName
+	 *            file name where to export data
+	 * @param pathRelative
+	 *            tells is the path relative
+	 */
+	public XMLVariableTracingConfigurationImporter(TreeItem root,
+			String configurationFileName, boolean pathRelative) {
+		super(root, configurationFileName, pathRelative);
+	}
+
+	/**
+	 * Imports data
+	 */
+	public void importData() {
+		File file = new File(filePath);
+		if (file.exists()) {
+			Document doc = getDocument();
+
+			if (doc != null) {
+
+				// Delete and clear old rules
+				Object[] oldRules = root.getChildren();
+				for (int i = 0; i < oldRules.length; i++) {
+					root.removeChild((VariableTracingTreeItem) oldRules[i]);
+				}
+				TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+						.getVariableTracingProcessor()
+						.getVariableTracingItems().clear();
+				TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+						.getVariableTracingProcessor().getTextRules().clear();
+
+				// Get variabletracing node from the XML file
+				NodeList list = doc.getElementsByTagName(VARIABLETRACING_TAG);
+				Node parent = list.item(0);
+
+				// Import children
+				if (parent != null) {
+					NodeList children = parent.getChildNodes();
+					for (int i = 0; i < children.getLength(); i++) {
+						if (children.item(i) instanceof Element) {
+							processChild(children.item(i), root);
+						}
+					}
+				}
+			}
+		}
+	}
+
+	/**
+	 * Import this variableTracing rule to root
+	 * 
+	 * @param node
+	 *            VariableTracing node to import
+	 * @param root
+	 *            Root node of variableTracing dialog
+	 */
+	private void processChild(Node node, TreeItem root) {
+		String name = null;
+		String text = null;
+		boolean matchCase = false;
+		int saveHistory = 0;
+
+		NamedNodeMap itemAttributes = node.getAttributes();
+
+		// Get name
+		Attr nameAttr = (Attr) itemAttributes.getNamedItem(NAME_TAG);
+		name = nameAttr.getValue();
+
+		// Group item
+		TreeItem newItem = null;
+		if (node.getNodeName().equals(GROUP_TAG)) {
+			newItem = new VariableTracingTreeBaseItem(TraceViewerGlobals
+					.getTraceViewer().getDataProcessorAccess()
+					.getVariableTracingProcessor().getTreeItemListener(), root,
+					name, VariableTracingTreeItem.Rule.GROUP);
+
+			// Configurations tag
+		} else if (node.getNodeName().equals(CONFIGURATION_TAG)) {
+
+			// Get rule
+			Attr ruleAttr = (Attr) itemAttributes.getNamedItem(RULE_TAG);
+			String rule = ruleAttr.getValue();
+
+			// Process text rule
+			if (rule.equals(TEXTRULE_TAG)) {
+				newItem = processTextRule(node, root, name, text, matchCase,
+						saveHistory);
+			}
+
+			// Check if the rules should be kept over boot
+			Attr enabledAttr = (Attr) itemAttributes.getNamedItem(ENABLED_TAG);
+			if (enabledAttr != null && newItem != null) {
+				String enabled = enabledAttr.getValue();
+				if (enabled.equals(YES_TAG)) {
+					TraceViewerGlobals.getTraceViewer()
+							.getDataProcessorAccess()
+							.getVariableTracingProcessor().enableRule(
+									(VariableTracingTreeItem) newItem);
+				}
+			}
+		} else {
+			// Shouldn't come here
+		}
+
+		if (newItem != null) {
+			root.addChild(newItem);
+		}
+
+		// If node was group, process it's children
+		if (node.getNodeName().equals(GROUP_TAG)) {
+			// Get children
+			NodeList children = node.getChildNodes();
+			for (int i = 0; i < children.getLength(); i++) {
+				if (children.item(i) instanceof Element) {
+					processChild(children.item(i), newItem);
+				}
+			}
+		}
+
+	}
+
+	/**
+	 * Processes text rule
+	 * 
+	 * @param node
+	 *            xml node
+	 * @param root
+	 *            parent node
+	 * @param name
+	 *            name of the rule
+	 * @param text
+	 *            text of the rule
+	 * @param matchCase
+	 *            match case value
+	 * @param saveHistory
+	 *            amount of history items to save
+	 * @return newly created text item
+	 */
+	private TreeItem processTextRule(Node node, TreeItem root, String name,
+			String text, boolean matchCase, int saveHistory) {
+		TreeItem newItem;
+		// Get the text properties
+		NodeList textProperties = node.getChildNodes();
+		for (int i = 0; i < textProperties.getLength(); i++) {
+			if (textProperties.item(i) instanceof Element) {
+				if (textProperties.item(i).getNodeName().equals(TEXT_TAG)) {
+					text = textProperties.item(i).getTextContent();
+				} else if (textProperties.item(i).getNodeName().equals(
+						MATCHCASE_TAG)) {
+					if (textProperties.item(i).getTextContent().equals(NO_TAG)) {
+						matchCase = false;
+					} else {
+						matchCase = true;
+					}
+				} else if (textProperties.item(i).getNodeName().equals(
+						SAVEHISTORY_TAG)) {
+					try {
+						saveHistory = Integer.parseInt(textProperties.item(i)
+								.getTextContent());
+					} catch (Exception e) {
+						saveHistory = 0;
+					}
+				}
+			}
+		}
+
+		// Create new item
+		TreeItemListener listener = TraceViewerGlobals.getTraceViewer()
+				.getDataProcessorAccess().getVariableTracingProcessor()
+				.getTreeItemListener();
+		newItem = new VariableTracingTreeTextItem(listener, root, name,
+				VariableTracingTreeItem.Rule.TEXT_RULE, text, matchCase,
+				saveHistory);
+		return newItem;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/messages.properties	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,38 @@
+XMLTriggerConfigurationExporter.UnknownText=Unknown
+XMLFilterConfigurationExporter.UnknownText=Unknown
+XMLColorConfigurationExporter.UnknownText=Unknown
+PreferenceConstants.DefaultConfigurationFile=userConf.xml
+XMLBaseConfigurationImporter.IncorrectFileErrorMsg=Configuration file incorrect, please check or remove it manually\!
+XMLLineCountRuleConfigurationExporter.UnknownText=Unknown
+XMLVariableTracingConfigurationExporter.Unkn=Unknown
+TraceViewerAdvancedPreferencesPage.ExternalFilterInformation=After enabling the external filter, you can start it by\nclicking Start External Filter on TraceViewer's toolbar. 
+TraceViewerAdvancedPreferencesPage.AdvancedGroupName=Advanced settings
+TraceViewerAdvancedPreferencesPage.BrowseButtonText=Browse...
+TraceViewerAdvancedPreferencesPage.BrowseButtonToolTip=Browse for a external filter application
+TraceViewerAdvancedPreferencesPage.ExternalFilterText=Use external stdin/stdout filter command 
+TraceViewerAdvancedPreferencesPage.CommandEditorText=Filter command:
+TraceViewerConnectionPreferencesPage.ServiceUiFailed=Connection service UI could not be constructed\!\nThis is propably due to missing license.
+TraceViewerConnectionPreferencesPage.AutoConnectDynamicText=Auto connect to dynamic connections
+TraceViewerConnectionPreferencesPage.AutoConnectDynamicToolTip=Auto connects to dynamic connections.\nWorks when the connection is set to "Current connection" and\nthe dynamic connection becomes the "Current connection".
+TraceViewerPluginsPreferencesPage.InfoLabel=Additional plugins using and contributing to TraceViewer product\nmay reside under this preference page.
+TraceViewerPluginsPreferencesPage.TitleLabel=TraceViewer Plugins Preference Page
+TraceViewerPreferencesPage.AutoReloadDictionariesText=Automatically reload changed Dictionaries
+TraceViewerPreferencesPage.AutoReloadDictionariesToolTip=If checked and loaded Dictionary changes, it is automatically reloaded
+TraceViewerPreferencesPage.ShowBTraceVariablesText=Show BTrace variables in OST traces
+TraceViewerPreferencesPage.ShowBTraceVariablesToolTip=If checked, Thread ID and possibly CPU ID are shown in the trace text in OST traces
+TraceViewerPreferencesPage.GeneralSettingsText=General TraceViewer settings
+TraceViewerPreferencesPage.GeneralGroupText=General settings
+TraceViewerPreferencesPage.TimeFromPreviousToolTip=Shows milliseconds from previous trace inside brackets after the timestamp of the trace
+TraceViewerPreferencesPage.TimestampAccuracyText=Timestamp accuracy
+TraceViewerPreferencesPage.MilliSecondsText=Milliseconds
+TraceViewerPreferencesPage.MicroSecondsText=Microseconds
+TraceViewerPreferencesPage.ShowPreviousTimeText=Show milliseconds from previous trace after timestamps
+TraceViewerPreferencesPage.ShowComponentGroupName=Show component and group name before the trace text
+TraceViewerPreferencesPage.ShowComponentAndGroupToolTip=Shows component and group name before the trace if they are available
+TraceViewerPreferencesPage.ShowClassFunctionName=Show class and function name before the trace text
+TraceViewerPreferencesPage.ShowClassAndFunctionToolTip=Shows class and function name before the trace if they are available
+TraceViewerPreferencesPage.ShowUndecodedTracesAsText=Show undecoded traces as:
+TraceViewerPreferencesPage.ShowUndecodedTracesAsInfoText="BINARY TRACE" text 
+TraceViewerPreferencesPage.ShowUndecodedTracesAsHexText=HEX
+TraceViewerPreferencesPage.ShowUndecodedTracesAsIDsText=Identification numbers and data
+TraceViewerPreferencesPage.DataFormatText=Data format
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/wizard/AbstractImportExportPage.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,135 @@
+/*
+ * 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:
+ *
+ * Abstract import / export page
+ *
+ */
+package com.nokia.traceviewer.engine.preferences.wizard;
+
+import org.eclipse.jface.viewers.*;
+import org.eclipse.jface.wizard.WizardPage;
+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.*;
+
+/**
+ * Abstract superclass of import and export page
+ * 
+ */
+public abstract class AbstractImportExportPage extends WizardPage {
+
+	/**
+	 * Path text
+	 */
+	protected Text pathText;
+
+	/**
+	 * Browse button
+	 */
+	protected Button browseButton;
+
+	/**
+	 * Table viewer
+	 */
+	protected CheckboxTableViewer viewer;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param pageName
+	 *            page name
+	 */
+	public AbstractImportExportPage(String pageName) {
+		super(pageName);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets
+	 * .Composite)
+	 */
+	public void createControl(Composite parent) {
+		initializeDialogUnits(parent);
+
+		Composite composite = new Composite(parent, SWT.NONE);
+		composite.setLayout(new GridLayout());
+		composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL
+				| GridData.HORIZONTAL_ALIGN_FILL));
+		composite.setSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
+		composite.setFont(parent.getFont());
+
+		setControl(composite);
+	}
+
+	/**
+	 * Create browse group
+	 * 
+	 * @param parent
+	 *            parent composite
+	 * @param labelText
+	 *            label text
+	 */
+	protected void createBrowseGroup(Composite parent, String labelText) {
+		Composite composite = new Composite(parent, SWT.NONE);
+		GridLayout layout = new GridLayout();
+		layout.numColumns = 3;
+		composite.setLayout(layout);
+		composite.setFont(parent.getFont());
+		composite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL
+				| GridData.GRAB_HORIZONTAL));
+
+		// Label
+		Label label = new Label(composite, SWT.NONE);
+		label.setText(labelText);
+		label.setFont(parent.getFont());
+
+		// Path text
+		pathText = new Text(composite, SWT.BORDER);
+		GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL
+				| GridData.GRAB_HORIZONTAL);
+		data.widthHint = 250;
+		pathText.setLayoutData(data);
+		pathText.setFont(parent.getFont());
+		pathText.addModifyListener(new ModifyListener() {
+			public void modifyText(ModifyEvent e) {
+				setPageComplete(validatePage(true));
+			}
+		});
+
+		// Browse button
+		browseButton = new Button(composite, SWT.PUSH);
+		browseButton.setText(Messages
+				.getString("AbstractImportExportPage.BrowseButtonText")); //$NON-NLS-1$
+		browseButton
+				.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
+		browseButton.setFont(parent.getFont());
+		setButtonLayoutData(browseButton);
+	}
+
+	/**
+	 * Validates the page
+	 * 
+	 * @param validateFile
+	 *            file path
+	 * @return true if page is OK, false otherwise
+	 */
+	protected abstract boolean validatePage(boolean validateFile);
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/wizard/ExportPage.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,123 @@
+/*
+ * 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:
+ *
+ * Export page
+ *
+ */
+package com.nokia.traceviewer.engine.preferences.wizard;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.*;
+
+import java.io.File;
+
+/**
+ * Page in export wizard
+ * 
+ */
+public class ExportPage extends AbstractImportExportPage {
+
+	/**
+	 * File
+	 */
+	private File file;
+
+	/**
+	 * Save as parent
+	 */
+	private static String saveAsParent;
+
+	/**
+	 * Constructor
+	 */
+	protected ExportPage() {
+		super("ExportPage"); //$NON-NLS-1$
+		setTitle(Messages.getString("ExportPage.PageTitle")); //$NON-NLS-1$
+		setDescription(Messages.getString("ExportPage.PageDescription")); //$NON-NLS-1$
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.preferences.wizard.AbstractImportExportPage
+	 * #createControl(org.eclipse.swt.widgets.Composite)
+	 */
+	@Override
+	public void createControl(Composite parent) {
+		super.createControl(parent);
+		Composite composite = (Composite) getControl();
+
+		// Create browse group
+		createBrowseGroup(composite, Messages
+				.getString("ExportPage.BrowseGroupText")); //$NON-NLS-1$
+		browseButton.addSelectionListener(new SelectionAdapter() {
+
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				FileDialog dialog = new FileDialog(getShell(), SWT.SAVE);
+				dialog.setText(Messages.getString("ExportPage.FileDialogText")); //$NON-NLS-1$
+				if (saveAsParent == null)
+					saveAsParent = System.getProperty("user.home"); //$NON-NLS-1$
+				dialog.setFilterPath(saveAsParent);
+				dialog.setFileName("TVConfigurations.xml"); //$NON-NLS-1$
+				String path = dialog.open();
+				if (path != null) {
+					IPath saveAsPath = new Path(path);
+					saveAsParent = saveAsPath.removeLastSegments(1).toString();
+					pathText.setText(saveAsPath.toOSString());
+				}
+			}
+		});
+		setPageComplete(validatePage(true));
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.preferences.wizard.AbstractImportExportPage
+	 * #validatePage(boolean)
+	 */
+	@Override
+	protected boolean validatePage(boolean validateFile) {
+		setErrorMessage(null);
+		boolean valid = !validateFile;
+		if (validateFile) {
+			IPath path = new Path(pathText.getText());
+			file = path.toFile();
+			valid = file.isAbsolute();
+		}
+
+		if (!valid) {
+			setErrorMessage(Messages.getString("ExportPage.NoFileSelectedMsg")); //$NON-NLS-1$
+		}
+		return valid;
+	}
+
+	/**
+	 * Get file
+	 * 
+	 * @return given file
+	 */
+	public File getFile() {
+		return file;
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/wizard/ExportWizard.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,114 @@
+/*
+ * 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:
+ *
+ * Export wizard
+ *
+ */
+package com.nokia.traceviewer.engine.preferences.wizard;
+
+import java.io.File;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.IExportWizard;
+import org.eclipse.ui.IWorkbench;
+
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.preferences.XMLColorConfigurationExporter;
+import com.nokia.traceviewer.engine.preferences.XMLFilterConfigurationExporter;
+import com.nokia.traceviewer.engine.preferences.XMLLineCountConfigurationExporter;
+import com.nokia.traceviewer.engine.preferences.XMLTriggerConfigurationExporter;
+import com.nokia.traceviewer.engine.preferences.XMLVariableTracingConfigurationExporter;
+
+/**
+ * Wizard for exporting TraceViewer configurations to a file
+ */
+public class ExportWizard extends Wizard implements IExportWizard {
+
+	/**
+	 * Export page
+	 */
+	private ExportPage exportPage;
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.wizard.Wizard#performFinish()
+	 */
+	@Override
+	public boolean performFinish() {
+		boolean success = false;
+		File file = exportPage.getFile();
+		if (file != null) {
+			String fn = file.getAbsolutePath();
+
+			// Export Filter rules to XML file
+			XMLFilterConfigurationExporter filterExporter = new XMLFilterConfigurationExporter(
+					TraceViewerGlobals.getTraceViewer()
+							.getDataProcessorAccess().getFilterProcessor()
+							.getRoot(), fn, false);
+			filterExporter.export();
+
+			// Export Color rules to XML file
+			XMLColorConfigurationExporter colorExporter = new XMLColorConfigurationExporter(
+					TraceViewerGlobals.getTraceViewer()
+							.getDataProcessorAccess().getColorer().getRoot(),
+					fn, false);
+			colorExporter.export();
+
+			// Export LineCount rules to XML file
+			XMLLineCountConfigurationExporter countExporter = new XMLLineCountConfigurationExporter(
+					TraceViewerGlobals.getTraceViewer()
+							.getDataProcessorAccess().getLineCountProcessor()
+							.getRoot(), fn, false);
+			countExporter.export();
+
+			// Export Variable Tracing rules to XML file
+			XMLVariableTracingConfigurationExporter var = new XMLVariableTracingConfigurationExporter(
+					TraceViewerGlobals.getTraceViewer()
+							.getDataProcessorAccess()
+							.getVariableTracingProcessor().getRoot(), fn, false);
+			var.export();
+
+			// Export Trigger rules to XML file
+			XMLTriggerConfigurationExporter triggerExporter = new XMLTriggerConfigurationExporter(
+					TraceViewerGlobals.getTraceViewer()
+							.getDataProcessorAccess().getTriggerProcessor()
+							.getRoot(), fn, false);
+			triggerExporter.export();
+
+			// Inform about export succesful
+			String exported = Messages.getString("ExportWizard.Emsg"); //$NON-NLS-1$
+			TraceViewerGlobals.getTraceViewer().getDialogs()
+					.showInformationMessage(exported);
+			success = true;
+		}
+
+		return success;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench,
+	 * org.eclipse.jface.viewers.IStructuredSelection)
+	 */
+	public void init(IWorkbench workbench, IStructuredSelection selection) {
+		setWindowTitle(Messages.getString("ExportWizard.ExportTitle")); //$NON-NLS-1$
+		exportPage = new ExportPage();
+		addPage(exportPage);
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/wizard/ImportPage.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,126 @@
+/*
+ * 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:
+ *
+ * Import page
+ *
+ */
+package com.nokia.traceviewer.engine.preferences.wizard;
+
+import java.io.File;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.*;
+
+/**
+ * Page in import wizard
+ * 
+ */
+public class ImportPage extends AbstractImportExportPage {
+
+	/**
+	 * File
+	 */
+	private File file;
+
+	/**
+	 * Filter extensions
+	 */
+	static final String[] FILTER_EXTS = { "*.xml", //$NON-NLS-1$
+			"*.*" //$NON-NLS-1$
+	};
+
+	/**
+	 * Filter extension names
+	 */
+	static final String[] FILTER_EXT_NAMES = {
+			Messages.getString("ImportPage.ConfigurationFileName"), //$NON-NLS-1$
+			Messages.getString("ImportPage.AllFilesName") }; //$NON-NLS-1$
+
+	/**
+	 * Constructor
+	 */
+	protected ImportPage() {
+		super("ImportPage"); //$NON-NLS-1$
+		setTitle(Messages.getString("ImportPage.PageTitle")); //$NON-NLS-1$
+		setDescription(Messages.getString("ImportPage.PageDescription")); //$NON-NLS-1$
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.preferences.wizard.AbstractImportExportPage
+	 * #createControl(org.eclipse.swt.widgets.Composite)
+	 */
+	@Override
+	public void createControl(Composite parent) {
+		super.createControl(parent);
+		Composite composite = (Composite) getControl();
+
+		// Create browse group
+		createBrowseGroup(composite, Messages
+				.getString("ImportPage.BrowseGroupText")); //$NON-NLS-1$
+		browseButton.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				FileDialog fileDialog = new FileDialog(getShell(), SWT.OPEN);
+				fileDialog.setText(Messages
+						.getString("ImportPage.FileDialogText")); //$NON-NLS-1$
+				fileDialog.setFilterExtensions(FILTER_EXTS);
+				fileDialog.setFilterNames(FILTER_EXT_NAMES);
+				String pathstr = fileDialog.open();
+				if (pathstr != null) {
+					pathText.setText(pathstr);
+				}
+			}
+		});
+
+		setPageComplete(validatePage(true));
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.preferences.wizard.AbstractImportExportPage
+	 * #validatePage(boolean)
+	 */
+	@Override
+	protected boolean validatePage(boolean validateFile) {
+		setErrorMessage(null);
+		boolean valid = !validateFile;
+		if (validateFile) {
+			IPath path = new Path(pathText.getText());
+			file = path.toFile();
+			if (file.exists()) {
+				valid = true;
+			}
+		}
+		return valid;
+	}
+
+	/**
+	 * Get file
+	 * 
+	 * @return given file
+	 */
+	public File getFile() {
+		return file;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/wizard/ImportWizard.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,114 @@
+/*
+ * 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:
+ *
+ * Import wizard
+ *
+ */
+package com.nokia.traceviewer.engine.preferences.wizard;
+
+import java.io.File;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.IImportWizard;
+import org.eclipse.ui.IWorkbench;
+
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.preferences.XMLColorConfigurationImporter;
+import com.nokia.traceviewer.engine.preferences.XMLFilterConfigurationImporter;
+import com.nokia.traceviewer.engine.preferences.XMLLineCountConfigurationImporter;
+import com.nokia.traceviewer.engine.preferences.XMLTriggerConfigurationImporter;
+import com.nokia.traceviewer.engine.preferences.XMLVariableTracingConfigurationImporter;
+
+/**
+ * Wizard for importing TraceViewer configurations from a file
+ */
+public class ImportWizard extends Wizard implements IImportWizard {
+
+	/**
+	 * Import page
+	 */
+	private ImportPage importPage;
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.wizard.Wizard#performFinish()
+	 */
+	@Override
+	public boolean performFinish() {
+		boolean success = false;
+		File file = importPage.getFile();
+		if (file != null) {
+			String fn = file.getAbsolutePath();
+
+			// Import Filter rules
+			XMLFilterConfigurationImporter filterImporter = new XMLFilterConfigurationImporter(
+					TraceViewerGlobals.getTraceViewer()
+							.getDataProcessorAccess().getFilterProcessor()
+							.getRoot(), fn, false);
+			filterImporter.importData();
+
+			// Import Color rules
+			XMLColorConfigurationImporter colorImporter = new XMLColorConfigurationImporter(
+					TraceViewerGlobals.getTraceViewer()
+							.getDataProcessorAccess().getColorer().getRoot(),
+					fn, false);
+			colorImporter.importData();
+
+			// Import LineCount rules
+			XMLLineCountConfigurationImporter countImporter = new XMLLineCountConfigurationImporter(
+					TraceViewerGlobals.getTraceViewer()
+							.getDataProcessorAccess().getLineCountProcessor()
+							.getRoot(), fn, false);
+			countImporter.importData();
+
+			// Import Variable Tracing rules
+			XMLVariableTracingConfigurationImporter var = new XMLVariableTracingConfigurationImporter(
+					TraceViewerGlobals.getTraceViewer()
+							.getDataProcessorAccess()
+							.getVariableTracingProcessor().getRoot(), fn, false);
+			var.importData();
+
+			// Import Trigger rules
+			XMLTriggerConfigurationImporter triggerImporter = new XMLTriggerConfigurationImporter(
+					TraceViewerGlobals.getTraceViewer()
+							.getDataProcessorAccess().getTriggerProcessor()
+							.getRoot(), fn, false);
+			triggerImporter.importData();
+
+			// Inform about import succesful
+			String imported = Messages.getString("ImportWizard.Imsg"); //$NON-NLS-1$
+			TraceViewerGlobals.getTraceViewer().getDialogs()
+					.showInformationMessage(imported);
+
+			success = true;
+		}
+		return success;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench,
+	 * org.eclipse.jface.viewers.IStructuredSelection)
+	 */
+	public void init(IWorkbench workbench, IStructuredSelection selection) {
+		setWindowTitle(Messages.getString("ImportWizard.ImportTitle")); //$NON-NLS-1$
+		importPage = new ImportPage();
+		addPage(importPage);
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/wizard/Messages.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,63 @@
+/*
+ * 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:
+ *
+ * String localization for wizard package.
+ *
+ */
+package com.nokia.traceviewer.engine.preferences.wizard;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * String localization for wizard package.
+ * 
+ */
+final class Messages {
+
+	/**
+	 * Bundle name
+	 */
+	private static final String BUNDLE_NAME = "com.nokia.traceviewer.engine.preferences.wizard.messages"; //$NON-NLS-1$
+
+	/**
+	 * Resource bundle
+	 */
+	private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
+			.getBundle(BUNDLE_NAME);
+
+	/**
+	 * Prevents construction.
+	 */
+	private Messages() {
+	}
+
+	/**
+	 * Maps a key to localized string.
+	 * 
+	 * @param key
+	 *            the key for the string
+	 * @return the localized string
+	 */
+	public static String getString(String key) {
+		String value;
+		try {
+			value = RESOURCE_BUNDLE.getString(key);
+		} catch (MissingResourceException e) {
+			value = '!' + key + '!';
+		}
+		return value;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/engine/preferences/wizard/messages.properties	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,16 @@
+AbstractImportExportPage.BrowseButtonText=Browse...
+ExportPage.BrowseGroupText=Configurations file
+ExportPage.FileDialogText=Select file
+ExportPage.NoFileSelectedMsg=A file must be selected to export configurations data
+ExportPage.PageDescription=Select file to export configurations to
+ExportPage.PageTitle=Export TraceViewer Configurations
+ExportWizard.ExportTitle=Export
+ExportWizard.Emsg=Configurations exported\!
+ImportPage.AllFilesName=All files
+ImportPage.BrowseGroupText=Browse
+ImportPage.ConfigurationFileName=TraceViewer Configuration file
+ImportPage.FileDialogText=Save as
+ImportPage.PageDescription=Select file to import configurations from
+ImportPage.PageTitle=Import TraceViewer Configurations
+ImportWizard.ImportTitle=Import
+ImportWizard.Imsg=Configurations imported\!
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/internal/api/Messages.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,35 @@
+/*
+ * 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:
+ *
+ */
+
+package com.nokia.traceviewer.internal.api;
+
+import org.eclipse.osgi.util.NLS;
+
+@SuppressWarnings("all")
+public final class Messages extends NLS {
+	private static final String BUNDLE_NAME = "com.nokia.traceviewer.internal.api.messages"; //$NON-NLS-1$
+	public static String TraceConnInfo_UnknownConnection;
+	public static String TraceConnInfo_UnknownConnectionRemote;
+	public static String TraceViewerAPI2Impl_UnregisterNotRegisteredClient_ErrMsg;
+	static {
+		// initialize resource bundle
+		NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+	}
+
+	private Messages() {
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/internal/api/TraceConnInfo.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,152 @@
+/*
+ * 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:
+ *
+ */
+package com.nokia.traceviewer.internal.api;
+
+import com.nokia.carbide.remoteconnections.interfaces.IConnection;
+import com.nokia.carbide.remoteconnections.interfaces.IConnectionFactory;
+import com.nokia.carbide.remoteconnections.interfaces.IConnectionType;
+import com.nokia.traceviewer.api.ITraceConnInfo;
+import com.nokia.traceviewer.api.TraceViewerAPI2;
+
+/**
+ * Connection information object that wraps <code>IConnection</code> enabling
+ * only getters for accessing connection specific information. This information
+ * object is used via <code>ITraceConnInfo</code> interface that is used by
+ * <code>TraceViewerAPI2</code>.
+ * 
+ * @see IConnection
+ * @see ITraceConnInfo
+ * @see TraceViewerAPI2
+ */
+public class TraceConnInfo implements ITraceConnInfo {
+
+	/**
+	 * Connection that is wrapped behind read-only interface.
+	 */
+	private final IConnection connection;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param connection
+	 *            connection to get info from.
+	 */
+	public TraceConnInfo(IConnection connection) {
+		this.connection = connection;
+	}
+
+	/**
+	 * Returns a null connection type in case no connection types set.
+	 * 
+	 * @return null connection type in case no connection types set
+	 */
+	private IConnectionType getNullConnectionType() {
+		return new IConnectionType() {
+			/*
+			 * (non-Javadoc)
+			 * 
+			 * @see
+			 * com.nokia.carbide.remoteconnections.interfaces.IConnectionType
+			 * #getIdentifier()
+			 */
+			public String getIdentifier() {
+				return ""; //$NON-NLS-1$
+			}
+
+			/*
+			 * (non-Javadoc)
+			 * 
+			 * @see
+			 * com.nokia.carbide.remoteconnections.interfaces.IConnectionType
+			 * #getHelpContext()
+			 */
+			public String getHelpContext() {
+				return ""; //$NON-NLS-1$
+			}
+
+			/*
+			 * (non-Javadoc)
+			 * 
+			 * @see
+			 * com.nokia.carbide.remoteconnections.interfaces.IConnectionType
+			 * #getDisplayName()
+			 */
+			public String getDisplayName() {
+				return Messages.TraceConnInfo_UnknownConnection;
+			}
+
+			/*
+			 * (non-Javadoc)
+			 * 
+			 * @see
+			 * com.nokia.carbide.remoteconnections.interfaces.IConnectionType
+			 * #getDescription()
+			 */
+			public String getDescription() {
+				return Messages.TraceConnInfo_UnknownConnectionRemote;
+			}
+
+			/*
+			 * (non-Javadoc)
+			 * 
+			 * @see
+			 * com.nokia.carbide.remoteconnections.interfaces.IConnectionType
+			 * #getConnectionFactory()
+			 */
+			public IConnectionFactory getConnectionFactory() {
+				return null;
+			}
+		};
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.api.ITraceConnInfo#getConnectionType()
+	 */
+	public IConnectionType getConnectionType() {
+		if (connection == null) {
+			return getNullConnectionType();
+		}
+		return connection.getConnectionType();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.api.ITraceConnInfo#getDisplayName()
+	 */
+	public String getDisplayName() {
+		if (connection == null) {
+			return getNullConnectionType().getDisplayName();
+		}
+		return connection.getDisplayName();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.api.ITraceConnInfo#getIdentifier()
+	 */
+	public String getIdentifier() {
+		if (connection == null) {
+			return getNullConnectionType().getIdentifier();
+		}
+		return connection.getIdentifier();
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/internal/api/TraceViewerAPI2Impl.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,207 @@
+/*
+ * 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:
+ *
+ */
+
+package com.nokia.traceviewer.internal.api;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import com.nokia.carbide.remoteconnections.interfaces.IConnection;
+import com.nokia.traceviewer.api.ITraceConnClient;
+import com.nokia.traceviewer.api.ITraceConnInfo;
+import com.nokia.traceviewer.api.TraceConnectivityException;
+import com.nokia.traceviewer.api.TraceViewerAPI;
+import com.nokia.traceviewer.api.TraceViewerAPI2;
+import com.nokia.traceviewer.api.TraceViewerAPI.TVAPIError;
+import com.nokia.traceviewer.engine.ConnectionHelper;
+
+/**
+ * Implementation if TraceViewer API functions that offers - notification
+ * services for client on connection status changes. - keeps count of active
+ * clients, and disconnects data source only when there is no more active
+ * clients.
+ */
+public class TraceViewerAPI2Impl {
+
+	/**
+	 * Storage for currently registered clients.
+	 */
+	public static Set<ITraceConnClient> clients = Collections
+			.synchronizedSet(new HashSet<ITraceConnClient>());
+
+	/**
+	 * Connect using current settings defined in TraceViewer's preferences.
+	 * Client is registered successfully in case no exceptions are thrown.
+	 * 
+	 * @param client
+	 *            client requesting the connection.
+	 * @return connection info about the connected service.
+	 * @throws TraceConnectivityException
+	 */
+	public static ITraceConnInfo connect(ITraceConnClient client)
+			throws TraceConnectivityException {
+		TVAPIError error = TraceViewerAPI.connect();
+		if (error == TVAPIError.NONE || error == TVAPIError.ALREADY_CONNECTED) {
+			// Register must have after connect attempt because it triggers
+			// notifications to already registered clients
+			registerClient(client);
+		} else {
+			throw new TraceConnectivityException(error);
+		}
+		IConnection connectionWithCurrentID = ConnectionHelper
+				.getConnectionWithCurrentID();
+		return new TraceConnInfo(connectionWithCurrentID);
+	}
+
+	/**
+	 * Connects using current settings defined in TraceViewer's preferences
+	 * Client is disconnected and unregistered successfully for notifications in
+	 * case no exceptions are thrown.
+	 * 
+	 * @param client
+	 *            client requesting the connection.
+	 * @throws TraceConnectivityException
+	 */
+	public static void disconnect(ITraceConnClient client)
+			throws TraceConnectivityException {
+		// Client is unregistered in any case and must be done before
+		// disconnect() is called
+		// because ínside disconnect() there is callback back to
+		// hasRegisteredClients() method.
+		boolean clientWasRegistered = unregisterClient(client);
+		// Real disconnect only, if there are no more other clients using the
+		// connection
+		if (!hasRegisteredClients()) {
+			TVAPIError error = TraceViewerAPI.disconnect();
+			if (error != TVAPIError.NONE) {
+				throw new TraceConnectivityException(error);
+			}
+		}
+		// clientWasRegistered is true if the client was registered before
+		// unregister attempt
+		if (!clientWasRegistered) {
+			// Reporting also possible failures that are possible errors in
+			// client code
+			throw new RuntimeException(
+					TraceViewerAPI2.class.getSimpleName()
+							+ ": " //$NON-NLS-1$ 
+							+ Messages.TraceViewerAPI2Impl_UnregisterNotRegisteredClient_ErrMsg
+							+ ": " + client); //$NON-NLS-1$ 
+		}
+	}
+
+	/**
+	 * Checks if there are any registered clients left.
+	 * 
+	 * @return <code>true</code> if there are registered clients, otherwise
+	 *         <code>false</code>.
+	 */
+	public static boolean hasRegisteredClients() {
+		synchronized (clients) {
+			return !clients.isEmpty();
+		}
+	}
+
+	/**
+	 * Registers client.
+	 * 
+	 * @param client
+	 *            client to register
+	 */
+	private static void registerClient(ITraceConnClient client) {
+		synchronized (clients) {
+			clients.add(client);
+		}
+	}
+
+	/**
+	 * Unregisters client.
+	 * 
+	 * @param client
+	 *            client to unregister
+	 * @return true if the previously registered client was unregistered
+	 *         successfully
+	 */
+	private static boolean unregisterClient(ITraceConnClient client) {
+		synchronized (clients) {
+			// remove returns true if the set contained the specified element.
+			return clients.remove(client);
+		}
+	}
+
+	/**
+	 * Notifies all client about disconnect event
+	 * 
+	 * @param currentConnection
+	 *            currently selected connection
+	 */
+	public static void notifyConnection(IConnection currentConnection) {
+		synchronized (clients) {
+			for (Iterator<ITraceConnClient> iterator = clients.iterator(); iterator
+					.hasNext();) {
+				ITraceConnClient client = iterator.next();
+				client.notifyConnection(new TraceConnInfo(currentConnection));
+			}
+		}
+	}
+
+	/**
+	 * Notifies all client about disconnect event
+	 */
+	public static void notifyDisconnection() {
+		synchronized (clients) {
+			for (Iterator<ITraceConnClient> iterator = clients.iterator(); iterator
+					.hasNext();) {
+				ITraceConnClient client = iterator.next();
+				client.notifyDisconnection();
+			}
+		}
+	}
+
+	/**
+	 * Notifies listeners that connection preferences has been changed.
+	 * 
+	 * @param connectionInfo
+	 *            Connection info about the new connection preferences.
+	 */
+	public static void notifyConnPrefsChanged(IConnection connectionInfo) {
+		synchronized (clients) {
+			for (Iterator<ITraceConnClient> iterator = clients.iterator(); iterator
+					.hasNext();) {
+				ITraceConnClient client = iterator.next();
+				client
+						.notifyConnPrefsChanged(new TraceConnInfo(
+								connectionInfo));
+			}
+		}
+	}
+
+	/**
+	 * Gets count of currently registered clients. This method is meant only for
+	 * unit testing purposes.
+	 * 
+	 * @return count of currently registered clients
+	 */
+	public static int getRegisteredClientsCount() {
+		synchronized (clients) {
+			return clients.size();
+		}
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/internal/api/messages.properties	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,3 @@
+TraceConnInfo_UnknownConnection=Unknown connection
+TraceConnInfo_UnknownConnectionRemote=Unkown connection not created via Remote Connections
+TraceViewerAPI2Impl_UnregisterNotRegisteredClient_ErrMsg=Tried to unregister not registered client
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/view/ColorRuleUpdater.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,75 @@
+/*
+ * 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:
+ *
+ * Color Rule Updater class
+ *
+ */
+package com.nokia.traceviewer.view;
+
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.TextViewer;
+import org.eclipse.swt.custom.StyleRange;
+import org.eclipse.swt.custom.StyledText;
+
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Color Rule Updater class
+ */
+public class ColorRuleUpdater implements Runnable {
+
+	/**
+	 * Style ranges
+	 */
+	private final StyleRange[] ranges;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param ranges
+	 *            Style range
+	 */
+	public ColorRuleUpdater(StyleRange[] ranges) {
+		this.ranges = ranges;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Runnable#run()
+	 */
+	public void run() {
+
+		TextViewer viewer = TraceViewerGlobals.getTraceViewer().getView()
+				.getViewer();
+		StyledText widget = viewer.getTextWidget();
+		IDocument document = viewer.getDocument();
+
+		// Start to replace styleranges
+		if (widget != null && document.getLength() > 0 && ranges.length > 0) {
+			viewer.getTextWidget().replaceStyleRanges(0, document.getLength(),
+					ranges);
+			// Delete all styleranges
+		} else if (widget != null && document.getLength() > 0
+				&& ranges.length == 0) {
+			StyleRange range = new StyleRange(0, document.getLength(), null,
+					null);
+			viewer.getTextWidget().setStyleRange(range);
+		} else {
+			// Do nothing
+		}
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/view/DialogFactory.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,146 @@
+/*
+ * 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:
+ *
+ * Constructs TraceViewer dialogs
+ *
+ */
+package com.nokia.traceviewer.view;
+
+import org.eclipse.swt.widgets.Shell;
+
+import com.nokia.traceviewer.dialog.ColorDialog;
+import com.nokia.traceviewer.dialog.FilterAdvancedDialog;
+import com.nokia.traceviewer.dialog.FilterDialog;
+import com.nokia.traceviewer.dialog.LineCountDialog;
+import com.nokia.traceviewer.dialog.ProgressBarDialog;
+import com.nokia.traceviewer.dialog.SearchDialog;
+import com.nokia.traceviewer.dialog.TraceActivationDialog;
+import com.nokia.traceviewer.dialog.TriggerDialog;
+import com.nokia.traceviewer.dialog.VariableTracingDialog;
+import com.nokia.traceviewer.dialog.VariableTracingHistoryDialog;
+import com.nokia.traceviewer.dialog.treeitem.TreeItem;
+import com.nokia.traceviewer.dialog.treeitem.TreeItemContentProvider;
+import com.nokia.traceviewer.engine.DataProcessorAccess;
+import com.nokia.traceviewer.engine.TraceViewerDialog;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.TraceViewerDialogInterface.Dialog;
+
+/**
+ * Constructs TraceViewer dialogs
+ * 
+ */
+public final class DialogFactory {
+
+	/**
+	 * Constructs a new TraceViewer dialog
+	 * 
+	 * @param name
+	 *            name of the dialog
+	 * @param shell
+	 *            shell of the view
+	 * @return the newly created dialog
+	 */
+	public TraceViewerDialog construct(Dialog name, Shell shell) {
+		TraceViewerDialog dialog = null;
+
+		// First check that the main shell exists and isn't disposed
+		if (shell != null && !shell.isDisposed()) {
+			DataProcessorAccess access = TraceViewerGlobals.getTraceViewer()
+					.getDataProcessorAccess();
+
+			// Create a dialog according to the name
+			switch (name) {
+
+			// Filter dialog
+			case FILTER:
+				dialog = new FilterDialog(shell,
+						(TreeItemContentProvider) access.getFilterProcessor()
+								.getTreeItemListener(), (TreeItem) access
+								.getFilterProcessor().getRoot().getParent());
+				break;
+
+			// Advanced filter dialog
+			case ADVANCEDFILTER:
+				dialog = new FilterAdvancedDialog(shell,
+						(TreeItemContentProvider) access.getFilterProcessor()
+								.getTreeItemListener(), (TreeItem) access
+								.getFilterProcessor().getRoot().getParent());
+				break;
+
+			// Search dialog
+			case SEARCH:
+				dialog = new SearchDialog(shell, TraceViewerGlobals
+						.getTraceViewer().getView());
+				break;
+
+			// Color dialog
+			case COLOR:
+				dialog = new ColorDialog(shell,
+						(TreeItemContentProvider) access.getColorer()
+								.getTreeItemListener(), (TreeItem) access
+								.getColorer().getRoot().getParent());
+				break;
+
+			// Count lines dialog
+			case COUNTLINES:
+				dialog = new LineCountDialog(shell,
+						(TreeItemContentProvider) access
+								.getLineCountProcessor().getTreeItemListener(),
+						(TreeItem) access.getLineCountProcessor().getRoot()
+								.getParent());
+				break;
+
+			// Variable tracing dialog
+			case VARIABLETRACING:
+				dialog = new VariableTracingDialog(shell,
+						(TreeItemContentProvider) access
+								.getVariableTracingProcessor()
+								.getTreeItemListener(), (TreeItem) access
+								.getVariableTracingProcessor().getRoot()
+								.getParent());
+				break;
+
+			// Variable tracing history dialog
+			case VARIBLETRACINGHISTORY:
+				dialog = new VariableTracingHistoryDialog(shell);
+				break;
+
+			// Trace activation dialog
+			case TRACEACTIVATION:
+				dialog = new TraceActivationDialog(shell);
+				break;
+
+			// Trigger dialog
+			case TRIGGER:
+				dialog = new TriggerDialog(shell,
+						(TreeItemContentProvider) access.getTriggerProcessor()
+								.getTreeItemListener(), (TreeItem) access
+								.getTriggerProcessor().getRoot().getParent());
+				break;
+
+			// Progressbar dialog
+			case PROGRESSBAR:
+				dialog = new ProgressBarDialog(shell);
+				break;
+
+			// Default, do nothing
+			default:
+				break;
+			}
+
+		}
+		return dialog;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/view/Messages.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,63 @@
+/*
+ * 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:
+ *
+ * String localization for view package.
+ *
+ */
+package com.nokia.traceviewer.view;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * String localization for view package.
+ * 
+ */
+final class Messages {
+
+	/**
+	 * Bundle name
+	 */
+	private static final String BUNDLE_NAME = "com.nokia.traceviewer.view.messages"; //$NON-NLS-1$
+
+	/**
+	 * Resource bundle
+	 */
+	private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
+			.getBundle(BUNDLE_NAME);
+
+	/**
+	 * Prevents construction.
+	 */
+	private Messages() {
+	}
+
+	/**
+	 * Maps a key to localized string.
+	 * 
+	 * @param key
+	 *            the key for the string
+	 * @return the localized string
+	 */
+	public static String getString(String key) {
+		String value;
+		try {
+			value = RESOURCE_BUNDLE.getString(key);
+		} catch (MissingResourceException e) {
+			value = '!' + key + '!';
+		}
+		return value;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/view/ProcessProgressBarUpdater.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,54 @@
+/*
+ * 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:
+ *
+ * Process ProgressBar updater class
+ *
+ */
+package com.nokia.traceviewer.view;
+
+import com.nokia.traceviewer.dialog.ProgressBarDialog;
+
+/**
+ * Process ProgressBar Updater
+ */
+public class ProcessProgressBarUpdater implements Runnable {
+
+	/**
+	 * Progressbar to be closed
+	 */
+	private final ProgressBarDialog dialog;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param dialog
+	 */
+	ProcessProgressBarUpdater(ProgressBarDialog dialog) {
+		this.dialog = dialog;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Runnable#run()
+	 */
+	public void run() {
+		// Close the progress bar
+		if (dialog != null && dialog.getShell() != null
+				&& !dialog.getShell().isDisposed()) {
+			dialog.close();
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/view/TracePropertyView.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,921 @@
+/*
+ * 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:
+ *
+ * Trace Property view
+ *
+ */
+package com.nokia.traceviewer.view;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.events.ControlListener;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.ViewPart;
+
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.action.AddLineCountRuleAction;
+import com.nokia.traceviewer.action.AddVariableTracingRuleAction;
+import com.nokia.traceviewer.action.DeactivateLineCountRuleAction;
+import com.nokia.traceviewer.action.DeactivateVariableTracingRuleAction;
+import com.nokia.traceviewer.action.EditLineCountRuleAction;
+import com.nokia.traceviewer.action.EditTraceCommentAction;
+import com.nokia.traceviewer.action.EditVariableTracingRuleAction;
+import com.nokia.traceviewer.action.JumpToTraceAction;
+import com.nokia.traceviewer.action.RemoveTraceCommentAction;
+import com.nokia.traceviewer.api.TraceViewerAPI;
+import com.nokia.traceviewer.engine.TraceProperties;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.TraceViewerPropertyViewInterface;
+import com.nokia.traceviewer.engine.dataprocessor.DataProcessor;
+import com.nokia.traceviewer.engine.dataprocessor.LineCountItem;
+import com.nokia.traceviewer.engine.dataprocessor.VariableTracingItem;
+
+/**
+ * Trace Property view
+ */
+public class TracePropertyView extends ViewPart implements
+		TraceViewerPropertyViewInterface, DataProcessor, Runnable {
+
+	/**
+	 * Line count rule name width configuration entry
+	 */
+	private static final String LINECOUNTNAME_WIDTH_CONFIGURATION = "TracePropertyView.LineCountNameWidth"; //$NON-NLS-1$
+
+	/**
+	 * Line count occurrences width configuration entry
+	 */
+	private static final String LINECOUNTOCCURRENCES_WIDTH_CONFIGURATION = "TracePropertyView.OccurrencesWidth"; //$NON-NLS-1$
+
+	/**
+	 * Variable tracing name width configuration entry
+	 */
+	private static final String VARIABLENAME_WIDTH_CONFIGURATION = "TracePropertyView.VariableNameWidth"; //$NON-NLS-1$
+
+	/**
+	 * Variable tracing value width configuration entry
+	 */
+	private static final String VARIABLEVALUE_WIDTH_CONFIGURATION = "TracePropertyView.VariableValueWidth"; //$NON-NLS-1$
+
+	/**
+	 * Name of the right column in variable tracing table
+	 */
+	private static final String VARIABLETABLE_RIGHT_COLUMN_NAME = Messages
+			.getString("TracePropertyView.ValueColumnName"); //$NON-NLS-1$
+
+	/**
+	 * Name of the left column in variable tracing table
+	 */
+	private static final String VARIABLETABLE_LEFT_COLUMN_NAME = Messages
+			.getString("TracePropertyView.VariableTracingColumnName"); //$NON-NLS-1$
+
+	/**
+	 * Name of the right column in line count table
+	 */
+	private static final String LINECOUNTTABLE_OCCURRENCES_COLUMN_NAME = Messages
+			.getString("TracePropertyView.OccurrencesColumnName"); //$NON-NLS-1$
+
+	/**
+	 * Name of the left column in line count table
+	 */
+	private static final String LINECOUNTTABLE_RULE_COLUMN_NAME = Messages
+			.getString("TracePropertyView.LineCountRuleColumnName"); //$NON-NLS-1$
+
+	/**
+	 * Name of the trace number column in the trace comment table
+	 */
+	private static final String TRACECOMMENTTABLE_NUMBER_COLUMN_NAME = Messages
+			.getString("TracePropertyView.TraceNumberColumnName"); //$NON-NLS-1$
+
+	/**
+	 * Name of the trace comment column in the trace comment table
+	 */
+	private static final String TRACECOMMENTTABLE_COMMENT_COLUMN_NAME = Messages
+			.getString("TracePropertyView.TraceCommentColumnName"); //$NON-NLS-1$
+
+	/**
+	 * Width of the left column of line count table
+	 */
+	private static final int LINECOUNTTABLE_RULE_COLUMN_SIZE = 300;
+
+	/**
+	 * Width of the right column of line count table
+	 */
+	private static final int LINECOUNTTABLE_OCCURRENCES_COLUMN_SIZE = 150;
+
+	/**
+	 * Width of the left column of variable tracing table
+	 */
+	private static final int VARIABLETABLE_RULE_COLUMN_SIZE = 150;
+
+	/**
+	 * Width of the right column of variable tracing table
+	 */
+	private static final int VARIABLETABLE_VALUE_COLUMN_SIZE = 300;
+
+	/**
+	 * Update time interval in milliseconds
+	 */
+	private static final long UPDATE_INTERVAL = 100;
+
+	/**
+	 * Timestamp of next update
+	 */
+	private long updateNextTime;
+
+	/**
+	 * Sash that divides the tables horizontally
+	 */
+	private SashForm horizontalSash;
+
+	/**
+	 * Sash that divides the tables vertically
+	 */
+	private SashForm verticalSash;
+
+	/**
+	 * Line counting items table
+	 */
+	private Table lineCountingTable;
+
+	/**
+	 * Variable tracing items table
+	 */
+	private Table variableTracingTable;
+
+	/**
+	 * Trace comment table
+	 */
+	private Table traceCommentTable;
+
+	/**
+	 * Line counting table rule name column
+	 */
+	private TableColumn lineCountRuleNameColumn;
+
+	/**
+	 * Line counting table occurrences column
+	 */
+	private TableColumn lineCountOccurrencesColumn;
+
+	/**
+	 * Variable tracing table value column
+	 */
+	private TableColumn variableTracingValueColumn;
+
+	/**
+	 * Variable tracing table rule name column
+	 */
+	private TableColumn variableTracingRuleNameColumn;
+
+	/**
+	 * Indicates if lineCountingTable should be updated
+	 */
+	private boolean changeToLineCountingTable;
+
+	/**
+	 * Indicates if variableTracingTable should be updated
+	 */
+	private boolean changeToVariableTracingTable;
+
+	/**
+	 * Indicates if traceCommentTable should be updated
+	 */
+	private boolean changeToTraceCommentTable;
+
+	/**
+	 * Indicates that all data hasn't been updated
+	 */
+	private boolean hasUnshownData;
+
+	/**
+	 * Parent composite
+	 */
+	private Composite parent;
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets
+	 * .Composite)
+	 */
+	@Override
+	public void createPartControl(Composite parent) {
+		this.parent = parent;
+		verticalSash = new SashForm(parent, SWT.VERTICAL);
+		horizontalSash = new SashForm(verticalSash, SWT.HORIZONTAL);
+
+		// Create tables and columns
+		createTables();
+
+		// Create context menus to all tables
+		createContextMenus();
+
+		// Create listeners for the tables
+		createListeners();
+
+		horizontalSash.setWeights(new int[] { 50, 50 });
+		verticalSash.setWeights(new int[] { 100, 0 });
+
+		// Get items to tables if they exist
+		if (TraceViewerGlobals.getTraceViewer().getDataProcessorAccess() != null
+				&& TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+						.getLineCountProcessor() != null
+				&& TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+						.getLineCountProcessor().getLineCountItems() != null) {
+			createNewPropertyTableItems();
+		}
+
+		// Set this view to engine
+		TraceViewerGlobals.getTraceViewer().setPropertyView(this);
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(parent,
+				TraceViewerHelpContextIDs.PROPERTY_VIEW);
+	}
+
+	/**
+	 * Creates tables and columns
+	 */
+	private void createTables() {
+		createLineCountTable();
+		createVariableTracingTable();
+		createTraceCommentTable();
+		configureWidgets();
+		createResizeListeners();
+	}
+
+	/**
+	 * Creates line count table
+	 */
+	private void createLineCountTable() {
+		// Line counting table
+		lineCountingTable = new Table(horizontalSash, SWT.BORDER
+				| SWT.FULL_SELECTION);
+		lineCountingTable.setHeaderVisible(true);
+
+		// Create linecount rule name column
+		lineCountRuleNameColumn = new TableColumn(lineCountingTable, SWT.NONE);
+		lineCountRuleNameColumn.setText(LINECOUNTTABLE_RULE_COLUMN_NAME);
+
+		// Create linecount occurrences column
+		lineCountOccurrencesColumn = new TableColumn(lineCountingTable,
+				SWT.NONE);
+		lineCountOccurrencesColumn
+				.setText(LINECOUNTTABLE_OCCURRENCES_COLUMN_NAME);
+	}
+
+	/**
+	 * Creates variable tracing table
+	 */
+	private void createVariableTracingTable() {
+		// Variable tracing table
+		variableTracingTable = new Table(horizontalSash, SWT.BORDER
+				| SWT.FULL_SELECTION | SWT.MULTI);
+		variableTracingTable.setHeaderVisible(true);
+
+		// Create variabletracing rule name column
+		variableTracingRuleNameColumn = new TableColumn(variableTracingTable,
+				SWT.NONE);
+		variableTracingRuleNameColumn.setText(VARIABLETABLE_LEFT_COLUMN_NAME);
+
+		// Create variable tracing value column
+		variableTracingValueColumn = new TableColumn(variableTracingTable,
+				SWT.NONE);
+		variableTracingValueColumn.setText(VARIABLETABLE_RIGHT_COLUMN_NAME);
+	}
+
+	/**
+	 * Creates trace comment table
+	 */
+	private void createTraceCommentTable() {
+		// Trace comment table
+		traceCommentTable = new Table(verticalSash, SWT.BORDER
+				| SWT.FULL_SELECTION);
+		traceCommentTable.setLayout(new GridLayout());
+		traceCommentTable.setHeaderVisible(true);
+		traceCommentTable.setVisible(false);
+
+		// Create trace number column
+		TableColumn traceNumberColumn = new TableColumn(traceCommentTable,
+				SWT.NONE);
+		traceNumberColumn.setText(TRACECOMMENTTABLE_NUMBER_COLUMN_NAME);
+		traceNumberColumn.setWidth(60);
+
+		// Create trace comment column
+		TableColumn traceCommentColumn = new TableColumn(traceCommentTable,
+				SWT.NONE);
+		traceCommentColumn.setText(TRACECOMMENTTABLE_COMMENT_COLUMN_NAME);
+		traceCommentColumn.setWidth(400);
+	}
+
+	/**
+	 * Creates resize listeners to all columns
+	 */
+	private void createResizeListeners() {
+		// Add resize listener to linecount rule name column
+		lineCountRuleNameColumn.addControlListener(new ControlListener() {
+			public void controlMoved(ControlEvent e) {
+			}
+
+			// When column is resized, save new width to preferencestore
+			public void controlResized(ControlEvent e) {
+				TraceViewerPlugin.getDefault().getPreferenceStore().setValue(
+						LINECOUNTNAME_WIDTH_CONFIGURATION,
+						lineCountRuleNameColumn.getWidth());
+			}
+
+		});
+
+		// Add resize listener to linecount occurrences column
+		lineCountOccurrencesColumn.addControlListener(new ControlListener() {
+			public void controlMoved(ControlEvent e) {
+			}
+
+			// When column is resized, save new width to preferencestore
+			public void controlResized(ControlEvent e) {
+				TraceViewerPlugin.getDefault().getPreferenceStore().setValue(
+						LINECOUNTOCCURRENCES_WIDTH_CONFIGURATION,
+						lineCountOccurrencesColumn.getWidth());
+			}
+
+		});
+
+		// Add resize listener to variabletracing rule name column
+		variableTracingRuleNameColumn.addControlListener(new ControlListener() {
+			public void controlMoved(ControlEvent e) {
+			}
+
+			// When column is resized, save new width to preferencestore
+			public void controlResized(ControlEvent e) {
+				TraceViewerPlugin.getDefault().getPreferenceStore().setValue(
+						VARIABLENAME_WIDTH_CONFIGURATION,
+						variableTracingRuleNameColumn.getWidth());
+			}
+
+		});
+
+		// Add resize listener to variabletracing occurrences column
+		variableTracingValueColumn.addControlListener(new ControlListener() {
+			public void controlMoved(ControlEvent e) {
+			}
+
+			// When column is resized, save new width to preferencestore
+			public void controlResized(ControlEvent e) {
+				TraceViewerPlugin.getDefault().getPreferenceStore().setValue(
+						VARIABLEVALUE_WIDTH_CONFIGURATION,
+						variableTracingValueColumn.getWidth());
+			}
+
+		});
+	}
+
+	/**
+	 * Configures the table column sizes
+	 */
+	private void configureWidgets() {
+
+		// Get preference store from the plugin
+		IPreferenceStore preferences = TraceViewerPlugin.getDefault()
+				.getPreferenceStore();
+
+		// Set line count rule name column width
+		int value = preferences.getInt(LINECOUNTNAME_WIDTH_CONFIGURATION);
+		if (value > 0) {
+			lineCountRuleNameColumn.setWidth(value);
+		} else {
+			lineCountRuleNameColumn.setWidth(LINECOUNTTABLE_RULE_COLUMN_SIZE);
+		}
+
+		// Set line count occurrences column width
+		value = preferences.getInt(LINECOUNTOCCURRENCES_WIDTH_CONFIGURATION);
+		if (value > 0) {
+			lineCountOccurrencesColumn.setWidth(value);
+		} else {
+			lineCountOccurrencesColumn
+					.setWidth(LINECOUNTTABLE_OCCURRENCES_COLUMN_SIZE);
+		}
+
+		// Set variable tracing rule name column width
+		value = preferences.getInt(VARIABLENAME_WIDTH_CONFIGURATION);
+		if (value > 0) {
+			variableTracingRuleNameColumn.setWidth(value);
+		} else {
+			variableTracingRuleNameColumn
+					.setWidth(VARIABLETABLE_RULE_COLUMN_SIZE);
+		}
+
+		// Set variable tracing value column width
+		value = preferences.getInt(VARIABLEVALUE_WIDTH_CONFIGURATION);
+		if (value > 0) {
+			variableTracingValueColumn.setWidth(value);
+		} else {
+			variableTracingValueColumn
+					.setWidth(VARIABLETABLE_VALUE_COLUMN_SIZE);
+		}
+	}
+
+	/**
+	 * Creates context menu
+	 */
+	private void createContextMenus() {
+
+		// Create menu manager for line count table.
+		final MenuManager lineCountMenuMgr = new MenuManager();
+		lineCountMenuMgr.setRemoveAllWhenShown(true);
+		lineCountMenuMgr.addMenuListener(new IMenuListener() {
+			public void menuAboutToShow(IMenuManager mgr) {
+				fillLineCountContextMenu(lineCountMenuMgr);
+			}
+		});
+
+		// Create menu
+		Menu menu = lineCountMenuMgr.createContextMenu(lineCountingTable);
+		lineCountingTable.setMenu(menu);
+
+		// Create menu manager for variable tracing table.
+		final MenuManager variableTracingMenuMgr = new MenuManager();
+		variableTracingMenuMgr.setRemoveAllWhenShown(true);
+		variableTracingMenuMgr.addMenuListener(new IMenuListener() {
+			public void menuAboutToShow(IMenuManager mgr) {
+				fillVariableTracingContextMenu(variableTracingMenuMgr);
+			}
+		});
+
+		// Create menu
+		menu = variableTracingMenuMgr.createContextMenu(variableTracingTable);
+		variableTracingTable.setMenu(menu);
+
+		// Create menu manager for trace comment table.
+		final MenuManager traceCommentMenuMgr = new MenuManager();
+		traceCommentMenuMgr.setRemoveAllWhenShown(true);
+		traceCommentMenuMgr.addMenuListener(new IMenuListener() {
+			public void menuAboutToShow(IMenuManager mgr) {
+				fillTraceCommentContextMenu(traceCommentMenuMgr);
+			}
+		});
+
+		// Create menu
+		menu = traceCommentMenuMgr.createContextMenu(traceCommentTable);
+		traceCommentTable.setMenu(menu);
+
+	}
+
+	/**
+	 * Fills the line count context menu
+	 * 
+	 * @param menuMgr
+	 *            menu manager
+	 */
+	public void fillLineCountContextMenu(MenuManager menuMgr) {
+		menuMgr.add(new AddLineCountRuleAction());
+		if (lineCountingTable.getSelectionCount() == 1) {
+			EditLineCountRuleAction editAction = new EditLineCountRuleAction(
+					lineCountingTable.getSelectionIndex());
+			DeactivateLineCountRuleAction deactivateAction = new DeactivateLineCountRuleAction(
+					lineCountingTable.getSelectionIndex(), lineCountingTable);
+			menuMgr.add(editAction);
+			menuMgr.add(deactivateAction);
+		}
+	}
+
+	/**
+	 * Fills the variable tracing context menu
+	 * 
+	 * @param menuMgr
+	 *            menu manager
+	 */
+	public void fillVariableTracingContextMenu(MenuManager menuMgr) {
+		// Variable tracing history
+		menuMgr.add(TraceViewerGlobals.getTraceViewer().getView()
+				.getActionFactory().getOpenVariableTracingHistoryAction());
+		if (variableTracingTable.getSelectionCount() == 0) {
+			TraceViewerGlobals.getTraceViewer().getView().getActionFactory()
+					.getOpenVariableTracingHistoryAction().setEnabled(false);
+		} else {
+			TraceViewerGlobals.getTraceViewer().getView().getActionFactory()
+					.getOpenVariableTracingHistoryAction().setEnabled(true);
+		}
+
+		// Add new and edit actions
+		menuMgr.add(new AddVariableTracingRuleAction());
+		if (variableTracingTable.getSelectionCount() == 1) {
+			EditVariableTracingRuleAction editAction = new EditVariableTracingRuleAction(
+					variableTracingTable.getSelectionIndex());
+			DeactivateVariableTracingRuleAction deactivateAction = new DeactivateVariableTracingRuleAction(
+					variableTracingTable.getSelectionIndex(),
+					variableTracingTable);
+			menuMgr.add(editAction);
+			menuMgr.add(deactivateAction);
+		}
+	}
+
+	/**
+	 * Fills the trace comment table context menu
+	 * 
+	 * @param menuMgr
+	 *            menu manager
+	 */
+	public void fillTraceCommentContextMenu(MenuManager menuMgr) {
+		int selectedTraceNumber = 0;
+		if (traceCommentTable.getSelectionCount() == 1) {
+			selectedTraceNumber = ((Integer) traceCommentTable.getSelection()[0]
+					.getData()).intValue();
+		}
+
+		// Add Jump, Edit and Remove actions
+		JumpToTraceAction jumpToTraceAction = new JumpToTraceAction(
+				selectedTraceNumber);
+		EditTraceCommentAction editAction = new EditTraceCommentAction(
+				selectedTraceNumber);
+		RemoveTraceCommentAction removeAction = new RemoveTraceCommentAction(
+				selectedTraceNumber);
+		menuMgr.add(jumpToTraceAction);
+		menuMgr.add(new Separator());
+		menuMgr.add(editAction);
+		menuMgr.add(removeAction);
+
+		// If no comments are selected, disable the action
+		if (traceCommentTable.getSelectionCount() != 1) {
+			jumpToTraceAction.setEnabled(false);
+			editAction.setEnabled(false);
+			removeAction.setEnabled(false);
+		}
+	}
+
+	/**
+	 * Creates listeners for the tables
+	 */
+	private void createListeners() {
+
+		// Add double click support
+		lineCountingTable.addListener(SWT.DefaultSelection, new Listener() {
+			public void handleEvent(Event e) {
+				EditLineCountRuleAction action = new EditLineCountRuleAction(
+						lineCountingTable.getSelectionIndex());
+				action.run();
+			}
+		});
+
+		// Add double click support
+		variableTracingTable.addListener(SWT.DefaultSelection, new Listener() {
+			public void handleEvent(Event e) {
+				TraceViewerGlobals.getTraceViewer().getView()
+						.getActionFactory()
+						.getOpenVariableTracingHistoryAction().run();
+			}
+		});
+
+		// Add double click support
+		traceCommentTable.addListener(SWT.DefaultSelection, new Listener() {
+			public void handleEvent(Event e) {
+				if (traceCommentTable.getSelectionCount() > 0) {
+					int traceNumber = ((Integer) traceCommentTable
+							.getSelection()[0].getData()).intValue();
+					TraceViewerAPI.syncToTrace(traceNumber, traceNumber);
+				}
+			}
+		});
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.TraceViewerViewInterface#clearAll()
+	 */
+	public void clearAll() {
+		// Empty lineCount items
+		List<LineCountItem> lineCountItems = TraceViewerGlobals
+				.getTraceViewer().getDataProcessorAccess()
+				.getLineCountProcessor().getLineCountItems();
+
+		for (int i = 0; i < lineCountItems.size(); i++) {
+			lineCountItems.get(i).setCount(0);
+			lineCountItems.get(i).setChanged(true);
+		}
+
+		// Empty variableTracing items
+		List<VariableTracingItem> variableTracingItems = TraceViewerGlobals
+				.getTraceViewer().getDataProcessorAccess()
+				.getVariableTracingProcessor().getVariableTracingItems();
+
+		for (int i = 0; i < variableTracingItems.size(); i++) {
+			variableTracingItems.get(i).clear();
+			variableTracingItems.get(i).setChanged(true);
+		}
+
+		changeToLineCountingTable = true;
+		changeToVariableTracingTable = true;
+		changeToTraceCommentTable = true;
+		update();
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.TraceViewerViewInterface#hasUnshownData()
+	 */
+	public boolean hasUnshownData() {
+		return hasUnshownData;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @seecom.nokia.traceviewer.engine.TraceViewerPropertyViewInterface#
+	 * updatePropertyTables()
+	 */
+	public void updatePropertyTables() {
+		changeToLineCountingTable = true;
+		changeToVariableTracingTable = true;
+
+		// Linecounts
+		List<LineCountItem> lineItems = TraceViewerGlobals.getTraceViewer()
+				.getDataProcessorAccess().getLineCountProcessor()
+				.getLineCountItems();
+		for (int i = 0; i < lineItems.size(); i++) {
+			lineItems.get(i).setChanged(true);
+		}
+
+		// Variables
+		List<VariableTracingItem> varItems = TraceViewerGlobals
+				.getTraceViewer().getDataProcessorAccess()
+				.getVariableTracingProcessor().getVariableTracingItems();
+		for (int i = 0; i < varItems.size(); i++) {
+			varItems.get(i).setChanged(true);
+		}
+
+		update();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @seecom.nokia.traceviewer.engine.TraceViewerPropertyViewInterface#
+	 * updateTraceComments()
+	 */
+	public void updateTraceComments() {
+		changeToTraceCommentTable = true;
+		update();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.TraceViewerViewInterface#update()
+	 */
+	public void update() {
+		Display display = this.getDisplay();
+		if ((display != null) && !display.isDisposed()) {
+			display.asyncExec(this);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.DataProcessor#processData(com.nokia.traceviewer
+	 * .engine.TraceProperties)
+	 */
+	public void processData(TraceProperties properties) {
+		if (changeToLineCountingTable || changeToVariableTracingTable) {
+
+			long time = System.currentTimeMillis();
+			// If update interval has passed, call the view update
+			if (time > updateNextTime) {
+				updateNextTime = time + UPDATE_INTERVAL;
+				update();
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Runnable#run()
+	 */
+	public void run() {
+		// Change to the linecounting table
+		if (changeToLineCountingTable) {
+			List<LineCountItem> items = TraceViewerGlobals.getTraceViewer()
+					.getDataProcessorAccess().getLineCountProcessor()
+					.getLineCountItems();
+
+			if (!lineCountingTable.isDisposed()) {
+				// If item count changed, update it to table
+				for (int i = 0; i < items.size(); i++) {
+					LineCountItem item = items.get(i);
+					if (item.isChanged()) {
+						lineCountingTable.getItem(i).setText(1,
+								String.valueOf(item.getCount()));
+						item.setChanged(false);
+					}
+				}
+				changeToLineCountingTable = false;
+			}
+		}
+
+		// Change to the variable tracing table
+		if (changeToVariableTracingTable) {
+			List<VariableTracingItem> items = TraceViewerGlobals
+					.getTraceViewer().getDataProcessorAccess()
+					.getVariableTracingProcessor().getVariableTracingItems();
+
+			if (!variableTracingTable.isDisposed()) {
+				// If item changed, update it to table
+				for (int i = 0; i < items.size(); i++) {
+					VariableTracingItem item = items.get(i);
+					if (item.isChanged()) {
+						variableTracingTable.getItem(i).setText(1,
+								item.getValue());
+						item.setChanged(false);
+					}
+				}
+				changeToVariableTracingTable = false;
+			}
+		}
+
+		// Change to the trace comment table
+		if (changeToTraceCommentTable) {
+			if (!traceCommentTable.isDisposed()) {
+				Map<Integer, String> traceComments = TraceViewerGlobals
+						.getTraceViewer().getDataProcessorAccess()
+						.getTraceCommentHandler().getComments();
+
+				if (!traceComments.isEmpty() && !traceCommentTable.isVisible()) {
+					traceCommentTable.setVisible(true);
+
+					// If table not visible, show it
+					if (verticalSash.getWeights()[0] == 1000) {
+						verticalSash.setWeights(new int[] { 50, 50 });
+					}
+
+					verticalSash.redraw();
+				}
+
+				traceCommentTable.removeAll();
+
+				// Loop the comments map
+				Iterator<Entry<Integer, String>> it = traceComments.entrySet()
+						.iterator();
+				while (it.hasNext()) {
+					Entry<Integer, String> entry = it.next();
+					TableItem item = new TableItem(traceCommentTable, SWT.NONE);
+					item.setData(entry.getKey());
+					String traceNumber = String.valueOf(entry.getKey());
+					item
+							.setText(new String[] { traceNumber,
+									entry.getValue() });
+				}
+			}
+
+		}
+
+		hasUnshownData = false;
+	}
+
+	/**
+	 * Creates new items to table
+	 */
+	public void createNewPropertyTableItems() {
+		// Line counting table - delete old items
+		lineCountingTable.removeAll();
+
+		List<LineCountItem> countItems = TraceViewerGlobals.getTraceViewer()
+				.getDataProcessorAccess().getLineCountProcessor()
+				.getLineCountItems();
+
+		// Insert new items
+		for (int i = 0; i < countItems.size(); i++) {
+			TableItem item = new TableItem(lineCountingTable, SWT.NONE);
+			item.setText(new String[] { countItems.get(i).getName(),
+					String.valueOf(countItems.get(i).getCount()) });
+		}
+
+		// Variabletracing table - delete old items
+		variableTracingTable.removeAll();
+
+		List<VariableTracingItem> variableItems = TraceViewerGlobals
+				.getTraceViewer().getDataProcessorAccess()
+				.getVariableTracingProcessor().getVariableTracingItems();
+
+		// Insert new items
+		for (int i = 0; i < variableItems.size(); i++) {
+			TableItem item = new TableItem(variableTracingTable, SWT.NONE);
+			item.setText(new String[] { variableItems.get(i).getName(),
+					variableItems.get(i).getValue() });
+		}
+
+		changeToLineCountingTable = true;
+		changeToVariableTracingTable = true;
+		update();
+
+	}
+
+	/**
+	 * Gets display
+	 * 
+	 * @return display
+	 */
+	private Display getDisplay() {
+		Display display = null;
+		if (parent != null && !parent.isDisposed()
+				&& parent.getDisplay() != null
+				&& !parent.getDisplay().isDisposed()) {
+			display = parent.getDisplay();
+		}
+		return display;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @seecom.nokia.traceviewer.engine.TraceViewerViewInterface#
+	 * setLineCountTableChanged()
+	 */
+	public void setLineCountTableChanged() {
+		changeToLineCountingTable = true;
+		hasUnshownData = true;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @seecom.nokia.traceviewer.engine.TraceViewerViewInterface#
+	 * setVariableTracingTableChanged()
+	 */
+	public void setVariableTracingTableChanged() {
+		changeToVariableTracingTable = true;
+		hasUnshownData = true;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
+	 */
+	@Override
+	public void setFocus() {
+		parent.setFocus();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.TraceViewerViewInterface#isDisposed()
+	 */
+	public boolean isDisposed() {
+		boolean disposed = false;
+		Display display = getDisplay();
+		if (display == null || display.isDisposed()) {
+			disposed = true;
+		}
+		return disposed;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @seecom.nokia.traceviewer.engine.TraceViewerPropertyViewInterface#
+	 * getSelectedVariableItems()
+	 */
+	public int[] getSelectedVariableIndices() {
+		return variableTracingTable.getSelectionIndices();
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/view/TraceViewerView.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,1745 @@
+/*
+ * 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:
+ *
+ * Trace Viewer view implementation
+ *
+ */
+package com.nokia.traceviewer.view;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.preference.IPreferenceNode;
+import org.eclipse.jface.preference.IPreferencePage;
+import org.eclipse.jface.preference.PreferenceDialog;
+import org.eclipse.jface.preference.PreferenceManager;
+import org.eclipse.jface.preference.PreferenceNode;
+import org.eclipse.jface.text.Document;
+import org.eclipse.jface.text.TextViewer;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyleRange;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+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.Listener;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Slider;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.ViewPart;
+
+import com.nokia.traceviewer.TraceViewerHelpContextIDs;
+import com.nokia.traceviewer.TraceViewerPlugin;
+import com.nokia.traceviewer.action.ActionFactory;
+import com.nokia.traceviewer.action.AddCommentToTraceAction;
+import com.nokia.traceviewer.action.EditTraceCommentAction;
+import com.nokia.traceviewer.action.OpenTraceLocationAction;
+import com.nokia.traceviewer.action.RemoveTraceCommentAction;
+import com.nokia.traceviewer.action.ShowTraceInfoAction;
+import com.nokia.traceviewer.action.TraceViewerActionUtils;
+import com.nokia.traceviewer.dialog.ProgressBarDialog;
+import com.nokia.traceviewer.dialog.SearchDialog;
+import com.nokia.traceviewer.engine.StateHolder;
+import com.nokia.traceviewer.engine.TraceMetaData;
+import com.nokia.traceviewer.engine.TraceProperties;
+import com.nokia.traceviewer.engine.TraceViewerDialog;
+import com.nokia.traceviewer.engine.TraceViewerDialogInterface;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.TraceViewerTraceViewInterface;
+import com.nokia.traceviewer.engine.TraceViewerUtils;
+import com.nokia.traceviewer.engine.dataprocessor.DataProcessor;
+import com.nokia.traceviewer.engine.preferences.PreferenceConstants;
+import com.nokia.traceviewer.engine.preferences.TraceViewerAdvancedPreferencesPage;
+import com.nokia.traceviewer.engine.preferences.TraceViewerConnectionPreferencesPage;
+import com.nokia.traceviewer.engine.preferences.TraceViewerPreferencesPage;
+import com.nokia.traceviewer.view.listener.ScrollerSelectionListener;
+import com.nokia.traceviewer.view.listener.SelectionProperties;
+import com.nokia.traceviewer.view.listener.ViewerClickListener;
+import com.nokia.traceviewer.view.listener.ViewerKeyListener;
+import com.nokia.traceviewer.view.listener.ViewerMouseWheelListener;
+import com.nokia.traceviewer.view.listener.ViewerSelectionChangedListener;
+import com.nokia.traceviewer.view.listener.WindowResizeListener;
+
+/**
+ * Trace Viewer view implementation
+ */
+public final class TraceViewerView extends ViewPart implements
+		TraceViewerTraceViewInterface, TraceViewerDialogInterface,
+		DataProcessor, Runnable {
+
+	/**
+	 * Title of the view
+	 */
+	private static final String TRACE_VIEWER_TITLE = Messages
+			.getString("TraceViewerView.ViewTitle"); //$NON-NLS-1$
+
+	/**
+	 * Hex prefix
+	 */
+	private static final String HEX_PREFIX = "0x"; //$NON-NLS-1$
+
+	/**
+	 * Max lines in the view
+	 */
+	private static final int MAX_LINES = TraceViewerGlobals.blockSize * 2;
+
+	/**
+	 * Update interval in milliseconds
+	 */
+	private static final int UPDATE_INTERVAL = 100;
+
+	/**
+	 * Normal view name
+	 */
+	private static final String VIEWNAME_NORMAL = TRACE_VIEWER_TITLE;
+
+	/**
+	 * Filtered view name
+	 */
+	private static final String VIEWNAME_FILTERED = Messages
+			.getString("TraceViewerView.FilteredText"); //$NON-NLS-1$
+
+	/**
+	 * Paused view name
+	 */
+	private static final String VIEWNAME_PAUSED = Messages
+			.getString("TraceViewerView.PausedText"); //$NON-NLS-1$
+
+	/**
+	 * View name when storing data while triggering
+	 */
+	private static final String VIEWNAME_STORING = Messages
+			.getString("TraceViewerView.StoringText"); //$NON-NLS-1$
+
+	/**
+	 * View name when trigger is armed
+	 */
+	private static final String VIEWNAME_ARMED = Messages
+			.getString("TraceViewerView.ArmedText"); //$NON-NLS-1$
+
+	/**
+	 * Opened Log file name separator shown before the log file name
+	 */
+	private static final String LOG_FILE_NAME_SEPARATOR = " - "; //$NON-NLS-1$
+
+	/**
+	 * Action factory
+	 */
+	private ActionFactory actionFactory;
+
+	/**
+	 * Text viewer
+	 */
+	private TextViewer viewer;
+
+	/**
+	 * StyledText widget
+	 */
+	private StyledText widget;
+
+	/**
+	 * String array to append to widget in next update
+	 */
+	private final StringBuffer newData;
+
+	/**
+	 * String array to append to widget in next update
+	 */
+	private final StringBuffer scrolledData;
+
+	/**
+	 * Timestamp of next update
+	 */
+	private long updateNextTime;
+
+	/**
+	 * Slider object
+	 */
+	private Slider slider;
+
+	/**
+	 * Tells from which count Viewer is showing traces from
+	 */
+	private int showingTracesFrom;
+
+	/**
+	 * Start line to highlight
+	 */
+	private int startHighlightLine;
+
+	/**
+	 * End line to highlight
+	 */
+	private int endHighlightLine;
+
+	/**
+	 * Indicates that view name should be updated
+	 */
+	private boolean updateViewName;
+
+	/**
+	 * Contains number of new traces in String buffer
+	 */
+	private int numberOfNewTraces;
+
+	/**
+	 * Contains offsets of new traces in newTraces String buffer
+	 */
+	private final List<Integer> offsetsOfNewTraces;
+
+	/**
+	 * Dialog factory
+	 */
+	private final DialogFactory dialogFactory;
+
+	/**
+	 * Indicates that view update is on
+	 */
+	private boolean viewUpdateOn = true;
+
+	/**
+	 * Inserting last block when scrolling the view
+	 */
+	private boolean insertingLastBlock;
+
+	/**
+	 * The constructor.
+	 */
+	public TraceViewerView() {
+		dialogFactory = new DialogFactory();
+
+		// Create StringBuffers
+		newData = new StringBuffer();
+		scrolledData = new StringBuffer();
+
+		// Offsets of new traces are also saved
+		offsetsOfNewTraces = new ArrayList<Integer>();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets
+	 * .Composite)
+	 */
+	@Override
+	public void createPartControl(Composite parent) {
+		actionFactory = new ActionFactory();
+		// Create layout for the shell
+		createLayout(parent);
+
+		// Creates the text viewer and set a document to it
+		viewer = new TextViewer(parent, SWT.V_SCROLL | SWT.H_SCROLL);
+		Document document = new Document();
+		viewer.setDocument(document);
+		viewer.setEditable(false);
+
+		// Get styled text widget and configure it
+		widget = viewer.getTextWidget();
+		setFontSize(FONT_SIZE);
+		widget.getVerticalBar().setVisible(false);
+		widget.getHorizontalBar().setVisible(true);
+		widget
+				.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1,
+						1));
+
+		// Create a slider
+		slider = new Slider(parent, SWT.VERTICAL);
+		slider.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, false, true, 1,
+				1));
+		slider.setEnabled(false);
+
+		fillMenuAndToolBar();
+		createContextMenu();
+
+		// Create listeners
+		createListeners();
+
+		// Sets this view to be the dialog provider
+		TraceViewerGlobals.getTraceViewer().setDialogs(this);
+
+		// Sets the view reference to trace viewer engine
+		TraceViewerGlobals.getTraceViewer().setTraceView(this);
+
+		// Set help
+		PlatformUI.getWorkbench().getHelpSystem().setHelp(parent,
+				TraceViewerHelpContextIDs.MAIN_VIEW);
+
+		// Set global action handler to own copy selection action
+		getViewSite().getActionBars().setGlobalActionHandler(
+				org.eclipse.ui.actions.ActionFactory.COPY.getId(),
+				actionFactory.getCopySelectionAction());
+
+		// Set global action handler to own seach action
+		getViewSite().getActionBars().setGlobalActionHandler(
+				org.eclipse.ui.actions.ActionFactory.FIND.getId(),
+				actionFactory.getSearchAction());
+
+		// Set global action handler to own select all action
+		getViewSite().getActionBars().setGlobalActionHandler(
+				org.eclipse.ui.actions.ActionFactory.SELECT_ALL.getId(),
+				actionFactory.getSelectAllAction());
+
+	}
+
+	/**
+	 * Adds action items to menu and toolbar
+	 */
+	private void fillMenuAndToolBar() {
+		IActionBars bars = getViewSite().getActionBars();
+		actionFactory.fillMenu(bars.getMenuManager());
+		actionFactory.fillToolBar(bars.getToolBarManager());
+	}
+
+	/**
+	 * Returns action factory
+	 * 
+	 * @return action factory
+	 */
+	public ActionFactory getActionFactory() {
+		return actionFactory;
+	}
+
+	/**
+	 * Create layout for the view
+	 * 
+	 * @param parent
+	 *            parent shell
+	 */
+	private void createLayout(Composite parent) {
+		GridLayout layout = new GridLayout(2, false);
+		layout.marginTop = 0;
+		layout.marginBottom = 0;
+		layout.marginHeight = 0;
+		layout.marginWidth = 0;
+		layout.horizontalSpacing = 0;
+		parent.setLayout(layout);
+	}
+
+	/**
+	 * Create all listeners
+	 */
+	private void createListeners() {
+		// Create scroller selection listener
+		ScrollerSelectionListener slistener = new ScrollerSelectionListener(
+				viewer);
+		slider.addSelectionListener(slistener);
+
+		// Viewer selection changed listener
+		ViewerSelectionChangedListener vlistener = new ViewerSelectionChangedListener(
+				slider);
+		viewer.addSelectionChangedListener(vlistener);
+
+		// Create viewer mouse wheel listener
+		Listener mlistener = new ViewerMouseWheelListener(slider, viewer);
+		widget.addListener(SWT.MouseWheel, mlistener);
+
+		// Create viewer key listener
+		ViewerKeyListener klistener = new ViewerKeyListener(slider, viewer,
+				this);
+		widget.addKeyListener(klistener);
+
+		// Create window resize listener
+		WindowResizeListener rlistener = new WindowResizeListener(slider,
+				viewer);
+		widget.addControlListener(rlistener);
+
+		// Create viewer click listener
+		ViewerClickListener clistener = new ViewerClickListener(viewer);
+		widget.addMouseListener(clistener);
+	}
+
+	/**
+	 * Creates context menu
+	 */
+	private void createContextMenu() {
+		// Create menu manager.
+		final MenuManager menuMgr = new MenuManager();
+		menuMgr.setRemoveAllWhenShown(true);
+		menuMgr.addMenuListener(new IMenuListener() {
+			public void menuAboutToShow(IMenuManager mgr) {
+				fillContextMenu(menuMgr);
+			}
+		});
+
+		// Create menu.
+		Menu menu = menuMgr.createContextMenu(viewer.getControl());
+		viewer.getControl().setMenu(menu);
+
+		// Register menu for extension.
+		getSite().registerContextMenu(menuMgr, viewer);
+	}
+
+	/**
+	 * Fills context menu
+	 * 
+	 * @param menuMgr
+	 *            menu manager
+	 */
+	public void fillContextMenu(MenuManager menuMgr) {
+		menuMgr.add(actionFactory.getShowTraceInfoAction());
+		menuMgr.add(actionFactory.getOpenTraceLocationAction());
+		menuMgr.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+
+		// Nothing is selected
+		if (widget.getSelectionCount() == 0) {
+			actionFactory.getShowTraceInfoAction().setEnabled(false);
+			actionFactory.getOpenTraceLocationAction().setEnabled(false);
+
+			// More than one trace selected
+		} else if (widget.getSelectionText().contains("\n")) { //$NON-NLS-1$
+			actionFactory.getShowTraceInfoAction().setEnabled(false);
+			actionFactory.getOpenTraceLocationAction().setEnabled(false);
+
+			// One trace is selected
+		} else {
+			int lineNumber = showingTracesFrom
+					+ widget.getLineAtOffset(widget.getCaretOffset());
+
+			// Get the trace from the file
+			List<TraceProperties> traceList = TraceViewerGlobals
+					.getTraceViewer().getTraces(lineNumber, lineNumber);
+
+			TraceProperties trace = null;
+			if (traceList != null && !traceList.isEmpty()) {
+				trace = traceList.get(0);
+			}
+
+			ShowTraceInfoAction infoAction = (ShowTraceInfoAction) actionFactory
+					.getShowTraceInfoAction();
+			infoAction.setEnabled(true);
+			infoAction.setTrace(trace);
+
+			OpenTraceLocationAction openLocationAction = (OpenTraceLocationAction) actionFactory
+					.getOpenTraceLocationAction();
+
+			// If traceInformation is found, enable open trace location action
+			if (trace != null && trace.information != null) {
+				TraceMetaData metaData = TraceViewerGlobals.getDecodeProvider()
+						.getTraceMetaData(trace.information);
+				if (metaData != null && metaData.getPath() != null) {
+					openLocationAction.setEnabled(true);
+					openLocationAction.setMetaData(metaData, true);
+				} else {
+					openLocationAction.setEnabled(false);
+				}
+			} else {
+				openLocationAction.setEnabled(false);
+			}
+
+			menuMgr.add(new Separator());
+
+			// Add / Edit / Remove trace comment actions
+			if (trace != null) {
+				TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+						.getTraceCommentHandler().processData(trace);
+				if (trace.traceComment == null) {
+					menuMgr.add(new AddCommentToTraceAction(trace.traceNumber));
+				} else {
+					menuMgr.add(new EditTraceCommentAction(trace.traceNumber));
+					menuMgr
+							.add(new RemoveTraceCommentAction(trace.traceNumber));
+				}
+			}
+
+		}
+		// Separator
+		menuMgr.add(new Separator());
+
+		// Copy action
+		Action copyAction = actionFactory.getCopySelectionAction();
+		menuMgr.add(copyAction);
+		if (widget.getSelectionCount() > 0) {
+			copyAction.setEnabled(true);
+		} else {
+			copyAction.setEnabled(false);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Runnable#run()
+	 */
+	public void run() {
+		if (!widget.isDisposed()) {
+
+			// Set redraw off
+			widget.setRedraw(false);
+
+			if (TraceViewerGlobals.getTraceViewer().getStateHolder().getState() == StateHolder.State.SEARCHED) {
+				slider.setSelection(startHighlightLine);
+				scrollViewToLine(slider.getSelection());
+			} else if (newData.length() > 0) {
+				runNormalUpdate();
+			}
+
+			colorTraces();
+
+			// If view name should be updated
+			if (updateViewName) {
+				generateAndSetViewName();
+			}
+			// Redraw
+			widget.setRedraw(true);
+			widget.update();
+		}
+	}
+
+	/**
+	 * Normal update sequence
+	 */
+	private void runNormalUpdate() {
+		// Max offset is number of traces minus 1
+		int max = TraceViewerGlobals.getTraceViewer().getDataReaderAccess()
+				.getCurrentDataReader().getTraceCount() - 1;
+
+		// If previous data is not from the end, get latest blocks from file
+		if (showingTracesFrom + widget.getLineCount() + numberOfNewTraces < max + 1) {
+			slider.setMaximum(max);
+			slider.setSelection(max);
+			scrollViewToLine(max);
+			setSliderProperties(max);
+		} else {
+
+			// If there is lot of new traces, cut down the StringBuffer already
+			// in here to avoid massive insertion to text widget
+			if (numberOfNewTraces > MAX_LINES + TraceViewerGlobals.blockSize) {
+				int offsetOfDeletion = offsetsOfNewTraces.size() - 1
+						- (MAX_LINES / TraceViewerGlobals.blockSize);
+
+				if (offsetOfDeletion >= 0
+						&& offsetOfDeletion < offsetsOfNewTraces.size()) {
+					newData.replace(0, offsetsOfNewTraces.get(offsetOfDeletion)
+							.intValue(), ""); //$NON-NLS-1$
+				}
+			}
+
+			// Append the new data to current
+			widget.append(newData.toString());
+
+			// Set slider properties
+			setSliderProperties(max);
+
+			// If there is over MAX_LINES lines, remove extra data blocks
+			if (widget.getLineCount() > MAX_LINES) {
+				removeDataBlocks(max);
+			} // no else
+		}
+
+		// Clear variables and selection
+		newData.setLength(0);
+		numberOfNewTraces = 0;
+		offsetsOfNewTraces.clear();
+		SelectionProperties.clear();
+
+		// Set the top index and caret to the end of the document
+		viewer.setTopIndex(max - slider.getThumb());
+		widget.setCaretOffset(widget.getCharCount());
+	}
+
+	/**
+	 * Removes extra data blocks
+	 * 
+	 * @param max
+	 *            number of lines alltogether
+	 */
+	private void removeDataBlocks(int max) {
+		// Get amount of full blocks
+		int fullBlocks = widget.getLineCount() / TraceViewerGlobals.blockSize;
+
+		// Showing traces is starting point of total number of blocks -
+		// 1
+		showingTracesFrom = (((max + 1) / TraceViewerGlobals.blockSize) - 1)
+				* TraceViewerGlobals.blockSize;
+
+		// Delete data from beginning of the widget
+		int line = ((fullBlocks - 1) * TraceViewerGlobals.blockSize);
+		int replaceTo = widget.getOffsetAtLine(line);
+		widget.replaceTextRange(0, replaceTo, ""); //$NON-NLS-1$
+	}
+
+	/**
+	 * Sets slider properties
+	 * 
+	 * @param max
+	 *            max value
+	 */
+	private void setSliderProperties(int max) {
+		// Set Slider properties
+		slider.setEnabled(max > 0);
+		slider.setMaximum(max);
+		slider.setSelection(max);
+		slider.setThumb(getNumberOfLinesInView());
+	}
+
+	/**
+	 * Color traces
+	 */
+	private void colorTraces() {
+		// If coloring, color lines
+		if (TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+				.getColorer().isColoring()) {
+			TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+					.getColorer().createColorRules();
+		}
+	}
+
+	/**
+	 * Adds traces before current data
+	 * 
+	 * @param traceToBeShown
+	 *            trace to be shown
+	 * @param numberOfBlocks
+	 *            number of block
+	 */
+	private void insertBeforeCurrentView(int numberOfBlocks, int traceToBeShown) {
+
+		widget.setRedraw(false);
+		// Save the caret position
+		int caretPos = widget.getLineAtOffset(widget.getCaretOffset());
+
+		// Save the old data
+		String oldData = getOldData(true, numberOfBlocks);
+
+		// Append the old data after the new data
+		if (!oldData.equals("")) { //$NON-NLS-1$
+			scrolledData.append(oldData);
+		}
+
+		// Set the new data to widget
+		widget.setText(scrolledData.toString());
+
+		// Update showing traces variable
+		showingTracesFrom = (traceToBeShown / TraceViewerGlobals.blockSize)
+				* TraceViewerGlobals.blockSize;
+
+		// Set view properties
+		updateViewPropertiesWhenInsertingBeforeCurrentData(caretPos,
+				traceToBeShown);
+
+		// Empty buffer
+		scrolledData.setLength(0);
+		colorTraces();
+		widget.setRedraw(true);
+		widget.update();
+	}
+
+	/**
+	 * Add traces after current data
+	 * 
+	 * @param traceToBeShown
+	 *            trace to be shown
+	 * @param numberOfBlocks
+	 *            number of block
+	 */
+	private void insertAfterCurrentView(int numberOfBlocks, int traceToBeShown) {
+
+		widget.setRedraw(false);
+		// Save the old data
+		String oldData = getOldData(false, numberOfBlocks);
+
+		// Create new StringBuffer with old and new data in it
+		StringBuffer data = new StringBuffer(oldData.length()
+				+ scrolledData.length());
+		data.append(oldData);
+		data.append(scrolledData);
+
+		// Set the new data
+		widget.setText(data.toString());
+
+		// Update showingTracesFrom variable
+		int fullBlocksInView = (traceToBeShown + getNumberOfLinesInView() + 1)
+				/ TraceViewerGlobals.blockSize;
+		showingTracesFrom = (fullBlocksInView * TraceViewerGlobals.blockSize)
+				- TraceViewerGlobals.blockSize;
+		if (showingTracesFrom < 0) {
+			showingTracesFrom = 0;
+		} // no else
+
+		// Set view properties
+		updateViewPropertiesWhenInsertingAfterCurrentData(traceToBeShown);
+
+		// Empty buffer
+		scrolledData.setLength(0);
+		colorTraces();
+		widget.setRedraw(true);
+		widget.update();
+	}
+
+	/**
+	 * Gets old data
+	 * 
+	 * @param beforeCurrentData
+	 *            getting data to before current view
+	 * @param numberOfBlocks
+	 *            number of blocks to get
+	 * @return old data
+	 */
+	private String getOldData(boolean beforeCurrentData, int numberOfBlocks) {
+		String oldData = ""; //$NON-NLS-1$
+		if (numberOfBlocks == 1) {
+			// More thatn 1 block of data, needs to be cut
+			if (widget.getLineCount() > TraceViewerGlobals.blockSize) {
+
+				// Inserting before current view
+				if (beforeCurrentData) {
+					oldData = widget.getText(0, widget
+							.getOffsetAtLine(TraceViewerGlobals.blockSize) - 1);
+
+					// Inserting after current view
+				} else if (!beforeCurrentData) {
+					int offsetAtBlockStart = widget
+							.getOffsetAtLine(TraceViewerGlobals.blockSize);
+					oldData = widget.getTextRange(offsetAtBlockStart, widget
+							.getOffsetAtLine(widget.getLineCount() - 1)
+							- offsetAtBlockStart);
+				}
+			} else {
+				oldData = widget.getText();
+			}
+		}
+
+		return oldData;
+	}
+
+	/**
+	 * Sets view properties when inserting before current data
+	 * 
+	 * @param caretPos
+	 *            old caret position
+	 * @param traceToBeShown
+	 *            trace to be shown
+	 */
+	private void updateViewPropertiesWhenInsertingBeforeCurrentData(
+			int caretPos, int traceToBeShown) {
+		StateHolder.State state = TraceViewerGlobals.getTraceViewer()
+				.getStateHolder().getState();
+		// Null check
+		if (state == null) {
+			TraceViewerGlobals.getTraceViewer().getStateHolder().setState(
+					StateHolder.State.SCROLLING_WITH_SCROLLBAR);
+			state = StateHolder.State.SCROLLING_WITH_SCROLLBAR;
+		}
+		switch (state) {
+		// Set top index when scrolling with scrollbar
+		case SCROLLING_WITH_SCROLLBAR:
+
+			viewer.setTopIndex((traceToBeShown % TraceViewerGlobals.blockSize));
+			break;
+		// Set top index and caret offset when scrolling with arrow keys
+		case SCROLLING_WITH_ARROWS:
+			viewer.setTopIndex((traceToBeShown % TraceViewerGlobals.blockSize));
+			if (caretPos + TraceViewerGlobals.blockSize - 1 < widget
+					.getLineCount()) {
+				widget.setCaretOffset(widget.getOffsetAtLine(caretPos
+						+ TraceViewerGlobals.blockSize - 1));
+			}
+			break;
+		// Set top index and selection when searching
+		case SEARCHED:
+			updateViewerPropertiesAfterSearch();
+			break;
+
+		// Set top index and caret offset when scrolling with page up/down
+		case SCROLLING_WITH_PAGEUPDOWN:
+			int topIndex = traceToBeShown % TraceViewerGlobals.blockSize - 2;
+			viewer.setTopIndex(topIndex);
+			int caretLine = caretPos + TraceViewerGlobals.blockSize - 1;
+			if (caretLine > 0 && widget.getLineCount() > 0) {
+				if (caretLine > widget.getLineCount()) {
+					caretLine = widget.getLineCount() - 1;
+				}
+				widget.setCaretOffset(widget.getOffsetAtLine(caretLine));
+			}
+
+			break;
+		default:
+			break;
+		}
+		TraceViewerGlobals.getTraceViewer().getStateHolder().setState(
+				StateHolder.State.NORMAL);
+		setSelection();
+	}
+
+	/**
+	 * Sets view properties when inserting after current data
+	 * 
+	 * @param traceToBeShown
+	 *            trace to be shown
+	 */
+	private void updateViewPropertiesWhenInsertingAfterCurrentData(
+			int traceToBeShown) {
+		StateHolder.State state = TraceViewerGlobals.getTraceViewer()
+				.getStateHolder().getState();
+
+		// Null check
+		if (state == null) {
+			TraceViewerGlobals.getTraceViewer().getStateHolder().setState(
+					StateHolder.State.SCROLLING_WITH_SCROLLBAR);
+			state = StateHolder.State.SCROLLING_WITH_SCROLLBAR;
+		}
+
+		switch (state) {
+		// Set top index when scrolling with scrollbar
+		case SCROLLING_WITH_SCROLLBAR:
+			viewer.setTopIndex(traceToBeShown - showingTracesFrom + 1);
+			break;
+
+		// Set top index and caret offset when scrolling with arrow keys
+		case SCROLLING_WITH_ARROWS:
+			viewer.setTopIndex(traceToBeShown - showingTracesFrom - 1);
+			int line = traceToBeShown - showingTracesFrom
+					+ getNumberOfLinesInView();
+			if (line <= widget.getLineCount() && line >= 0) {
+				widget.setCaretOffset(widget.getOffsetAtLine(line));
+			}
+			break;
+		// Set top index and selection when searching
+		case SEARCHED:
+			updateViewerPropertiesAfterSearch();
+			break;
+
+		// Set top index and caret offset when scrolling with page up/down
+		case SCROLLING_WITH_PAGEUPDOWN:
+			viewer.setTopIndex(traceToBeShown - showingTracesFrom + 1);
+			int topLine = traceToBeShown - showingTracesFrom
+					+ getNumberOfLinesInView() - 1;
+			if (topLine < widget.getLineCount()) {
+				int caretOffset = widget.getOffsetAtLine(traceToBeShown
+						- showingTracesFrom + getNumberOfLinesInView() - 1);
+				if (caretOffset >= 0 && caretOffset < widget.getCharCount()) {
+					widget.setCaretOffset(caretOffset);
+				}
+			} else {
+				widget.setCaretOffset(widget.getCharCount() - 1);
+			}
+			break;
+		// Unknown case, set basic top index
+		case NORMAL:
+			viewer.setTopIndex(traceToBeShown
+					- TraceViewerGlobals.getTraceViewer().getView()
+							.getShowingTracesFrom());
+			break;
+		default:
+			break;
+		}
+
+		TraceViewerGlobals.getTraceViewer().getStateHolder().setState(
+				StateHolder.State.NORMAL);
+		setSelection();
+	}
+
+	/**
+	 * Sets selection to viewer
+	 */
+	public void setSelection() {
+		if (SelectionProperties.lastClickedLine != -1) {
+
+			// Calculate start offset
+			int startOffset = 0;
+
+			// If clicked from the totally first line
+			if (SelectionProperties.firstClickedLine < showingTracesFrom) {
+				startOffset = 0;
+
+				// If clicked in the totally last line
+			} else if (SelectionProperties.firstClickedLine > showingTracesFrom
+					+ widget.getLineCount()) {
+				startOffset = widget.getCharCount() - 1;
+
+				// Clicked between the first and last line in the viewer
+			} else {
+				int lineNumber = SelectionProperties.firstClickedLine
+						- showingTracesFrom;
+				if (lineNumber < widget.getLineCount()) {
+					startOffset = widget.getOffsetAtLine(lineNumber)
+							+ SelectionProperties.firstClickedLineCaretOffset;
+				}
+			}
+
+			// Calculate end offset
+			int endOffset = 0;
+
+			// If clicked from the totally first line
+			if (SelectionProperties.lastClickedLine < showingTracesFrom) {
+				endOffset = 0;
+
+				// If clicked in the totally last line
+			} else if (SelectionProperties.lastClickedLine >= showingTracesFrom
+					+ widget.getLineCount()) {
+				endOffset = widget.getCharCount() - 1;
+
+				// Clicked between the first and last line in the viewer
+			} else {
+				int lineNumber = SelectionProperties.lastClickedLine
+						- showingTracesFrom;
+				if (lineNumber < widget.getLineCount()) {
+					endOffset = widget.getOffsetAtLine(lineNumber)
+							+ SelectionProperties.lastClickedLineCaretOffset;
+				}
+			}
+
+			// Save current top index
+			int topIndex = viewer.getTopIndex();
+
+			// Set the selection to the viewer
+			widget.setSelection(startOffset, endOffset);
+
+			// Return old top index
+			viewer.setTopIndex(topIndex);
+
+			// Put caret to the end
+		} else if (SelectionProperties.putCaretToTheEnd) {
+			SelectionProperties.putCaretToTheEnd = false;
+			widget.setCaretOffset(widget.getCharCount());
+		}
+
+		// Update trim
+		ViewerSelectionChangedListener.handleTrimInformationUpdate();
+	}
+
+	/**
+	 * Updates top index and selection after searching
+	 */
+	private void updateViewerPropertiesAfterSearch() {
+		int selIndex = startHighlightLine - showingTracesFrom;
+		int topIndex = selIndex - LINES_TO_LEAVE_BEFORE_FOUND_LINE;
+
+		if (topIndex < 0) {
+			topIndex = 0;
+		}
+		viewer.setTopIndex(topIndex);
+
+		// Remove possible old selection values from the Selection Properties
+		SelectionProperties.clear();
+
+		// Select range of traces
+		if (endHighlightLine != 0) {
+			SelectionProperties.firstClickedLine = startHighlightLine;
+			SelectionProperties.lastClickedLine = endHighlightLine + 1;
+
+		} else {
+
+			// Select one line
+			if (topIndex < widget.getLineCount()
+					&& (selIndex + 1 < widget.getLineCount())) {
+				widget.setSelection(widget.getOffsetAtLine(selIndex), widget
+						.getOffsetAtLine(selIndex + 1) - 1);
+			}
+		}
+
+		// Enable search button from search dialog
+		SearchDialog searchDialog = TraceViewerGlobals.getTraceViewer()
+				.getDataProcessorAccess().getSearchProcessor()
+				.getSearchDialog();
+		if (searchDialog != null && searchDialog.isOpen()) {
+			searchDialog.enableSearchButton();
+		}
+		TraceViewerGlobals.getTraceViewer().getStateHolder().setState(
+				StateHolder.State.NORMAL);
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ui.IWorkbenchPart#setFocus()
+	 */
+	@Override
+	public void setFocus() {
+		viewer.getControl().setFocus();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ui.part.WorkbenchPart#dispose()
+	 */
+	@Override
+	public void dispose() {
+		super.dispose();
+		TraceViewerGlobals.getTraceViewer().shutdown();
+	}
+
+	/**
+	 * Gets shell
+	 * 
+	 * @return shell from the text viewer
+	 */
+	private Shell getShell() {
+		Shell shell = null;
+		if (viewer != null && viewer.getControl() != null
+				&& viewer.getControl().getShell() != null
+				&& !viewer.getControl().getShell().isDisposed()) {
+			shell = viewer.getControl().getShell();
+		}
+		return shell;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.TraceViewerTraceViewInterface#getViewer()
+	 */
+	public TextViewer getViewer() {
+		return viewer;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @seecom.nokia.traceviewer.engine.TraceViewerTraceViewInterface#
+	 * getShowingTracesFrom()
+	 */
+	public int getShowingTracesFrom() {
+		return showingTracesFrom;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.DataProcessor#
+	 * processData(com.nokia.traceviewer.engine.TraceProperties)
+	 */
+	public void processData(TraceProperties properties) {
+		TraceViewerGlobals.debug("processData in View", //$NON-NLS-1$
+				TraceViewerGlobals.DebugLevel.TEST);
+		// Main if to check if trace is ok to show
+		if (!properties.traceConfiguration.isFilteredOut()
+				&& properties.traceConfiguration.isShowInView()
+				&& !properties.traceConfiguration.isTriggeredOut()) {
+			if (properties.traceConfiguration.isScrolledTrace()) {
+				processScrolledTrace(properties);
+
+				// Empty new data if we are reading last block
+				if (insertingLastBlock && properties.lastTrace) {
+					newData.setLength(0);
+					insertingLastBlock = false;
+				}
+			} else if (viewUpdateOn) {
+				processNormalTrace(properties);
+			}
+		}
+	}
+
+	/**
+	 * Process normal trace
+	 * 
+	 * @param properties
+	 *            trace properties
+	 */
+	private void processNormalTrace(TraceProperties properties) {
+		numberOfNewTraces++;
+		// Traces missing
+		if (properties.bTraceInformation.isTraceMissing()) {
+			newData.append(TraceViewerActionUtils.TRACES_DROPPED_MSG);
+		}
+
+		// Append timestamp to StringBuffer
+		if (properties.timestampString != null) {
+			newData.append(properties.timestampString);
+			newData
+					.append(TraceViewerGlobals.getTraceViewer()
+							.getDataProcessorAccess().getTimestampParser()
+							.getTimeFromPreviousString(
+									properties.timeFromPreviousTrace));
+			newData.append('\t');
+		}
+		if (!properties.binaryTrace) {
+			newData.append(properties.traceString);
+			if (properties.traceComment != null) {
+				newData.append(TraceViewerActionUtils.COMMENT_PREFIX);
+				newData.append(properties.traceComment);
+			}
+
+			// Binary trace
+		} else {
+			addBinaryTraceToBuffer(properties, newData);
+		}
+
+		newData.append('\n');
+		// Add offset of every new block to array so we know where to
+		// cut the StringBuffer
+		if (numberOfNewTraces % TraceViewerGlobals.blockSize == 1
+				&& numberOfNewTraces != 1) {
+			offsetsOfNewTraces.add(Integer.valueOf(newData.length()));
+		}
+		long time = System.currentTimeMillis();
+		// If update interval has passed, call the view update
+		if (time > updateNextTime) {
+			updateNextTime = time + UPDATE_INTERVAL;
+			update();
+		}
+	}
+
+	/**
+	 * Process scrolled trace
+	 * 
+	 * @param properties
+	 *            trace properties
+	 */
+	private void processScrolledTrace(TraceProperties properties) {
+		// Traces missing
+		if (properties.bTraceInformation.isTraceMissing()) {
+			scrolledData.append(TraceViewerActionUtils.TRACES_DROPPED_MSG);
+		}
+
+		// Append timestamp to StringBuffer
+		if (properties.timestampString != null) {
+			scrolledData.append(properties.timestampString);
+			scrolledData
+					.append(TraceViewerGlobals.getTraceViewer()
+							.getDataProcessorAccess().getTimestampParser()
+							.getTimeFromPreviousString(
+									properties.timeFromPreviousTrace));
+			scrolledData.append('\t');
+		}
+		if (!properties.binaryTrace) {
+			scrolledData.append(properties.traceString);
+
+			if (properties.traceComment != null) {
+				scrolledData.append(TraceViewerActionUtils.COMMENT_PREFIX);
+				scrolledData.append(properties.traceComment);
+			}
+
+			// Binary trace
+		} else {
+			addBinaryTraceToBuffer(properties, scrolledData);
+		}
+		scrolledData.append('\n');
+	}
+
+	/**
+	 * Adds binary traces to buffer
+	 * 
+	 * @param properties
+	 *            trace properties
+	 * @param dataBuf
+	 *            data buffer to add the trace to
+	 */
+	private void addBinaryTraceToBuffer(TraceProperties properties,
+			StringBuffer dataBuf) {
+
+		// Get the selected value
+		String type = TraceViewerPlugin.getDefault().getPreferenceStore()
+				.getString(PreferenceConstants.SHOW_UNDECODED_TRACES_TYPE);
+
+		// Show binary trace info message
+		if (type.equals(PreferenceConstants.UNDECODED_INFO_TEXT)) {
+			String binMsg = Messages
+					.getString("TraceViewerView.BinaryTraceInformationMessage"); //$NON-NLS-1$);
+			dataBuf.append(binMsg);
+
+			// Show binary traces as hex
+		} else if (type.equals(PreferenceConstants.UNDECODED_HEX)) {
+
+			// Read the message to a byte array
+			String hexTrace = TraceViewerUtils.getTraceAsHexString(
+					properties.byteBuffer, properties.messageStart,
+					properties.messageLength, true);
+			dataBuf.append(hexTrace);
+
+			// Show binary trace as ID and data
+		} else if (type.equals(PreferenceConstants.UNDECODED_ID_AND_DATA)) {
+			dataBuf.append(Messages
+					.getString("TraceViewerView.BinaryTraceText")); //$NON-NLS-1$
+			dataBuf.append(Messages.getString("TraceViewerView.ComponentID")); //$NON-NLS-1$
+			dataBuf.append(HEX_PREFIX);
+			dataBuf.append(Integer.toHexString(properties.information
+					.getComponentId()));
+			dataBuf.append(Messages.getString("TraceViewerView.GroupID")); //$NON-NLS-1$
+			dataBuf.append(HEX_PREFIX);
+			dataBuf.append(Integer.toHexString(properties.information
+					.getGroupId()));
+			dataBuf.append(Messages.getString("TraceViewerView.TraceID")); //$NON-NLS-1$
+			dataBuf.append(properties.information.getTraceId());
+			dataBuf.append(Messages.getString("TraceViewerView.DataString")); //$NON-NLS-1$
+
+			// Read the message to a byte array
+			String hexTrace = TraceViewerUtils.getTraceAsHexString(
+					properties.byteBuffer, properties.dataStart,
+					properties.dataLength, true);
+			dataBuf.append(hexTrace);
+
+			if (properties.traceComment != null) {
+				dataBuf.append(TraceViewerActionUtils.COMMENT_PREFIX);
+				dataBuf.append(properties.traceComment);
+			}
+		}
+	}
+
+	/**
+	 * Returns number of lines in view
+	 * 
+	 * @return number of lines in view
+	 */
+	public int getNumberOfLinesInView() {
+		return viewer.getBottomIndex() - viewer.getTopIndex();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.TraceViewerViewInterface#clearAll()
+	 */
+	public void clearAll() {
+		// Sync with UI thread
+		if (viewer != null && viewer.getControl() != null
+				&& viewer.getControl().getDisplay() != null) {
+
+			viewer.getControl().getDisplay().syncExec(new Runnable() {
+
+				public void run() {
+					// Remove text from textviewer and disable slider
+					if (!widget.isDisposed()) {
+						widget.setText(""); //$NON-NLS-1$
+					}
+					if (!slider.isDisposed()) {
+						slider.setEnabled(false);
+					}
+
+					// Clear all arrays
+					newData.setLength(0);
+					scrolledData.setLength(0);
+					showingTracesFrom = 0;
+					offsetsOfNewTraces.clear();
+
+					// Empty the trim text
+					TraceViewerGlobals.getTrimProvider().updateText(""); //$NON-NLS-1$
+				}
+			});
+		}
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.TraceViewerViewInterface#hasUnshownData()
+	 */
+	public boolean hasUnshownData() {
+		return (newData.length() > 0);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.TraceViewerViewInterface#update()
+	 */
+	public void update() {
+		update(this);
+	}
+
+	/**
+	 * Calls syncExec with some Runnable
+	 * 
+	 * @param r
+	 *            runnable object
+	 */
+	public void update(Runnable r) {
+		Control control = viewer.getControl();
+		if ((control != null) && !(control.isDisposed())) {
+			control.getDisplay().syncExec(r);
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.TraceViewerTraceViewInterface#highlightLines
+	 * (int, int, boolean)
+	 */
+	public void highlightLines(int startLine, int endLine, boolean syncToSource) {
+		this.startHighlightLine = startLine;
+		this.endHighlightLine = endLine;
+		TraceViewerGlobals.getTraceViewer().getStateHolder().setState(
+				StateHolder.State.SEARCHED);
+		update();
+
+		// Sync to source
+		if (syncToSource) {
+			viewer.getControl().getDisplay().asyncExec(new Runnable() {
+				public void run() {
+
+					// Jump to selected trace source
+					jumpToSelectedTraceSource();
+				}
+			});
+		}
+	}
+
+	/**
+	 * Jumps to selected traces source if needed metadata exists
+	 */
+	private void jumpToSelectedTraceSource() {
+		// Get clicked line number
+		int clickedLine = widget.getLineAtOffset(widget.getSelectionRange().x)
+				+ TraceViewerGlobals.getTraceViewer().getView()
+						.getShowingTracesFrom();
+
+		// Get the trace from the file
+		List<TraceProperties> traceList = TraceViewerGlobals.getTraceViewer()
+				.getTraces(clickedLine, clickedLine);
+
+		TraceProperties trace = null;
+		if (traceList != null && !traceList.isEmpty()) {
+			trace = traceList.get(0);
+		}
+
+		OpenTraceLocationAction openLocationAction = (OpenTraceLocationAction) actionFactory
+				.getOpenTraceLocationAction();
+
+		// If traceInformation is found, run open location action
+		if (trace != null && trace.information != null) {
+			TraceMetaData metaData = TraceViewerGlobals.getDecodeProvider()
+					.getTraceMetaData(trace.information);
+			if (metaData != null && metaData.getPath() != null) {
+				openLocationAction.setMetaData(metaData, false);
+				openLocationAction.run();
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.TraceViewerTraceViewInterface#scrollViewToLine
+	 * (int)
+	 */
+	public void scrollViewToLine(int lineNumber) {
+		if (!TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+				.getTriggerProcessor().isStartTriggering()) {
+
+			// Save trace to be shown
+			int traceToBeShown = lineNumber;
+
+			int topIndex = viewer.getTopIndex();
+			int bottomIndex = viewer.getBottomIndex();
+
+			// If we need more traces to start of the view
+			if (traceToBeShown < showingTracesFrom) {
+				getMoreTracesBeforeCurrentData(traceToBeShown);
+
+				// More trace to end of the view
+			} else if (traceToBeShown + getNumberOfLinesInView() + 2 > showingTracesFrom
+					+ widget.getLineCount()
+					&& TraceViewerGlobals.getTraceViewer()
+							.getDataReaderAccess().getCurrentDataReader() != null
+					&& (showingTracesFrom + TraceViewerGlobals.blockSize * 2 < TraceViewerGlobals
+							.getTraceViewer().getDataReaderAccess()
+							.getCurrentDataReader().getTraceCount())) {
+
+				getMoreTracesAfterCurrentData(traceToBeShown, bottomIndex);
+
+				// If the trace to be shown value is different to real value
+				// shown in screen or we need to highlight search result
+			} else if ((slider.getSelection() < topIndex + showingTracesFrom
+					- 1 || slider.getSelection() > bottomIndex
+					+ showingTracesFrom)
+					|| TraceViewerGlobals.getTraceViewer().getStateHolder()
+							.getState() == StateHolder.State.SEARCHED) {
+				moveViewAccordingToSlider();
+			} else {
+				TraceViewerGlobals.getTraceViewer().getStateHolder().setState(
+						StateHolder.State.NORMAL);
+			}
+		}
+	}
+
+	/**
+	 * Moves view according to slider position and highlight found text if
+	 * searching
+	 */
+	private void moveViewAccordingToSlider() {
+		// If this is because of searching
+		if (TraceViewerGlobals.getTraceViewer().getStateHolder().getState() == StateHolder.State.SEARCHED) {
+			updateViewerPropertiesAfterSearch();
+			setSelection();
+		} else {
+			viewer.setTopIndex(slider.getSelection() - showingTracesFrom);
+		}
+	}
+
+	/**
+	 * Get more traces after the current data
+	 * 
+	 * @param traceToBeShown
+	 *            trace to be shown
+	 * @param bottomIndex
+	 *            bottom index value
+	 */
+	private void getMoreTracesAfterCurrentData(int traceToBeShown,
+			int bottomIndex) {
+
+		int numberOfBlocks;
+		int offset;
+
+		TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+				.getTimestampParser().nullPreviousTimestamp();
+
+		// If we need only one block
+		if (traceToBeShown < showingTracesFrom + bottomIndex
+				+ TraceViewerGlobals.blockSize) {
+			numberOfBlocks = 1;
+			offset = traceToBeShown + getNumberOfLinesInView() + 2;
+		} else {
+			numberOfBlocks = 2;
+			offset = traceToBeShown + getNumberOfLinesInView()
+					- TraceViewerGlobals.blockSize + 1;
+		}
+
+		// Check if we are getting the last block from the file
+		if (offset + (TraceViewerGlobals.blockSize * numberOfBlocks) > TraceViewerGlobals
+				.getTraceViewer().getDataReaderAccess().getCurrentDataReader()
+				.getTraceCount()) {
+			insertingLastBlock = true;
+		} else {
+			insertingLastBlock = false;
+		}
+
+		// Start scroll reader
+		TraceViewerGlobals.getTraceViewer().getDataReaderAccess()
+				.startScrollReader(offset, numberOfBlocks);
+
+		// Insert after current view
+		insertAfterCurrentView(numberOfBlocks, traceToBeShown);
+	}
+
+	/**
+	 * Get more traces before the current data
+	 * 
+	 * @param traceToBeShown
+	 *            trace to be shown
+	 */
+	private void getMoreTracesBeforeCurrentData(int traceToBeShown) {
+		int numberOfBlocks;
+		TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+				.getTimestampParser().nullPreviousTimestamp();
+		// If we need only one block
+		if (traceToBeShown + TraceViewerGlobals.blockSize > showingTracesFrom) {
+			numberOfBlocks = 1;
+		} else {
+			numberOfBlocks = 2;
+		}
+
+		TraceViewerGlobals.getTraceViewer().getDataReaderAccess()
+				.startScrollReader(traceToBeShown, numberOfBlocks);
+
+		// Insert before current view
+		insertBeforeCurrentView(numberOfBlocks, traceToBeShown);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.TraceViewerTraceViewInterface#closeProgressBar
+	 * (com.nokia.traceviewer.dialog.ProgressBarDialog)
+	 */
+	public void closeProgressBar(ProgressBarDialog dialog) {
+		update(new ProcessProgressBarUpdater(dialog));
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.TraceViewerTraceViewInterface#applyColorRules
+	 * (org.eclipse.swt.custom.StyleRange[])
+	 */
+	public void applyColorRules(StyleRange[] ranges) {
+		update(new ColorRuleUpdater(ranges));
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.TraceViewerTraceViewInterface#updateViewName
+	 * ()
+	 */
+	public void updateViewName() {
+		updateViewName = true;
+		update();
+	}
+
+	/**
+	 * Update the name of the view
+	 */
+	private void generateAndSetViewName() {
+		StringBuilder viewName = new StringBuilder(VIEWNAME_NORMAL);
+
+		// Triggering
+		if (TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+				.getTriggerProcessor().isTriggering()) {
+
+			// Trigger is armed
+			if (TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+					.getTriggerProcessor().isStartTriggering()) {
+				viewName.append(VIEWNAME_ARMED);
+			} else if (TraceViewerGlobals.getTraceViewer()
+					.getDataProcessorAccess().getTriggerProcessor()
+					.isStopTriggering()) {
+				viewName.append(VIEWNAME_STORING);
+			}
+
+		}
+		// Paused
+		if (TraceViewerGlobals.getTraceViewer().getDataReaderAccess()
+				.getMainDataReader().isPaused()) {
+			viewName.append(VIEWNAME_PAUSED);
+		}
+		// Filtered
+		if (TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+				.getFilterProcessor().isFiltering()) {
+			viewName.append(VIEWNAME_FILTERED);
+		}
+
+		// Log file opened
+		if (TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+				.getLogger().isLogFileOpened()) {
+			String logFilePath = TraceViewerGlobals.getTraceViewer()
+					.getDataProcessorAccess().getLogger()
+					.getOpenedLogFileName();
+			viewName.append(LOG_FILE_NAME_SEPARATOR);
+			viewName.append(logFilePath);
+		}
+
+		this.setPartName(viewName.toString());
+		updateViewName = false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.TraceViewerViewInterface#isDisposed()
+	 */
+	public boolean isDisposed() {
+		boolean disposed = false;
+		Shell shell = getShell();
+		if (shell == null || shell.isDisposed()) {
+			disposed = true;
+		}
+		return disposed;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.TraceViewerTraceViewInterface#stopViewUpdate
+	 * (boolean)
+	 */
+	public void stopViewUpdate(boolean stop) {
+		viewUpdateOn = !stop;
+
+		// If view should be refreshed
+		if (!stop) {
+
+			// Sync with UI thread
+			viewer.getControl().getDisplay().asyncExec(new Runnable() {
+
+				public void run() {
+					refreshTraceBlock(TraceViewerGlobals.getTraceViewer()
+							.getDataReaderAccess().getCurrentDataReader()
+							.getTraceCount());
+				}
+			});
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.TraceViewerTraceViewInterface#refreshCurrentView
+	 * ()
+	 */
+	public void refreshCurrentView() {
+		// Sync with UI thread
+		viewer.getControl().getDisplay().asyncExec(new Runnable() {
+
+			public void run() {
+				refreshTraceBlock(slider.getSelection());
+			}
+		});
+	}
+
+	/**
+	 * Find the trace block containing given trace and refreshes it. When coming
+	 * here, we should be in UI thread
+	 * 
+	 * @param traceNumber
+	 *            the trace number
+	 */
+	private void refreshTraceBlock(final int traceNumber) {
+		// Set "showing traces from" variable to totally wrong and
+		// then generate a request to get last block of traces
+		showingTracesFrom = 0 - TraceViewerGlobals.blockSize * 5;
+		scrollViewToLine(traceNumber);
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.TraceViewerTraceViewInterface#setFontSize
+	 * (int)
+	 */
+	public void setFontSize(final int size) {
+		if (widget != null && !widget.isDisposed()) {
+			// Sync with UI thread
+			viewer.getControl().getDisplay().syncExec(new Runnable() {
+
+				public void run() {
+					// Set the font
+					Font font = new Font(viewer.getControl().getDisplay(),
+							new FontData(FONT, size, SWT.NORMAL));
+					widget.setFont(font);
+				}
+			});
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.TraceViewerDialogInterface#showErrorMessage
+	 * (java.lang.String)
+	 */
+	public void showErrorMessage(String error) {
+		MessageDialog.openError(getShell(), TRACE_VIEWER_TITLE, error);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @seecom.nokia.traceviewer.engine.TraceViewerDialogInterface#
+	 * showConfirmationDialog(java.lang.String)
+	 */
+	public boolean showConfirmationDialog(String message) {
+		boolean ok = MessageDialog.openConfirm(getShell(), TRACE_VIEWER_TITLE,
+				message);
+		return ok;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @seecom.nokia.traceviewer.engine.TraceViewerDialogInterface#
+	 * showInformationMessage(java.lang.String)
+	 */
+	public void showInformationMessage(String message) {
+		MessageDialog.openInformation(getShell(), TRACE_VIEWER_TITLE, message);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * com.nokia.traceviewer.engine.TraceViewerDialogInterface#openPreferencePage
+	 * (
+	 * com.nokia.traceviewer.engine.TraceViewerDialogInterface.TVPreferencePage)
+	 */
+	public boolean openPreferencePage(TVPreferencePage TVpage) {
+		boolean ret = false;
+		PreferenceManager mgr = new PreferenceManager();
+
+		// Create general preference page
+		IPreferencePage generalPage = new TraceViewerPreferencesPage();
+		generalPage.setTitle(TRACE_VIEWER_TITLE);
+		IPreferenceNode generalNode = new PreferenceNode("1", generalPage); //$NON-NLS-1$
+		mgr.addToRoot(generalNode);
+
+		// Create advanced preference page
+		IPreferencePage advancedPage = new TraceViewerAdvancedPreferencesPage();
+		advancedPage.setTitle(Messages
+				.getString("TraceViewerView.AdvancedPageTitle")); //$NON-NLS-1$
+		IPreferenceNode advancedNode = new PreferenceNode("2", advancedPage); //$NON-NLS-1$
+		mgr.addTo("1", advancedNode); //$NON-NLS-1$
+
+		// Create connection preference page
+		IPreferencePage connectionPage = new TraceViewerConnectionPreferencesPage();
+		connectionPage.setTitle(Messages
+				.getString("TraceViewerView.ConnectionPageTitle")); //$NON-NLS-1$
+		IPreferenceNode connectionNode = new PreferenceNode("3", connectionPage); //$NON-NLS-1$
+		mgr.addTo("1", connectionNode); //$NON-NLS-1$
+
+		PreferenceDialog dialog = new PreferenceDialog(getShell(), mgr);
+		dialog.create();
+		dialog.getTreeViewer().expandAll();
+
+		// Switch the page
+		switch (TVpage) {
+		case GENERAL:
+			dialog.getTreeViewer().setSelection(
+					new StructuredSelection(generalNode));
+			break;
+		case ADVANCED:
+			dialog.getTreeViewer().setSelection(
+					new StructuredSelection(advancedNode));
+			break;
+		case CONNECTION:
+			dialog.getTreeViewer().setSelection(
+					new StructuredSelection(connectionNode));
+			break;
+		default:
+			break;
+		}
+
+		// Open dialog and get return value
+		int ok = dialog.open();
+		if (ok == Window.OK) {
+			ret = true;
+		}
+
+		return ret;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.nokia.traceviewer.engine.TraceViewerDialogInterface
+	 * #createDialog
+	 * (com.nokia.traceviewer.engine.TraceViewerDialogInterface.Dialog)
+	 */
+	public TraceViewerDialog createDialog(Dialog name) {
+		TraceViewerDialog dialog = dialogFactory.construct(name, getShell());
+		return dialog;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/view/listener/Messages.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,63 @@
+/*
+ * 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:
+ *
+ * String localization for view listener package.
+ *
+ */
+package com.nokia.traceviewer.view.listener;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * String localization for view listener package.
+ * 
+ */
+final class Messages {
+
+	/**
+	 * Bundle name
+	 */
+	private static final String BUNDLE_NAME = "com.nokia.traceviewer.view.listener.messages"; //$NON-NLS-1$
+
+	/**
+	 * Resource bundle
+	 */
+	private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
+			.getBundle(BUNDLE_NAME);
+
+	/**
+	 * Prevents construction.
+	 */
+	private Messages() {
+	}
+
+	/**
+	 * Maps a key to localized string.
+	 * 
+	 * @param key
+	 *            the key for the string
+	 * @return the localized string
+	 */
+	public static String getString(String key) {
+		String value;
+		try {
+			value = RESOURCE_BUNDLE.getString(key);
+		} catch (MissingResourceException e) {
+			value = '!' + key + '!';
+		}
+		return value;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/view/listener/ScrollerSelectionListener.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,82 @@
+/*
+ * 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:
+ *
+ * Scroller Selection Listener class
+ *
+ */
+package com.nokia.traceviewer.view.listener;
+
+import org.eclipse.jface.text.TextViewer;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Slider;
+
+import com.nokia.traceviewer.engine.StateHolder;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Scroller Selection Listener listens changes in view's scroller
+ */
+public class ScrollerSelectionListener implements SelectionListener {
+
+	/**
+	 * Text viewer
+	 */
+	private final TextViewer viewer;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param viewer
+	 *            the viewer
+	 */
+	public ScrollerSelectionListener(TextViewer viewer) {
+		this.viewer = viewer;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse
+	 * .swt.events.SelectionEvent)
+	 */
+	public void widgetDefaultSelected(SelectionEvent e) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt
+	 * .events.SelectionEvent)
+	 */
+	public void widgetSelected(SelectionEvent e) {
+		Slider slider = (Slider) e.getSource();
+
+		TraceViewerGlobals.getTraceViewer().getStateHolder().setState(
+				StateHolder.State.SCROLLING_WITH_SCROLLBAR);
+
+		// Scroll to new line
+		TraceViewerGlobals.getTraceViewer().getView().scrollViewToLine(
+				slider.getSelection());
+
+		viewer.setTopIndex(slider.getSelection()
+				- TraceViewerGlobals.getTraceViewer().getView()
+						.getShowingTracesFrom());
+
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/view/listener/SelectionProperties.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,79 @@
+/*
+ * 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:
+ *
+ * Selection Properties holds properties of current selection
+ *
+ */
+package com.nokia.traceviewer.view.listener;
+
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Selection Properties holds properties of current selection
+ */
+public class SelectionProperties {
+
+	/**
+	 * Line number of the first clicked line
+	 */
+	public static int firstClickedLine = -1;
+
+	/**
+	 * Caret offset of the first clicked line
+	 */
+	public static int firstClickedLineCaretOffset;
+
+	/**
+	 * Timestamp of the first clicked line
+	 */
+	public static String firstClickedTimestamp = ""; //$NON-NLS-1$
+
+	/**
+	 * Line number of the last clicked line
+	 */
+	public static int lastClickedLine = -1;
+
+	/**
+	 * Caret offset of the last clicked line
+	 */
+	public static int lastClickedLineCaretOffset;
+
+	/**
+	 * Timestamp of the last clicked line
+	 */
+	public static String lastClickedTimestamp = ""; //$NON-NLS-1$
+
+	/**
+	 * Puts caret to the end when setting the selection to the view
+	 */
+	public static boolean putCaretToTheEnd;
+
+	/**
+	 * Clears selection
+	 */
+	public static void clear() {
+		firstClickedLine = -1;
+		lastClickedLine = -1;
+		firstClickedLineCaretOffset = 0;
+		lastClickedLineCaretOffset = 0;
+		firstClickedTimestamp = ""; //$NON-NLS-1$
+		lastClickedTimestamp = ""; //$NON-NLS-1$
+		putCaretToTheEnd = false;
+
+		// Update trim
+		TraceViewerGlobals.getTrimProvider().updateText(""); //$NON-NLS-1$
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/view/listener/ViewerClickListener.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,349 @@
+/*
+ * 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:
+ *
+ * Viewer Mouse Click Listener class
+ *
+ */
+package com.nokia.traceviewer.view.listener;
+
+import java.util.List;
+
+import org.eclipse.jface.text.TextViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.graphics.Point;
+
+import com.nokia.traceviewer.action.OpenTraceLocationAction;
+import com.nokia.traceviewer.engine.TraceMetaData;
+import com.nokia.traceviewer.engine.TraceProperties;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.TraceViewerUtils;
+
+/**
+ * Viewer Mouse Click listener
+ * 
+ */
+public class ViewerClickListener implements MouseListener {
+
+	/**
+	 * Left mouse button
+	 */
+	private static final int BUTTON_1 = 1;
+
+	/**
+	 * Right mouse button
+	 */
+	private static final int BUTTON_3 = 3;
+
+	/**
+	 * Double click count
+	 */
+	private static final int DOUBLE_CLICK_COUNT = 2;
+
+	/**
+	 * Triple click count
+	 */
+	private static final int TRIPLE_CLICK_COUNT = 3;
+
+	/**
+	 * Text viewer
+	 */
+	private final TextViewer viewer;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param viewer
+	 */
+	public ViewerClickListener(TextViewer viewer) {
+		this.viewer = viewer;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.swt.events.MouseListener#mouseDoubleClick(org.eclipse.swt
+	 * .events.MouseEvent)
+	 */
+	public void mouseDoubleClick(MouseEvent event) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.swt.events.MouseListener#mouseDown(org.eclipse.swt.events
+	 * .MouseEvent)
+	 */
+	public void mouseDown(MouseEvent event) {
+		if (event.button == BUTTON_1) {
+			// If shift was not pressed, save the line where click happened
+			if ((event.stateMask & SWT.SHIFT) == 0) {
+
+				// Single click
+				if (event.count == 1) {
+					saveClickedLineProperties(event, true);
+
+					// Double click, jump to source code
+				} else if (event.count == DOUBLE_CLICK_COUNT) {
+					jumpToSource(event);
+
+					// Triple click, remove one character from the selection
+				} else if (event.count == TRIPLE_CLICK_COUNT) {
+					Point point = viewer.getSelectedRange();
+					viewer.setSelectedRange(point.x, point.y - 1);
+				}
+
+			} else {
+				// Shift was pressed, select lines from viewer if necessary
+				saveClickedLineProperties(event, false);
+				selectLinesFromViewer(event);
+			}
+
+			// Select the line with right mouse button
+		} else if (event.button == BUTTON_3) {
+			String text = viewer.getTextWidget().getText();
+			if (text.length() > 0) {
+				int startOffset = viewer.getTextWidget().getSelectionRange().x - 1;
+				int endOffset = startOffset
+						+ viewer.getTextWidget().getSelectionRange().y + 1;
+				if (startOffset < 0) {
+					startOffset = 0;
+				}
+				if (endOffset >= text.length()) {
+					endOffset = text.length() - 1;
+				}
+				char c1 = text.charAt(startOffset);
+				char c2 = text.charAt(endOffset);
+				if (!viewer.getTextWidget().getSelectionText().contains("\n") //$NON-NLS-1$
+						&& (viewer.getTextWidget().getSelectionCount() == 0
+								|| (c1 == '\n' && c2 == '\n') || startOffset == 0)) {
+
+					// Save the line number
+					int clickedLine = getClickedLine(event)
+							+ TraceViewerGlobals.getTraceViewer().getView()
+									.getShowingTracesFrom();
+
+					SelectionProperties.firstClickedLine = clickedLine;
+					SelectionProperties.lastClickedLine = clickedLine;
+
+					selectClickedLine(event);
+				}
+			}
+		}
+	}
+
+	/**
+	 * Saves clicked lines properties
+	 * 
+	 * @param event
+	 *            mouse event
+	 * @param firstClick
+	 *            if true, save line properties to first click, otherwise to
+	 *            last click
+	 */
+	private void saveClickedLineProperties(MouseEvent event, boolean firstClick) {
+		// Get timestamp length
+		int timestampLength = TraceViewerGlobals.getTraceViewer()
+				.getDataProcessorAccess().getTimestampParser()
+				.getTimestampStringLength();
+
+		// Save the line number
+		int clickedLine = getClickedLine(event)
+				+ TraceViewerGlobals.getTraceViewer().getView()
+						.getShowingTracesFrom();
+
+		int offsetAtLine = viewer.getTextWidget().getOffsetAtLine(
+				getClickedLine(event));
+
+		if (offsetAtLine + timestampLength > viewer.getTextWidget()
+				.getCharCount()
+				&& getClickedLine(event) > 0) {
+			int line = getClickedLine(event) - 1;
+			if (line > 0 && line < viewer.getTextWidget().getLineCount()) {
+				offsetAtLine = viewer.getTextWidget().getOffsetAtLine(line);
+			} else {
+				// Offset is wrong, make sure we won't save it. Minus some value
+				// so the value doesn't go around when something is added to it
+				offsetAtLine = Integer.MAX_VALUE - timestampLength - 1;
+			}
+		}
+
+		int clickedLineCaretOffset = 0;
+		String clickedTimestamp = ""; //$NON-NLS-1$
+		if (offsetAtLine + timestampLength < viewer.getTextWidget()
+				.getCharCount()) {
+
+			// Save the caret offset
+			clickedLineCaretOffset = viewer.getTextWidget().getCaretOffset()
+					- offsetAtLine;
+
+			// Save the timestamp String
+			clickedTimestamp = TraceViewerUtils
+					.getTimestampStringForTrace(clickedLine);
+		}
+		// Save variables to the first click
+		if (firstClick) {
+			SelectionProperties.firstClickedLine = clickedLine;
+			SelectionProperties.firstClickedLineCaretOffset = clickedLineCaretOffset;
+			SelectionProperties.firstClickedTimestamp = clickedTimestamp;
+
+			// Null last click values
+			SelectionProperties.lastClickedLine = -1;
+			SelectionProperties.lastClickedLineCaretOffset = 0;
+			SelectionProperties.lastClickedTimestamp = ""; //$NON-NLS-1$
+			ViewerSelectionChangedListener.handleTrimInformationUpdate();
+		} else {
+			// Save variables to the last click
+			SelectionProperties.lastClickedLine = clickedLine;
+			SelectionProperties.lastClickedLineCaretOffset = clickedLineCaretOffset;
+			SelectionProperties.lastClickedTimestamp = clickedTimestamp;
+		}
+	}
+
+	/**
+	 * Selects lines from viewer when clicked with shift down
+	 * 
+	 * @param event
+	 *            mouse click event
+	 */
+	private void selectLinesFromViewer(MouseEvent event) {
+		int showingFrom = TraceViewerGlobals.getTraceViewer().getView()
+				.getShowingTracesFrom();
+		int currentLine = getClickedLine(event) + showingFrom;
+		int caretOffset = viewer.getTextWidget().getCaretOffset();
+
+		// Current line is smaller than the one clicked first
+		// Select everything from current line to the first clicked
+		// or to the end of the block
+		if (currentLine < SelectionProperties.firstClickedLine) {
+
+			// Selection goes out of the block
+			if (SelectionProperties.firstClickedLine > showingFrom
+					+ viewer.getTextWidget().getLineCount()) {
+				int topIndex = viewer.getTopIndex();
+				viewer.getTextWidget().setRedraw(false);
+				viewer.getTextWidget().setSelection(
+						viewer.getTextWidget().getCharCount() - 1, caretOffset);
+				viewer.setTopIndex(topIndex);
+				viewer.getTextWidget().setRedraw(true);
+			}
+		} else {
+			// Current line is bigger than the one clicked first
+			// Select everything upwards from the current line to the first
+			// clicked or to the top of the block
+
+			// Selection start goes up from this block
+			if (SelectionProperties.firstClickedLine < showingFrom) {
+				// Select from start of this block to current pos
+				viewer.setSelectedRange(0, caretOffset);
+			}
+		}
+
+		// Update Trim widget
+		ViewerSelectionChangedListener.handleTrimInformationUpdate();
+	}
+
+	/**
+	 * Selects clicked line
+	 * 
+	 * @param event
+	 *            clicking event
+	 */
+	private void selectClickedLine(MouseEvent event) {
+		int clickedInLine = getClickedLine(event);
+		if (clickedInLine < viewer.getTextWidget().getLineCount() - 1) {
+			int beginIdx = viewer.getTextWidget()
+					.getOffsetAtLine(clickedInLine);
+			int endIdx = viewer.getTextWidget().getOffsetAtLine(
+					clickedInLine + 1) - 1;
+
+			// Select backwards to keep Viewer in the beginning of the trace
+			viewer.getTextWidget().setSelection(endIdx, beginIdx);
+
+			String clickedTimestamp = TraceViewerUtils
+					.getTimestampStringForTrace(clickedInLine);
+
+			// Set properties
+			SelectionProperties.firstClickedLineCaretOffset = 0;
+			SelectionProperties.firstClickedTimestamp = clickedTimestamp;
+
+			SelectionProperties.lastClickedLineCaretOffset = endIdx - beginIdx;
+			SelectionProperties.lastClickedTimestamp = clickedTimestamp;
+
+			// Update Trim widget
+			ViewerSelectionChangedListener.handleTrimInformationUpdate();
+		}
+	}
+
+	/**
+	 * Gets linenumber where clicking happened
+	 * 
+	 * @param event
+	 *            clicking event
+	 * @return line number where clicking happened
+	 */
+	private int getClickedLine(MouseEvent event) {
+		int clickedInLine = viewer.getTextWidget().getLineIndex(event.y);
+		return clickedInLine;
+	}
+
+	/**
+	 * Jumps to source code
+	 * 
+	 * @param event
+	 *            click event
+	 */
+	private void jumpToSource(MouseEvent event) {
+		// Get the line number
+		int clickedLine = getClickedLine(event)
+				+ TraceViewerGlobals.getTraceViewer().getView()
+						.getShowingTracesFrom();
+
+		// Get the trace from the file
+		List<TraceProperties> traceList = TraceViewerGlobals.getTraceViewer()
+				.getTraces(clickedLine, clickedLine);
+
+		TraceProperties trace = null;
+		if (traceList != null && !traceList.isEmpty()) {
+			trace = traceList.get(0);
+		}
+
+		// If traceInformation is found, jump to source code line
+		if (trace != null && trace.information != null) {
+			TraceMetaData metaData = TraceViewerGlobals.getDecodeProvider()
+					.getTraceMetaData(trace.information);
+			if (metaData != null && metaData.getPath() != null) {
+				OpenTraceLocationAction openLocationAction = (OpenTraceLocationAction) TraceViewerGlobals
+						.getTraceViewer().getView().getActionFactory()
+						.getOpenTraceLocationAction();
+				openLocationAction.setMetaData(metaData, false);
+				openLocationAction.run();
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @seeorg.eclipse.swt.events.MouseListener#mouseUp(org.eclipse.swt.events.
+	 * MouseEvent)
+	 */
+	public void mouseUp(MouseEvent event) {
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/view/listener/ViewerKeyListener.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,366 @@
+/*
+ * 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:
+ *
+ * TraceViewer view key listener
+ *
+ */
+package com.nokia.traceviewer.view.listener;
+
+import org.eclipse.jface.text.TextViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.widgets.Slider;
+
+import com.nokia.traceviewer.engine.StateHolder;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.TraceViewerTraceViewInterface;
+import com.nokia.traceviewer.engine.TraceViewerUtils;
+import com.nokia.traceviewer.view.TraceViewerView;
+
+/**
+ * TraceViewer view key listener
+ * 
+ */
+public class ViewerKeyListener implements KeyListener {
+
+	/**
+	 * The slider in the view
+	 */
+	private final Slider slider;
+
+	/**
+	 * The TextViewer in the view
+	 */
+	private final TextViewer viewer;
+
+	/**
+	 * TraceViewer view
+	 */
+	private final TraceViewerView view;
+
+	/**
+	 * Boolean determining if view should be updated after arrow up/down
+	 */
+	private boolean shouldBeUpdated;
+
+	/**
+	 * Font size
+	 */
+	private int fontSize = TraceViewerTraceViewInterface.FONT_SIZE;
+
+	/**
+	 * Max font size
+	 */
+	private static final int MAX_FONT_SIZE = 100;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param slider
+	 *            reference to the slider
+	 * @param viewer
+	 *            reference to the viewer
+	 * @param view
+	 *            reference to the view
+	 */
+	public ViewerKeyListener(Slider slider, TextViewer viewer,
+			TraceViewerView view) {
+		this.slider = slider;
+		this.viewer = viewer;
+		this.view = view;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.swt.events.KeyListener#keyPressed(org.eclipse.swt.events.
+	 * KeyEvent)
+	 */
+	public void keyPressed(KeyEvent e) {
+		int keyCode = e.keyCode;
+		int showingTracesFrom = TraceViewerGlobals.getTraceViewer().getView()
+				.getShowingTracesFrom();
+
+		switch (keyCode) {
+
+		// Page up pressed
+		case SWT.PAGE_UP:
+			// If there is at least one full page left in up of the cursor, we
+			// just move the slider to where top index is
+			if (viewer.getTopIndex() > (viewer.getBottomIndex() - viewer
+					.getTopIndex())) {
+				slider.setSelection(showingTracesFrom + viewer.getTopIndex());
+
+				// If there is not at least one full page left, we move the
+				// slider with one thumb
+			} else {
+				slider.setSelection(slider.getSelection() - slider.getThumb());
+				TraceViewerGlobals.getTraceViewer().getStateHolder().setState(
+						StateHolder.State.SCROLLING_WITH_PAGEUPDOWN);
+			}
+
+			break;
+
+		// Page down pressed
+		case SWT.PAGE_DOWN:
+			// If there is at least full page left down from the cursor, we
+			// just move the slider to where top index is
+			if (viewer.getTopIndex() + viewer.getBottomIndex()
+					- viewer.getTopIndex() + 2 < viewer.getTextWidget()
+					.getLineCount()) {
+
+				slider.setSelection(showingTracesFrom + viewer.getTopIndex());
+
+				// If there is not full page left, we move the
+				// slider with one thumb
+			} else {
+				slider.setSelection(slider.getSelection() + slider.getThumb());
+				TraceViewerGlobals.getTraceViewer().getStateHolder().setState(
+						StateHolder.State.SCROLLING_WITH_PAGEUPDOWN);
+			}
+
+			break;
+
+		case SWT.ARROW_UP:
+			// There is at least 1 row in top of the view, just move slider to
+			// where top index is
+			if (viewer.getTopIndex() > 0) {
+				slider.setSelection(showingTracesFrom + viewer.getTopIndex());
+			} else {
+				// When we are in the first row, the second time is when we want
+				// to update
+				if (shouldBeUpdated) {
+					TraceViewerGlobals.getTraceViewer().getStateHolder()
+							.setState(StateHolder.State.SCROLLING_WITH_ARROWS);
+					slider.setSelection(showingTracesFrom - 1);
+					shouldBeUpdated = false;
+				} else {
+					shouldBeUpdated = true;
+				}
+
+			}
+			removePossibleSelection(e.stateMask);
+			break;
+		case SWT.ARROW_DOWN:
+			// There is at least 1 row in bottom of the view, just move slider
+			// to where top index is
+			if (viewer.getBottomIndex() < viewer.getTextWidget().getLineCount() - 1) {
+				slider.setSelection(showingTracesFrom + viewer.getTopIndex());
+			} else {
+				TraceViewerGlobals.getTraceViewer().getStateHolder().setState(
+						StateHolder.State.SCROLLING_WITH_ARROWS);
+				slider.setSelection(slider.getSelection() + 1);
+			}
+			removePossibleSelection(e.stateMask);
+			break;
+		case SWT.ARROW_LEFT:
+			// Fall through
+		case SWT.ARROW_RIGHT:
+			removePossibleSelection(e.stateMask);
+			break;
+		case SWT.HOME:
+			// Ctrl was used
+			if ((e.stateMask & SWT.CTRL) == SWT.CTRL) {
+
+				// Shift was used
+				if ((e.stateMask & SWT.SHIFT) == SWT.SHIFT) {
+					SelectionProperties.lastClickedLine = 0;
+					SelectionProperties.lastClickedLineCaretOffset = 0;
+					SelectionProperties.lastClickedTimestamp = TraceViewerUtils
+							.getTimestampStringForTrace(0);
+
+				} else {
+					SelectionProperties.firstClickedLine = 0;
+					SelectionProperties.firstClickedLineCaretOffset = 0;
+					SelectionProperties.firstClickedTimestamp = TraceViewerUtils
+							.getTimestampStringForTrace(0);
+					SelectionProperties.lastClickedLine = -1;
+					SelectionProperties.lastClickedTimestamp = ""; //$NON-NLS-1$
+				}
+
+				// If we are in the first block
+				if (isInFirstBlock()) {
+					// Update trim and set selection
+					ViewerSelectionChangedListener
+							.handleTrimInformationUpdate();
+					view.setSelection();
+				}
+
+				// Jump to first line
+				viewer.getTextWidget().setCaretOffset(0);
+				slider.setSelection(0);
+
+				// Ctrl was not used
+			} else {
+				removePossibleSelection(e.stateMask);
+			}
+
+			break;
+		case SWT.END:
+			// Ctrl was used
+			if ((e.stateMask & SWT.CTRL) == SWT.CTRL) {
+				int traceCount = TraceViewerGlobals.getTraceViewer()
+						.getDataReaderAccess().getCurrentDataReader()
+						.getTraceCount();
+
+				// Shift was used
+				if ((e.stateMask & SWT.SHIFT) == SWT.SHIFT) {
+					SelectionProperties.lastClickedLine = traceCount;
+					SelectionProperties.lastClickedLineCaretOffset = 0;
+					SelectionProperties.lastClickedTimestamp = TraceViewerUtils
+							.getTimestampStringForTrace(traceCount - 1);
+				} else {
+					SelectionProperties.firstClickedLine = traceCount;
+					SelectionProperties.firstClickedLineCaretOffset = 0;
+					SelectionProperties.firstClickedTimestamp = TraceViewerUtils
+							.getTimestampStringForTrace(traceCount - 1);
+					SelectionProperties.lastClickedLine = -1;
+					SelectionProperties.lastClickedTimestamp = ""; //$NON-NLS-1$
+				}
+
+				// If we are in the last block
+				if (isInLastBlock()) {
+
+					// Set the caret to the end
+					viewer.getTextWidget().setCaretOffset(
+							viewer.getTextWidget().getCharCount());
+
+					viewer.setTopIndex(traceCount);
+
+					// Update trim and set selection
+					ViewerSelectionChangedListener
+							.handleTrimInformationUpdate();
+					view.setSelection();
+
+					// Not in the last block
+				} else {
+					SelectionProperties.putCaretToTheEnd = true;
+				}
+
+				// Change the slider position
+				slider.setSelection(traceCount);
+
+				// Ctrl was not used
+			} else {
+				removePossibleSelection(e.stateMask);
+			}
+
+			break;
+
+		// Search again
+		case SWT.F3:
+			String previousSearch = TraceViewerGlobals.getTraceViewer()
+					.getDataProcessorAccess().getSearchProcessor()
+					.getSearchDialog().getPreviousSearchString();
+
+			if (!previousSearch.equals("")) { //$NON-NLS-1$
+				TraceViewerGlobals.getTraceViewer().getDataProcessorAccess()
+						.getSearchProcessor().searchTraceWithString(
+								previousSearch);
+			}
+			break;
+		default:
+			break;
+		}
+
+		// Font size can be changed with CTRL + "+" or CTRL + "-" chars
+		if (e.stateMask == SWT.CTRL) {
+			switch (e.character) {
+			case '+':
+				if (fontSize++ <= MAX_FONT_SIZE) {
+					TraceViewerGlobals.getTraceViewer().getView().setFontSize(
+							fontSize);
+				} else {
+					fontSize = MAX_FONT_SIZE;
+				}
+
+				break;
+			case '-':
+				if (fontSize-- > 0) {
+					TraceViewerGlobals.getTraceViewer().getView().setFontSize(
+							fontSize);
+				} else {
+					fontSize = 1;
+				}
+				break;
+			default:
+				break;
+			}
+
+		}
+
+		// Scroll to new line or get more data
+		TraceViewerGlobals.getTraceViewer().getView().scrollViewToLine(
+				slider.getSelection());
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.swt.events.KeyListener#keyReleased(org.eclipse.swt.events
+	 * .KeyEvent)
+	 */
+	public void keyReleased(KeyEvent e) {
+
+	}
+
+	/**
+	 * Checks if we are in the last block of traces
+	 * 
+	 * @return true if we are in the last block of traces
+	 */
+	private boolean isInLastBlock() {
+		boolean lastBlock = false;
+		if (TraceViewerGlobals.getTraceViewer().getView()
+				.getShowingTracesFrom()
+				+ (2 * TraceViewerGlobals.blockSize) > TraceViewerGlobals
+				.getTraceViewer().getDataReaderAccess().getCurrentDataReader()
+				.getTraceCount()) {
+			lastBlock = true;
+		}
+		return lastBlock;
+
+	}
+
+	/**
+	 * Checks if we are in the first block of traces
+	 * 
+	 * @return true if we are in the first block of traces
+	 */
+	private boolean isInFirstBlock() {
+		boolean firstBlock = false;
+		if (TraceViewerGlobals.getTraceViewer().getView()
+				.getShowingTracesFrom() == 0) {
+			firstBlock = true;
+		}
+		return firstBlock;
+
+	}
+
+	/**
+	 * Removes possible selection
+	 * 
+	 * @param stateMask
+	 *            state mask for the key
+	 */
+	private void removePossibleSelection(int stateMask) {
+		if (stateMask != SWT.SHIFT) {
+			SelectionProperties.clear();
+		}
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/view/listener/ViewerMouseWheelListener.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,89 @@
+/*
+ * 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:
+ *
+ * Viewer Mouse Wheel Listener class
+ *
+ */
+package com.nokia.traceviewer.view.listener;
+
+import org.eclipse.jface.text.TextViewer;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Slider;
+
+import com.nokia.traceviewer.engine.StateHolder;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+
+/**
+ * Viewer Mouse Wheel Listener class
+ * 
+ */
+public class ViewerMouseWheelListener implements Listener {
+
+	/**
+	 * The scroller object in the view
+	 */
+	private final Slider slider;
+
+	/**
+	 * The viewer object in the view
+	 */
+	private final TextViewer viewer;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param slider
+	 *            reference to the slider
+	 * @param viewer
+	 *            reference to the viewer
+	 */
+	public ViewerMouseWheelListener(Slider slider, TextViewer viewer) {
+		this.slider = slider;
+		this.viewer = viewer;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.
+	 * Event)
+	 */
+	public void handleEvent(Event e) {
+		int showingTracesFrom = TraceViewerGlobals.getTraceViewer().getView()
+				.getShowingTracesFrom();
+
+		// If there is data left in the up or in the bottom of the current view,
+		// move the slider to where top index is
+		if ((viewer.getTopIndex() > e.count)
+				&& (viewer.getTopIndex() + viewer.getBottomIndex()
+						- viewer.getTopIndex() + 2 < viewer.getTextWidget()
+						.getLineCount())) {
+
+			slider.setSelection(showingTracesFrom + viewer.getTopIndex());
+
+		} else {
+			slider.setSelection(slider.getSelection() - e.count);
+			TraceViewerGlobals.getTraceViewer().getStateHolder().setState(
+					StateHolder.State.SCROLLING_WITH_SCROLLBAR);
+		}
+
+		// Scroll view to correct line
+		TraceViewerGlobals.getTraceViewer().getView().scrollViewToLine(
+				slider.getSelection());
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/view/listener/ViewerSelectionChangedListener.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,361 @@
+/*
+ * 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:
+ *
+ * Viewer Selection Changed Listener listens changes in viewers selection
+ *
+ */
+package com.nokia.traceviewer.view.listener;
+
+import org.eclipse.jface.text.TextViewer;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.widgets.Slider;
+
+import com.nokia.traceviewer.engine.StateHolder;
+import com.nokia.traceviewer.engine.TraceViewerGlobals;
+import com.nokia.traceviewer.engine.TraceViewerUtils;
+
+/**
+ * Viewer Selection Changed Listener listens changes in viewers selection
+ * 
+ */
+public class ViewerSelectionChangedListener implements
+		ISelectionChangedListener {
+
+	/**
+	 * Seconds in day
+	 */
+	private static final int SECONDS_IN_DAY = 86400;
+
+	/**
+	 * Timestamp length
+	 */
+	private static final int TIMESTAMP_LENGTH = 12;
+
+	/**
+	 * The slider in the view
+	 */
+	private final Slider slider;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param slider
+	 *            the slider
+	 */
+	public ViewerSelectionChangedListener(Slider slider) {
+		this.slider = slider;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.viewers.ISelectionChangedListener
+	 * #selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
+	 */
+	public void selectionChanged(SelectionChangedEvent event) {
+		handleViewUpdate(event);
+		handleTrimInformationUpdate();
+	}
+
+	/**
+	 * Handles view update
+	 * 
+	 * @param event
+	 *            selection changed event
+	 */
+	private void handleViewUpdate(SelectionChangedEvent event) {
+		TextViewer viewer = (TextViewer) event.getSource();
+		StyledText widget = viewer.getTextWidget();
+		int showingTracesFrom = TraceViewerGlobals.getTraceViewer().getView()
+				.getShowingTracesFrom();
+
+		slider.setSelection(showingTracesFrom + viewer.getTopIndex());
+
+		int caretOffset = widget.getCaretOffset();
+		int line = widget.getLineAtOffset(caretOffset);
+
+		if (line <= 0) {
+			// First line
+			TraceViewerGlobals.getTraceViewer().getStateHolder().setState(
+					StateHolder.State.SCROLLING_WITH_ARROWS);
+			slider.setSelection(showingTracesFrom - 1);
+		} else if (line >= widget.getLineCount() - 1
+				&& line < TraceViewerGlobals.getTraceViewer()
+						.getDataReaderAccess().getCurrentDataReader()
+						.getTraceCount()
+						- showingTracesFrom) {
+			TraceViewerGlobals.getTraceViewer().getStateHolder().setState(
+					StateHolder.State.SCROLLING_WITH_ARROWS);
+			slider.setSelection(showingTracesFrom + widget.getLineCount() + 1);
+		}
+
+		updateSelectionProperties(widget);
+
+		// Scroll view to correct line
+		TraceViewerGlobals.getTraceViewer().getView().scrollViewToLine(
+				slider.getSelection());
+	}
+
+	/**
+	 * Updates selection properties
+	 * 
+	 * @param widget
+	 *            styledtext widget
+	 */
+	private void updateSelectionProperties(StyledText widget) {
+		int showingTracesFrom = TraceViewerGlobals.getTraceViewer().getView()
+				.getShowingTracesFrom();
+
+		// Get selection start
+		int selectionStart = widget.getSelectionRange().x;
+
+		int upperSelectionLine = widget.getLineAtOffset(widget
+				.getSelectionRange().x);
+		int upperSelectionLineOffset = widget
+				.getOffsetAtLine(upperSelectionLine);
+
+		int belowSelectionLine = widget.getLineAtOffset(widget
+				.getSelectionRange().x
+				+ widget.getSelectionRange().y);
+		int belowSelectionLineOffset = widget
+				.getOffsetAtLine(belowSelectionLine);
+
+		// If last line selected, take it out
+		if (belowSelectionLineOffset + TIMESTAMP_LENGTH >= widget
+				.getCharCount()
+				&& belowSelectionLine > 0) {
+			belowSelectionLine--;
+			belowSelectionLineOffset = widget
+					.getOffsetAtLine(belowSelectionLine);
+		}
+
+		int firstSelLine = upperSelectionLine;
+		int firstSelLineOffset = upperSelectionLineOffset;
+		int firstSelCaretOffset = widget.getSelectionRange().x
+				- upperSelectionLineOffset;
+		int lastSelLine = belowSelectionLine;
+		int lastSelLineOffset = belowSelectionLineOffset;
+		int lastSelCaretOffset = widget.getSelectionRange().x
+				+ widget.getSelectionRange().y - belowSelectionLineOffset;
+
+		// If caret is not at start, we are selection downwards
+		if (widget.getCaretOffset() == selectionStart) {
+			firstSelLine = belowSelectionLine;
+			firstSelLineOffset = belowSelectionLineOffset;
+
+			int tmp = firstSelCaretOffset;
+			firstSelCaretOffset = lastSelCaretOffset;
+			lastSelCaretOffset = tmp;
+
+			lastSelLine = upperSelectionLine;
+			lastSelLineOffset = upperSelectionLineOffset;
+		}
+
+		// Only save new start offset if current offset is in same block,
+		// at initial state -1 or start at position 0
+		boolean offsetInSameBlock = SelectionProperties.firstClickedLine > showingTracesFrom
+				&& SelectionProperties.firstClickedLine < showingTracesFrom
+						+ widget.getLineCount();
+
+		if (offsetInSameBlock
+				|| SelectionProperties.firstClickedLine == -1
+				|| (showingTracesFrom == 0 && SelectionProperties.firstClickedLine == 0)) {
+
+			SelectionProperties.firstClickedLine = firstSelLine
+					+ showingTracesFrom;
+			SelectionProperties.firstClickedLineCaretOffset = firstSelCaretOffset;
+			if (firstSelLineOffset + TIMESTAMP_LENGTH < widget.getCharCount()) {
+				SelectionProperties.firstClickedTimestamp = TraceViewerUtils
+						.getTimestampStringForTrace(SelectionProperties.firstClickedLine);
+			}
+		}
+
+		SelectionProperties.lastClickedLine = lastSelLine + showingTracesFrom;
+		SelectionProperties.lastClickedLineCaretOffset = lastSelCaretOffset;
+		if (lastSelLineOffset + TIMESTAMP_LENGTH < widget.getCharCount()) {
+			SelectionProperties.lastClickedTimestamp = TraceViewerUtils
+					.getTimestampStringForTrace(SelectionProperties.lastClickedLine);
+		}
+	}
+
+	/**
+	 * Handles trim information update
+	 */
+	public static void handleTrimInformationUpdate() {
+		String timeDiff = ""; //$NON-NLS-1$
+
+		// Check that first and last timestamps exist
+		if (SelectionProperties.firstClickedTimestamp.length() > 0
+				&& SelectionProperties.lastClickedTimestamp.length() > 0) {
+			int firstTimeSeconds = getTimeInSeconds(SelectionProperties.firstClickedTimestamp);
+			int firstTimeMilliSeconds = getTimeInMilliSeconds(SelectionProperties.firstClickedTimestamp);
+			int lastTimeSeconds = getTimeInSeconds(SelectionProperties.lastClickedTimestamp);
+			int lastTimeMilliSeconds = getTimeInMilliSeconds(SelectionProperties.lastClickedTimestamp);
+
+			// Go here if first clicked line is smaller than last clicked line
+			// -> selecting forward
+			if (SelectionProperties.firstClickedLine < SelectionProperties.lastClickedLine) {
+				timeDiff = generateLabelString(
+						SelectionProperties.firstClickedLine, firstTimeSeconds,
+						firstTimeMilliSeconds,
+						SelectionProperties.lastClickedLine, lastTimeSeconds,
+						lastTimeMilliSeconds);
+
+				// Go here if first clicked line is bigger than last clicked
+				// line -> selecting backward
+			} else {
+				timeDiff = generateLabelString(
+						SelectionProperties.lastClickedLine, lastTimeSeconds,
+						lastTimeMilliSeconds,
+						SelectionProperties.firstClickedLine, firstTimeSeconds,
+						firstTimeMilliSeconds);
+			}
+		}
+		TraceViewerGlobals.getTrimProvider().updateText(timeDiff);
+	}
+
+	/**
+	 * Generates label string
+	 * 
+	 * @param firstLineNumber
+	 *            first line number
+	 * @param firstTimeSeconds
+	 *            first time seconds
+	 * @param firstTimeMilliSeconds
+	 *            first time milliseconds
+	 * @param lastLineNumber
+	 *            last line number
+	 * @param lastTimeSeconds
+	 *            last time seconds
+	 * @param lastTimeMilliSeconds
+	 *            last time milliseconds
+	 * @return label string
+	 */
+	private static String generateLabelString(int firstLineNumber,
+			int firstTimeSeconds, int firstTimeMilliSeconds,
+			int lastLineNumber, int lastTimeSeconds, int lastTimeMilliSeconds) {
+
+		// There cannot be too many traces selected. This makes Select all to
+		// show correct amount of traces while still actually selecting also the
+		// last trace
+		if (lastLineNumber >= TraceViewerGlobals.getTraceViewer()
+				.getDataReaderAccess().getCurrentDataReader().getTraceCount()) {
+			lastLineNumber = TraceViewerGlobals.getTraceViewer()
+					.getDataReaderAccess().getCurrentDataReader()
+					.getTraceCount() - 1;
+		}
+
+		boolean moreMillisInFirst = false;
+
+		if (firstTimeSeconds > lastTimeSeconds) {
+			firstTimeSeconds -= SECONDS_IN_DAY;
+		}
+
+		// Take one second off if more milliseconds in the first
+		// time
+		if (firstTimeMilliSeconds > lastTimeMilliSeconds) {
+			moreMillisInFirst = true;
+			lastTimeSeconds--;
+		}
+
+		int diffSeconds = lastTimeSeconds - firstTimeSeconds;
+		int diffMillis;
+		if (moreMillisInFirst) {
+			diffMillis = 1000 - Math.abs(lastTimeMilliSeconds
+					- firstTimeMilliSeconds);
+		} else {
+			diffMillis = Math.abs(lastTimeMilliSeconds - firstTimeMilliSeconds);
+		}
+
+		// String buffer where to construct the text
+		StringBuffer labelText = new StringBuffer();
+		labelText
+				.append(Messages
+						.getString("ViewerSelectionChangedListener.TracesSelectedText")); //$NON-NLS-1$
+		labelText.append((lastLineNumber - firstLineNumber + 1));
+		labelText
+				.append(Messages
+						.getString("ViewerSelectionChangedListener.TimeDifferenceText")); //$NON-NLS-1$
+
+		// Hours
+		int hours = diffSeconds / 3600;
+		if (hours < 10) {
+			labelText.append('0');
+		}
+		labelText.append(hours);
+		labelText.append(':');
+
+		int minutes = (diffSeconds % 3600) / 60;
+		if (minutes < 10) {
+			labelText.append('0');
+		}
+		labelText.append(minutes);
+		labelText.append(':');
+
+		int seconds = diffSeconds % 60;
+		if (seconds < 10) {
+			labelText.append('0');
+		}
+		labelText.append(seconds);
+		labelText.append('.');
+
+		// Milliseconds
+		if (diffMillis < 100) {
+			labelText.append('0');
+		}
+		if (diffMillis < 10) {
+			labelText.append('0');
+		}
+		labelText.append(diffMillis);
+
+		return labelText.toString();
+	}
+
+	/**
+	 * Gets time in seconds from timestamp string
+	 * 
+	 * @param timestamp
+	 *            timestamp string
+	 * @return time in seconds
+	 */
+	private static int getTimeInSeconds(String timestamp) {
+		int seconds = 0;
+		try {
+			seconds = (Integer.parseInt(timestamp.substring(0, 2)) * 3600);
+			seconds += (Integer.parseInt(timestamp.substring(3, 5)) * 60);
+			seconds += Integer.parseInt(timestamp.substring(6, 8));
+		} catch (Exception e) {
+		}
+		return seconds;
+	}
+
+	/**
+	 * Gets time in milliseconds from timestamp string
+	 * 
+	 * @param timestamp
+	 *            timestamp string
+	 * @return time in milliseconds
+	 */
+	private static int getTimeInMilliSeconds(String timestamp) {
+		int milliseconds = 0;
+		try {
+			milliseconds += (Float.parseFloat(timestamp.substring(9, 12)));
+		} catch (Exception e) {
+		}
+		return milliseconds;
+	}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/view/listener/WindowResizeListener.java	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,75 @@
+/*
+ * 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:
+ *
+ * Window Resize Listener
+ *
+ */
+package com.nokia.traceviewer.view.listener;
+
+import org.eclipse.jface.text.TextViewer;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.events.ControlListener;
+import org.eclipse.swt.widgets.Slider;
+
+/**
+ * Window Resize Listener
+ */
+public class WindowResizeListener implements ControlListener {
+
+	/**
+	 * The slider in the view
+	 */
+	private final Slider slider;
+
+	/**
+	 * The TextViewer in the view
+	 */
+	private final TextViewer viewer;
+
+	/**
+	 * Constructor
+	 * 
+	 * @param slider
+	 *            slider of the view
+	 * @param viewer
+	 *            viewer of the view
+	 */
+	public WindowResizeListener(Slider slider, TextViewer viewer) {
+		this.slider = slider;
+		this.viewer = viewer;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.swt.events.ControlListener#controlMoved(org.eclipse.swt.events
+	 * .ControlEvent)
+	 */
+	public void controlMoved(ControlEvent e) {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.swt.events.ControlListener#controlResized(org.eclipse.swt
+	 * .events.ControlEvent)
+	 */
+	public void controlResized(ControlEvent e) {
+		slider.setThumb(viewer.getBottomIndex() - viewer.getTopIndex());
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/view/listener/messages.properties	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,2 @@
+ViewerSelectionChangedListener.TracesSelectedText=\ Traces selected: 
+ViewerSelectionChangedListener.TimeDifferenceText=. Time difference: 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/view/messages.properties	Wed Jun 23 14:49:59 2010 +0300
@@ -0,0 +1,19 @@
+TracePropertyView.ValueColumnName=Value
+TraceViewerView.BinaryTraceInformationMessage=BINARY TRACE, DICTIONARY FILE NOT LOADED OR INCORRECT?
+TraceViewerView.BinaryTraceText=BINARY: 
+TraceViewerView.AdvancedPageTitle=Advanced
+TraceViewerView.ConnectionPageTitle=Connection
+TracePropertyView.VariableTracingColumnName=Variable tracing rule name
+TracePropertyView.OccurrencesColumnName=Occurrences
+TracePropertyView.LineCountRuleColumnName=Line counting rule name
+TracePropertyView.TraceCommentColumnName=Trace comment
+TracePropertyView.TraceNumberColumnName=Trace no
+TraceViewerView.ViewTitle=TraceViewer
+TraceViewerView.FilteredText=-Filtered
+TraceViewerView.PausedText=-Paused
+TraceViewerView.DataString=\ Data: 
+TraceViewerView.StoringText=-Storing
+TraceViewerView.ComponentID=Component ID: 
+TraceViewerView.ArmedText=-Armed
+TraceViewerView.GroupID=\ Group ID: 
+TraceViewerView.TraceID=\ Trace ID: